The WeeklyScheduleRelation is a smart relation designed to create an outbound implied relations from a BWeeklySchedule (BooleanSchedule, EnumSchedule, NumericSchedule, StringSchedule) component to any BControlPoint components which the schedule's out slot is linked to. The smart relation supports the schedule being linked directly to the control point, being linked through an intermediate BAbstractScheduleSelector (BooleanScheduleSelector, NumericScheduleSelector, StringScheduleSelector, EnumScheduleSelector), or being linked through other intermediate components such as a BStatusEnumToStatusBoolean block. The schedule and control point are shown in the same wiresheet in the images below, but are not required to be in the same wiresheet.
The WeeklykScheduleRelation is a smart relation which must be assigned to the desired BControlPoint and BWeeklySchedule components in the station using a tag rule in a BSmartTagDictionary. Prerequisites are having a smart tag dictionary configured in the station, see the Niagara Tagging Guide for more information.
The station's TagDictionaryService has the Niagara and Haystack dictionaries, plus a smart tag dictionary named 'Building'.
The AHU devices in the station have an EnumPoint named 'Occupancy' which a BWeeklySchedule in the station will be linked to for occupancy control.
Add an "AndRule" from the tagdictionary palette to the TagRules folder under the Building dictionary. Configure the tag rule Condition with an isType condition to test for control:EnumWritable type components and a BooleanFilter condition to filter based on the point name being 'Occupancy'. Assign desired tags to the TagList, tag groups to the TagGroupList, and the WeeklyScheduleRelation from the relations sub folder in the vykonPro palette. Assign the desired relation Id to the WeeklyScheduleRelation such as b:scheduleRef.
Add an "IsTypeRule" from the tagdictionary palette to the TagRules folder under the Building dictionary. Configure the tag rule condition to test for the desired type of BWeeklySchedule such as schedule:EnumSchedule. Add the WeeklyScheduleRelation from the relations sub folder in the vykonPro palette to the RelationList. Assign the desired relation Id to the WeeklyScheduleRelation such as b:scheduleRef.
After setting up the tag rule for the desired BWeeklySchedule and BControlPoint components, the implied WeeklyScheduleRelatoin should be displayed in the spy remote view on the applicable components. The spy remote view on the schedule should display an outbound implied relation for any BControlPoint which the schedule's out slot is linked to.
The spy remote view on the applicable BControlPoint components should display and inbound relation from any linked schedule.
The relation may be utilized in graphics to provide hyperlinks from the scheduled equipment to the applicable schedule. The hyperlink property of a widget may be configured using a neql predicate in conjunction with the '|single:' scheme. In this case a Px view is assigned to multiple AHU devices in the station and the Px view has a button widget configured to hyperlink to the schedule which is linked to the 'Occupancy' point.
The Px view is assigned to the device which is the base component ord that provides scope to the NEQL statement. The neql:hs:occupied and hs:cmd|single: syntax searches under the device and finds the 'Occupancy' point. The resulting 'Occupancy' point is then piped as the base component ord to provide scope to the neql:traverse b:scheduleRef<-|single: syntax which traverses the inbound b:scheduleRef relation to resolve the source schedule component.
A BqlGrid component from the report palette can be utiized in the station query for points which are related to the desired schedule. In this example the base ord of the LonNetwork provides scope to limit the NEQL query which searches for components with the hs:occupied and hs:cmd marker tags that have an inbound b:scheduleRef relation from a component named 'FirstFloorWeekly'. The result of the NEQL query is piped into a BQL query to format what is displayed in the table.
station:|slot:/Drivers/LonNetwork|neql:hs:occupied and hs:cmd and b:scheduleRef<-n:name='FirstFloorWeekly'|bql:select parent.parent.displayName as 'Zone'
The BqlGrid component results can be displayed in a Px view utilizing a WebWidget for the HTML5 Grid Table View. The hyperlink property on the WebWidget is configured as slot:../.. since the query resolves to the 'Occupancy' point under the device it is necessary to use a relative backup ord which resolves the grandparent of the 'Occupancy' point which is the device with the Px view assigned.
It may be useful to create a hierarchy to display the Weekly Schedule components in the station that includes the applicable devices which are controlled by each schedule. See the Niagara Hierarchies Guide for more information on creating hierarchies.
Add a Hierarchy from the hierarchy palette to the HierarchyService in the station named Schedules. Add a QueryLevelDef from the palette to the Schedules hierarchy. Click the Query Context >> link, then add a facet with Key = sched, Type = String, Value = n:name. Configure the Query property with a NEQL prediate to find the desired Weekly Schedule components in the station such as n:type='schedule:EnumSchedule'.
Add a second QueryLevelDef from the hierarchy palette to the Schedules hierarchy. Configure the Query property with a NEQL predicate to find equipment which has an inbound n:parentDevice relation from a control point which has an inbound b:scheduleRef relation from a schedule whose name matches the sched variable stored in the query context.
hs:equip and n:parentDevice<-b:scheduleRef<-n:name={sched}