MangoAutomation / BACnet4J

BACnet/IP stack written in Java. Forked from http://sourceforge.net/projects/bacnet4j/
GNU General Public License v3.0
187 stars 111 forks source link

RAD-5573 Improve scheduling and validation logic for Schedule Object #98

Closed MertCingoz closed 3 months ago

MertCingoz commented 4 months ago

Addressing scheduling issues discussed in #97

kishorevenki commented 3 months ago

I created my application with Schedule Object like the below: ScheduleObject Sch1 = new ScheduleObject(localDevice, 1, "Schedule_1", effectivePeriod, weeklySchedule, exceptionSchedule, new Real(10f), sequenceDOPR, priorityForWriting.intValue(), false); Sch1.updatePresentValue();

I have got the above error message: The method updatePresentValue() from the type ScheduleObject is not visible

So I feel updatePresentValue() for Calendar and Schedule object should be made public.

MertCingoz commented 3 months ago

@kishorevenki why did you need to call this method on your code?

If value is not correct and you need to trigger update, then we need to focus why it is not correct instead of making this method to public.

kishorevenki commented 3 months ago
  1. "If value is not correct and you need to trigger update" - how to trigger update?
  2. Lets consider the below configurations for Schedule Object:
MertCingoz commented 3 months ago

@kishorevenki thank you for pointing the issue. There were issues around time format and should be fixed here #101.

So you don't need to trigger update method manually.

I think if you really want to trigger force update you need to use WP for any of following properties.

PropertyIdentifier.effectivePeriod PropertyIdentifier.weeklySchedule PropertyIdentifier.exceptionSchedule PropertyIdentifier.scheduleDefault

kishorevenki commented 3 months ago

@MertCingoz The test will fail in multiple situations as I mentioned above. Hence its required for the application to call updatePresentValue() of Schedule and Calendar Object. You can notice the same by creating an application and testing the schedule object. Updating of Scheduling and Calendar is required when the controller receives a) TimeSynch b) RP / RPM request c) Schedule will update automatically when it receives WP for the above properties as mentioned.

If you need I can create a separate issue for the same.

MertCingoz commented 3 months ago

The test will fail in multiple situations as I mentioned above. Hence its required for the application to call updatePresentValue() of Schedule and Calendar Object. You can notice the same by creating an application and testing the schedule object.

fullTest seems to be very complex than your example and still be able to pass without need of updatePresentValue call.

Did you actually check what is changed? Scheduler is completely broken since beginning, it is scheduling next update 30-40 years later instead of hours-minutes.

Please try your case on top of fix and let me know if it works or not.