LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

State machine with multiple software control timing requirements

Hello all

 

I am setting up a state machine that once configured and run will cycle a series of systems.  Each system contains up to 4 motors. 

 

I am using an NI 9476 Digital Output card to drive each motor.  Because of duty cycle limitations, I can usually only run one motor per system at a time, and each motor runs at a different rate.  Like this:

 

Init

M1 Out

M2 Out

M1 In

M2 In

etc, etc

Null (additional cool down time...)

 

After each motor runs Out, i reset the out bit to 0.  Same with the In, I reset each drive bit to 0.  This is due to the external relay control in the power supplies.

 

Now, if I did not need to be able to run an EM stop I could simply put a timer in each motor case to enable a delay to account for the on time of hte motor until it hits an external limit switch and shuts off. So the timer is out.  I have tried the standard methodology as refered to in the Labview 1 Manual, Section 1 but it results in a continous loop so the motors are chattering on and off very fast, or they never run.

 

I have no access to the limit switch to permit triggering control. 

 

So, can i make use of the existing state machine (there are almost no user interactions during operation, except the stop button) or should i implement a Producer / Consumer Event machine.  Would that even work here?

 

Thanks

Mackley

0 Kudos
Message 1 of 5
(2,434 Views)

HI,

 

Are you saying that you want to run through each state for a total time, but you can't put the timer in the state as you need to be able to EM off the whole thing?

 

If so, you can put your timer outside the case structure, but inside the loop, and reset the timer whenever you do all the other resetting ( due to limit switch or time ends, etc..)

 

Then you can loop back into your state over and over, and check the timer each loop.

 

I'm not clear on the interaction of the timer, limit switch, and the in/out states.  So thus my general take on the issue.

 

Of course a producer consumer would work, but it might be overkill if you can just use a timer in the loop but outside the state.

-------
Mark Ramsdale
-------
0 Kudos
Message 2 of 5
(2,432 Views)

Hi Mark

 

Almost, what i mean is that each state requires a pause before moving onto the next state.  Each state has a different length of pause.  Such that the first motor requires on the order of 30 seconds from when it starts till it reaches the end of its travel.  Then the second motor requires about 20 seconds, and so on.  They can only run sequentially, I cannot run any in parallel.

0 Kudos
Message 3 of 5
(2,414 Views)

So if that is the case you create an Idle state and keep a timer inside and feed the pause timing value depending on the time that the motor takes. So once the 30 sec wait time has to be executed (Paused) go into the idle case and wait until that time once that is done go to the next state.

-----

The best solution is the one you find it by yourself
0 Kudos
Message 4 of 5
(2,411 Views)

Hi,

 

If I understand correctly, you want to cycle through multiple states, in order, and each state needs to "dwell" ( rather than pause or wait ) for different times.

 

This still works with a timer outside those states, either in the main loop or as it's own state.  Cycle through both the dwell state and the timer, then when the time is up, start on the next dwell state, in series with the timer again.

 

Of course the timer has to be re-set, and you have to decide how to feed the timer a different dwell time.  I would probably make the dwell time 'new value' be based on the next dwell state.

 

I don't know all the logic of the app, but this ia a general description of how a timer could be used in a state machine.

-------
Mark Ramsdale
-------
0 Kudos
Message 5 of 5
(2,403 Views)