fix $given and $param_given

This commit is contained in:
rlar 2017-05-13 16:12:04 +02:00 committed by Holger Vogt
parent 951fc54139
commit 6777b43be5
4 changed files with 18 additions and 27 deletions

View File

@ -1877,19 +1877,18 @@ inline double _d1_pow(double x,double y) { return (x==0.0)?0.0:((log(x)/exp(0.
<admst:variable name="xpq" select="$epq"/>
<admst:variable name="e" select="_DDT($x)"/>
</admst:when>
<admst:when test="[name='\$given']">
<admst:when test="[name='\$given' or name='\$param_given']">
<admst:variable name="arg1" select="%(arguments[1])"/>
<admst:assert test="$arg1/adms[datatypename='variable']" format="\$given: argument is not a variable\n"/>
<admst:assert test="$arg1/[input='yes']" format="\$given(%(name)): argument is not a parameter\n"/>
<admst:assert test="$arg1/[datatypename='variable' and input='yes']" format="%(name): argument is not a parameter\n"/>
<admst:choose>
<admst:when test="$arg1/[parametertype='model']">
<admst:variable name="e" select="_mpg(%(name),%(name)Given)"/>
<admst:variable name="e" select="(model->%(arguments[1])_Given)"/>
</admst:when>
<admst:when test="$arg1/[parametertype='instance']">
<admst:variable name="e" select="_ipg(%(name),%(name)Given)"/>
<admst:variable name="e" select="(here->%(arguments[1])_Given)"/>
</admst:when>
<admst:otherwise>
<admst:fatal format="$given(): should not be reached\n"/>
<admst:fatal format="%(name): should not be reached\n"/>
</admst:otherwise>
</admst:choose>
</admst:when>
@ -2005,7 +2004,7 @@ inline double _d1_pow(double x,double y) { return (x==0.0)?0.0:((log(x)/exp(0.
<admst:choose>
<admst:when test="[name='absdelay']">
</admst:when>
<admst:when test="[name='\$given']">
<admst:when test="[name='\$given' or name='\$param_given']">
</admst:when>
<admst:when test="[name='\$temperature']">
</admst:when>
@ -2074,7 +2073,7 @@ inline double _d1_pow(double x,double y) { return (x==0.0)?0.0:((log(x)/exp(0.
<admst:choose>
<admst:when test="[name='absdelay']">
</admst:when>
<admst:when test="[name='\$given']">
<admst:when test="[name='\$given' or name='\$param_given']">
</admst:when>
<admst:when test="[name='\$temperature']">
</admst:when>

View File

@ -56,15 +56,9 @@
<admst:when test="[name='analysis']">
<admst:apply-templates select="." match="function:analysis"/>
</admst:when>
<admst:when test="[name='\$given']">
<admst:when test="[name='\$given' or name='\$param_given']">
<admst:for-each select="arguments[position(.)=1]">
<admst:if test="[datatypename!='variable']">
<admst:error format="$given: argument is not a variable\n"/>
</admst:if>
<admst:if test="[input='no']">
<admst:value-of select="name"/>
<admst:error format="$given(%s): argument is not a parameter\n"/>
</admst:if>
<admst:assert test="[datatypename='variable' and input='yes']" format="%(../name)(%(../arguments[1])): argument is not a parameter\n"/>
<admst:choose>
<admst:when test="[parametertype='model']">
<admst:value-of select="name"/>
@ -75,7 +69,7 @@
<admst:value-to select="/simulator/tmp" value="here->%s_Given"/>
</admst:when>
<admst:otherwise>
<admst:error format="$given(%s): should not be reached\n"/>
<admst:error format="%(../name)(%(../arguments[1])): should not be reached\n"/>
</admst:otherwise>
</admst:choose>
</admst:for-each>

View File

@ -609,15 +609,9 @@
<admst:value-to select="/simulator/tmp" value="%s"/>
</admst:for-each>
</admst:when>
<admst:when test="[name='\$given']">
<admst:when test="[name='\$given' or name='\$param_given']">
<admst:for-each select="arguments[position(.)=1]">
<admst:if test="adms[datatypename!='variable']">
<admst:error format="$given: argument is not a variable\n"/>
</admst:if>
<admst:if test="[input='no']">
<admst:value-of select="name"/>
<admst:error format="$given(%s): argument is not a parameter\n"/>
</admst:if>
<admst:assert test="[datatypename='variable' and input='yes']" format="%(../name)(%(../arguments[1])): argument is not a parameter\n"/>
<admst:choose>
<admst:when test="[parametertype='model']">
<admst:value-of select="name"/>
@ -628,7 +622,7 @@
<admst:value-to select="/simulator/tmp" value="here->%s_Given"/>
</admst:when>
<admst:otherwise>
<admst:error format="$given(%s): should not be reached\n"/>
<admst:error format="%(../name)(%(../arguments[1])): should not be reached\n"/>
</admst:otherwise>
</admst:choose>
</admst:for-each>
@ -707,7 +701,7 @@
<admst:when test="[name='\$options']">
<admst:for-each select="arguments[position(.)=1]">
<admst:if test="adms[datatypename!='string']">
<admst:error format="$given: argument is not a string\n"/>
<admst:error format="$options: argument is not a string\n"/>
</admst:if>
<admst:choose>
<admst:when test="[value='OPTm_hier']">

View File

@ -27,6 +27,10 @@ module r2_cmc(t, b);
parameter real type = 0; // 0=n, 1=p
analog begin : L
real dT, rsh_t, c, r, Ir, Qc, Ceff, pwrR;
if ($param_given(tcr))
$finish(4);
if ($param_given(tcr))
$finish(4);
if (nc > 2)
$finish(0);
begin : initializeModel