Simulink changing the specified operating point during simulation

Hello All,
I am trying to optimize the turn of a 6 DoF model of F-18 HARV, for that I calculate the required states using fmincon. Next, I use
operpoint
to create an operating point for my simulink model. During simulation, I copy the values of all my states at each time interval in a file, using "To File" in Simulink.
The problem I am facing is that when I specify the operating point to be used by my model, the matlab workspace loads it correct but after the simulation when I check the initial value of the states from the saved file, I find that simulink is using some different value for one of the states as initial condition. I am ataching some code and images for better understanding.
[XU,fval,exitflag,output] = fmincon(trimfun,xu,Afmc,bfmc,Aeqfmc,beqfmc,lb,ub,nonlcon,opts)
Xst = [XU(1) XU(2) 0 XU(3) XU(4) XU(5) XU(6) XU(7) XU(8) 0 0 0];%states (some states that I want to be forced are added manually)
Ust = XU(9:13);%controls
model = 'HARV_6DoF_turn_mdl';
op = operpoint(model);
op.Inputs.u = Ust;
op.States.x = Xst;
The value of op in the matlab workspace is provided in image [1]. Notice the value of state 8.
My simulink model (although not required) is attached as below [2]. I am copying al the values of states at each time interval to a file named, "Test"
Now I am attaching the output of the file at time=0 which gives the initial states that simulink used during simulation [3]
Notice the value of the state 8 that has been changed to 0.1677 from 0.1833. I am not able to understand what exactly is causing this because simulink should have started the simulation from the initial condition provided by the operating point. I made sure that my getstatestruct(op) is checked in data import/export pane in simulink.
Your inputs will be of much help as it will help me in completing the project. Thank you!

Answers (0)

Categories

Products

Release

R2019a

Asked:

on 15 Apr 2020

Edited:

on 15 Apr 2020

Community Treasure Hunt

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

Start Hunting!