Real-Time Measurement and Control

Showing results for 
Search instead for 
Did you mean: 

Labviews Model Predictive Control Toolbox


Hey Guys


I am currently trying to use Labview's inbuilt model predictive control toolkit to implement control on a small scale pilot plant. I am using a c-RIO as the input/output device to send signals out to the field. 


My system is a multiple input multiple output (MIMO) system with 2 process variables (2 liquid levels) and 2 manipulated variables (flow control valve and a pump controlled by a VSD). I have attached a copy of my system for a better view of what i am trying to control. Level tank 3 is controlled by a flow control valve feeding into the tank. Level tank 1 is controlled by a pump which pumps from level tank 3 up to level tank 1. My system was modeled using MATLABs system identification toolbox and my model is in terms of transfer functions which are turned into state space models to build my MPC controller in Labview.


I have tried to put the system under control however the MPC controller in Labview does not seem to be doing what its supposed to. Does anyone have experience with using the MPC toolkit for real-time implementation and would be kind enough to have a look at the photos I have attached to tell me where I am going wrong?


 Thanks in advance 



0 Kudos
Message 1 of 3

The first thing I would do is check the output of the system identification - does the derived TF models behave in the same way as the data you input - and perhaps more importantly make sense in terms of your process diagram. It is easy to get the input data mixed up and TF co-efficients the wrong way around. System identification works fine, but data needs prepared (e.g. offsets removed).

The next thing I would do is check the model manipulation is as it should be - do the TF models you start with and the discrete SS models used by the MPC behave in a very similar way (steady state gain, dynamic response). Do a quick step plot to check responses of both, including the off-diagonal terms.

It looks like one of your models has a negative steady state gain. Is that corrtect ? It should be ok MPC but worth making sure that isn't a problem.

Are you running the MPC connected to a simulation (maybe using the derived TF models) or trying to run the actual process straight away ? It would be a good check to run with the model first. A fundamental difference between a TF model and the real system is the bias / offsets needed (i.e. zero error usually needs something non-zero for its MVs). Run the MPC with the SP = CV - so it should give the MVs = 0.

It looks like you are using default values for weights (error and control) - unconnected terminals - maybe they are not appropriate for your application.

Are you defining any constraints - mayeb default constraints on variables are restricting the MPC action.


Hope this helps and good luck.



Consultant Control Engineer
0 Kudos
Message 2 of 3

Hey Andy 


Thank you very much for the advice, it is much appreciated. 


I noticed that my final State Space model did not behave in the same way as my transfer function model (the gains were massively different and the responses were not the same). I have now rectified this and the system seems to be responding much better.


The transfer function with the negative gain is the relationship between tank 3 and the pump (it pumps out of tank 3 and up to tank 1). I believe this is reverse acting hence the negative gain for the transfer function. 


I have defined actuator and pump restraints for my manipulated variables. I am now just trying to find appropriate values for the prediction horizon, control horizon and weighting factors.


Thank you very much again for your help


Kind Regards


Liam McGinley

0 Kudos
Message 3 of 3