ModelingToolkit.jl icon indicating copy to clipboard operation
ModelingToolkit.jl copied to clipboard

Documentation: add example on system identification

Open CasBex opened this issue 11 months ago • 0 comments

Is your feature request related to a problem? Please describe. I think a system identification example with a ModelingToolkit model would be a nice addition to the documentation. Particularly one with a multi-component subsystem.

Describe the solution you’d like

A common application is coming up with reduced-order simplified models for complex systems. In my field, it is relatively common to model heat transfer phenomena in buildings (nonlinearities include radiation, convection) using linear thermal RC models with a low amount of states (i.e. going from multiple walls with multiple material layers to a single capacitance to represent all walls simultaneously). This is of course only a suggestion for the example.

Describe alternatives you’ve considered Alternatively make an example with ModelingToolkit in the documentation of one of the inverse problem / estimation packages (SciMLSensitivity...).

Additional context

I've been doing some system identification using ModelingToolkit 8.75 and SciMLSensitivity the past week. I started with zero knowledge of ModelingToolkit (but some Modelica experience). Some of the issues I ran into I did not immediately see documented anywhere, so I thought it would be a good idea to do so. Below are some of the less intuitive things I found and needed some workarounds for, and which I could not find in the documentation.

  • AutoZygote is not compatible with providing parameters of the form [name => value] and only accepts [value1, value2...]
  • To use AutoZygote the full parameter array must be provided (i.e. if the default is [a=>1, b=>a], simply providing [a=>2] will fail (see above) but [2] will also fail. You must provide [2, 2] instead. Some preprocessing in the loss function can make this work, but it's not intuitive.
  • My particular model was a thermal RC network. I built it with @mtkmodel and component models from ModelingToolkitStandardLibrary, but then found I had many duplicate parameters. For example, in the RC network, there was a FixedTemperature component, but I also provided a higher-level parameter to set that temperature (this is common enough in Modelica). The FixedTemperature.T parameter however does not disappear and must still be specified (see remark above).

Some of these problems are likely due to my inexperience, but I guess that makes me the target audience for the documentation.

CasBex avatar Feb 29 '24 09:02 CasBex