Schedule Management Feature Question

General Question about shift start and end datetime values that get populated from the schedule management feature.

Under Config -> Alarms -> Schedules

My question is about the Holidays. I know when you populate the holidays it disregards the shifts that are set up for that date for example.

In my tag browser on the designer, I show under the Default a folder called Time Periods which directly gets populated from the schedule feature on the gateway.

See below the Shift 1 Start and End Time.

When a holiday occurs, it disregards this shift. What would the default time period tags show during a selected holiday event? Does Ignition default start and end datetime tags to 0's? or do they just stay at the previous dates value until updated on the next shift it takes into account?

Has anyone experienced this or knows? I watched the inductive university video and did not mention it. Also searched on the forum. Not sure if anyone has brought this up yet?

Thanks!

My understanding is that the schedule is not automatically available as a tag. In your snippet, both end and start tags are memory tags; therefore, a script somewhere is writing the schedule to those tags.

I do the same thing in my setup, and I include boolean tags that indicate whether the schedule is active or not.

Yes. Thank you. I do have a MES script running that writes all this information to those time period tags.

It does not take into account the holiday dates anywhere in it though. So, if a holiday occurs it will just remain the last shift that occurred datetime info that writes to those tags.

Would still be interested in knowing, without the script and writing to my tags, how Ignition handles the shift values and data tied to that when holiday is selected. :thinking:

It depends on your script and how your schedule is setup. If the script checks to see if the schedule is active before writing to the memory tags, then it will stay with the last value, IE schedule is inactive; therefore, do not write to shift tags.

If you do not check whether the shift is active or not, then it should write the times to the tags no matter what.

Here is an example of getting a schedule's start time.

##################################################################################################################################
def getScheduleStartDateTime(scheduleName):
	'''
	return a datetime representing the start time of the provided schedule Id
	args:
		scheduleName: (str) name of the schedule 
	'''
	today = system.date.midnight( system.date.now() )
	#-----------------------------------------------------------------------------------#
	schedule = system.user.getSchedule(scheduleName)
	
	if not schedule:
		return None
	#-----------------------------------------------------------------------------------#
	# create a Java Calendar instance to retreive a Java Timeline 
	cal = Calendar.getInstance()
	cal.setTime(today)
	
	timeline = schedule.getScheduleForDay(cal)
	longToday = system.date.toMillis(today)
	
	allowClosest=True
	segment = timeline.getSegment(longToday, allowClosest)
	
	if not segment:
		return None
	
	longStart = segment.getStart()
	
	return system.date.fromMillis(longToday + longStart)

This operates on system.user.getSchedule() which returns a BasicScheduleModel