LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Programming a timing function

Solved!
Go to solution

Hey people of the world,

 

I have a program that tests and logs data for a dc motor, I am currently in the process of automating the program so that data is recorded and exported out to an excel file. My only issue is that I'm trying to set the automation up to run and log data for 5 seconds and then shutdown for another arbitrary time before it starts up to run and record again for 5 seconds. Any suggestions? Thank you.

 

Sincerely,

Z^2

0 Kudos
Message 1 of 8
(3,003 Views)

Use a timing function.  If you want more specific help you have to provide more info or post you current code.

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
0 Kudos
Message 2 of 8
(2,998 Views)

Are you running this data acquisition system on a OS such as Windows or Mac?  Or are you using a real time enviroment?

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If someone helped you out, please select their post as the solution and/or give them Kudos!
0 Kudos
Message 3 of 8
(2,991 Views)

This is going to be in a real time environment.

0 Kudos
Message 4 of 8
(2,989 Views)

By real-time, we mean a true real-time OS and hardware.  If you're using Windows or Mac PC, it is not real-time.  

 

Again, we can't really suggest anything until you tell us what you're trying to do.  I would create a state machine but there are many other simple ways to run some code for a set amount of time.  Post what you have and explain what added functionality you require...

 

EDIT:  Also don't forget that in the latest versions of LabVIEW (I have 2013) there are start-up templates including one for Continuous Measurement and Logging.  Have you looked at these?

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
0 Kudos
Message 5 of 8
(2,980 Views)

This is the program. Essentially what I want to do is after the proper voltage/current is supplied I want to log data for 5 seconds. After those 5 seconds the voltage/current is cut off from the motor so it stops running and the data that was logged for the 5 seconds is held. The way its set up now, I manually click log data, count down 5 seconds, click hold, and then disable the power supplies. And yes I have looked at the continuous measurements/message handler template and such. I was originally going to try and recreate the attached program from that template but figured I'd ask before I got too far in. Thank you.

 

0 Kudos
Message 6 of 8
(2,973 Views)

This is not real-time this is Windows.  That isn't a deal breaker just know your limitations.  It sounds like you don't care how accurate your 5 seconds are so Windows is probably fine.  By that I mean what if your 5 seconds is actually 5.1 is that okay?

 

To do what you want one method is to have another loop running that starts when you click a button like "Run Profile".  In this loop it will just change the values of the controls you would normally do at predefined intervals.  Use local variables and property nodes.  Other design patterns are easier to edit, but since you've done so much work already I wouldn't recommend changing.

0 Kudos
Message 7 of 8
(2,940 Views)
Solution
Accepted by topic author Zzimmha42

The first thing you should do is break up this one VI into 4 separate VIs with one loop in each. This change will allow you to test each component separately. Because you started with the producer/consumer structure, you already have most of the infrastructure in place to enable this change. The main thing is to change the queues to be named queues. That way you don't need to pass references around, all you have to know is the queue's name.

 

You will also need to develop a mechanism for launching the separate VI's -- VI server can do that easily -- as well as some way to shut them all down -- user defined events are very good for that.

 

This might seem like a lot of work, but it will make completing (and maintaining!) the project much easier.

 

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 8 of 8
(2,925 Views)