I have a model with 2 machines and only 1 buffer before them (it represents a stage and in my model i have 3 stages). When a product arrives at the buffer I want to decide in which machine it has to go.
Firtsly I want to control if ther are machines in the operational state, if there's a machine in operational state the product has to go there;
then I want to control if there are machines in the working state, if there's a machine in the working state and it finishes in 1 minute the product has to waut in the buffer and then it will go there;
then I want to control if there are machines in the standby state, if there's a machine in the standby state i decide to turn on it and the product has to go there;
If i don't find a machine in these states the product stays in the buffer and the controls in the method are iterative.
I guess i've to put this method in the buffer control, but i don't know exactly where and then i don't know how to write it.
someone can help me? thanks so much
To achieve this behavior you should create an exit control for the buffer. Just create a method from the Information flow bar in the frame. On the Controls tab of the buffer, select this method for the exit control.
BTW, it is probably more manageable if you create a library object called "Stage", containing the buffer and the machines. Then the main model consists of 3 stages and thus fewer connectors.
You would at least need the following SimTalk commands:
Since I do not know about your programming skills. On the start page, you can go to the video area and see how to create and program a simple exit control.
thanks a lot but I've already read the step-by-step guide but i didn't find the instruction about those commands and so i don't know to use them. in the method i'd like to write something like:
--if the machine1 is in the operational state then the product has to go there
--else if the machine1 in the working state and it finishes in 1 minute then the product has to go there
I don't know how to transform these words in the code language
Here is something to get you started, not necessarily a solution to your problem. Hopefully it will help you in how to use the properties Nomden mentioned earlier and how to use them in conditional programming:
if machine1.EnergyCurrentState = "Operational" then Buffer.cont.move(machine1); elseif machine1.EnergyCurrentState = "Working" and machine1.cont.remainingProcTime <= 60 then Buffer.cont.move(machine1); else ... <..> etc.
Of course there may be much simpler ways to solve this. Perhaps if you draw a map or flow chart of how you want your program to function logically, it will help you program the conditions correctly.
I attached a short example. It shows some of the basic tricks. It is no very elegant, but it works and gives you an idea of what you can do.
In a more generic case I would probably put the routing options in a table together with the selection criteria.