01-26-2011 07:09 PM
Hi,
I am using a CompactRIO to control a laboratory power plant. I am trying to implement a control strategy that needs to solve an optimization problem at every iteration, which might be too heavy for the cRIO. So, I want the cRIO target to call matlab to solve the optimization problem, wait for the solution and send the corresponding instructions to the plant.
The Matlab Script node would be usefull but is not supported by RT targets. Is there another way I can do it?. Any way to have a VI running in the cRIO that sends and receive data to/from Matlab?
Thanks in advance. Regards,
Pablo Jimenez
01-26-2011
10:02 PM
- last edited on
03-26-2025
08:28 AM
by
Content Cleaner
Use Mathscript RT.
01-27-2011 08:13 AM
01-31-2011 07:09 AM
Hello Pablo,
Would you mind sharing your script or even just a list of all optimization functions you wish to call?
Grant M.
Senior Software Engineer | National Instruments
01-31-2011 08:51 AM
Hello,
Thanks for your help. Basically I want to use Matlab's function fmincon. What if I run a VI on my computer that calls fmincon from a Matlab Script node and writes the results on a global variable which is read by my RT target???.
Thanks again.
Pablo
02-04-2011 08:58 AM
Hello Pablo,
You will need to use a shared variable instead of a global variable, but this will solve your communication needs. However, you mention you need to solve this optimization problem at every iteration on your cRIO. Using a shared variable to communicate with a separate machine will not be deterministic.
You could also rewrite your optimization routine to use LabVIEW's optimization VIs for better performance (although likely still not deterministic).
Grant M.
Senior Software Engineer | National Instruments