ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple Relay Control with various profiles

Hi All,

 

Need some suggestions on how I should go about building my VI.

 

So this is what I'm trying to do. 

 

I have 5 relays which I'm controlling with LabVIEW (just using a simple Digital output to turn them ON/OFF)

so DO0-DO4 to control 5 different relays.

 

The problem is, each relay has different profiles/cycles than need to be run simulatenously

 

For example:

Relay 1 turns ON for 1 min and OFF for 1 min for a total time of 180 mins

Relay 2 turns ON for 30 mins OFF for  30 mins for a total time of 180 mins

Relay 3 turns ON for 60 mins OFF for 30 mins for a total time of 180 mins

etc etc

 

The one consistent thing about the program I'm working on is that its a 180 min run.

 

During the 180 min , each relay will be turning on/off at different times which is where I'm having trouble.

How can I run this type of profile? While loop for each relay? but I couldn't get them to work simultenously. 

If anyone has a suggestion to control multiple relays with varying ON/OFF time in sequence, I'd love to hear it.

Thank you!

 

 

 

0 Kudos
Message 1 of 4
(3,524 Views)

I have done something similar using the dynamic calls to a reentrant VI.  So the idea is to open a reference and run (not waiting for completion) the VI in a FOR loop.  Then each call will be running off on its own.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 4
(3,500 Views)

Hello, I need to implement the same concept.  I basically need to control two relays at the same time but one will turn off sooner than the other.  Is there an example of how to program this any where?

0 Kudos
Message 3 of 4
(2,688 Views)

Give a good look for Queued Message Handlers and for State Machine.  I am picturing a main loop that is a state machine and then it gives commands/messages to 2 other loops that are QMHs to handle the actual relay controls.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 4
(2,676 Views)