LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Running motors for a time with SSR's

I am trying to create a loop to run motors in different directions for a specific time, over an interval of time.

 

For one motor I will have 3 SSR's -

1) power

2) CW

3) CCW

 

I want to be able to press the power, then it runs the entire sub vi for 7200 Seconds. Every 900 seconds I would like to turn the motor off for 15 seconds to switch directions, then run for another 900 seconds and so on, until it reaches the 7200 seconds- which the power is turned off.

 

The issue I am having is, I cannot figure out if I need Controls or an Enum inside of my sub vi to perform this action.

 

I have looked at multiple examples which is where I get confused, because I cannot figure out the switching back and forth operation.

 

Originally I went with the attached Ring Case Structure, but my goal is to have the program switch back and forth on it's own because another motor will have to run for 48 hours and switch every 2 hours.

 

Any help would be much appreciated

0 Kudos
Message 1 of 3
(681 Views)

Hi Gee,

 


@NoobGee wrote:

Originally I went with the attached Ring Case Structure, but my goal is to have the program switch back and forth on it's own because another motor will have to run for 48 hours and switch every 2 hours.


Well, right now you are far away from your goal as your VI finishes within seconds while you want to run it for 48h…

 

What about using a simple statemachine approach?

 


@NoobGee wrote:

I want to be able to press the power, then it runs the entire sub vi for 7200 Seconds. Every 900 seconds I would like to turn the motor off for 15 seconds to switch directions, then run for another 900 seconds and so on, until it reaches the 7200 seconds- which the power is turned off.

 

The issue I am having is, I cannot figure out if I need Controls or an Enum inside of my sub vi to perform this action.


Usually you use an enum with statemachines, holding one item per state.

There is no "subVI" in your VI. There is no timing at all in your VI. You really need to describe your VI a little better…

 

I recommend these states:

  • wait(1s)
  • TurnOn motor
  • TurnOff motor
  • SwitchDirection

All you need to implement is to call the next state as needed.

Keep the "last switched timestamp" in a shift register to easily check for your "900s" and "15s" intervals…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 3
(675 Views)

Thank you so much for recommending a state machine. 

 

I have been trying to build one, but I can't figure out why my delay timer is backwards. 

 

Here's what I have so far.

0 Kudos
Message 3 of 3
(612 Views)