Domanda

I have a system with a Model Predictive Controller and PID Controller. Assuming I have models for each controller and can express them in discrete time, please how do I integrate them together to simulate properties of the system in matlab?

Thanks

È stato utile?

Soluzione

... continuing from the comments. This is what Simulink is made for. Of course there are ways to do it without Simulink, but often you still use Simulink tools and functions just without the graphical Interface.

I assume you have your transfer functions "on paper". So you need the tf function to define your system model.

G = tf(num,den)

num and den are the coefficient vectors of your transfer function of numerator and denumerator. In Simulink you use the Transfer Fcn block and you define it with

G.num{1} %Numerator coefficients
G.den{1} %Denumerator coefficients

Your PID-controller cannot be defined using this block, as Simulink requires a higher or equal order for the denumerator. Instead use the PID controller Block. You need to calculate the Proportional, Integral and Differential gain before.

Then read the documentation about the MPC toolbox - I'm not familiar with it and can't help you on that - it is explained how you can create an mpc object regarding all your constraints (see your other question).

Then you have various options to transform your mpc object into something Simulink can deal with. I'd recommend the ss - the state space model - which can be implemented using the state space block. There is also a MPC Controller block, I don't have the toolbox - but you'll be able to find out how it can be used.

Finally you find source blocks, like a step to generate a test signal. And there are Sinks, in the easiest case scope to display your results. You can also save them to workspace or whatever...

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top