Skip to content

How to reinitialize a continuous variable which isn't a state #74

@modelica-trac-importer

Description

@modelica-trac-importer

Reported by AHaumer on 7 May 2008 11:01 UTC
The Modelica specification doesn't allow to reinit a continuous variable which isn't a state;
but how should I get the peak value of a signal with respect to predefined periods:

block PosPeak "Positive peak during one period"
  extends Modelica.Blocks.Interfaces.SISO;
  parameter Modelica.SIunits.Frequency f=1 "Basic signal frequency";
protected
  Real x;
equation
  x=max(u,x);
  when sample(0, 1/f) then
    y=x;
    reinit(x,u); // not standard compliant!
  end when;
end PosPeak;

Migrated-From: https://trac.modelica.org/Modelica/ticket/74

Metadata

Metadata

Labels

bugSomething isn't workingwontfixThis will not be worked on

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions