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: 

Should I use Flat Sequence, User Event, or Something Else?

I'm doing a pretty simple battery discharge testing and I'd like to somehow automatically adjust my code based on user input (prior to running the code). 

 

Overview: I have a power supply, an electronic load, and two multimeters. One multimeter is measuring current and the other is measuing voltage (see schematic in attached VI).

 

The VI I've posted has some dummy variables in place of the multimeters (I didn't want actual readings to get in the way of my beta testing), labled voltage input and current input. The code configures and operates an electronic load and a power supply (currently constants are in place). I want to create certain "events" (that may not be the right word to use in the LabVIEW sense). Basically the events would look something like this:

 

"Charge" / Set power supply voltage and current to some value / Set electronic load to zero / After voltage condition is met, sustain charge for 8 hrs

"Rest" / Set power supply and electronic load current to zero / Wait 8 hrs

"Discharge" / Set power supply to zero current / Set electronic load current to some value / End when voltage condition is met

 

The idea is that the user would program the VI to do different tests. For example, they might run a test that looks like Charge, Rest, Discharge, Rest or Charge, Rest, Discharge, Rest, Discharge, Rest. The user would also set voltage and current conditions (for non-zero current events) as well as specify the amount of time to rest. 

All of this would then be automated and the test would occur on its own. (I'll also be putting in some fail safes to make sure something bad doesn't happen like over charging or discharging. 

 

However, I have no clue how to pull all of this off. I've been staring at user events and flat sequences (which I've always been told to stay away from). I'm not sure what the best way is to go about this. I'd also accept a half solution that isn't quite so automated as a potential first step.

0 Kudos
Message 1 of 3
(2,786 Views)

THIS LOOKS LIKE A JOB FOR.... a state machine.

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019 - Unfortunately now moving back to C#, .NET, Python due to forced change to subscription model by NI. 8^{
Message 2 of 3
(2,777 Views)

Having written your program myself (more than once) I would have to agree, a state machine is the way to go.

 

I will attach my top level vi, of course it is going to be unusable without all the sub-vi's and instruments. 

 

But you should get the general idea.

========================
=== Engineer Ambiguously ===
========================
Message 3 of 3
(2,760 Views)