Search code examples
anylogicschedule

Error By Create Schedule Programmatically


I want to create a (on/off)schedule in variable via excel and it will used in a resourcePool. I have whote the code in a function like this:

```
1. v_Workshift = new Schedule<Boolean>();
2. v_Workshift.setOwner(this);
3. v_Workshift.setCalendarType(true);
4. v_Workshift.setFirstDayOfWeek(MONDAY);
5. v_Workshift.setTimeUnits(DAY.toMilliseconds());
6. v_Workshift.setPeriod(1);
7. v_Workshift.setGlueIntervals(true);
8. 
9. v_Workshift.addInterval(1, b1, b2, b3, 1, b4, b5, b6, true);
10. v_Workshift.addInterval(1, c1, c2, c3, 1, c4, c5, c6, false);
11. v_Workshift.addInterval(1, d1, d2, d3, 1, d4, d5, d6, false);
12. 
13. v_Workshift.initialize();
```

The prameter b,c,d are the start time and end time from excel.

And the error is: Parameter capacityScheduleOnOff is not specified (null/empty)

Can anyone tell me how to solve this problem?

Thank you in advance


Solution

  • This error is actually coming from the ResourcePool object. It seems that you've selected an option capacity defined by on/off schedule but you didn't actually set the reference to the v_Workshift object into the appropriate field in the ResourcePool that this schedule is supposed to control.