Home > database >  how du model setuptime for diffrent agent in service block
how du model setuptime for diffrent agent in service block

Time:12-20

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 A and then agent B comes then XX delay time. If the predecessor is agent A and then agent C comes then XX delay time.... and so on.

CodePudding user response:

You need to store the predecessor somewhere and use it accordingly:

  1. create a variable v_Predecessor next to the Service block, type should be your agent type flowing through the blocks (say MyAgent)
  2. create a function f_getDuration that takes 2 arguments of type MyAgent: first is currentAgent and 2nd is predecessor. Function returns a double.
  3. Call this function in your service block delay code section using f_getDuration(agent, v_Predecessor)
  4. In the on-exit code block of the service block, update v_Predecessor = agent;

The code in f_getDuration will look something like:

if (currentAgent.myType == "A" && predecessor.myType == "B") {
    return 12.;
} else if (currentAgent.myType == "A" && predecessor.myType == "C") {
    return 13.;
} else if ... // add your logic
  • Related