![]() ![]()
|
CHAPTER 11
More Advanced Model BuildingThis chapter discusses the advanced schedules of the Generate activity and Resource downtime. Most real world scenarios do not operate at the same schedule 24 hours per day, 365 days per year. Thus, the ability to vary entity generation and the availability of resources is critical.
Defining a More Complex Generate Activity
A Generate Activity generates different types of Entities, or it can vary the schedule of entity generation for a single entity type.Specifying the Active Period of Entity Release
The period that the entity release schedule is in effect can be limited by specifying Release Start and End dates. To do this, click on the Start/End tab and specify the Start and End dates.If Start and End dates are specified, the Generate Activity will not produce Entities outside of that time period.The Start and End dates work in conjunction with the Start Date and End Date of a simulation run. So keep in mind that, if the simulation run dates are entirely outside of the period defined for the Generate release schedule, no Entities are generated during that simulation.If a Generation Start date is not specified, SIMPROCESS sets the Start time to correspond to simulation start time. Similarly, if Generation End date is blank, it defaults to the simulation end time. So leaving the Generation Start/End fields blank ensures that the schedule is in effect for the entire simulation run.Defining Schedules for a Generate Activity
The Generate schedule identifies the entity-generation pattern defined for an Activity. When a new schedule item is defined, it is added to the Schedule list box:
Each Schedule identifies an entity generation pattern of a specific type:· Periodic: A periodic schedule generates a specified quantity of Entities at the end of a specified time period· Calendar: Generates Entities according to a calendar schedule: daily, weekly, monthly, etc.· Weekly: A schedule that allows generation intervals for every day of the week. This schedule differs from a Calendar Weekly schedule. See description below for details.· Cyclical: A detailed sequence of when Entities are generated· File: A schedule defined in an external file· Spreadsheet: A schedule defined in an external spreadsheet· External: Generates Entities based on inputs from an external source. External schedules are a plug-in capability that can be licensed separately from CACI.Schedules are processed in parallel. If there are two schedules that overlap in time, SIMPROCESS processes both simultaneously.Click on Add to define a new schedule, or Edit to change the definition of the item highlighted in the schedules list box. When adding a new schedule, first identify the type of entity generation pattern by selecting from the Schedule Type combo box.Copy duplicates the definition of the item highlighted in the Schedule list box. Use this when two or more similar schedules are needed.Remove deletes the highlighted schedule.Adding a Periodic Schedule
The Periodic schedule defines a constant or statistical distribution of entity generation events per period:
The Periodic Schedule dialog contains the following items:Schedule: Assign a meaningful name to the entity generation schedule. The default name assigned by SIMPROCESS is the same as the schedule type; in this case, Periodic1.Entity specifies the type of entity to be generated by this schedule. Use default tells SIMPROCESS to generate the type of entity indicated in the Generate Activity Properties dialog. To specify a different type, click on the pull-down arrow for a list of entity types to choose from.Quantity is the number of Entities to be produced at each entity generation by this schedule. Again, use default refers back to the value in the Generate Activity Properties dialog. See page 75 of the SIMPROCESS User's Manual for additional details on this field.Interval defines the time between entity-generation events for this schedule.Start/End defines the effective period for this schedule.The times in the Start and End fields apply just to this schedule. The Start and End dates for the schedule must be within the Start and End dates specified on the Generate Activity Properties dialog. If a date is not entered for either Start or End, the corresponding value (if any) in the Generate Activity Properties applies.Count Limit sets the maximum number of Entities that can be generated by this schedule. A Count Limit value of 0 indicates that there is no limit.If the Count Limit is reached, the Generate Activity may stop generating Entities for this schedule. This depends on the setting of the Both must be reached and Generation End fields.Both must be reached specifies that both the Count Limit and Release End date must be attained in order to terminate entity generation for this schedule. If the Both must be reached field is not marked, then reaching either Generation End or Count Limit terminates the schedule.Adding a Calendar Schedule
To add a schedule that generates Entities based on the calendar, select Calendar under Schedule Type on the Generate Activity Properties dialog, and then click on Add:
The following types of entity-generation schedules can be specified in the Calendar Schedule dialog:· Yearly - Entities are generated once every year, on a particular date· Monthly - Entities are generated on a specific day in each month (e.g., 1st of the month)· Weekly - A certain time of day, on the specified day of the week (e.g., Monday, Tuesday...)· Daily - Every day, generated at the specified time· Hourly - Every hour, generated at the specified time· Date - A specific date and time. This event will occur only once, at the specified date and time.The Calendar Schedule dialog changes in appearance depending on the Type of schedule selected:· If Calendar Type is Weekly, a list of the days of the week is added to the dialog.· The heading above the Date and Time field changes to prompt for the information required for the Type schedule selected.For example, if a Daily entity generation schedule is selected, a time of day must be entered in the Date and Time field.Any information that does not apply to a Daily schedule, such as the date and year, is ignored.As with all schedules, Start/End can be used to further define the effective period for a Calendar generation schedule.Adding a Weekly Schedule
A Weekly schedule is similar to a Periodic schedule in that the schedule defines a constant or statistical distribution of entity generation events. The difference is that the Weekly schedule allows the entity generation events to be restricted to certain days of the week and certain time periods of the day. Note that this Weekly schedule is different from a Calendar Weekly schedule. A Calendar Weekly schedule only generates a certain quantity of entities once a week on a specified day and time. This Weekly schedule generates multiple times based on a periodic interval restricted to certain days and times. To add a Weekly schedule, select Weekly under Schedule Type on the Generate Activity Properties dialog, and then click on Add.See the Periodic schedule definition (page 321) for information on Schedule, Entity, Quantity, Interval, Time Unit, and Start/End.Use the Weekly Schedule portion to select each Day of Week for which the Entity, Quantity, and Interval apply. When a Day of Week is selected, the Start Time and End Time for that day activate. Enter the Start Time and End Time for entity generation for that Day of Week. If both Start Time and End Time show 00:00:00, entity generation will occur for the complete day (24 hours). If End Time shows 23:59:59, it is assumed that 00:00:00 for the next day is intended, and the final second will be added to the entity generation period.If the Generate at start of first interval check box is selected, an entity will be generated at the Start Time of each active Day of Week. If the check box is not selected, a random value based on the Interval and Time Unit will be added to the Start Time for the first entity generation of each active Day of Week.
Defining Cyclical Schedules
Use the cyclical schedule to define a detailed sequence of entity generation cycles. For example, a week day-by-day, or a year month-by-month could be described. A unique period such as the holiday rush leading up to Christmas could be defined, where entity generation behavior differs markedly from the rest of the year.A cyclical schedule is defined as a series of cycles. Each cycle describes a different entity generation sequence. In a sense, the cycle series is like a schedule of its own. But unlike the schedules defined for the Generate Activity as a whole, cycle events are processed sequentially, not in parallel. Since one cycle follows another, order is important. Cycles can be repeated as many times as is needed.The following types of cycles can be defined:· Periodic. A constant or statistical distribution defining the time interval between events· Calendar. Entity generation events scheduled at intervals based on the calendar, i.e., weekly, monthly, etc.· Single Event. A one-time entity generation event· No Event. A period where no Entities are generated· Cyclical. A cycle within a cycle; that is, a more detailed breakdown within a schedule (e.g., the various periods within a single day - breakfast, meeting, coffee break, lunch - within a workweek described day-by-day).
Cycles are added to and modified from the Cyclical Schedule dialog.The Sequence of Events dialog lists the cycle events defined for this cyclical schedule. The events are listed in the order in which SIMPROCESS will execute them. When a cycle is added, SIMPROCESS places it at the end of the list. The pattern can be rearranged using the Move command.For example, here is a list of cycles defined out of sequence:
To move the April cycle to the end of the list, highlight April and click on the Move button three times. Each click of Move shifts the item down a row.Cycles can be moved up in the list by checking the Upwards option before clicking the Move button.Repeat Sequence tells SIMPROCESS how many times to repeat execution of the pattern of cycles. If Infinite is checked, SIMPROCESS will keep repeating the cycle pattern until Generation End is reached.
Refer to page 322 for a description of the Start/End option.Defining a Periodic Cycle
A periodic cycle defines a constant or statistical distribution of entity generation events. To define a periodic cycle in a cyclical schedule, select Periodic from the list of Schedule types, and then click on Add:
Defining a periodic cycle is similar to defining a periodic schedule (see page 321). The major difference is that duration of the cycle is not defined in terms of start and end dates. That is because the start time is under the control of the cyclical schedule of which the cycle is a part:Duration is how long this cycle is in effect. A number can be entered or a value selected from the pull-down list for this field. Time Units specifies the time unit of the Duration.The starting time of the event is determined by the following factors:· The Generation Start date of the cyclical schedule· The position of this cycle in the Schedule of Events in the Cyclical Schedule detail dialog· The Duration of the cycles that precede this one.Count Limit sets a maximum number of Entities that may be generated during this cycle. A value of 0 indicates no limit.The Both must be reached checkbox, if marked, specifies that both the Duration and Count Limit must be reached before the cycle completes.Note that selecting Both must be reached can result in a cycle of unknown duration. This happens if the Count Limit is not reached before the end of the Duration period. In that event, the cycle continues until either the Count Limit is attained, or the Generate Activity Generation End is reached.Repeat Event tells SIMPROCESS how many times to repeat execution of this cycle. If Infinite is selected, SIMPROCESS will keep repeating the cycle until the schedule's Generation End date is reached.· The Entity, Quantity, and Interval fields are used the same way they are in the Periodic Schedule detail dialog (see page 321).Defining a Calendar Cycle
A calendar cycle defines entity generation events that repeat on either a daily, weekly, monthly, or yearly basis:
The dialog above shows a calendar cycle representing four days leading up to a festive holiday, when people are rushing to buy gifts for their loved ones. It's a daily schedule, beginning at 9 a.m. Note that there is no duration on calendar events. They will operate as long as possible. For the example above, since it is a Daily schedule, it will generate every day at 9 o'clock. Thus, any events listed after the Daily event in the Cyclical schedule will not execute, since the Daily event will keep generating.As with the periodic cycle, the start time of a calendrical event is determined by the cyclical schedule in which the cycle is defined. However, entity generation is not triggered until the time that is indicated in the Date and Time field. If the trigger point is not reached while the cycle is in effect, no Entities are generated. For a further explanation, see "SIMPROCESS' Scheduling of Event Cycles" on page 328.The Date and Time needed depends on the Calendar Type schedule selected:· Yearly. Enter a date and time of day, but do not specify a year. Entity generation begins if the simulation reaches the specified date and time during this cycle.· Monthly. Specify a day of the month and time of day, e.g., the first of the month, at noon. Entity generation begins if the simulation reaches the specified day and time while the cycle is in effect.· Weekly. Select a day of the week (from a list that appears when Weekly is checked off) and a time of day. Entity generation begins if the simulation reaches that day and time during the cycle.· Daily. Specify a time of day. Entities are released if the simulation reaches this time of day while the cycle is in effect.· Hourly. Specify the minutes and seconds of an hour. Entities are released if the simulation reaches this time of day while the cycle is in effect.· Date. Specify a specific date and time. Entities are released if the simulation reaches this date and time while the cycle is in effect.SIMPROCESS' Scheduling of Event Cycles
Calendar cycles must be carefully placed within the Sequence of Events. If the trigger time specified in the Date and Time field has already passed when SIMPROCESS invokes a cycle, entity generation may not occur.For example, assume a cyclical schedule with a Generation Start date of January 1, 2004, and a Generation End date of March 31, 2004. The schedule contains the following Schedule of Events cycles:· A periodic cycle event beginning on January 1, with a duration of 48 hours.· A calendar cycle which is triggered monthly, on the 2nd of the month.The simulation begins at midnight, January 1. The periodic cycle starts right away and lasts for 48 hours. At this point it is midnight, January 3rd, and the calendar cycle is implemented. What happens during this period?No Entities are generated by the calendrical event for January. Here is why:1. On January 3rd of simulation time, SIMPROCESS acts on the calendrical cycle. It checks the Date and Time value (which is set to the 2nd of the month, at midnight) and compares it to the current date. SIMPROCESS determines that the trigger date has already passed and bypasses entity generation. The next possible trigger point is on February 2nd.2. The calendar cycle continues until the end of the simulation or until the end of the active period for the Cyclical schedule.Note that the Calendar event maintains control of the Cyclical schedule since there is no duration for the Calendar event.Defining a Single Event Cycle
A Single Event cycle describes a one-time entity generation event:
A single event has the same parameters as a calendar cycle, except that when the event begins cannot be specified. A single event's starting date and time is dependent on the cycles that precede it in the pattern of cycles. Once the event is active, the generation occurs at the end of the duration.Defining Inactive Time Periods
The No Event cycle defines a period of time during which no Entities are generated (for example, a holiday or weekend). The period of inActivity begins at whatever time SIMPROCESS invokes the No Event cycle.Defining Specific Entity Generation Events in a File
Entity generation events can be specified in an event file. An event file is created with a text editor or some other means independent of SIMPROCESS (such as a user written program). With an event file, a simulation can be run using data captured outside of SIMPROCESS.For example, most mail order businesses use computer systems to track customer sales information. This information is stored in some kind of database. This information can be extracted from the database and a series of entity generation events defined that precisely matches customer activity for an actual day, week, month, etc. (Note that the database can also be read directly by SIMPROCESS. See "Interfacing With A Database" on page 296.)Each record in an event file defines one entity generation event. To learn how to define entity generation events, see Appendix G-External Event Files, on page 577.Use the External File schedule to identify an event input file to SIMPROCESS:
To identify the event file, click on the Browse button to the right of the Event File box. Use the resulting dialog to find and select the file.The Read Event File button causes SIMPROCESS to read the event file, checking for syntax errors and building a list of the entity types and attributes referred to in the file. The Read Event File button must be clicked to complete the definition of the event file.Refer to page 322 for a description of the Start/End option.Identifying Entity Types to be Generated
An event file can contain records referring to many different entity types. An event record can even refer to a type of entity that has not yet been defined in the model and to entity instance attributes that have not been defined in the model. Which entity types SIMPROCESS should generate during simulation can be specified precisely.Select the Generate Entities option that indicates which of the entity types referenced in the event file are to be generated:· Defined in the model tells SIMPROCESS to generate Entities for every event record that specifies an entity type already defined in the model.· Selected in the list tells SIMPROCESS to generate Entities only for the types highlighted in the entity type list.
· If the event file refers to an entity type that is not defined in the model, it flags the type name. For example:GQL Add(Type)· Selecting this type will cause SIMPROCESS to add the entity type to the model.· If the entity in the event file refers to entity instance attributes that have not been defined in the model, this is flagged as well. For example:BC Add(Type, Attributes);· Note that attributes are tied to Entities. Entity instance attributes cannot be added without adding the entity type.To select the entity types to be used:· Highlight the listed type name. To highlight several types, press and hold the Ctrl key while clicking on each item.· To deselect a type, click on it again while pressing the Ctrl key.Saving Events
The option Save events in model determines whether the event file is needed for simulation. The option defaults to not selected. Not being selected means the event file will be read at simulation time. Thus, the file is required to run the simulation. If the option is selected, then the events are saved as a part of the model, and the file is not needed for simulation. However, saving events as a part of the model could significantly increase the size of the model file and increase the amount of time needed to load the model. If events are saved, the Read Event File button must be exercised if the event file changes. Otherwise, the simulation will not run with the events from the new file. Note that if the events are not saved, and the event file changes, the events for the simulation will change. But, doing this without intentionally reading the event file using the Read Event File button assumes that the Entities and attributes used in the new file are the same as the previous file.Adding a Spreadsheet Schedule
The Spreadsheet schedule allows full or partial generation events to be read from a spreadsheet.
The Spreadsheet schedule is essentially a Periodic schedule modified to allow spreadsheet entries to override the Entity, Quantity, and Interval. These fields operate as on a Periodic schedule unless overridden by the check boxes below.The File Name field contains the name of the spreadsheet file. The spreadsheet can be a Workbook file or an XML Spreadsheet. If no path is included, the file is assumed to be in the model's directory. (It is recommended that the file be located in the model's directory. If the model and its directory are moved, the File Name field will not need to be changed.) There are three options for overriding the defaults:· Use Spreadsheet for Entity· Use Spreadsheet for Quantity· Use Spreadsheet for IntervalSelecting any option causes the Sheet, First Row, and Column fields for that option to activate. The Use Spreadsheet for Interval option also has a check box (Column contains Date/Time) that designates whether the column contains interarrival times or date and time information (default). All options assume the information is in a column starting at a particular row. No empty cells are allowed. For any option, if an empty cell is encountered in the designated column, the schedule stops operation.Enter the appropriate Worksheet name in the Sheet field. First Row is the starting row for the events. The row number must be an INTEGER and must be greater than or equal to one. The Column field contains the column number of the data. As with the row number, the column number must be an INTEGER greater than or equal to 1. So if the data is in column A starting at row 1, First Row would be 1 and Column would be 1. Note that the First Row and Column fields contain the distribution list. Thus, evaluated values can be used as long as the above criteria are met.Use Spreadsheet for Entity overrides the Entity field. Only Entity names defined in the model should be in the spreadsheet. If a value read does not correspond to an Entity defined in the model, a runtime error will occur. Entity names are case sensitive.Use Spreadsheet for Quantity overrides the Quantity field. The values in the designated column should be numeric. If the value read is not an INTEGER, the value will be rounded to the nearest INTEGER.Use Spreadsheet for Interval overrides the Interval field. If the values in the designated column are interarrival times, make sure Column contains Date/Time is not selected. Also, the Time Unit selected for the default Interval field applies to interarrival times read from a spreadsheet. If the values in the designated column are date and time values, the Time Unit field is ignored. Note that if the column contains date and time information, the column is assumed to be sorted in ascending order. An out of order date and time will cause the schedule to stop.In the example below,arrivals.xlscontains the complete generation event information since all three options are selected. All information is on the same Worksheet (Entity Arrivals), and all options start on the same row. In the spreadsheet excerpt below, the Generation Date contains no time information. This means the event will occur at midnight of the specified date. Time information must be included if generation at midnight is not acceptable (such as 1/4/2005 08:00:00).
Note below that the values for each field (Sheet, First Row, and Column) can be different for each option. Typically Column will be different across options unless different Worksheets are used.
Refer to page 322 for a description of the Start/End option.Adding an External Schedule
An external schedule allows a remote application to cause the generation of Entities within a SIMPROCESS model. This is a plug-in capability that can be purchased separately from CACI. Typical uses for external schedules include connecting decision support or operational systems to a SIMPROCESS simulation model to see how a model is affected by the randomness of real work applications in use rather than just randomness from statistical distribution functions. Other uses may include custom training software that allows students to interact with the simulation based on things they see occurring in the model - hence, influencing the remaining simulation.An external schedule changes the normal operation of a simulation. If SIMPROCESS detects an external schedule within a model (and the appropriate license has been purchased), then the ending date and time specified in the Run Settings (page 109) is no longer active. Normally, if there are no more simulation events to process, then the end simulation event (which is based on the ending date and time specified in the Run Settings) is executed. When an external schedule is present and there are no more simulation events to process, the simulation suspends execution until an external schedule is signaled to generate Entities. Note that simulation time does not advance while simulation processing is suspended.There are three ways to stop a simulation that contains an external schedule. The first is to manually stop the simulation using the Stop button, the F9 key, or Simulate/Stop. The second way is to route Entities to a Dispose Activity that has a maximum entity count set (page 80). When the maximum has been reached, the simulation will stop. The final way is to call thestopSimulationmethod of SPServerFactory (page 338).Three actions must be accomplished before the start of the simulation in order to use an external schedule. The last two can be done before SIMPROCESS is started and can remain operational even though SIMPROCESS is closed and reopened.· Create the external schedule in a Generate Activity· Start the Java RMI Registry· Start SPServer.External Schedule Setup
Use the External schedule dialog to set the default Entity and Quantity.
The Entity and Quantity specified on the dialog can be overridden by the external application. Multiple external schedules can be specified in a single generate Activity or in different generate Activities.Java RMI Registry
The Java RMI Registry must be started before SPServer or the simulation is started. This is because Java RMI is the protocol used to communicate between the external application and SPServer, and between SPServer and SIMPROCESS. The RMI Registry program (rmiregistry) is located in the Java Runtime Environment (JRE) included with SIMPROCESS. To start the RMI Registry locally, select Tools/Remote/Start RMI Registry. Note that once the RMI Registry has been started, it will remain active until SIMPROCESS is closed. Alternatively, a batch file or UNIX shell script can be constructed in the SIMPROCESS directory, because the RMI Registry program is required to have in its classpath the locations of files referenced by server processes. Here are some examples of what should be contained in those files:In a Windows batch file:
set CLASSPATH=SPSYSTEM\simprocess.jar;SPSYSTEM\SPRemote.jar
rmiregistryIn a UNIX shell script using the Bourne shell or a derivative:
CLASSPATH=SPSYSTEM/simprocess.jar:SPSYSTEM/SPRemote.jar
export CLASSPATH
rmiregistryIn a UNIX shell script using the C shell or a derivative:
setenv CLASSPATH SPSYSTEM/simprocess.jar:SPSYSTEM/SPRemote.jar
rmiregistrySample batch files and scripts are located in theSPUser\SampleFilesdirectory.SPUseris located in the SIMPROCESS installation directory. The sample batch and script files are intended to be run from the SIMPROCESS installation directory.SPServer
SPServer instantiates a single object called SPServerFactory. SPServerFactory creates instances of a server for each simulation that has an external schedule. SPServerFactory keeps track of which server instance is associated with which simulation. Thus, the user only needs to interface with SPServerFactory through a set of public methods. The user is responsible for creating the interface to SPServerFactory. If RMI Registry is running on the same system as SIMPROCESS, select Tools/Remote/Start SPServer to start SPServer. To start SPServer from a command line in the directory in which SIMPROCESS was installed, type the commandjre/bin/java -classpath SPSYSTEM/simprocess.jar:SPSYSTEM/SPRemote.jar com.caci.remote.SPServer(use backslashes and semicolons on Windows). Once the command has been executed, SPServerFactory is available through the Java RMI Registry using its bound name of "SPServer."To run RMI Registry and SPServer on a host other than the host on which SIMPROCESS is running, and/or to specify a TCP port other than the default (1099), make the appropriate changes in the Run Settings. The sample files to start RMI Registry and SPServer can be copied fromSPUser\SampleFilesto the appropriate system.
Running The Simulation
With the above steps complete, the simulation can be started. The simulation must be started before the external application attempts to communicate with SIMPROCESS. If not, an error will occur and the simulation will be terminated.
SPServerFactory API
When the simulation is running, the external or remote application can begin communicating with SIMPROCESS. In order to do this, the application must obtain a reference to SPServerFactory. However, since SPServerFactory is remote to the application, a "Stub" representation of SPServerFactory must be used instead. Stub classes are provided by RMI and serve as references to the methods of SPServerFactory that are available remotely. Because SPServerFactory was created according to RMI conventions, it implements a Java Interface containing the methods that may be invoked by the remote application. Therefore, the usual way to refer to it is by using the name of that Interface, SPServerFactoryInterface. That is, cast the item returned from the RMI Registry to the name of the Interface. The code fragment below is from an example remote application and shows the traditional way to refer to SPServerFactory.import com.caci.remote.*;import java.rmi.*;import java.rmi.server.*;public class ExternalApp {public static void main(String args[]) {SPServerFactoryInterface spServer = null;boolean goodEvent = false;try {spServer =(SPServerFactoryInterface)Naming.lookup("rmi://localhost/SPServer");}catch (Exception e) {e.printStackTrace(System.out);}The namelocalhostcan be replaced with any valid entry that will resolve to the system on which SPServerFactory is running (including an actual Internet Protocol address). Note that theNaming.lookupmethod throws aNotBoundExceptionand aMalformedURLExceptionso this command must be within atryblock.The class com.caci.remote.SPServerFactoryInterface has these public methods for communication with SIMPROCESS models:public double getSimTime(String modelName)throws RemoteException;public boolean generateEntity(String modelName, String generate,String schedule, double time, int quantity)throws RemoteException;public boolean stopSimulation(String modelName)throws RemoteException;getSimTimereturns adoublerepresenting the current simulation time. The time unit of this number is the simulation time unit specified in the Run Settings. Its single parameter, modelName, is the name of the simulation model (the same as its filename without the .spm extension).generateEntityreturns a boolean indicating success or failure. Its parameters are as follows:·modelNameis the name of the simulation model (the same as its filename without the .spm extension)·generateis the name of the Generate Activity·scheduleis the name of the External schedule within the Generate Activity·entityis the name of the Entity to create·timeis the simulation time at which the generation event should occur·quantityis the number of Entities to generate for this generation eventThe parametersentityandquantitycan default to the Entity and Quantity specified on the external schedule dialog. A value ofnullor "" forentitywill cause the default to be used. A value of0forquantitycauses the default quantity to be used. Thetimeparameter can default to the current simulation time by passing a value of-1.stopSimulationreturns abooleanindicating success or failure.modelNameis the only parameter.All methods throw aRemoteException.External Application Example
The code below is a simple example of an external application communicating with SIMPROCESS. In this example, Remote is the name of the model (Remote.spm). Theforloop runs from 1 to 10. For 1 and 2, thegenerateEntitymethod specifies all the parameters exceptquantity. ThegenerateEntitymethod for 3, 4, and 5 specifies all the parameters. ThegenerateEntitymethod for 6 through 10 only specifies themodel,generate, andscheduleparameters. The remaining parameters are set for defaults. ThegenerateEntitymethod after theforloop calls the StopSim schedule. This schedule is set to generate a StopSim entity, which enters a Dispose Activity with a maximum entity count of 1, thus stopping the simulation. See Chapter 5 of the SIMPROCESS Getting Started Manual for instructions on running this example. The code (ExternalApp.java) is in theSPUser\SampleFilesdirectory. Also, in theSPUser\SampleFilesdirectory isExternalApp2.java. This application is exactly the same asExternalApp.java, but it usesstopSimulationto end the simulation.package com.caci.demo;import com.caci.remote.*;import java.rmi.*;import java.rmi.server.*;public class ExternalApp {public static void main(String args[]) {SPServerFactoryInterface spServer = null;boolean goodEvent = false;try {spServer =(SPServerFactoryInterface)Naming.lookup("rmi://localhost/SPServer");}catch (Exception e) {e.printStackTrace(System.out);}try {if (spServer != null) {for (int i = 1; i < 11; i++) {double time = spServer.getSimTime("Remote");time = time + 10.0;if (i < 3) {goodEvent = spServer.generateEntity("Remote","Generate1", "External1", "Entity9", time, 0);}else if (i < 6) {goodEvent = spServer.generateEntity("Remote","Generate1", "External1", "Entity6", time, 2);}else {goodEvent = spServer.generateEntity("Remote","Generate1", "External1", null, -1, 0);} // end of inner ifif (!goodEvent) {System.out.println("Generate event failed");}try {Thread.sleep(2000);}catch (Exception e) { }} // end of for loopgoodEvent = spServer.generateEntity("Remote","Generate1", "StopSim", null, -1, 0);} // end of outer if} // end of try blockcatch (RemoteException re) {re.printStackTrace(System.out);}} // end of main} // end of ExternalAppExternal Schedule Errors
If the call togetSimTimeis not successful, a -1 will be returned. If the call togenerateEntityis not successful, false will be returned. Error messages from SPServerFactory or one of the server instances will be in the fileserver.login the SIMPROCESS directory. If the error occurred within SIMPROCESS, the error messages will be insimprocess.logorsimprocess.errin the SPSYSTEM directory.Generate Activity Summary
The Generate Activity generates the Entities that are processed in a SIMPROCESS simulation:The number of Entities generated at each generation event and the frequency of entity generation events may be expressed as either constant numbers or statistical distributions.Schedules of discrete entity generation events can be defined. Schedules are classified as:· Periodic: A constant or statistical distribution of generation events per time unit.· Calendar: Daily, weekly, monthly, etc., events.· Weekly: Schedule for a complete week.· Cyclical: A detailed sequence of generation events.· File: A schedule defined in an external file.· Spreadsheet: A schedule defined in an external spreadsheet.· External: A schedule that receives generation signals from an external application.Cyclical schedules are further broken down into cycles, each of which describes a different entity generation event. Cycle events are processed sequentially. This differs from other Generate schedules, which are processed in parallel.Resource Downtime
Resource Downtime determines when a resource is unavailable. Resource Downtime can be defined locally or globally. A Resource can have multiple global and one local Resource Downtime. Each global Resource Downtime for a particular Resource and the local Resource Downtime for the Resource operate independently. Thus, each can have different Start and End dates and times, and each can have different Schedules.Local Resource Downtime
Local Resource Downtime is defined on the Downtime tab of the Resource properties dialog. Downtime defined on the Downtime tab of a Resource properties dialog will only apply to the Resource currently being edited.
The global Resource Downtimes can be accessed while defining a local Resource Downtime. There is a Global Downtimes button on the Downtime tab of the Resource Properties dialog that displays a dialog that lists the global Resource Downtimes defined in the model. The global Resource Downtimes that are applied to the Resource are selected and can be modified. The global Resource Downtimes can be edited by selecting the Edit Downtimes button.
Global Resource Downtime
Global Resource Downtimes can be applied to any Resource in the model. They are defined by selecting the menu item Define/Resource Downtimes....
SIMPROCESS comes with three predefined Resource Downtime templates that are listed in the Type combo box on the Resource Downtime list dialog:· Empty - Default Resource Downtime, with no Downtime scheduled.· Night Shift - Includes a Downtime schedule that causes a Resource to only be available from 11 p.m. to 3 a.m. and from 4 a.m. to 8 a.m. Monday through Friday nights.· Standard Shift - Includes a Downtime schedule that causes a Resource to only be available from 8 a.m. to noon and 1-5 p.m.The Add Template button on the Resource Downtime list dialog creates a Resource Downtime template that can be saved in a Library. When the Library is loaded the Resource Downtime templates in the Library are added to the Type list. See "Adding Resource Downtime Templates," beginning on page 232 for more information on creating Resource Downtime templates.Selecting Add brings up a global Resource Downtime dialog.