How to design controller for models in Simscape multibody?

5 views (last 30 days)
I'm currently working on designing a controller for stabilizing a self balancing bicycle that uses Control Moment Gyroscope for balancing. A simmechanics model of the self balancing bicycle was developed using Simscape Multibody. I'm trying to develop a MPC controller using the MPC toolbox. The MPC cannot linearize the simmechanics model. So, I collected precession torque as Input and Roll angle as output to make a SISO State space model. This is then fed into the system identification app to get a State Space with Identified Parameters. The idss correlation with collected data is 99.5% with one step prediction focus. Now, when I'm implementing the idss on simulink using idmodel block, the output of idmodel is not as expected. I'm planning to use the idss to tune my MPC controller. If the idss roll angle output doesn't match with the roll angle data of the model, then my controller cannot be tuned properly. I tried the transfer function as well. It doesn't work.So I require help in designing a controller using a simscape model.
The Simmechanics model is attached below. Thank you very much and I'm looking forward to hearing from you.

Answers (1)

J Chen
J Chen on 3 Aug 2021
You can use MATLAB 'linearize' command to lineraize Simscape plant models, [sys, ~, info] = linearize(plantModel, opPoint). The complete sequence is:
  1. Create a specification for the operating point using opSpec = operspec(plantModel);
  2. adjust your opSpec to select known/non-steady state variables. more info here.
  3. Find the operating point using [opPoint, opReport] = findop(plantModel, opSpec)
  4. Perofrm lineraization [sys, ~, info] = linearize(plantModel, opPoint)
The linerized model then can be used in the MPC block. The angle state variables are tricky since Simscape MB use quaterion.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!