I have 3 identical suites represented by one agent type for productionSuite and I want to use loops to set the suites as idle and busy. The agent of productionOrder needs to be sent to only the idle rooms.
I have a parameter of assignedSuite in the ProductionOrder agent that equals a random suite that is picked in the source on main. I started to try loops in this source that relate to the statechart for ProductionSuite agent. I think I need a piece of code to defines the ProductionSuite as 0,1,2 and then checks with a loop if they have an ProductionOrder or not.
[Source]
(Original Code)
agent=ProductionOrder
agent.assignedSuite = productionSuite(uniform_discr(0,2));
deliver("Suite is Scheduled", agent.assignedSuite);
(new code)
Action:
`if ( productionSuite(0).inState(idle))
agent.assignedSuite = productionSuite(0);
agent.receive("Suite is Scheduled");
if ( productionSuite(1).inState(idle))
agent.assignedSuite = productionSuite(1);
agent.receive("Suite is Scheduled");
if ( productionSuite(2).inState(idle))
agent.assignedSuite = productionSuite(2);
agent.receive("Suite is Scheduled");`
The error I get is that idle cannot be resolved as a variable. Though I am not sure this is the best method to use. Could also use some direction on when to group the suites or if I should define them separately.