From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Controls for Single Acting Pump

I am currently trying to create a control program using LabVIEW for a single acting pump.  The current vi attached generates a 5VDC signal to open and close a relay.  I currently have a 12VDC power supply wired to the normally open terminal of the relay.  The 12VDC is used to power the pump.  I now want to add code that analyzes load cells and uses a user input to determine when to start our current routine.  Currently it operates on a push of the relay button.  I want it to start when the pressure transducer readout is less than the set value (constant) I determined (this is used to prevent the pump from overloading) AND when the load cell values are less than the user input.

 

For example:

1) If the user wants a 200lbs load applied with the pump to a specimen, he or she enters 200lbs in the load cell input field.

2) If the current load analyzed by our NI9237 module is less than the user input in step 1 then send a signal to start the 5V routine attached to this post.

3)  When the desired input is achieved we want to stop the 5VDC signal attached.

 

Any help would be appreciated!

0 Kudos
Message 1 of 13
(3,150 Views)

Hi elambdin,

 

so you write all the things you want to program.

But: what is your problem?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 13
(3,148 Views)

Sorry for the delayed response.  I am currently waiting on the calibration data for the pressure transducer and load cells.  These were not shipped with the sensor.  That being said I cannot (at least to my knowledge) create the daq assistance for these devices with proper calibration.

 

The real issue I am looking for help on is how we would use the daq assistance for the load cell and pressure transducer to automatically, based on a value, start our current 5V routine.

 

My idea is as follows:

1) I'd have a readout value produced by the transducer and load cell using external excitation for the transducer and internal excitation for the load cell.  (These will communicate with LabVIEW via NI 9237 module.)

2) If the readouts are less than the constant that user inputs then step 3. (I'd use the less than bit in LabVIEW.)

3) Automatically perform the 5V routine based on the above steps.

 

For now I believe I can create the readouts and user input.  However, I am not sure how to make the subroutine above start my 5V routine. 

 

***I am actively trying to obtain the calibration data so I can create as much of the block diagram as possible then restate this question with a better visual aide.  

 

0 Kudos
Message 3 of 13
(3,088 Views)

I've created an image to better show my idea.  I just need some help:

  1. making the while loop stop when the AND is no longer true (I understand the logic gates).
  2. starting this routine with a start button on the VI. 
    1. I do not want the user to be able to use the start button until the input has been selected for the load cell.
  3. making this subroutine automatically start my 5V subroutine if the AND is true.

I see this in ladder logic and m struggling to put it into "LabVIEW logic".

 

0 Kudos
Message 4 of 13
(3,075 Views)

Hi elambdin,

 

so you painted this image - it looks just like the LabVIEW code you want to create!

 

Did you already start to code? Where are you stuck?

You don't need to wait for calibration data to start with your development - you can implement that later on…

Best regards,
GerdW


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

That is the code I want to create.  I am out of town with no access to LabVIEW, but must make some progress.  I am stuck at the whole automating the task.  The jpg in my above post is an addition I want to add to my original VI in my first post.  When I say I am stuck with the automating process...I want the part in the jpg to start the 5V task in my VI if the present readout value is less than the user input. I do not know how to make the process flow from one loop to starting the next.  Does this make sense?

0 Kudos
Message 6 of 13
(3,053 Views)

I was able to create the code I uploaded as a jpg.  I do not understand why I had to convert from dynamic data for the pressure transducer daq assistant.  What does this mean? Will that still produce a Boolean value for the AND bit?

 

The next question I have is when the x and y for the AND are True, then I want to start the 5V routine contained in the other while loop.  How do I do this?

0 Kudos
Message 7 of 13
(3,038 Views)

Hi elambdin,

 

 I do not understand why I had to convert from dynamic data for the pressure transducer daq assistant.

Because all those ExpressVIs use these dreaded DDT wires. (Usually you don't need ExpressVIs…)

Why do you use two ExpressVIs for reading two inputs? Why not use just one?

Why do you use ExpressVIs at all? You already use the plain (and very easy to use) DAQmx functions!

 

What does this mean? Will that still produce a Boolean value for the AND bit?

Yes, it will. But you never know how and why because you don't know what's hidden inside the wire…

In your VI you have set the DAQAssistent to read 25k samples at a rate of 25kS/s: all those samples are hidden in the DDT wires. Now you want to calculate a result of just ONE boolean value: which conditions should be applied?

Do you want a result for ALL samples? Or just one sample hitting your limit? Is there a difference if the first or the last sample hits the limit?

 

The next question I have is when the x and y for the AND are True, then I want to start the 5V routine contained in the other while loop.  How do I do this?

Easiest would be to put all your code into just one loop: the result of the AND operation will directly wired to the select function.

If you insist on using two loops you can use a simple local variable of "Relay" in your AI loop.

You might also read about using a producer-consumer scheme with a queue (or notifier).

Best regards,
GerdW


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

Why do you use two ExpressVIs for reading two inputs? Why not use just one?

This may be because I am extremely new to LabVIEW.  More specifically,  I used two ExpressVIs because I am gathering inputs from two devices (Load Cell and Pressure Transduce).  Could I have combined both to the same VI?

Why do you use ExpressVIs at all? You already use the plain (and very easy to use) DAQmx functions!

In college we created routines for thermistors, pressure tranducers, and load cells...We were taught to use the ExpressVI for simple calibration.  I only used the DAQmx for the 5V routine because 1) it required no calibration and 2) I found a fan control VI on the forum page that closely modeled what I wanted for my controls.

 

In your VI you have set the DAQAssistent to read 25k samples at a rate of 25kS/s: all those samples are hidden in the DDT wires. Now you want to calculate a result of just ONE boolean value: which conditions should be applied?

Do you want a result for ALL samples? Or just one sample hitting your limit? Is there a difference if the first or the last sample hits the limit?

 I really just care about one sample hitting my limit.  If the limit occurs for the pressure transducer or the load cell I wanted the and bit to not be true.  To better answer your question, I just want one result to be applied (te input reaching the predetermined value).

 

Easiest would be to put all your code into just one loop: the result of the AND operation will directly wired to the select function.

If you insist on using two loops you can use a simple local variable of "Relay" in your AI loop.

You might also read about using a producer-consumer scheme with a queue (or notifier).

I would prefer to use two loops unless you can give me a strong argument as to why this is not smart.  I am semi-familiar with the producer-consumer scheme within RSLogix PLC programming.  Correct me if I am wrong, but it works similarly in LabVIEW...(When X produces a desired output, then the consumer uses this to begin its process)

 

 

0 Kudos
Message 9 of 13
(3,022 Views)

Hi elambdin,

 

Could I have combined both to the same VI?

I don't recall the DAQAssistent settings and don't want to download your VI again: when both signals are measured by the same device (like dev1/ai0 and dev1/ai1) then you can easily combine both measurement into one DAQAssistent.

But again: using DAQmx is plain simple and also allows measuring several channels within one task very easily.

See this!

 

We were taught to use the ExpressVI for simple calibration.

You were taught ExpressVIs because of their easy-to-use configuration dialog. Nothing more!

LabVIEW comes with a lot of example VIs, just browse the example finder!

 

I really just care about one sample hitting my limit.  

Ok.

But which result do you get from your "From DDT" conversion? Do you get the first sample? Do you get the last sample? Do you get an AND of all samples or an OR operation? As all this is very ambiguous with DDT wires you really should avoid them!

 

I would prefer to use two loops unless you can give me a strong argument as to why this is not smart.

You have such a simple VI it is much more effort to create this two-loop solution. A simple all-in-one solution for your simple problem!

 

When X produces a desired output, then the consumer uses this to begin its process

X produces some output and stores the output in a queue.

Y can consume the queue elements at whatever rate it achieves…

LabVIEW also comes with example projects, including an example producer-consumer project. Just examine them!

Best regards,
GerdW


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