Definition of model elements: As shown in Figure 1, the elements listed below are defined on the canvas.
- Entity: Product
- Activity: Produce, Use, Dispose
- Scene: All, Broken
- Attributes of Entity: ElapsedLifeTime(of Product) and PhysicalState (of Product)
Figure 1: Model elements on the canvas
Set up simulation parameters and objectives (evaluation criteria): Select Toolbar＞Prep＞Define Parameters and Objectives and define Time, Parameter, Objective on Parameter Editor and Objective Editor, respectively.
- Parameters: FailureRate=0; MarketSize=100
- Objectives: AverageElapsedLifeTime (Average of ElapsedLifeTime of Product in Scene All)
Figure 2: Definition of simulation parameters and objectives.
- Definition of Scene-All: Inspect Scene-All. Select Product. Then answer NO (this indicates that this scene includes all Product instances in the market). After that, Relation 1 is defined between Scene-All and Entity-Product.
- Definition of Scene-Broken: Inspect Scene-Broken. Select Product. Then answer Yes (this indicates that this scene selectively collect Product instances in terms of the value of attributes). In the next dialog, define PhysicalState=Broken. After that, Relation 2 is defined between Scene-All and Attribute-PhysicalState
Definition of Activity-Produce: Inspect Activity-Produce. On Activity Editor, describe the following code on the top frame as shown below. This indicates that the number of production at a single simulation step is MarketSize-(the number of products in the market). The number of products in the market is obtained by the function self.count_scene(). On the bottom frame shown below, new Product instance is created, and the value of ElapsedLifeTime and PhysicalState is initialized.
Definition of Activity-Use: Similar to Activity-Produce, Activity-Use is defined by inspecting the node on the canvas. The description on the top frame indicates that Activity-Use is applied to all products in the market. The description on the bottom frame indicates that
- Call a product instance in Scene-All.
- Increment ElapsedLifeTime of the called instance.
- If a randomly generated number (between 0 and 1) is smaller than FailureRate, change PhysicalState of the called instance from Healthy to Broken.
if Random().uniform(0,1) < V['FailureRate']:
Definition of Activity-Dispose: On the top window, define the number of iteration of the activity is the same as the number of broken products. On the bottom window, first call one of the broken product, then delete the called instance.
Figure 3: The model on the canvas after defining Scene and Activity.
Setting of the timing of Activity and Evaluation of objectives: Select Toolbar＞Prep＞Set Timing of. The popped window with several gauges is used to adjust the timing of the execution of all activities and the evaluation of all objectives. The timing is relative to the timing to calculate the number of the execution of Activity and size of Scene. In this example, if the timing of Activity-Dispose is before that of Activity-Use. The number of broken products (i.e., the number of instances in Scene-Broken) is always 0. It is because of that the number is collected after the calculation of the size of Scene. As shown in Figure 4, if the size of Scene-Broken (.00) is measured after executing Activity-Use (.59) and before executing Activity-Dispose (.02), the number of broken products is collected successfully.
Figure 4: Defining the timing of the execution of activities and the evaluation of objectives.
Executing Simulation: Select Toolbar＞Run＞Execute Simulation. Depending on the performance of the computer, ISCL finishes the simulation within 10 seconds.
Observation of simulation results: Users can visualize the time series of the collected values by selecting Toolbar＞Post＞Plot Results. For instance, Figure 5 shows the average of life time of products Value-AcerageElapsedLifeTime(left), the number of broken products Scene-Broken(middle), and the number of production Activity-Produce (right). Users can export the results in csv format by selecting Toolbar＞Post＞Export results as csv (Comma Separate Value) format.
Figure 5: Visualization of simulation results.