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.
THIS LOOKS LIKE A JOB FOR.... a state machine.
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.