'Create a new transporterFleet from an existing transporterFleet [closed]
I have a transporter type agent called Truck. Its population called truck. I added a TransporterFleet block to the model which is called truckFleet. In truckFleet I selected Truck for both New Transporter and Transporter Type sections. An agent called trench seizes from truckfleet and when it release the truck, it will allocate a value to a variable as I used ((Truck)unit).v_capacityFull = true;
in the on release transporter section.
Now I have another agent called dumping. Now this agent needs to sieze a specefic truck from truckFleet. one that has the following value v_capacityFull == true.
So I have been applying two approaches:
- I used the same transportFleet which called truckFleet. But I use a dynamic Fleet section in which I typed
new truckFleet = List filter(truck, t -> v_capacity == 0);
- I created a new transporterFleet called fullTruckFleet and in the new transporter section I typed
new truckFleet = List filter(truck, t -> v_capacity == 0);
but in the transporter type I still used Truck.
for the first approach: I get the following errors:
and for the second option: I get the following errors:
In general, I am not happy about non of them but could not think about another approach. And I am not just interested to resolve errors but to find an approach that fulfill my intentions.
Solution 1:[1]
The answer is very easy actually. I can use the same truckFleet but in the Advanced section of the SeizeTransporter block, in Transporter choice condition section, I can type ((Truck)unit).v_capacityFull == true
. :)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Neda |