Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

11-01-2016 12:29 PM

Options

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Hi,

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.

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?

Thanks.

11-03-2016 10:08 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Hi,

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

http://www.ni.com/tutorial/7595/en/

Application Design Patterns: State Machines

http://www.ni.com/white-paper/3024/en/

Luis G.

11-04-2016 01:34 PM - edited 11-04-2016 01:35 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

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.

Thanks.

11-04-2016 01:43 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

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

11-04-2016 03:54 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

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?

Thanks.

11-07-2016 10:51 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Anyone have suggestions?

Thanks.

11-07-2016 11:04 AM - edited 11-07-2016 01:37 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

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!