How to get the state of a resource? I only want to unload my item at the processor if it is idle. So, I want to use a decision block that gets the state of the resource (numeric) and based on that decides the destination of the item.
How to get the state of a resource? I only want to unload my item at the processor if it is idle. So, I want to use a decision block that gets the state of the resource (numeric) and based on that decides the destination of the item.
If I'm understanding correctly, you want to get the current state of the processor and assign it to a token label, so you can use it in your process flow logic. You can do this with this code:
Model.find("Processor1").as(Object).stats.state().valueString
By putting this code in the value field of an Assign Labels activity, you can get the current state of Processor1 and assign it to a token label. You can then use this token in decide activities, synchronize activities, etc. to perform the logic you want. I've demonstrated this in a simple model:
Thank your for the response! My resource is numeric, no a 3D object, so I only want to reference the state of my resource block in my process flow.
Peter upload your model - you're using words like processor, item and resource in your question where their meanings are ambiguous/interchangable and we need to know when something is 3D as opposed to pure process flow. Also what you're describing sounds like it can be better done using another method, so either the description could be better or we should be recommending another approach.
The Resource shared asset in a process flow doesn't have state - it has a content stats that will tell you how many tokens have acquired the shared assets. You can access that using something like this:
getstat(getactivity("ProcessFlow", "Resource"), "Content", STAT_CURRENT, current)
or you can find the available asset count:
getstat(getactivity("ProcessFlow", "Resource"), "ResourceAvailable", STAT_CURRENT, current)
In the case of numerical count or an array of numerical values, the asset that you see listed in the token's properties isn't something that has state either - it's an sdt coupling request/allocation that is transient, exists on a per token basis, and no longer exists once the asset is released.
14 People are following this question.
FlexSim can help you understand and improve any system or process. Transform your existing data into accurate predictions.
FlexSim is a fully 3D simulation software environment. FlexSim can be used to simulate any process in any industry.
FlexSim®, FlexSim Healthcare™, Problem Solved.®, the FlexSim logo, the FlexSim X-mark, and the FlexSim Healthcare logo with stylized Caduceus mark are trademarks of FlexSim Software Products, Inc. All rights reserved.
Privacy | Do not sell or share my personal information | Cookie preferences | Report noncompliance | Terms of use | Legal | © Autodesk Inc. All rights reserved