Showing results for 
Search instead for 
Did you mean: 

Equation balance and output rate


I am trying to create a program that solves an equation consisting of 3 variables that balance out if any changes occur.

More specifically, I need to solve the equation of: x = a/b.

The user needs to be able to alter variables "a" and "b" in a way that the equation is still true. "x" is going to be set once at the beginning of the program, but it would be nice to also be able to change "x" as the program is running (by using "a" or "b" as a reference for solving the rest of the equation).


The reason I am doing this is because I am trying to relate two pressures together by some number "x".


I can't seem to think of a method to make this work even though it seems very simple. Smiley Sad


Also, I need to be able to limit the rate of change of the variables "a" and "b". For instance, if I set "a" to adjust at a rate of 10 units/min, each time "a" updates, "b" will also update at the same rate. The same would also need to be true if I adjusted "b" instead of "a". However, based on this design, I understand that at some point, "a" may reach the final value and "b" will need to continue at the same rate until it has reached its final value as well.


I thought of using the PID Output Rate Limiter VI for limiting the output rate, but it seems to require a "dt" input that I do not understand. It also doesn't ask for a final value. I am not using a PID controller in my program, so I am not too sure if this VI is even suitable.


The ultimate goal is to have variables "a" and "b" adjust from an initial value to a final value while maintaining a ratio "x" between each other at a user specified rate. It would preferable if the increase would be as smooth as possible. Once the final values are reached, the program holds it there.


My program so far has timing using the elapsed time VI and has a maximum rate of 1 second (anything faster and the other components of my program will not run fast enough).



When "Time has Elapsed" is true, the program will execute the equation balance. I don't know whether or not this would be compatible with limiting the output rate though.


Anyone have any suggestions on how I can achieve this program design?



0 Kudos
Message 1 of 7



Have you thought the use of state machines to accomplish what you need, obviously the logic to design it has to be create it! but it will help you to control the timing. Take a look at the following documentation: 

Tutorial: State Machines 

Application Design Patterns: State Machines

Luis G.

0 Kudos
Message 2 of 7

Hi lcgse88,


I am actually already using a state machine design for my program. The way my program works is that it acquires data in one state, logs the data in another state, and then finally applies feedback to a pressure system in the last state.


In the last state, I need to be able solve the x = a/b equation where "a" and "b" are pressures and "x" is a user inputted ratio. I'm not sure how to implement rate of change control such that the change will occur at the rate the user inputs.


I can post my VI if need be, but my feedback portion of the program is blank right now (and this is the section I need help with) since I need some help with the timing design.



0 Kudos
Message 3 of 7

I don't understand what you mean by "solve the x = a/b equation".


What do you know?  Do you know a?  Do you know b?  Do you know x?  What do you need to know (i.e. "What is the unknown?").  If you know a and b, with x being the unknown, wire a and b to a divide function and wire x to the output.  If a is the unknown, wire x and b to the multiply function.  If b is the unknown, wire a and x to the divide function.


I'm assuming it isn't that simple, but without seeing your code (attach a VI, do not attach a "picture") or having a better understanding of the problem, I remain puzzled.


Bob Schor

0 Kudos
Message 4 of 7

Hi Bob_Schor,


I apologize for not posting a VI in my original post.


To be more specific, this is how I want the "x = a/b" equation to work:

The user always enters in a value for 'x". The user then must enter a value for either "a" or "b", and the program must solve for the last missing variable.


The variables "a" and "b" are actually pressures, so I'm trying to relate two pressures together by a ratio "x" that the user enters.


You can also see from my design that the feedback rate can be adjusted by the user. In terms of how this relates to the above equation, the above equation determines the final values for the pressure. The program should take a user input for rate of change for pressure (e.g. 10 kPa/min) and then apply it until it reaches the final pressures where it will hold it there.


Any suggestions?





0 Kudos
Message 5 of 7

Anyone have suggestions?



0 Kudos
Message 6 of 7

You attached a gigantic VI with four large tabs (containing more tabs!) worth of controls and indicators, some are labeled A, B, or C. (I could not find x). Your problem description has only a,b, and x.

Please simplify your code to the essential parts. Nobody wants to weed through that mess trying to find what you were talking about. Thanks!

LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
0 Kudos
Message 7 of 7