How to close a processor input port based on its state?
I want to close it when the state is "Changeover"
How to close a processor input port based on its state?
I want to close it when the state is "Changeover"
Hi @ahmedmedhat,
This is something that can be done fairly easily by using process flow. In the attached model I created an event triggered source that fires each time the processor's state changes. I made sure that I created labels for the to and from states. I then used two decide activities to filter out state changes that I don't need to look at (this can be simplified into a single decide if you want.) Once a token with the toState for changeover is found, I then close the input on the processor, wait for the changeover to occur, (a delay activity.) And then I open the ports again to allow items to enter.
It is helpful to have a state table open so that you can make sure that you know what state a number references. These can be found in the toolbox.
great it works but now I am trying to input time in the delay with referral to a global table by looking for the flowitem's code and retrieve the time, the code i use in the 3D model doesn't work when I place it in the delay code
here's the code:
/**Custom Code*/ Object current = ownerobject(c); Object item = param(1); int port = param(2); double Time=Table.query("SELECT Time FROM [C1] WHERE Code = $1",item.Code)[1][1]; print(Time); return Time;
For the delay activity, if the flowitem's code is a label stored on the item, one way is to use the prebuilt global table search. To make this work, on the Source I added a label for the assign event object to. This will create a reference to the processor that is changing states. Then in the delay activity I select the using global table lookup option, and in the row or column, depending on how you set up your data. I put the following
token.Processor.subnodes[1].Type
The subnodes callout looks at the item currently in the processor. the [1] says to look at the first item in the array, which in the case of most processors will be the item being processed, and the .Type refers to the label Type that I stored on the item. If pulling values from a table, it is generally best practice to use the prebuilt option if possible.
In regards to your second question, you can create a group of all of the processors that you want to have stop, and then on the event triggered source, you can listen to that group. If you set up the assign event object label, you can use that to differentiate what processor to stop. In the custom Code activites that close and open the ports, you can now use token.Processor to control which object's ports you want to close and open.
The attached model has implemented most of these things other than the group of processors.
13 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