06-22-2014 11:50 PM
Hi foum,
i using a state machine with Labview (states: start, recording, logging, report, stop) I would like to have a report in a text file with state changes, date and time.
What would be a great way to do this?
Example:
Time
00:00:00 Start
00:01:00 Recording
00:02:00 Logging
00:02:30 Recording
...
Thanks and best
Martin
Solved! Go to Solution.
06-23-2014 12:03 AM
Are you aiming to have event driven recording (i.e. when a user presses a button) or just have it recording the time that it enters and exits each of your states?
If you know where it will be exiting each 'loop' of states from then you could simply use a case structure that is called at the end of the loop when the "start recording", "stop recording" "exit" states are called. This isn't very tidy for expandability however.
06-23-2014 12:14 AM
Hi ogk.nz
thanks for your answer. For me would be ok just recording the time that it enters and exits each state.
I was thinking to save the states with timestamp somehow temporarily in an array then in recording write them to a file.
Some ideas?
06-23-2014 02:13 AM
Create an AE (Action Engine) with Init, Write and Close functionality, Init opens a log-file and stores the ref in a shift register, Write writes time and input string (which you'll put in each state) and close closes the file.
/Y
06-23-2014 07:06 AM
The Action Engine sounds like the best route. You can also store the previous state in the Action Engine so that if you are in the same state you don't have to record.
06-23-2014 08:25 AM
I've used a logging loop as a another consumer loop before so all the logging overhead doesn't affect the other loops. The logging file ref was opened in the init state and closed in the exit state. How does this compare with the Action Engine logging?
Thanks.
06-23-2014 08:37 AM
@Billko i did just that the other week, an AE which held file ref and user event ref (as outputs) and a Message as input. A logging loop writes to file when event happens and the Message command sends the event. Depending on how often the logging happens and the other loops speed requirement it can be the better solution.
/Y
06-23-2014 11:29 AM - edited 06-23-2014 11:31 AM
@Yamaeda wrote:
@billko i did just that the other week, an AE which held file ref and user event ref (as outputs) and a Message as input. A logging loop writes to file when event happens and the Message command sends the event. Depending on how often the logging happens and the other loops speed requirement it can be the better solution.
/Y
Thanks - that is exactly the info I needed. I knew it was an "it depends" kind of an answer, and you answered specifically what it depended on. (And I strongly suspected it was what you said it was.)
Again, thanks!
06-23-2014 12:52 PM
Hi guys,
thanks a lot for your advices but i am realtivy new working with Labview, there are some example how to do this with an action engine. Or how i will creat an action engine in labview.
Thanks
Martin
06-23-2014 12:57 PM