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.

Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Fuel Consumption Meter (Gravimetric Method)

Solved!
Go to solution

Hi,

 

it's been a long time. The vi that you shared is working perfectly fine. Thank you for that.

 

Currently, I am trying to add another feature to my program that is to control two solenoid valves (NO & NC, both 24Vdc) programmatically. I want to incorporate it to the current algorithm. So on the first loop after five (5) seconds, instead of just a Boolean indicator it will also be the signal to close the NO valve and open the NC valve. Then on the second loop once ten (10) seconds is over it will do the opposite of the first loop.

 

Will provide more information next time but for now I am very grateful of your help from the start.

 

Again, Thank you very much.

0 Kudos
Message 11 of 16
(483 Views)

So you need a subvi between the loops that send a true and a false to a digital port

And after the second loop you can use the same subvi to send a false and a true...

 

In that subvi you can send a signal of the right polarity to the hardware.

 

Be sure to use diodes to prevent the high voltage peak when stopping a current in a solenoid valve.

That diode blocks current during on and should be big enough to prevent the peak to destroy the diode.

greetings from the Netherlands
Message 12 of 16
(471 Views)

And don't forget that by wiring the input to this subvi from inside the previous while you can be sure that the vi is executed as soon as the while loop finishes.

This is called sequence by wiring. No need to have sequence frames.

greetings from the Netherlands
0 Kudos
Message 13 of 16
(469 Views)

Hi,

 

yes I am using a diode. I already have a working circuit just need to incorporate the algorithm for that though. Will follow your advice regarding the subvi. Your inputs are really helpful.

 

Thank you very much.

0 Kudos
Message 14 of 16
(463 Views)

Hi Albert.Geven,

 

first of all thank you for your help as always. I have another question, I am trying to write the data to an excel file and I made a subvi for that. You have an idea how the program works however data is not being appended to the Excel file. It just overwrites the previously recorded data every time I click the Play button.

 

Ideally, I want the datalogging to continue writing the data every time the Play button is clicked. It will only stop when the user stops the program.

 

How can I make the datalogging vi work like that?

 

Here's the screenshot of the block diagram for the main and sub vi's. I also attached the actual vi's.

 

Main viMain vi

 

Sub viSub vi

 

Thank you very much!

Download All
0 Kudos
Message 15 of 16
(431 Views)

Hi

little mistake, the header overwrites the file each time.

 

But I made more changes see attached vi.

And by the way, You have to call this vi in the loop. So no while and no stop button.

greetings from the Netherlands
Message 16 of 16
(421 Views)