'Changing transporterfleet based on programmaticaly created schedule

In following up related to my previous question previous question, when a schedule programmatically is created, where I run the function at the start-up of my main (see image 1), I want to change the transporterfleet (image2) schedule based on this. But when I do this by the initschedule function the next error is given " The parameter capacitySchedule cannot be changed dynamically". So my question is how can you use a programmatically created schedule use in the capacity definition of a transporter fleet?

enter image description here

Later added in response to Benjamin

enter image description here



Solution 1:[1]

In the Capacity field, write schedule == null ? 0. : schedule.getValue()

This will link it to your programmatic schedule, but only after it has been created (which is not done right at the start of the model but an instance later).

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 Benjamin