I am trying to get the A,B,C,D matrices of the system at different points during a dynamic simulation to understand how they vary and see if my system stays controllable.
To do this I am running the simulation, pausing and running the following command in the gomboc terminal:
query(linearise({xNames:[‘z’,’e’,’f’,’w’,’p’,’q’],yNames:[‘z’,’e’,’f’,’w’,’p’,’q’],uNames:[‘Front.TargetFlapStbd’,’Front.TargetFlapPort’,’Front.TargetFrontRake’,’Aft.TargetRudderRake’]}))
This gives me the following error:
Error: ‘Front.TargetFlapStbd’ is not a state
In the code TargetFlapStbd (and the other target flap angles) is governed by a controller run in a LQR01.js file which is called by Control01.bic and defined like this:
StbdWingFlap : BL.State({ Init: 0, Min: -10, Max: 10 }),
Then in FrontFoil01.bic I call the previous value:
TargetFlapPort :”{^.Control.LQR.Angles.PortWingFlap}”,
This code works fine with the issue that TargetFlapPort doesn’t show up in the States tab in the gomboc interface. I have tried using R.merge to update the variable with the result that TargetFlapPort did become a State but wouldn’t be updated by the controller and remained constant during the simulation.
Is there a way to make TargetFlapPort be taken as a State while still being updated by the controller? Is there a better way to get the A,B,C,D matrices I am not seeing?
Hi Jules,
Thanks for your question. If I understand your case correctly, you are trying to use ‘TargetFlapPort’ in the ‘uNames’ parameter of the ‘linearise’ method. As you described it, ‘TargetFlapPort’ is a JavaScript expression in function of the output of the State block ‘PortWingFlap’. Therefore, it is not a State block which is way it does not show in the ‘State’ window and cannot be used in the ‘uNames’ array.
If you do a R.merge to update the variable so that TargetFlapPort becomes a State block, then you break its relationship with the controller variable and, as you observed, the flap remains constant throughout the simulation.
Without full access to the model we might be missing something, but why not keeping the model as you defined it and trying to use directly the ‘PortWingFlap’ in the ‘uNames’ array? Indeed, ‘PortWingFlap’ is equal to ‘TargetFlapPort’, so it would then be straightforward to get ‘TargetFlapPort’ from ‘PortWingFlap’.
Please let us know if this works.