02-15-2018 11:04 AM
Don't put a 20.001 second wait in your loop. If you use a state machine architecture have the loop keep running through a wait state until 20 seconds have passed based on either the Elapsed Time express VI, or any other mechanism using shift registers where you keep track of the start time. Once 20 seconds have passed, then issue a Stop motor command.
02-15-2018 12:31 PM
Okay is the current architecture not incorporating State machine? Removing the wait and trying to think of how to implement your logic. Using elapsed time a Boolean true will be sent out to change a case state to true and issue stop motor, would this work repeatedly? I was having issues with the elapsed time VI staying consistent.
02-15-2018 12:50 PM
No. Not really. I would consider it a queued message handler. A state machine is usually defined by having a shift register that tells what the next iteration of the loop should do. That shift register usually carries an enum that is type def'ed for all the states, but some people like a string datatype instead.
In your lower while loop, I don't understand why you have a comparison to "Set RPM 500" inside the "Set RPM 500". That comparison will always be True whenever it is made because the only way to get into that outer case structure is for it to be that string. You can eliminate the comparison and the inner case structure and have exactly the same result.
02-15-2018 03:16 PM
Yeah that was from just testing a different number of options, jumping over to the simple state machine template to see if I can implement what you were saying there. Ill post what I figure out. Thank you for the help so far.
02-22-2018 01:27 PM
Progress in small steps. I managed to use the simple state machine template to build most of the functions I need for the test stand. What I have so far is an excel file that is created when the user starts the program and a finite sample is saved to the spreadsheet periodically. When the user starts the program the motor turns on and runs at 3500 RPM. My next step that I need help with is creating an automatic shutdown sequence. I'm sure there is a simple way to implement but it is escaping me. If i have a comparison on the data stream with some constant to be determined if a data value exceed said constant a Boolean true is sent and shuts down the motor. I am not sure how to call to the state machines wait for event that has my Boolean button press for the motor.
02-23-2018 02:58 PM
Having a problem with logging. The timer works but seems to not register unless I press a button on the front panel or do an action. Any help would be greatly appreciated.
02-23-2018 04:33 PM
It may be helpful to see screenshots of the other states (or attach a copy of the VI) to better understand the entirety of the program. I've implemented shutdown protocols in the past by having a shutdown check at the end of a running state. Depending on the result of the check, you can use a select function (or case structure) to choose different states to feed into the shift register.
02-26-2018 09:01 AM
Managed to fix the logging error. New problem has arisen that is stumping me. Ill post VI snippets of each state of my program. The error I'm seeing happens from my DAQ loop, when my logging loop completes after a specified time excel will maximize and create a sheet showing the logged data, if I leave excel open ill see a new page at every specified time interval. If I minimize excel and look at the front page of the labview program it will keep running and create new worksheets in excel but no data will be logged it will only have the title for each new sheet. Not sure why I need excel maximized for the program to run correctly.
02-27-2018 01:58 PM
Hi Nemord,
You may want to take a look at this forum post about the excel problem. It seems the problem is found in a subvi of the Excel Easy Text vi. The following quote from the post may help:
"When you use the "New Report.vi", you have to wire in one of four choices for the state of the window. "Maximized", "Minimized", "Normal" and "No Change". If you use the "Excel Easy Text.vi" to insert data into an Excel 2013 Spreadsheet, it will generate an error if you opened the Excel file in "Minimized" mode. The other three states work fine."