01-30-2024 07:53 AM
Good evening Everyone,
Actually I am counting cycle of battery. so I made a logic through event structure that when battery charges from 0 to 100% SOC, it will not count it and when battery is discharging from 100 to 0%, then at 40% SOC it counts as 1 cycle.
So, in image 1- when i was making SOC Control inside the Event structure, then it works fine. but I am calculating SOC in another while loop. so i am taking local variable from there, and in this case event structure is not working (Image-2).
please help with this event structure or any another logic through i can count the cycle as per my SOC Logic.
thank you in advance.
Solved! Go to Solution.
01-30-2024 08:40 AM
Why do you want to do that? the better can be using shift register hold the previous value and compare if the current Value is less than previous and the Value is 40 increment the counter, By this way it will work without Multiple Loops and Event Structure,
I Recreated your application to match you screenshot and it works and Make sure you setting the Local variable of Second Loop Stop Value Ssss is set to false before executing loop.
01-30-2024 09:51 AM
Thank you sir,
I did that way also by adding shift register. But through shift register, I have to use delay. And forcefully I need 60 sec of delay. And due to this there is a problem when I stop the VI or while loop. It doesn't stops immediately.
01-30-2024 10:14 AM - edited 01-30-2024 10:16 AM
Have you tried something similar to this?
Why you need delay?
01-30-2024 10:58 AM - edited 01-30-2024 11:01 AM
What happens when one cycle is complete (i.e. once it reaches 40% going down)? Does it go back to zero or go up again to 100%?
01-30-2024 11:04 AM
The logic to increment a cycle counter is by far the simplest part of the program regardless of using an event driven state machine or a simple state machine.
Now if you want to talk battery cycling methods I have been qualifying large battery systems for years.
01-30-2024 11:27 AM - edited 01-30-2024 11:53 AM
Here's a very simple simulation that might give you some ideas....
Note that the simulation is ideal. If the reading is noisy, extra protection is needed (e.g. if the value going down reads 40.1, 40.0. 39.9, 40.1, 39.7 etc.) it should only count once, of course.