BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Ebele
Obsidian | Level 7

We receive messages from sensors (each 10 seconds) and put them on a queue. 

This is done in a very simple ESP model on a edge device, using a socket connector and writing the message to a message queue.

 

As long as the sensors function properly, there is no problem in our ESP Models.


But if a sensor stops sending messages, we still want to produce a message in our ESP model (each 10 seconds, one message) indicating the sensor hasn't produced a valid message.

 

What would be the best approach for this ?  

 

Thanks,

Ebele

1 ACCEPTED SOLUTION

Accepted Solutions
Ebele
Obsidian | Level 7

Hi Andy,

 

Yes, that works. Thanks a lot. It generates one event in case of 'a not arriving e2'.

 

Also very happy with the timer connector which is available in 5.2. With this, the pattern window can still be initiated when there are no input messages from the sensor. In that way we can create multiple messages instead of one.

  

Thanks!

Ebele 

 

View solution in original post

4 REPLIES 4
AndyT_SAS
SAS Employee

Hi Ebele,

I think a pattern window could help with this.  The pattern would use clock time and be specific to each sensor by setting the pattern index to the sensor id.  This way your pattern has an instance for each specific sensor.  The pattern would be "fby{10 seconds}(a,not(a))" where event "a" is just an event from the input window.  That pattern would complete after 10 seconds of no activity, which would output an event you could use to send a message in a notification window.  If another event from the sensor came in before 10 seconds, the pattern should collapse and produce no output event. 

Pattern windows can be tricky to get the patterns just right, so this would take some testing to validate this pattern is correct.  

.

There is also a timer connector/adapter, which can publish an event at a specified interval.  That could be helpful, but there would need to be some thing else to maintain a field for the last heard from time for a sensor and then look for sensors that haven't responded within 10 seconds when a timer event comes in.  I think that would need to be DS2 or Python code. 

Thanks,

Andy

 

 

Ebele
Obsidian | Level 7

Hi Andy,

Nice!

 

Tried your solution, but the not(a) doesn't occur in case of there are now input messages at all.

In that case the pattern just isn't executed (or dies), without sending a notification.

 

<patterns>
<pattern name="error">
<events>
<event name="e1" source="B01_Parse_json"><![CDATA[isNull(raw_sensor_output)==0]]></event>
<event name="e2" source="B01_Parse_json"><![CDATA[isNull(raw_sensor_output)==0]]></event>
</events>
<logic><![CDATA[fby{10 seconds}(e1, not(e2))]]></logic>
<output>
<field-selection name="raw_sensor_output" node="e1"/>
</output>
</pattern>
</patterns>

 

We got 1 sensor. So no other messages from other sensors.

 

Where can I find the timer connector/adapter, I think we need that one to produce some events to have this working.

 

Cheers,
Ebele

 

AndyT_SAS
SAS Employee

Hi Ebele,

Sorry, I had the timer in the wrong spot.  This should work for you:

 

fby(e1, not{10 seconds}(e2))

 

Every time an e1 is found, the 10 second timer will start.   If another event arrives(e2), the pattern will collapse with no output.  If the timer pops after 10 seconds, then the pattern will complete and output an event.  

 

The timer connector is documented here.  Hopefully the pattern window by itself will solve this issue.  

 

Thanks,

Andy

Ebele
Obsidian | Level 7

Hi Andy,

 

Yes, that works. Thanks a lot. It generates one event in case of 'a not arriving e2'.

 

Also very happy with the timer connector which is available in 5.2. With this, the pattern window can still be initiated when there are no input messages from the sensor. In that way we can create multiple messages instead of one.

  

Thanks!

Ebele 

 

Whether you're already using SAS Event Stream Processing or thinking about it, this is where you can connect with your peers, ask questions and find resources.

 

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 1601 views
  • 1 like
  • 2 in conversation