Azzera filtri
Azzera filtri

How to get a dynamics model to solve completely and use its outputs in a Simulink model, all in one simulation?

1 visualizzazione (ultimi 30 giorni)
This is a hard question to phrase, so I am going to explain what the model is currently doing and what I would like it to do. The gist of this problem is that I have a dynamics model that, given some initial conditions, solves for the highest altitude (apogee) a model rocket will fly to. On this model rocket there is an airbrake system that will hopefully help the rocket hit a target apogee within reasoanable accuracy. This airbrake will utilize a feedback controller, which I am currently developing in Simulink. Now, what I want the Simulink model to do is:
  1. Given some initial conditions on the state vector and airbrake input (zero at start), find the expected apogee.
  2. If this expected apogee is larger than the desired apogee, utilize a PD controller (exact controller still up for debate) to actuate the airbrake.
  3. Now, with these new initial condtions (airbrake input added), solve for the new state vector at the next time step, and find the new expected apogee.
  4. Repeat steps 2 - 3 until the expected apogee is less than or equal to the desired apogee.
The issue I am facing on my Simulink model is that I don't know how to get the Dynamics Model to solve for the expected apogee, feed that into the controller, and then use that as the new initial conditions. Currently, the model incoporates the controller at each time step, which is how it would traditionally be done for a system that was based off of instantaenous error. However, I need to solve the ODE first, use that final expected height as an input into the controller, and then actuate. I've tried to make a seperate Simulink Dynamics Model and reference that, I tried using the while iterator block, but I can't get it working. I essentially need to replace the Dynamics Model with a function that solves the ODE, but I would like to avoid making a whole new function while I currently have a model that works (without controller inputs that is).
Any help would be appreaciated, I've attached the current iteration of the Simulink model. There are a lot of extra xy plots and scopes as I was trying to fix it. Thank you in advance!

Risposte (0)

Categorie

Scopri di più su General Applications in Help Center e File Exchange

Prodotti


Release

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by