Skip to content

Add documentation how to simulate parsed model #54

@AnHeuermann

Description

@AnHeuermann

Is your feature request related to a problem? Please describe.

After parsing a BaseModelica file I want to automate simulation and saving of result files.

On BaseModelica.jl v1.1.0 I used the following script:

import BaseModelica
import DifferentialEquations
import DataFrames

parsed_model = BaseModelica.parse_basemodelica(base_modelica_file)
ode_problem = DifferentialEquations.ODEProblem(parsed_model)
ode_solution = DifferentialEquations.solve(
        ode_problem,
        tspan = (0.0, 1.0),
        saveat = 0.02)
df = DataFrames.DataFrame(ode_solution)

This changed with the latest version of BaseModelica.jl / ModelingToolkit.jl and I can't find how to update this in the docs.

Describe the solution you’d like

Add a short example to the documentation showcasing how to

  1. Parse a BaseModelica.jl file (already documented)
  2. Get the experiment annotation from the BaseModelica file or parsed model (currently I use OpenModelica to read the information from the BaseModelica file)
  3. Create an ODE problem with DifferentialEquations.jl or OrdinaryDiffEqDefault.jl or ModelingToolkit.jl
  4. Simulate the problem with the start values provided by the BaseModelica file and solver settings (start, stop, ...) specified by the BaseModelica file.

and keep it up-to-date with some CI running the documentation examples.

Describe alternatives you’ve considered

  • Documenting how to simulate an ODE model of type ModelingToolkit.System is maybe not the task of this package, but I think it is the output type of baseModelica_to_ModelingToolkit and dependencies change faster than I can keep up with our library test scripts.

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions