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: 

Count up by 1 eyery time for a cycle

Solved!
Go to solution

Hello everyone we are now using labview for our project, which is to manage charging and discharging process for a battery. And we need to record the life cycle for the battery. That is when recharging it life cycle should be increased by 1.

 

We try to use case structure with for loop but it increase too fast and keep increasing. I only want it to increase once when limitation is meeted. Also I try to use shift register but it can't stop...also keep increasing unless I  stop the whole program.

 

 

Can anyone help us with this problem?? If recieve a signal, boolean or something else..., life cycle(variable) will increase by 1.

Millions of thakls!!!

 

0 Kudos
Message 1 of 14
(4,346 Views)

You should be able to use the loop counter from your outer most For or While Loop to count up a number for each cycle, assuming that you have each charge and discharge as a single process. 

 

Otherwise you should be able to implement the counter pretty simply dependent on some condition using the most basic set up of:Increment.bmp

0 Kudos
Message 2 of 14
(4,332 Views)
Solution
Accepted by topic author AmeHyesung

@AmeHyesung wrote:

Hello everyone we are now using labview for our project, which is to manage charging and discharging process for a battery. And we need to record the life cycle for the battery. That is when recharging it life cycle should be increased by 1.

 

We try to use case structure with for loop but it increase too fast and keep increasing. I only want it to increase once when limitation is meeted. Also I try to use shift register but it can't stop...also keep increasing unless I  stop the whole program.

 

 

Can anyone help us with this problem?? If recieve a signal, boolean or something else..., life cycle(variable) will increase by 1.

Millions of thakls!!!

 


here's a simulation using a state machine, see if you understand the process here. user sets charge and discharge capacity and the number of cycles to be done.

simulate charger.png

0 Kudos
Message 3 of 14
(4,316 Views)

This all seems to be working fine, Is there anything else that you need help with?

0 Kudos
Message 4 of 14
(4,305 Views)

Thanks !!! I'll try it!!!

0 Kudos
Message 5 of 14
(4,299 Views)

really really thank you!!!!!!!

0 Kudos
Message 6 of 14
(4,293 Views)

Hello apok~I try to connet the vi that you did with a DAQ to get the state of charge from a battery. But when connect to daq the program cannot work well....When press start putton there's nothing happen.  mAh also doesn't indicate SOC and it won't change to either 'charge' or 'discharge'... Is there something wrong with what I added??

0 Kudos
Message 7 of 14
(4,266 Views)

Hi Ame,

 

are you working with hahaxuan on the same project?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 14
(4,257 Views)

@AmeHyesung wrote:

Hello apok~I try to connet the vi that you did with a DAQ to get the state of charge from a battery. But when connect to daq the program cannot work well....When press start putton there's nothing happen.  mAh also doesn't indicate SOC and it won't change to either 'charge' or 'discharge'... Is there something wrong with what I added??


yes...dataflow. the daq must be read by the loop, whether it's internal(daq in same loop) or a second loop communicating through queues or locals and not by the way you connected the 2 loops.

 

hmmm...i've read the SOC somewhere? are you working with @JoeR_87 

0 Kudos
Message 9 of 14
(4,238 Views)

Sorry...what do you mean by locals??? local variables or a function??

 I'm not working with  him~ 🙂

 

0 Kudos
Message 10 of 14
(4,200 Views)