Opened 7 years ago
Closed 7 years ago
#4919 closed defect (fixed)
The NF does not recognize a discrete variable as such
Reported by: | Francesco Casella | Owned by: | Per Östlund |
---|---|---|---|
Priority: | high | Milestone: | 2.0.0 |
Component: | New Instantiation | Version: | |
Keywords: | Cc: |
Description
Please check Modelica.Electrical.PowerConverters.Examples.DCAC.MultiPhaseTwoLevel.MultiPhaseTwoLevel_R.err. The following error is reported:
[Modelica 3.2.2/Blocks/Discrete.mo:68:5-68:21:writable] Error: Argument 1 of pre must be a discrete expression, but signalPWM.zeroOrderHold.ySample is continuous.
The source code reads:
block ZeroOrderHold "Zero order hold of a sampled-data system" extends Interfaces.DiscreteSISO; output Real ySample(start=0, fixed=true); equation when {sampleTrigger, initial()} then ySample = u; end when; /* Define y=ySample with an infinitesimal delay to break potential algebraic loops if both the continuous and the discrete part have direct feedthrough */ y = pre(ySample); end ZeroOrderHold;
From Section 3.8.3 of the Modelica Specification
Discrete time expressions are:
Discrete-time variables, i.e., Integer , Boolean , String variables and enumeration variables, as well as Real variables assigned in when-clauses
In this case, ySample
is assigned in a when-clause, so it is discrete-time, not continuous-time.
Change History (2)
comment:1 by , 7 years ago
Component: | *unknown* → New Instantiation |
---|---|
Milestone: | Future → 2.0.0 |
Owner: | changed from | to
comment:2 by , 7 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Fixed in 6f42885.