01-14-2011
05:46 PM
- last edited on
11-13-2024
09:36 AM
by
Content Cleaner
Hi Rob,
Just posting this question again.
I am doing another project in which i am reading analog data using cRio 9014, may be frequency and some other things, but based on analog signals (temperature in this case) I have to control a digital output signal or inother words turn ON or OFF a heating source. I have done lots of acquiring stuff but have not done the control element. We have digitial output 9476 module we can use. Can you please show me some place to look for an example to build such a program using FPGA?
I will appreciate a lot.
Ajay
Hey Ajay,
Might be best to open a new thread on this unrelated topic, but you have a pretty straightforward control need. You could do something as simple as:
while loop(
(read analog temperature = temp)
if(temp < setpoint)
dig channel 0 = TRUE
else
do nothing
)
I know this is text pseudocode, but with your experience you should be able to convert that pretty easy to G with a while loop, less than symbol, and a case structure. The control gets more complicated if you want to add PID control, hysteresis(would be a good idea), or pulse width modulation of the heater element, but those topics are very specific to application needs and cannot easily be answered on forums.
To bring this back around to the GPS question, one will be starting out with something simple such as
while loop(
read current position(x, y)
compare (x,y) to (desired x, desired y)
Turn motors on or off as needed at calculated power and direction (ie, if we only have to go a short distance, no need to turn motor to 100% power or you will overshoot)
This is greatly simplified since it assumes a cartesian coordinate system with a motor for X and a motor for Y, however we all know most robots do not have that, they have a direction they are pointing and it takes a certain distance to get to the correct facing direction. For example, if I have to drive straight north, and I am facing West, I am going to have to move a little west as I turn before I am facing north. Most robotics also integrate encoders on the wheels to approximate distance travelled and to make a better closed-loop control system. I say approximate because there is always minor slip in wheels.
Rob,
Thank you very much, its always a pleasure taking to you.
I believe this while loop sits in the host.vi and then pass this true or False back to FPGA part of the program? is that right.
Appreciate your help.
Ajay
01-17-2011
12:09 PM
- last edited on
11-13-2024
09:41 AM
by
Content Cleaner
Hello Ajay,
Thanks for starting a new thread for this new topic. I wanted to go ahead and answer your question, and Rob can chime in if he has some other info for you.
You can run your control loop either in the Host VI or on the FPGA directly - there are pros and cons to each approach. You will have faster and more deterministic control if you do it on the FPGA, but it will use more of your FPGA space and some algorithms are easier to implement on the Real-time host.
For the simple control that Rob suggested, I would just do it in your FPGA VI. You can still send the data back to the host for logging and monitoring, but this way the communication delay won't slow down your control.
For something simple like Rob suggested, take a look at the Switch VI included in the LabVIEW FPGA module - https://www.ni.com/docs/en-US/bundle/lvfpga-api-ref/page/vi-lib/rvi/analysis/control/nonlinear/templ...
Morgan S
Applications Engineer
National Instruments
01-17-2011 01:10 PM
Hi Morgan,
Thanks very much, I think I got it, will come back and let you know very soon.
Appreciate it.
Ajay