08-19-2014 01:15 AM
Hello everyone!!
I meet a problem in my project, I knwo it's not difficult but we are all beginners for labview.
We need to control 4 batteries, each battery needs a life cycle calculator. I try to connect 4 life cycle calculator(case structure) in my while loop, but there are 4 stops for 4 case structure and 1 stop button for the whole while loop....I don't know how to handle with these four extra case structure stop buttons....
As the battery charging and discharging, the life cycle part keep working so actually it's no need for stop button for each case structure , can we just get rid off the stop button for each case structure?? Is there any problem with the life cycle calculator if we do not use the stop button???
Really Thank you for help !!!!
here I attach our vi, you can configure it directly !!
08-19-2014 01:50 AM
Hi
You could use a local variable if you want to use only one stop button for multiple needs. and Bro ttry to use SubVIs. Yuor program would be more easy to understand. 🙂
08-19-2014 01:59 AM
I've done the changes here
08-19-2014 02:07 AM
Hey
I just understood. You want the output of those OR gates to go into that stop switch. You can use a compound arithmetic.
08-19-2014 02:55 AM
Thank you Thank you!!!
I just remove the stop button, It's also can work!!
08-19-2014 10:45 AM - edited 08-19-2014 10:58 AM
@Mayur_VIenthusiast wrote:
Hey
I just understood. You want the output of those OR gates to go into that stop switch. You can use a compound arithmetic.
you really want to AND the 4 cases once they ALL complete and OR the stop control to exit any time....batteries have unique characteristics: charge and discharge rates, internal resistances, etcetera....so depending on the acquisition from each battery will determine whether to charge or discharge independently. this is not a simple thing to implement. batteries can be overcharged causing heat issues and the breakdown of the materials, shortening life. complex charging/discharging algorithms need to apply depending on the types of battery being used. this is a simple dirty simulation that does not consider the rate of change in a charge/discharge acquisition. this example is like powering a bicycle with a rubber band as opposed to using human muscles or better yet a gas engine...i wonder if you truly considered all the specifications and requirements,? it can be done...but at what cost? could'nt you buy an "off the shelf" $10 charger/discharger...
edit: tried to upload the VI and zipping it.... no bueno!
08-19-2014 11:14 AM
The main problem is code architecture. Once you fix this, your current problem will vanish automatically. 😄
You seem to be spending way too much time rewriting basically the same code over and over. You need to modularize the code and make it scalable. You have four instances of basically the same code. Are you planning to later scale this up for a few hiundred batteries? Would you then simply make it a diagram that is millions of pixels hight? Once you combine all the functionality for one battery into scalable code, you can scale it up for an arbitrary number of instances.
Same for the front panel. Make the controls for one battery into a cluster and then make a 2D array of such cluster (2x2 in your case). Suddenly, the entire code will be the size of a postage stamp and easy to maintain. If you currently want to change an error in the algorithm, you need to make identical changes in four different places. If you forget one place, bugs will be very had to find.
08-19-2014 08:12 PM
Hi~Apok!!
I just remove the stop button for each case structure. It seems can still working well~
Is that ok?
08-19-2014 08:17 PM - edited 08-19-2014 08:17 PM
Sorry I'm a very begineer for LabView I don't know how to combine those functionality for one battery...
Would you help me?? I attach my VI, could you show me how???
Thank you!!!!
08-19-2014 11:02 PM
Hey
Dont worry. Everyone has been a beginner sometime or the other. You just have to have to interest to learn new things. I'm posting a link here. you can learn how to make a subVI from there. Its not complicated, just like creating functions in C programming. You have very good instruction manuals in the NI site. all see that.