LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Solenoid subVI

Solved!
Go to solution

Hi!

 

Im working with making a subVI to set a the outputs to a valve. I have been trying for a while now, but just dont seem to get it right.

 

This is the function that im looking for:

One output opens the valve, and output closes it. These two can not be active at the same time. 

To open the valve, i need the output to be set hi for at least 5 sec, and after that it goes low again. The valve vil now hold its posittion. 

The same ways goes with the closing. 

The output status changes with a hi pulse.

 

Can anyone help me with this? Anyone that got a smart solution?:)

0 Kudos
Message 1 of 16
(3,487 Views)

Hi Elling,

            Do this first, in your subVI.File>>VI properties>>In category>>Execution>>Enable re-entrant execution.

            Then try to do properly what you want.

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Thanks as kudos only:)
0 Kudos
Message 2 of 16
(3,470 Views)

Hi danil,

 

could you please explain how reentrancy could solve any of the problems involved in the OPs question?

Infact I think it's not a good idea to set this subVI reentrant.

 

 


This is the function that im looking for:

One output opens the valve, and output closes it. These two can not be active at the same time. 

To open the valve, i need the output to be set hi for at least 5 sec, and after that it goes low again. The valve vil now hold its posittion. 

The same ways goes with the closing. 

The output status changes with a hi pulse.


I would use a statemachine approach for that purpose. The subVI will remember the current status of the valve and can handle any timing inssues on it's own. Define some states (like: init, switch, wait) to handle the different tasks. Then it will become easy to implement the logic...

Best regards,
GerdW


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

What hardware are you using?  Can you post the section of code in question?  This would be helpful.

-----------------------------------------------------------------------------------------
Reese, (former CLAD, future CLD)

Some people call me the Space Cowboy!
Some call me the gangster of love.
Some people call me MoReese!
...I'm right here baby, right here, right here, right here at home
0 Kudos
Message 4 of 16
(3,453 Views)

Hi and thanks for the replys:)

 

Im using a Ni PXI-1036 Chassis, with a PXI-6238 card.

Im also using the PXI-8360 link card to connect to the laptop.

 

 

0 Kudos
Message 5 of 16
(3,448 Views)

And your code?

-----------------------------------------------------------------------------------------
Reese, (former CLAD, future CLD)

Some people call me the Space Cowboy!
Some call me the gangster of love.
Some people call me MoReese!
...I'm right here baby, right here, right here, right here at home
0 Kudos
Message 6 of 16
(3,444 Views)

Im not quite shure what code you want 

 

Im kind of new in this program.

 

I have tryed setting it up as a event(Attached file) but i than figured out that i couldn't jump out of the event if the valve needed to be closed soner than after the event.

I have been sitting a few hours today(without getting far), trying with a state machine. But im just no getting it right.

0 Kudos
Message 7 of 16
(3,441 Views)

An event structure may not be the right archetecture for you.  I think a state-machine will work best.  Can you down-convert your state-machine?  Go to File>>Save for Previous Version, and save it for 8.2.

-----------------------------------------------------------------------------------------
Reese, (former CLAD, future CLD)

Some people call me the Space Cowboy!
Some call me the gangster of love.
Some people call me MoReese!
...I'm right here baby, right here, right here, right here at home
0 Kudos
Message 8 of 16
(3,438 Views)
0 Kudos
Message 9 of 16
(3,432 Views)

I think i might figured it out now!

 

Check out the attached file:)

 

Is there any improvements that should be done?

0 Kudos
Message 10 of 16
(3,425 Views)