﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
4919	The NF does not recognize a discrete variable as such	Francesco Casella	Per Östlund	"Please check [https://libraries.openmodelica.org/branches/newInst/Modelica_3.2.2/files/Modelica_3.2.2_Modelica.Electrical.PowerConverters.Examples.DCAC.MultiPhaseTwoLevel.MultiPhaseTwoLevel_R.err 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."	defect	closed	high	2.0.0	New Instantiation		fixed		
