Anda di halaman 1dari 2

Problem:

I have a user-created object in my model and want to update a state variable in the main model from
within that object. ** NOTE: This is an extension of the SimBit ProcessModelWithinModel.spfx.

Categories:

Building New Objects / Hierarchy

Key Concepts:

BasicNode, ContinueProcess, Delay Step, EndTransfer Step, Expression Property, ExternalNode, Object
Instance Property, ProcessStation, Release Step, Resource, Seize Step, Station Element, Submodel,
Transfer Step, State Property

Assumptions:

The SimBit ProcessModelWithinModel.spfx is used as a baseline for this example. The steps show how
to add a state property reference to an object so that a state in the main model can be appropriately
updated.

Technical Approach:

A state type property will be utilized within the user-created object. Once the object is placed in a
model, the property will then reference the state defined within the model.

Details for Building the Model:

ProcessModelWithinModel.spfx
Open the SimBit ProcessModelWithinModel.spfx and review the corresponding *.pdf file for
logic details.

Defining a State-Type Property


Within the Navigation bar, click on thte SeizeDelayRelease object.
Go to the Definitions window, Properties panel to add a new property to the object. This is done
by selecting Standard Property and then clicking on State within the pull -down list.
Rename the state WhichState and change the Category Name to Properties so that it appears
in the same area with the ResourceName and DelayTime properties for the object.

Assigning the State within the SeizeDelayRelease Object


Click on the Processes window of the SeizeDelayRelease object. After the Seize step, add an
Assign step.
Within the Assign step, right click on the State Variable Name property, select Set Referenced
Property and click on WhichState. This will cause WhichState to be placed in the property
field with a green arrow, indicating a reference from an object property.
Within the New Value field, enter the value WhichState + 1. This will cause each token going
through this process to increase the associated state by 1.

Defining the State within the Model


Within the Navigation window, click on the Model and go to the Definitions tab, States panel.
Add a new Integer type State and change the Name to Model_Count.
Within the Facility window of the model, add an animated status label of this state by going to
the Animation ribbon, selecting and placing a Status Label and entering the Expression
Model_Count.

Defining Which State to Reference within the Object


Click on the SeizeDelayRelease object within the Models Facility Window.
Notice in the Properties window, under the category Properties, there is a new property called
WhichState, which you will specify as Model_Count.

Anda mungkin juga menyukai