Skip to content

Commit ec29280

Browse files
committed
fix(demo): scale MonitorTag.MinDuration to datenum time base
MonitorTag.applyDebounce_ measures run duration in parent-X native units. plantConfig expresses MinDuration in seconds (1 / 2 / 3), which was correct while the data generator emitted posix seconds as the time base. After the datenum switch, parent-X is in days — so a config value of '1 second' was being treated as '1 day' of debounce, and every 3-second breach (3.5e-5 days) was quietly zeroed out by the debounce filter before it could fire the monitor. Divide each MinDuration by 86400 when constructing the MonitorTags in registerPlantTags, so the demo's monitors keep human-readable seconds in plantConfig while the instantiated tags use the correct datenum units on the wire. Criticality and AlarmOff predicates are unaffected (the AlarmOff condition is evaluated on Y, not on X). Regression suite: 80/80 green.
1 parent 27ad9b0 commit ec29280

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

demo/industrial_plant/private/registerPlantTags.m

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,18 @@
9494

9595
mDefs = cfg.MonitorDefs; % expects 4 entries in fixed order, see plantConfig
9696

97+
% MonitorTag.MinDuration is expressed in parent-X native units. The
98+
% demo's parent SensorTags carry time as MATLAB datenum (days since
99+
% 0000-01-00), so a config value of "1 second" must be rescaled to
100+
% 1/86400 days. Without this, a 3-second breach reads as 3.5e-5 days
101+
% and always falls below the 1-day debounce window → monitor never
102+
% fires and StatusWidget / IconCardWidget stay green.
103+
secondsPerDay = 86400;
104+
97105
mFeedlinePressureHigh = MonitorTag(mDefs(1).Key, ...
98106
TagRegistry.get(mDefs(1).ParentKey), mDefs(1).ConditionFn, ...
99107
'AlarmOffConditionFn', mDefs(1).AlarmOffFn, ...
100-
'MinDuration', mDefs(1).MinDuration, ...
108+
'MinDuration', mDefs(1).MinDuration / secondsPerDay, ...
101109
'Criticality', mDefs(1).Criticality, ...
102110
'EventStore', store, ...
103111
'Name', prettyName_(mDefs(1).Key));
@@ -106,7 +114,7 @@
106114
mReactorPressureCritical = MonitorTag(mDefs(2).Key, ...
107115
TagRegistry.get(mDefs(2).ParentKey), mDefs(2).ConditionFn, ...
108116
'AlarmOffConditionFn', mDefs(2).AlarmOffFn, ...
109-
'MinDuration', mDefs(2).MinDuration, ...
117+
'MinDuration', mDefs(2).MinDuration / secondsPerDay, ...
110118
'Criticality', mDefs(2).Criticality, ...
111119
'EventStore', store, ...
112120
'Name', prettyName_(mDefs(2).Key));
@@ -115,7 +123,7 @@
115123
mReactorTemperatureHigh = MonitorTag(mDefs(3).Key, ...
116124
TagRegistry.get(mDefs(3).ParentKey), mDefs(3).ConditionFn, ...
117125
'AlarmOffConditionFn', mDefs(3).AlarmOffFn, ...
118-
'MinDuration', mDefs(3).MinDuration, ...
126+
'MinDuration', mDefs(3).MinDuration / secondsPerDay, ...
119127
'Criticality', mDefs(3).Criticality, ...
120128
'EventStore', store, ...
121129
'Name', prettyName_(mDefs(3).Key));
@@ -124,7 +132,7 @@
124132
mCoolingFlowLow = MonitorTag(mDefs(4).Key, ...
125133
TagRegistry.get(mDefs(4).ParentKey), mDefs(4).ConditionFn, ...
126134
'AlarmOffConditionFn', mDefs(4).AlarmOffFn, ...
127-
'MinDuration', mDefs(4).MinDuration, ...
135+
'MinDuration', mDefs(4).MinDuration / secondsPerDay, ...
128136
'Criticality', mDefs(4).Criticality, ...
129137
'EventStore', store, ...
130138
'Name', prettyName_(mDefs(4).Key));

0 commit comments

Comments
 (0)