+ All Categories
Home > Documents > Chap 10 - Arena Integration and Customization

Chap 10 - Arena Integration and Customization

Date post: 15-Oct-2015
Category:
Upload: robson-almeida
View: 60 times
Download: 1 times
Share this document with a friend
Popular Tags:

of 54

Transcript
  • Simulation with Arena, 5th ed.Chapter 10 Arena Integration & Customization

    Arena Integration and CustomizationChapter 10Last revision June 21, 2009Slide * of 52

    Chapter 10 Arena Integration & Customization

  • Simulation with Arena, 5th ed.Chapter 10 Arena Integration & CustomizationWhat Well Do ...Reading and Writing Data Files (ReadWrite)ActiveX and Visual Basic for Applications (VBA)Creating Modules with Arena Professional EditionSlide * of 52

    Chapter 10 Arena Integration & Customization

  • Simulation with Arena, 5th ed.Chapter 10 Arena Integration & CustomizationReading and Writing Data FilesReading entity arrivals from a text fileReading and writing Microsoft Access and Excel filesAdvanced reading and writingSlide * of 52

    Chapter 10 Arena Integration & Customization

  • Simulation with Arena, 5th ed.Chapter 10 Arena Integration & CustomizationReading Entity Arrivals From a Text FileWhy data-driven simulations?Model validationEvaluating how a particular scenario is handledModeling a specific arrival patternAssumes historical data exist and can be transformed for use in simulationSlide * of 52

    Chapter 10 Arena Integration & Customization

  • Simulation with Arena, 5th ed.Chapter 10 Arena Integration & CustomizationSimple Call Center ModelSingle call stream Single agent resourceRandom call processing time

    Slide * of 52

    Chapter 10 Arena Integration & Customization

  • Simulation with Arena, 5th ed.Chapter 10 Arena Integration & CustomizationExternal Call Center DataHistorical call arrival timesModel 10-02 Input.txtASCII file (e.g., Notepad, saved as text from Excel)Absolute simulation arrival times1.038457 2.374120 4.749443 9.899661 10.525897 17.098860 Slide * of 52

    Chapter 10 Arena Integration & Customization

  • Simulation with Arena, 5th ed.Chapter 10 Arena Integration & CustomizationModel Logic to Read DataCant use simple time between arrivals Control entityCreate only oneDuplicate to send actual call entity into model

    Control EntityActual Call EntitySlide * of 52

    Chapter 10 Arena Integration & Customization

  • Simulation with Arena, 5th ed.Chapter 10 Arena Integration & CustomizationModel Logic to Read Data (contd.)ReadWrite module (Advanced Process)Arena File Name: description (actual disk filename is specified in File module)Assignments: model variables/attributes to be assigned based on data read from file (Call Start Time attribute)Delay/Duplicate LogicFile contains absolute times; Delay module holds entity for a time intervalDelay control entity for interval until actual arrival time of call (Call Start Time - TNOW)Create a duplicate (Separate module) to dispatch actual call into model. Original entity loops back to read next time.Slide * of 52

    Chapter 10 Arena Integration & Customization

  • Simulation with Arena, 5th ed.Chapter 10 Arena Integration & CustomizationModel Logic to Read Data (contd.)File data module (Advanced Process)Name: Name referenced in other Arena modules.Access Type: Sequential indicates to read in order.Operating System File Name: The name used by file system. May be relative or fully qualified.End of File Action: What to do when all records are read.Slide * of 52

    Chapter 10 Arena Integration & Customization

  • Simulation with Arena, 5th ed.Chapter 10 Arena Integration & CustomizationRun TerminationRun Setup optionsMaximum replications / simulation end time always terminates the simulation run.System emptiesIf no entities on calendar and no other time-based controls, run may terminate earlier than setup options dictate.The control entity is disposed after it reads the last data value.Slide * of 52

    Chapter 10 Arena Integration & Customization

  • Simulation with Arena, 5th ed.Chapter 10 Arena Integration & CustomizationReading Access FilesSample Access dataModel 10-03 Input.mdbTable: ArrivalTimes

    Slide * of 52

    Chapter 10 Arena Integration & Customization

  • Simulation with Arena, 5th ed.Chapter 10 Arena Integration & CustomizationReading Access FilesFile data module (Advanced Process)Access Type: Microsoft Access (*.mdb)Operating System File Name: Model 10-03 Input.mdbRecordsets: Click to load the Recordsets EditorImportant: Never name an access file the same as the model name or it will conflict with the automatic output database file.Slide * of 52

    Chapter 10 Arena Integration & Customization

  • Simulation with Arena, 5th ed.Chapter 10 Arena Integration & CustomizationReading Access FilesRecordsets EditorAssociates a recordset name with a tableTable must already existView allows you to see a sample of the real data

    Slide * of 52

    Chapter 10 Arena Integration & Customization

  • Simulation with Arena, 5th ed.Chapter 10 Arena Integration & CustomizationReading Access FilesReadWrite module (Advanced Process)Recordset ID: Same as defined in Recordsets Editor

    Slide * of 52

    Chapter 10 Arena Integration & Customization

  • Simulation with Arena, 5th ed.Chapter 10 Arena Integration & CustomizationReading Excel FilesExcel is not a relational database but has many similarities:An Excel workbook is similar to an Access database file.The rows and columns in a rectangular named range in an Excel worksheet are similar to the rows and columns of an Access table. Slide * of 52

    Chapter 10 Arena Integration & Customization

  • Simulation with Arena, 5th ed.Chapter 10 Arena Integration & CustomizationReading Excel FilesSample Excel dataModel 10-03 Input.xlsNamed Range: ArrivalTimes

    Slide * of 52

    Chapter 10 Arena Integration & Customization

  • Simulation with Arena, 5th ed.Chapter 10 Arena Integration & CustomizationReading Excel FilesFile data module (Advanced Process)Access Type: Microsoft Excel (*.xls)Operating System File Name: Model 10-03 Input.xlsRecordsets: Click to load the Recordsets EditorSlide * of 52

    Chapter 10 Arena Integration & Customization

  • Simulation with Arena, 5th ed.Chapter 10 Arena Integration & CustomizationReading Excel FilesRecordsets EditorAssociates a recordset name with a named rangeNamed range must already existView allows you to see a sample of the real data

    Slide * of 52

    Chapter 10 Arena Integration & Customization

  • Simulation with Arena, 5th ed.Chapter 10 Arena Integration & CustomizationWriting Access and Excel FilesThe file:The table or named range must already exist.An Excel named range should be formatted as numeric.ReadWrite module: Add new module to specify which data to write.Slide * of 52

    Chapter 10 Arena Integration & Customization

  • Simulation with Arena, 5th ed.Chapter 10 Arena Integration & CustomizationWriting Access and Excel FilesReadWrite module: Use Type of Write To FileUse Recordset ID as before.Slide * of 52

    Chapter 10 Arena Integration & Customization

  • Simulation with Arena, 5th ed.Chapter 10 Arena Integration & CustomizationWriting Access and Excel FilesSpreadsheet options: You may predefine a plot on the named range and the plot will be built dynamically as data is added to the file.Slide * of 52

    Chapter 10 Arena Integration & Customization

  • Simulation with Arena, 5th ed.Chapter 10 Arena Integration & CustomizationAdvanced Reading and WritingFormatting can be used to handle text files with fields not delimited by spaces: Part 1 1.038 Part 27 2.374 Part 5194.749 Part 67 9.899 Part 72 10.52 Part 16217.09 Slide * of 52

    Chapter 10 Arena Integration & Customization

  • Simulation with Arena, 5th ed.Chapter 10 Arena Integration & CustomizationAdvanced Reading and WritingSkip columns in Access & Excel by using dummy variables:Slide * of 52

    Chapter 10 Arena Integration & Customization

  • Simulation with Arena, 5th ed.Chapter 10 Arena Integration & CustomizationAdvanced Reading and WritingAdvanced data access is available using Access Type of Active Data Objects (ADO) and a Connection String:Excel With Headings Using ADO

    SQL Commands Using ADOProvider=Microsoft.JET.OLEDB.4.0;Data Source=C:\Documents\Book1.xls;Extended Properties=Excel 8.0; HDR=Yes;Driver={SQL Server};Server=RSI-Joe; Database=BizBikes;Uid=BizWareUser; pwd=MyPassword

    Use two double quotes for each embedded double quoteSlide * of 52

    Chapter 10 Arena Integration & Customization

  • Simulation with Arena, 5th ed.Chapter 10 Arena Integration & CustomizationActiveX AutomationProgram applications to automate tasksAct on themselves (e.g., macros in Excel)Act on other applications (e.g., Arena creating Excel file)External programming languagesC++, Visual Basic, Java, etc.Visual Basic for Applications (VBA) programming embedded in applicationMicrosoft Office, Visio, AutoCAD, Arena, Both types work together (e.g., Arena VBA controlling Excel)Slide * of 52

    Chapter 10 Arena Integration & Customization

  • Simulation with Arena, 5th ed.Chapter 10 Arena Integration & CustomizationApplication Object ModelObjects: application components that can be controlledProperties: characteristics of objectsMethods: actions performed on or by objects Arena ObjectsPropertiesMethodsApplicationVisibleShowModelName, StateClose, GoViewBackground ColorZoom InSlide * of 52

    Chapter 10 Arena Integration & Customization

  • Simulation with Arena, 5th ed.Chapter 10 Arena Integration & CustomizationVisual Basic for Applications (VBA)Included with ArenaFull Visual Basic programming environmentCode stored with Arena model (.doe) fileUserForms (dialogs) for custom interfacesCode-debugging toolsComprehensive online helpVisual Basic Editor window: child of Arena (Tools/Show Visual Basic Editor) Slide * of 52

    Chapter 10 Arena Integration & Customization

  • Visual Basic for Applications (VBA)Arenas VBA interface provides the ability to:Create custom interfaces for users; this is especially useful in consulting applications where the model may be used by clients who are not as familiar with Arena.Automate the creation of logic, especially in cases where there is a large amount of data, which would require timely manual entry.Interface with other applications which support VBA.

  • Simulation with Arena, 5th ed.Chapter 10 Arena Integration & CustomizationBuilt-in Arena VBA EventsThisDocument: accesses objects, events in Arenas object modelBuilt-in VBA events: locations where VBA code can be activatedPre-run events (e.g., DocumentOpen)Arena-initiated run events (e.g., RunBegin, RunEndReplication)Model/user-initiated run events (e.g., UserFunction, VBA_Block_Fire)Type code in Visual Basic Editor to populate an eventSlide * of 52

    Chapter 10 Arena Integration & Customization

  • Simulation with Arena, 5th ed.Chapter 10 Arena Integration & CustomizationSimulation Run VBA EventsArena/VBA sequence of events when model runs:Slide * of 52

    Chapter 10 Arena Integration & Customization

  • Simulation with Arena, 5th ed.Chapter 10 Arena Integration & CustomizationArenas Object ModelModel-window objects: items placed in model window, such as:ModulesConnectionsLinesSIMAN object: simulation run data, such as:Variable valuesQueue lengthsSimulation timeStructural objects: access general functionsApplicationPanelsSlide * of 52

    Chapter 10 Arena Integration & Customization

  • Simulation with Arena, 5th ed.Chapter 10 Arena Integration & CustomizationSample: Create Ten Status VariablesWIP(1)WIP(10)Dim oModel As Arena.ModelDim i As IntegerDim nX As LongSet oModel = ThisDocument.Model

    'add the status variables to the Arena model.

    nX = 0 'Start position x at 0For i = 1 To 10 'Add a status Variable to the model window oModel.StatusVariables.Create nX, 0, _ nX + 400, 150, "wip(" & i & ")", "**.*", False, _ RGB(0, 0, 255), RGB(0, 255, 255), RGB(0, 0, 0), "Arial"'Move over 500 world units for next positionnX = nX + 500Next iSlide * of 52

    Chapter 10 Arena Integration & Customization

  • Simulation with Arena, 5th ed.Chapter 10 Arena Integration & CustomizationSample: Assign Variable Value During Run Dim oSIMAN As Arena.SIMAN Dim nVarIndex As Long Dim sNewValue As String ' Prompt for a new value sNewValue = InputBox("Enter the new average cycle time:") ' Assign their answer to the Mean Cycle Time variable Set oSIMAN = ThisDocument.Model.SIMAN nVarIndex = oSIMAN.SymbolNumber("Mean Cycle Time") oSIMAN.VariableArrayValue(nVarIndex) = sNewValueSlide * of 52

    Chapter 10 Arena Integration & Customization

  • Simulation with Arena, 5th ed.Chapter 10 Arena Integration & CustomizationArena Macro RecorderA Macro is a VBA function to perform a task.Macro recording automatically creates the VBA code to reproduce the actions you take while performing the steps in the task.Use the Record Macro toolbar to start/stop and pause/resume recording.Useful for automating repetitive tasks.Ideal for learning VBA commands and prototyping functions.Slide * of 52

    Chapter 10 Arena Integration & Customization

  • Model 10-05: Using StringsString data can read into Attributes and VariablesUseful in cases where The following functions are supported to manipulate strings; Str, Val, StrCompare, StrFormat, Chr, Mid, Len and Eval.The Eval function evaluates the string expression and returns the result. Model 10-05 highlights the use of Eval in routing logic.

  • Simulation with Arena, 5th ed.Chapter 10 Arena Integration & CustomizationModel 10-06: Presenting Arrival Choices to the UserPrompt at beginning of runGenerate entities via random process or Generate based on arrival times stored in a fileSlide * of 52

    Chapter 10 Arena Integration & Customization

  • Simulation with Arena, 5th ed.Chapter 10 Arena Integration & CustomizationOur ApproachBoth sets of logic placed in model window and connected to start of call logic (Process module)Slide * of 52

    Chapter 10 Arena Integration & Customization

  • Simulation with Arena, 5th ed.Chapter 10 Arena Integration & CustomizationOur Approach (contd.)Change Max Arrivals field in Create module to turn on or off its generation of entitiesRandom interarrival-time processCreate Call module: InfiniteCreate Control Entity to Read Data module: 0Arrival times from a fileCreate Call module: 0Create Control Entity to Read Data module: 1Give unique tag to each Create module (so VBA code can find them)

    Slide * of 52

    Chapter 10 Arena Integration & Customization

  • Simulation with Arena, 5th ed.Chapter 10 Arena Integration & CustomizationVBA UserFormInsert/UserForm menu in Visual Basic EditorDrop controls from Control Toolbox (labels, option buttons, command button)LabelOption buttonsCommand buttonSlide * of 52

    Chapter 10 Arena Integration & Customization

  • Simulation with Arena, 5th ed.Chapter 10 Arena Integration & CustomizationShow the UserFormAt beginning of run (ModelLogic_RunBegin), show the form:Option ExplicitPrivate Sub ModelLogic_RunBegin() ' Display the UserForm to ask for the type of arrivals frmArrivalTypeSelection.Show Exit SubEnd SubProgram control passes to the form until its closedArena run suspended while form is in controlSlide * of 52

    Chapter 10 Arena Integration & Customization

  • Simulation with Arena, 5th ed.Chapter 10 Arena Integration & CustomizationChange Module Data On OKWhen user clicks OK button on form, modify the Create module dataFind the Create modulesSet the Max Arrivals fieldsPlay a sound Close the UserFormWhen form is closed, simulation run commences with the new data values in the Create modulesSlide * of 52

    Chapter 10 Arena Integration & Customization

  • Simulation with Arena, 5th ed.Chapter 10 Arena Integration & CustomizationModel 10-07: Record Call Data in Microsoft ExcelOur goal:Raw call data tablesDaily call duration chartsSlide * of 52

    Chapter 10 Arena Integration & Customization

  • Simulation with Arena, 5th ed.Chapter 10 Arena Integration & CustomizationUsing ActiveX Automation in VBAReference the Excel Object LibraryTools/References menu in Visual Basic EditorCheck the Microsoft Excel Object LibraryEstablishes link between Arena VBA and ExcelObject variables from applications object modelExcel.Application, Excel.WorkbookArena.SIMANStarting ExcelCreateObject: starts application, returning handle to the program (stored in oExcelApp variable)oExcelApp.Workbooks.Add: similar to File/New in ExcelSlide * of 52

    Chapter 10 Arena Integration & Customization

  • Simulation with Arena, 5th ed.Chapter 10 Arena Integration & CustomizationRetrieving Simulation DataThisDocumentBuilt-in variable accessing the Arena modelUse only within Arenas VBA

    ThisDocument.Model.SIMANUsed to access simulation run dataBrowse (F2) in VBA window for full list of variablesActive only when simulation run data is available -- i.e., built-in events:after (and including) ModelLogic_RunBeginSimulationbefore (and including) ModelLogic_RunEndSimulationSlide * of 52

    Chapter 10 Arena Integration & Customization

  • Simulation with Arena, 5th ed.Chapter 10 Arena Integration & CustomizationOur ApproachVBA ModelLogic_RunBeginSimulationCalled once at the beginning of the simulation runStart Excel with a new spreadsheet (Workbook)Format header rows for data worksheetVBA ModelLogic_RunBeginReplicationCalled at the beginning of each replicationWrite headers for the three columns and the DayFormat the data columnsSlide * of 52

    Chapter 10 Arena Integration & Customization

  • Simulation with Arena, 5th ed.Chapter 10 Arena Integration & CustomizationOur Approach (contd.)VBA Module (Blocks panel)Insert in model logic just before disposing callsVBA CodeVBA modules numbered as theyre placed, with corresponding VBA_Block__Fire events in VBASlide * of 52

    Chapter 10 Arena Integration & Customization

  • Simulation with Arena, 5th ed.Chapter 10 Arena Integration & CustomizationOur Approach (contd.)VBA_Block_1_FireCalled each time an entity enters the VBA Block in the modelRetrieve data from running simulation via SIMAN object (stored in oSIMAN variable)Row and columns into which to write data stored in global VBA variables (nNextRow, nColumnA, nColumnB, nColumnC)

    Slide * of 52

    Chapter 10 Arena Integration & Customization

  • Simulation with Arena, 5th ed.Chapter 10 Arena Integration & CustomizationOur Approach (contd.)ModelLogic_RunEndReplicationCalled at end of each replicationCreates the chart and updates the global variablesHint: Use Excel macro recording for skeleton code (e.g., for formatting commands, creation of chart); copy into Arena VBA and adjust variable names (e.g., add oExcelApp to access Excel)ModelLogic_RunEndSimulationTurn DisplayAlerts off (overwrites .xls file if it exists)SaveAs method to give filenameExcel still running. Could use oExcelApp.QuitSlide * of 52

    Chapter 10 Arena Integration & Customization

  • Simulation with Arena, 5th ed.Chapter 10 Arena Integration & CustomizationCreating Modules with Arena Professional EditionTemplate 10-01: Create from File moduleTemplate (.tpo) can be attached and used in Academic ArenaPlace and edit like any other moduleNeed Research/ Professional Arena to create/edit template source (.tpl)Slide * of 52

    Chapter 10 Arena Integration & Customization

  • Simulation with Arena, 5th ed.Chapter 10 Arena Integration & CustomizationPanel Icon and User ViewPanel Icon: Button displayed in template panel to represent the moduleUser View: Graphics objects placed in the model window with an instance of the moduleModule handleEntry, exit pointsAnimationOperand valuesSlide * of 52

    Chapter 10 Arena Integration & Customization

  • Simulation with Arena, 5th ed.Chapter 10 Arena Integration & CustomizationOperandsOperands: Fields that can be filled out by the modelerAllow different data for each instance of the same module type in a modelPassed down to logic via back quotes ( ` )Entry and exit point operands permit entities to move through underlying module logicOperandsSlide * of 52

    Chapter 10 Arena Integration & Customization

  • Simulation with Arena, 5th ed.Chapter 10 Arena Integration & CustomizationModule LogicModule Logic: A submodel containing module instancesCan paste from a model into a module definitions logic windowSame interface as for building modelsReference to module operand ( `Data File` )Reference to module operand ( `Name` )Slide * of 52

    Chapter 10 Arena Integration & Customization

  • Simulation with Arena, 5th ed.Chapter 10 Arena Integration & CustomizationUses of TemplatesCommercial templatesArena templates (Basic Process, Advanced Process, etc.)Contact Center, Packaging templatesApplication-focused templatesTerminology, modeling capabilities designed for a particular application environment (e.g., mining, material handling, order processing)Personal / utility templatesReuse what you learnShare your modeling techniquesSlide * of 52

    Chapter 10 Arena Integration & Customization

  • Simulation with Arena, 5th ed.Chapter 10 Arena Integration & CustomizationSummaryWe have just barely scratched the surface of Arena customization and interactions with other software including:Reading and writing various types of external data files. Visual Basic for ApplicationsInteracting with Microsoft OfficeBuilding custom applications with templates.There are many other ways of customizing Arena and allowing Arena to interact and exchange data with other software.Slide * of 52

    Chapter 10 Arena Integration & Customization

    ****************************************************


Recommended