Reputation: 43
i have used a service block for my machine. i want to implement my setup time in it. So the setup time and the processing time will be a common time.
I would like to write a function for my delay time in the service block. How can I write the function that it gives me the following output: If the predecessor is agent.Name "A" and then agent.Name "B" comes then XX delay time. If the predecessor is agent.Name "A" and then agent.Name "C" comes then XX delay time.... and so on. Name is a Parameter in the Agent
Maybe i can use a variable?
Upvotes: 0
Views: 42
Reputation: 12640
Put a variable of type String predecessorName
next to the service block
create a function getDelayTime
that returns a double and takes 2 input arguments of type String: nameCurrentAgent
and namePredecessor
in the function, compare as you need, for example:
if (nameCurrentAgent.equals("A") && namePredecessor.equals("B") {
return 12.;
} else if ...
in the service block's delay code block, you call getDelayTime(agent.Name, predecessorName)
in the service block's "on at exit" code block, update predecessorName = agent.Name
for the next agent
Upvotes: 2