take care for different types of output variables in analogfunctions

This commit is contained in:
dwarning 2019-08-18 18:20:21 +02:00
parent 285d5b8636
commit 9d56b6ca86
1 changed files with 28 additions and 5 deletions

View File

@ -1011,7 +1011,16 @@ static inline double _d0_vt(double arg) { (void) arg; return (1.380650
<admst:apply-templates select="." match="v2c:converttype"/><admst:text format=" %s"/>
</admst:join>)
<admst:text format="\n{\n"/>
<admst:text format="double $function=0.0;\n"/>
<!-- for all output declared variables -->
<admst:for-each select="variable[output='yes']">
<admst:value-of select="name"/>
<admst:apply-templates select="." match="v2c:converttype"/>
<admst:text format=" %s"/>
<admst:if test="[type='integer']">=0</admst:if>
<admst:if test="[type='real']">=0.0</admst:if>
<admst:text format=";\n"/>
</admst:for-each>
<!-- for all local declared variables -->
<admst:for-each select="variable[input='no' and output='no']">
<admst:value-of select="name"/>
<admst:apply-templates select="." match="v2c:converttype"/>
@ -1033,12 +1042,26 @@ double $(module)_d_$(function) (<admst:join select="variable[input='yes']" separ
<admst:apply-templates select="." match="v2c:converttype"/><admst:text format=" d_%s"/>
</admst:join>)
<admst:text format="\n{\n"/>
<admst:text format="double $function=0.0;\n"/>
<admst:for-each select="$globalanalogfunction/variable[input='yes']">
<!-- for all output declared variables -->
<admst:for-each select="variable[output='yes']">
<admst:value-of select="name"/>
<admst:variable name="ddx" select="%s"/>
<admst:text format="double $(function)_$(ddx)=0.0;\n"/>
<admst:variable name="name" select="%s"/>
<admst:apply-templates select="." match="v2c:converttype"/>
<admst:text format=" $(name)"/>
<admst:if test="[type='integer']">=0</admst:if>
<admst:if test="[type='real']">=0.0</admst:if>
<admst:text format=";\n"/>
<admst:for-each select="$globalanalogfunction/variable[input='yes']">
<admst:value-of select="name"/>
<admst:variable name="ddx" select="%s"/>
<admst:apply-templates select="." match="v2c:converttype"/>
<admst:text format=" $(name)_$(ddx)"/>
<admst:if test="[type='integer']">=0</admst:if>
<admst:if test="[type='real']">=0.0</admst:if>
<admst:text format=";\n"/>
</admst:for-each>
</admst:for-each>
<!-- for all local declared variables -->
<admst:for-each select="variable[input='no' and output='no']">
<admst:value-of select="name"/>
<admst:variable name="name" select="%s"/>