I have a simulink process model with a number of control inputs. I have modeled the process model using a number of susbsytems (m-file block in series and parallel), and the integration is done using an integrator for each subsystem.
I can run this model and get the states and outputs (Is is possible to programmatically play a Simulink model and measure its states?), but I would also like to be able to get the time derivative of the states sometimes.
For example, if I am running an optimal control problem , I need a function that programmatically returns the state variable derivatives to use as constraints. I would ideally be reusing the same model, but not using the simulink software for integration.
I suppose I could gather the input to every integrator in the model and use that as the derivative, but that is a horrible way to go about it (difficult to maintain, for starters).