LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

feedback control coding

i wish to do a feedback control but don't know how to do it
 
the output node which i monitor (input of feedback control) : power (in DBM)
the feedback output : there are 4 channels of voltage control, 0-150V each. adjusting the voltage will affect the power in the output node
 
my feedback loop is doing a simple maximum-search algorithm (on each channels)(sweeping up and down from the existing voltage used and monitor the power that is maximum)
 
i couldn't find a suitable example on ni. How do i ensure that i don't over sweep into unnecessary out of bound voltage (which gives lower power output). is there any algorithm/coding that let me do it one channel by one channel or all 4 channels together?
I'm as happy as i want to be!
0 Kudos
Message 1 of 16
(4,375 Views)

The typical way to approach a feedback control system problem is to have a good mathematical model of the system in question.  The system characteristics will dictate the best approach toward the sweep & detect algorithm.

For example: As 3 of the 4 outputs are held constant and the other is swept, will you expect to see exactly 1 peak output?  Or could it be more?  Does it depend on the specific values of the other 3 outputs?  Etc.

The answers to these kinds of questions put some constraints on the expected output behavior, and help to dictate the kind of algorithm to use for sweep & detect.

-Kevin P.

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 2 of 16
(4,352 Views)

thank you.

i want to do a hill climbing algorithm , each channel at one time. i'm coding it now.

how to store the initial power into the loop? (for comparative with the updated power value as i execute the hill-climbing loop)...

I'm as happy as i want to be!
0 Kudos
Message 3 of 16
(4,320 Views)

You'll want to learn about the use of Shift Registers, not only for the initial value of power, but also so each cycle through the loop gives you access to the power value from the prior cycle -- this lets you know if you've increased or decreased it.  Odds are, you'll need to expand the left-hand-side shift register to give you access to info from 2+ cycles in the past.  This is because once you see a power decrease, you'll probably want to "roll back" to where you were 2 cycles earlier.

-Kevin P.

 

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 4 of 16
(4,314 Views)

i decided to use a master/slave with state diagram. I'm studying some examples and Below is an example files i downloaded from ni LabVIEW Application Design Patterns at http://zone.ni.com/devzone/learningcenter.nsf/03f7c60f17aad210862567a90054a26c/338ee44cb1c3450986256... it is a zip file, and this is the example BuckRogers laser. one things i cannot comprehend is the operation of the "while loop"(smaller loop) within the "state" while loop.

if i not understand wrongly, the "i" of the smaller loop with iterate through the enumerated "conditions" (namely: manual shutdown, too hot, a bit warm, fire, needs power, default). if certain parameters are met, for example within the "too hot" condition, if temperature>80, the boolean condition will end that loop and trigger the next state to be Active Cooling on the "state" while loop.

however, i cannot comprehend a portion:, the "default" condition under the "check status" state, as in the figure pasted below. it seems to me that the while loop will be forever trapped within this sequence, as there is no way to letting pass this "default" loop , as a True is defined to end the loop everytime, and forcing it to reenter another "check status" state. How exactly the "FIRE" condition is even reached ? (and stopping the loop there after the user click on the FIRE button on the GUI?

I'm as happy as i want to be!
0 Kudos
Message 5 of 16
(4,277 Views)
back to my coding. I'm using a master slave. Master is the GUI. Slave is where i put my maximum search algorithm (using state diagram). that's
i'm asking the question above.
 
for that example, the power and temp is indicator, and we can write to it.
for my case, i'm also having power (a readable input value from a connected instrument) and control voltage (output of my algorithm to the instrument).
 
i'm placing instrument query for power VI on the master loop (or should i place it on the slave loop?)
i created a local variable for both power and control voltage .
 
but i try to connect to slave loop (same like the picture i posted above for temp and power), i get error
"you have conncted 2 wires of different types. sink is void, source is double". my local variable appears to be in orange colour.
 
how to overcome this?
I'm as happy as i want to be!
0 Kudos
Message 6 of 16
(4,278 Views)

here is the state diagram i would like to code in the slave loop (hope it provides enough clarification to make my question clear)

my algorithm is suppose to check the power (check DOP), if DOP less than threshold voltage, then it simply control the voltage (up or down) until the DOP is back to normal. it will sweep to the next voltage channel (4 of them total) if the prior voltage channel control fail

I'm as happy as i want to be!
0 Kudos
Message 7 of 16
(4,268 Views)
Weiwei2,
Were you able to get past the error you were having?
Doug M
Applications Engineer
National Instruments
For those unfamiliar with NBC's The Office, my icon is NOT a picture of me 🙂
0 Kudos
Message 8 of 16
(4,222 Views)
not yet...i'm still coding...but i don't understand the portion that i asked above, how come the while loop can escape out from that situation? won't it get stuck there. and i don't know how to debug it as well
I'm as happy as i want to be!
0 Kudos
Message 9 of 16
(4,219 Views)
I can't tell from the screenshot, but if one of the case structure cases in the inner loop outputs a 'Shut Down' instance of the enum, then it will stop the outer loop. It sounds like you are fairly new to LabVIEW.  There are several good interactive tutorials available online.  Check out How Can I Learn LabVIEW?


Doug M
Applications Engineer
National Instruments
For those unfamiliar with NBC's The Office, my icon is NOT a picture of me 🙂
0 Kudos
Message 10 of 16
(4,208 Views)