LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Case Selector and Conditional Programming

Key program functionality:
1. Start program (Disarm System)

2. Get data in spreadsheet and title it

3. Prompt user for a pressure value

4. Read pressure sensors

5. Depending on those pressure sensor values in comparison to pressure value given open or close solenoids.

 

1x cDAQ-9174 (Chassis for Relay Modules)

2x 9482 (Relay Modules for Solenoid Valve Control)

1x USB-8452 (USB to SPI Interface for Pressure Sensors)

Issue: Solenoids not firing, most likely due to case selector not initializing and updating state?

0 Kudos
Message 1 of 22
(273 Views)

You should repost your code in an older version of LabVIEW. Most people do not use LabVIEW2025. You can save for a previous version in the file menu. Save it back to 2019 or so to get the most help with your project.

Tim
GHSP
0 Kudos
Message 2 of 22
(252 Views)

Nobody here will have the patience to look at a  disorganized diagram that is the size of many (many!) screens. Can you explain where the case structure is that you mentioned?

 

altenbach_0-1750865575718.png

 

Please re-architect as a simple state machine that fits on a typical screen.

 

Constantly creating and destroying virtual channels in both cases of a case structure with code that only differ in a single boolean is just plain silly!

 

0 Kudos
Message 3 of 22
(239 Views)

@altenbach wrote:

Constantly creating and destroying virtual channels in both cases of a case structure with code that only differ in a single boolean is just plain silly!

 


Just to clarify what I said...

 

(Sorry, I don't have drivers installed, so these VIs are missing for me)

 

altenbach_0-1750867100453.png

 

Message 4 of 22
(212 Views)

Overall, there is so much code smell that I really think you should do a few basic tutorial. You are not ready to dove into the deep end. Most of what you are doing could be done better and with 20% of the code.

 

For example, also compare your code with an equivalent alternative.

 

altenbach_0-1750867983218.png

 

Message 5 of 22
(191 Views)

So let's analyze you V3 and V4 solenoid controls.

 

You have two inputs ("PG3 reading" and "Target pressure", where the target pressure is read only once, and never again).

 

You have two boolean outputs, V3 and V4.

 

Following the extremely long crisscrossing branched wires and cleaning things up a bit, I made a small test VI where you can see how the booleans currently depend on the two inputs. Once validated, the comparison code should be made into a subVI with two DBL inputs and two boolean outputs. It is very well possible that the logic needs to change, it simply does not look right...

 

Can you explain in words how the solenoids should behave (e.g. if PG3 within ~2% of the target, then ABC,  etc. How often can a reading be negative or zero, etc.)

 

altenbach_0-1750870740973.png

 

Message 6 of 22
(173 Views)

Another example of your Rube Goldberg code and a simple equivalent.

 

altenbach_0-1750873545125.png

 

Message 7 of 22
(159 Views)

andrew_h01_0-1750875302280.jpeg

 

0 Kudos
Message 8 of 22
(140 Views)
0 Kudos
Message 9 of 22
(139 Views)

Please add a few words when posting pictures and maybe quote relevant sections you are replying to.

 

 

As I said, you need to clean up your code. It is way too convoluted and not debug-able. Have you checked the logic in a small test program similar to what I showed earlier?

0 Kudos
Message 10 of 22
(128 Views)