Jump to content

Assigning and Managing State Variables for a Worker in SIMIO


Recommended Posts

Hello SIMIO experts,

I am currently working on a project where I need to assign state variables to a worker and manage these variables throughout the simulation. I'm looking for guidance on a few key aspects:

  1. Assigning a State Variable to a Worker: How can I assign a state variable (e.g., a boolean or numerical value) to a worker in SIMIO? I want to track attributes such as availability, task completion count, or other custom metrics.
  2. Updating the State Variable During the Simulation: What is the best practice for updating the state variable of a worker based on specific events or conditions during the simulation? For instance, updating the availability status when a worker starts or completes a task.
  3. Accessing the State Variable: How can I access or consult the state variable of a worker at any point in the simulation for monitoring or decision-making purposes?

Any advice or example models that illustrate these processes would be greatly appreciated. Thank you for your help!  

Link to comment
Share on other sites

Before you start adding state variables to a library object, I suggest that you first familiarize yourself with all of the existing states. One easy way to do this is to instantiate the object (e.g., Worker1) and then go to any expression field and type "Worker." and look at the list. In the case of Worker, there are over 100 states, functions, and properties built-in to the Worker object.

image.png.6fecf5a20e589373348e39f36712f8f5.png

Another way is to subclass the Worker, then go to the Definitions tab of the MyWorker object and you can see all of the built-in definitions by category:

image.png.b77ee34c354818aef3ecf67b39e731f5.png

There is a pretty good chance that what you need is already there. But if not, use the same screen illustrated above and add whatever state (or property, event, ...) that you need. 

As far as referencing or assigning that custom state or a built-in state, it is done using ObjectName.StateName. For example if you added a state named TimeStartedMove to MyWorker, and you wanted to assign that value, you might assign MyWorker.TimeStartedMove to TimeNow.

The tricky part, especially with more complex objects like Workers, is to determine exactly when/how to assign that value. Sometimes you can interact with the model itself to insert an Assign at the correct location (let's say in the Loaded Add-on Process). Or sometimes you might need to override the process logic in your custom object. The SimBits RecordDistanceTraveled and ElectricVehicle  are examples to review.

 

Link to comment
Share on other sites

  • 2 weeks later...
  • 3 weeks later...

@dsturrock

Thank you, David, for your advice. I ultimately implemented the second method, creating a custom worker in which I set up a custom state variable that I could update and monitor without any issues.

Thank you for your detailed response,

Best regards,

Raimundo Yachan

Link to comment
Share on other sites

×
×
  • Create New...