I want to insert vehicles via an source block into a specific plant. My plants are a population based on an agent type where I want to program a generally applicable logic.
The arrival is defined by an arrival rate (e.g. 5 per week) which I want to read from the database. The database consists of the following columns: start (Name of the plant where the vehicle should start), depatures_per_week (rate), destination (destination of vehicle).
For example:
- start= city1, depatures_per_week = 2, destination= dest1
- start= city1, depatures_per_week = 0.5, destination= dest2
Now I have 2 rates for one source block. I want to add them up to one rate and write the destination according to the departures per week in the variable v_destination of the vehicle. So 0.2 % would get the dest2 and 0.8 % the dest1.
How can I write a code to define the destinations of the vehicles according to the individual rates?
Thanks!