Logging Sequence


User123

Recommended Posts

Sorry for the very basic question, but I am still learning the ropes! 

 

I have been trying to set up a sequence for logging the output data such that the output is logged only when specific criteria are met.

 

For example,  I tried the following set:

 

if(Channel_1 = 2)

 beginlogging(mylog)

else

 endlogging(mylog) 

 

but, I get the following error function- 

 

Channel or function not found 

 

I also tried 

 

if (mychannel [Channel_1] = 2) 

 beginlogging(mylog)

else 

 endlogging(mylog)

 

I think the error might be due to missing information, but I am not sure how to include it. Can someone please provide some guidance on where I am going wrong, and how to fix it? 

 

 

Link to comment
Share on other sites

First, what's the name of your channel?  If its "Channel_1", then you want:

 

if (channel_1[0] == 2)

   beginlogging(myLog)

else

   endlogging(myLog)

endif

 

Second, a comparison is two ==, not one =.  One = is assignment and doesn't work in if()'s.

 

Third, you have to have Endif too.

 

Finally, because of the way logging sets work, the logging may not start or stop the instant the sequence tells it.  You may miss a couple data points at the beginning and get a few extra at the end.  The latency can be up to 1 second. 

Link to comment
Share on other sites

Please ignore the last post. I hit send too early. 

 

Assuming 

 

channel to be monitored is 'Channel_1', input channel to be logged is 'Current' and the name of the log file is 'mylog' :

 

if(Channel_1[0] = = 0.2) 

 beginlogging(mylog)

else 

 endlogging(mylog)

endif 

 

I tried with this, but I still get an error. Do I need to specify the channel name to be logged as well? Also, why are we using [0] with the channel name? 

 

Thanks! 

Link to comment
Share on other sites

The == can't have a space in the middle.

 

You need [0] because you only want to compare the most recent value. Without [0] you are comparing the entire history.  MyLog is not the name of the log file, but rather the name of the logging set.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.