I have a cyclic event in which 4 times a day, if the inventory is greater than 1 pallet, I want to create a new agent and add it to the population pop_palletsLine1 AND assign the pallet variable v_toLineFrom = "Silo" and the pallet variable v_movementNbr = 6. I know to assign one variable I could do
if (v_inventorySiloMalt >= p_lbPerPallet) {
add_pop_palletsLine1().v_toLineFrom = "Silo";
}
But to assign 2 variables I can't do
if (v_inventorySiloMalt >= p_lbPerPallet) {
add_pop_palletsLine1().v_toLineFrom = "Silo";
add_pop_palletsLine1().v_movementNbr= 6;
}
because that adds 2 agents to my population, each with 1 of the variables assigned. Any suggestions? Thank you!
Fair question. The
add_xxxfunction actually returns the agent it just created. So you can store it temporarily and do with it what you like:This assumes your agent type is called
MyPalletLine