Main /

MigrationFromMPT2

Main.MigrationFromMPT2 History

Hide minor edits - Show changes to output

May 23, 2013, at 08:18 PM by Michal Kvasnica -
Added lines 1-37:
!! Migrating MPC problems described by @@sysStruct@@ and @@probStruct@@

In MPT2, definition of the MPC problem was split into a @@sysStruct@@ structure, which described the prediction model, and a @@probStruct@@ structure, which defined parameters of the MPC problem.

MPT3 contains a completely redesigned user interface for control synthesis, which combines these two structure into a single object. To migrate your MPC setup, use the @@mpt_import@@ function:
(:source lang=MATLAB -getcode:) [@
model = mpt_import(sysStruct, probStruct)
@]

The command above will migrate your MPC problem setup into an MPT3 object, which represents the [[UI.Systems | prediction model]], along with constraints and penalties on the model's states, inputs, and outputs.

To synthesize an on-line MPC controller using the MPT3 prediction model, use the @@MPCController@@ constructor:
(:source lang=MATLAB -getcode:) [@
mpc = MPCController(model, N)
@]
where @@N@@ represents the prediction horizon.

To synthesize an explicit MPC controller, use the @@toExplicit()@@ method of @@MPCController@@ objects, i.e.
(:source lang=MATLAB -getcode:) [@
mpc = MPCController(model, N)
expmpc = mpc.toExplicit()
@]

The table below shows what are the equivalents of important MPT2 functions in MPT3:

|!MPT2 function|!Equivalent in MPT3|
|@@ctrl = mpt_control(sysStruct, probStruct)@@|@@model = mpt_import(sysStruct, probStruct); ctrl = MPCController(model, probStruct.N).toExplicit()@@|
|@@ctrl = mpt_control(sysStruct, probStruct, 'online')@@|@@model = mpt_import(sysStruct, probStruct); ctrl = MPCController(model, probStruct.N)@@|
|@@mpt_getInput@@|@@MPCController.evaluate()@@|
|@@mpt_ownmpc@@|@@MPCController.toYALMIP()@@, @@MPCController.fromYALMIP()@@|
|@@mpt_invariantSet@@|@@EMPCController.toInvariant()@@|
|@@mpt_computeTrajectory@@|@@ClosedLoop.simulate()@@|
|@@mptctrl/length@@|@@EMPCController.nr@@|
|@@mptctrl/plot@@|@@EMPCController.partition.plot()@@|
|@@mptctrl/plotj@@|@@EMPCController.cost.fplot()@@|
|@@mptctrl/plotu@@|@@EMPCController.feedback.fplot()@@|
|@@mptctrl/sim@@|@@ClosedLoop.simulate()@@|