Skip to content

Events for @mtkmodel components #2421

Open
@cgutsche

Description

@cgutsche

In component based modeling your components might need to do event handeling. These events should be declarable within the component for easy modeling. As far as I can understand the code, there is no nice way to do this at the moment. Therefore I think additional syntax like the following would be nice:

@mtkmodel FOL begin
    @parameters begin
        τ # parameters
    end
    @variables begin
        x(t) # dependent variables
    end
    @equations begin
        D(x) ~ (1 - x) / τ
    end
    @discrete_events begin
        (t > 5) => [x ~ x + 1]
    end
    @continuous_events begin
        [t ~ 1] => [x ~ x + 1]
    end
end

I think this would be the easiest way to do it. Maybe a more Modelica like syntax including the events into the equation block would be possible but I think this is not necessary.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions