Copyright(c)1993-1995AdvanEdgeTechnologies,Inc.Chapter5Attributes,Expressions,andFunctions5Thischaptercontainsintroductorymaterialaboutattributesandhowyoucanusetheminaprocessmap.Attributesarevariablesthatcanbesetatdifferentpointsintheprocessmap.Youcanusesimpleandmorecomplexexpressionsaspartofthelogicinastatement.Theexpressionscansetattributes,oruseoneoftheseveralsystem-oruser-definedfunctions.YoucanfollowtheNowTryThisexercisesinthischaptertolearnhowtouseattributes,expressions,andfunctions.InThisChapterAboutAttributes..........................................5-2DefiningAttributes......................................5-4DefiningTypes............................................5-6AboutAttributeLocations...........................5-8AssigningValuestoAttributes..................5-12UsingtheExpressionBuilder....................5-14UsingFunctions.........................................5-18SettingaPriority........................................5-24SettingaPreempt.......................................5-26Page5-2Optima!User'sGuideAboutAttributesAttributesprovideamethodtosetinformationthatishighlyspecifictotheprocessthatyouaredocumenting.ManyOptima!statementscansetthevalueofanattribute.Ortheycancheckavalueandperformadditionalactivitiesbasedontheresults.Besidesusingattributesinstatementsasyoucreateaprocessmap,youcaninitializeanattributeatsimulationtimeinthescenariowindow.Thescenarioisthesetofdatathatisusedtorunthesimulationeachtime.Theabilitytoinitializeattributesatsimulationtimeisusefulbecauseyoucanchangethevalueoftheattributeseveraltimesduringsimulationwithoutreturningtotheprocessmaptochangethelogicofone,orsometimesseveral,statements.WhatisanAttribute?Anattributeisavariableusedinstatements.Anattributehasfourcharacteristics:itsname,type,location,andvalue.Whenyoudefineanattribute,youdeclareitsname.Thenamemustbeuniqueforeveryattributewithinalocation.Youdeclaretheattributetype,whichistherangeofvaluesthattheattributecanhave.Andyoudeclarethelocation,whichprovidesascope,orboundary,fortheattribute.Themethodfordefiningtheattributeisdescribedinupcomingpages.Hereisanexampleofabasicattribute.Thenameoftheattributeis"items."Itstypeisnumberbecauseofitsvalue,3.Attributesettings:items=3The"items"attributecanbeincrementedatanotherstatement.InanActionstatement,forexample,thenumberofitemscanbesettothecurrentvalue,whichis3,plus1,toequal4.Count:items=items+1Attributescanbeusedinmorecomplexexpressions.Inthefollowingexample,fourattributesareused.Theattributenamed"cost"isthetotaloftwoattributesaddedtogetheranddividedbythevalueofathirdattribute.Expression:cost=(workers+overhead)/rateAttributes,Expressions,andFunctions5Page5-3NowTryThisApopularitemfromHouseHolds,Inc.,isabookshelf.Theshelfcanbeorderedindifferentmaterials,plastic,glass,orwood.Youcanbeginbyopeningthischapter'sself-pacedexercises.1.FromtheFilemenu,chooseOpentodisplaytheOpenFiledialogbox.2.ForFileName,enter:c:\optima\exercise\ch5.pfd3.IntheOpenFiledialogbox,clickonOK.Thisbringsupthedesignforthischapter'sself-pacedexercises.4.ClickontheMaximizeicontousethewholescreen.5.(Optional)Ifyouaregoingtostopinthemiddleofthisexerciseandwanttosaveyourwork,fromtheFilemenu,chooseSaveAs.ThisbringsuptheSaveAsdialogbox.6.ForFileName,enteranamethatisuniquetoyourworkspace.7.ClickonOKtoclosetheSaveAsdialogbox.Page5-4Optima!User'sGuideDefiningAttributesYoucanusea...