LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using Event Structure Counting Cycle count

Solved!
Go to solution

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. 

Download All
0 Kudos
Message 1 of 7
(1,584 Views)
Solution
Accepted by AlienVi6789

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.

----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
0 Kudos
Message 2 of 7
(1,557 Views)

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.

0 Kudos
Message 3 of 7
(1,540 Views)
Solution
Accepted by AlienVi6789

Have you tried something similar to this?

Why you need delay?

CountIf.png

----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
0 Kudos
Message 4 of 7
(1,530 Views)
Solution
Accepted by AlienVi6789
  • Event structures are for user interaction, not for value changes elsewhere. (Yes, ve have signaling proerties, but that's probably not  the solution here)
  • You have way too many local variables and value property nodes for no reason. If you think you need hidden front panel elements as scaffold for locals, you are not doing it right.
  • It is supper annoying to have the front panel and diagram maximized to the screen.
  • Counting is done with integers. there should be very little orange.
  • EQual comparisons with DBL are extremely dangerous. It is very likely that the reading is never 40.0000000000000000000.
  • Not sure why you think a greedy loop spinning millions of times is reasonable for the lower loop in your attempt.
  • All you need is a single loop with shift registers that reads the battery value at a reasonable rate. A boolean indicating up or down and one to keep the previous reading and one for the count..

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%?

0 Kudos
Message 5 of 7
(1,509 Views)
Solution
Accepted by AlienVi6789

 

  1. Discharge battery to EOD
  2. Recharge battery to capacity
  3. Increment a cycle counter
  4. goto 1 or exit

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.  

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 6 of 7
(1,504 Views)
Solution
Accepted by AlienVi6789

Here's a very simple simulation that might give you some ideas....

 

altenbach_0-1706637204723.png

 

 

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.

 

0 Kudos
Message 7 of 7
(1,494 Views)