Acausal Modelling and Control Sytem

How the example works:

  1. First, the functions that generate the symbolic DAE system are called. They return a vector of equations, and in addition vectors of initial values.
  2. Then, an ODE system is created from these vectors.
  3. Then the system is symbolically simplified (might take 30-60s)
  4. Now the init! function is called on the ODE system to find the initial state
  5. Now, in a loop for each timestep:
    • first, the system is simulated for one timestep of the control system
    • then the controller is called
    • the system parameters are updated from the controller output
    • this repeats until the final simulation time is reached.

In reality, it is a bit more complex, but first you have to understand this simple scheme.

Is it clear now?

In the given example, the controller is operating at 20 Hz, it uses a fixed time step of 50ms. The continues time model of the physical system is using a varying time step solver, in average about 100 iterations are needed to converge for simulating the 50ms time span of the outer loop.

To clarify: I am not using MTK to implement the controller, only to implement the model of the physical system.

Alright, thank you—I’ve understood the general idea. However, I’m still not quite sure how to apply it to my code that ive created based on this reference DC Motor with Speed Controller · ModelingToolkitStandardLibrary.jl.

Hello, i manage to find the solution and find the right connection to each component using ModellingToolkit @mtkmodel. But when i try to use solve function it causes this warning like this :

How can i debug and solve this issue? Does modellingtoolkit have the tools to solve this problem?