cancel
Showing results for 
Search instead for 
Did you mean: 

Conditional Data Logging

VOlet.1
Associate II

I want to in corporate conditional data logging in Cube Monitor Flow, since i intend to monitor the behaviour over many hours.

My requirement is to log all the 4 fields:

ms_enDeviceOrientation

ms_stStAccelDataX

ms_stStAccelDataY

ms_stStAccelDataZ

only if ms_enDeviceOrientation changes from value of 1 to value of 2.

I tried to tie this to the trigger threshold in data acquisition but this option was disabled.

Could not find any examples to do this any other way.

Looking forward to clear and specific description or example.

Thanks in advance.

1 ACCEPTED SOLUTION

Accepted Solutions

No update since a while, closing the post.

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

View solution in original post

11 REPLIES 11
Landry
Senior

Hello @VOlet.1​ ,

What do you mean by "this option was disabled" ? This option should be always available.

Do you want to start logging all data as soon as the value of ms_enDeviceOrientation changes form value 1 to value 2 or do you want to log data each time the value change from 1 to 2 ?

If it's option 1 , you should be able to use the trigger feature. We need to find why the option is "disable" together.

If it's option 2 , it could be more complex. No solution yet.

Landry

VOlet.1
Associate II

Hi Landry,

I added the variables for monitoring using the variable name, address options.

Also I did not use the option of using axf/elf file since this approach was missing out most of the variables (This is an open question in another post).

@Trigger name field doesn't allow me to select any of the variables.

Attached a screenshot that might give you more information.

Not sure what step i missed here.

Regards,

Vijay

Landry
Senior

Ok it's a bug . We need to correct it.

One workaround ( waiting for this correction ) is to add a executable file configuration ( where you select no variable ) .

Then you close the node and reopen it , the picklist will be now updated with manual variables.

Then you select your trigger name : ms_enDeviceOrientation, trigger start mode : rising edge and trigger threshold : 2

P.S : If you don't have it, i attached an .out file to create the "fake" executable configuration.

Landry

VOlet.1
Associate II

Hi Landry,

thanks, i was able to get the option to choose the variable if i changed the variable name in the window.

Now the trigger is working - data acquisition and logging starts when condition is met.

But now the next question how to stop the data logging when value changes from 2 to 1?

Currently the data acquisition continues once started, even after the value has changed back.

Any suggestions?

Landry
Senior

One short trick is to use a switch node between your acq in node and your processing node.

No need to define trigger in this case, you will "manually" filter data .

You need to know the position of the variable you want to use as trigger , and then in the switch node you need to define the following ( in this exemple i want only data where the third variable is >=5 :

0693W000000VxevQAC.png

Hope it will help.

Landry

VOlet.1
Associate II

Hi Landry,

That sounds promising.

I couldn't figure out how to determine/discern the structure msg.

Only place i could see some information was in the log file:

{"groupname":"STAccelData","variabledata":[{"y":1,"x":1587097378157}],"variablename":"DeviceOrientation"}

{"groupname":"STAccelData","variabledata":[{"y":-880,"x":1587097378160}],"variablename":"StAccelDataX"}

{"groupname":"STAccelData","variabledata":[{"y":-353,"x":1587097378160}],"variablename":"StAccelDataY"}

{"groupname":"STAccelData","variabledata":[{"y":16479,"x":1587097378160}],"variablename":"StAccelDataZ"}

but how to map this to say something like msg.payload[row][col].y in the filter block?

I tired blindly assuming msg.payload[0][0].y is the corresponding location for DeviceOrientation but that didnt work unfortunately.

Landry
Senior

HI @VOlet.1​ 

You can have the structure message in the help of each node (" info" sheet in the right panel of the design view).

You can also add a debug node after any output to see the messages exchanged in the debug panel ( "debug " sheet in right panel of the design view ).

The mapping of variables is simple, it's the order you see in your variables node or processing node.

I can see in the message you sent me that you forgot the .data in the element to filter.

So in your case if the "DeviceOrientation" is at the first place it should work with the filtering on msg.payload.data.[0][0].y >= 2.

0693W000000VzGbQAK.png

Thank you

Landry

VOlet.1
Associate II

Hi Landry,

That was it, after add the missing .data it's working perfectly.

I was also able to figure out the contents using the debug block.

Thanks a lot, it was very helpful!

VOlet.1
Associate II

Hi Landry,

i had some additional questions that came up with regard to the logged data:

{"groupname":"STAccelData","variabledata":[{"y":1,"x":1587097378157}],"variablename":"DeviceOrientation"}

{"groupname":"STAccelData","variabledata":[{"y":-880,"x":1587097378160}],"variablename":"StAccelDataX"}

{"groupname":"STAccelData","variabledata":[{"y":-353,"x":1587097378160}],"variablename":"StAccelDataY"}

{"groupname":"STAccelData","variabledata":[{"y":16479,"x":1587097378160}],"variablename":"StAccelDataZ"}

here "x":1587097378157 - i presume this is a running counter.

What is the units for this number?

And what is the timebase reference?

Can i set it to any desired starting point?

And the contents that are logged in the log file are they supposed to be JSON parser compatible?

Since i got an error trying to load this data in matlab using JSON parser.