Changes between Initial Version and Version 2 of Ticket #1692


Ignore:
Timestamp:
2012-10-02T10:06:18Z (12 years ago)
Author:
Martin Sjölund
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #1692

    • Property Cc Frenkel TUD added; Jens Frenkel removed
    • Property ComponentBackend
  • Ticket #1692 – Description

    initial v2  
    11http://openmodelica.org/index.php?option=com_agora&task=topic&id=526&Itemid=87
    2 {{{package Medium
     2{{{
     3package Medium
    34  function h_pt
    45    input Real p;
     
    128129
    129130{{{$ MODELICAUSERCFLAGS="-g -fstack-protector" omc +s +simCodeTarget=Dump a.mo | grep residual | wc -l
    130 16}}}
    131 
    132 {{{$ MODELICAUSERCFLAGS="-g -fstack-protector" omc +s +simCodeTarget=Dump a.mo | grep nonlinear | tr , \\n | cut -d:  -f2 | tr -d " " | wc -l
    133 12}}}
     13116
     132}}}
     133
     134{{{
     135$ MODELICAUSERCFLAGS="-g -fstack-protector" omc +s +simCodeTarget=Dump a.mo | grep nonlinear | tr , \\n | cut -d:  -f2 | tr -d " " | wc -l
     13612
     137}}}
    134138
    135139So we have 16 residual expressions written to 12 memory locations. WRONG WRONG WRONG.
    136140
    137141Also, many of the expressions are KNOWN ZERO!
    138 {{{  residual: xloc[2];
     142{{{
     143  residual: xloc[2];
    139144  residual: xloc[1];
    140145  residual: xloc[11] - Medium.d_ph(100000.0,xloc[10]);
     
    151156  residual: xloc[2];
    152157  residual: xloc[1];
    153   residual: xloc[8] - Medium.h_pt(xloc[0],300.0);}}}
    154 
    155 We can replace {{{xloc[1]=xloc[2]=xloc[4]=xloc[3]=0}}} since this is a trivial solution (and the only correct one). We can then replace all these variables with the known constant (like removeSimpleExpressions), and re-run SCC algorithm since this may no longer be a SCC :)
     158  residual: xloc[8] - Medium.h_pt(xloc[0],300.0);
     159}}}
     160
     161We can replace `xloc[1]=xloc[2]=xloc[4]=xloc[3]=0` since this is a trivial solution (and the only correct one). We can then replace all these variables with the known constant (like removeSimpleExpressions), and re-run SCC algorithm since this may no longer be a SCC :)
    156162
    157163In this case:
    158 {{{  residual: xloc[11] - Medium.d_ph(100000.0,xloc[10]);
     164{{{
     165  residual: xloc[11] - Medium.d_ph(100000.0,xloc[10]);
    159166  residual: xloc[9] + (-0.9999999999999998 * source.port.h + -0.00000000000000009999999999999999 * xloc[10]);
    160167  residual: xloc[10] + -0.5 * (xloc[8] + xloc[9]);
     
    163170  residual: xloc[5] - Medium.d_ph(100000.0,xloc[6]);
    164171  residual: xloc[0] - 0.0;
    165   residual: xloc[8] - Medium.h_pt(xloc[0],300.0);}}}
    166 
    167 
    168 In this case (re-run {{{xloc[0]=0}}}:
    169 {{{  residual: xloc[11] - Medium.d_ph(100000.0,xloc[10]);
     172  residual: xloc[8] - Medium.h_pt(xloc[0],300.0);
     173}}}
     174
     175In this case (re-run `xloc[0]=0`:
     176{{{
     177  residual: xloc[11] - Medium.d_ph(100000.0,xloc[10]);
    170178  residual: xloc[9] + (-0.9999999999999998 * source.port.h + -0.00000000000000009999999999999999 * xloc[10]);
    171179  residual: xloc[10] + -0.5 * (xloc[8] + xloc[9]);
     
    173181  residual: xloc[7] + (-0.6666666666666666 * source.port.h + -0.3333333333333333 * xloc[6]);
    174182  residual: xloc[5] - Medium.d_ph(100000.0,xloc[6]);
    175   residual: xloc[8] - Medium.h_pt(0.0,300.0); /* Another known constant! */}}}
    176 
    177 
    178 
    179 In this case (re-run {{{xloc[8]=300.0}}}:
    180 {{{  residual: xloc[11] - Medium.d_ph(100000.0,xloc[10]);
     183  residual: xloc[8] - Medium.h_pt(0.0,300.0); /* Another known constant! */
     184}}}
     185
     186
     187
     188In this case (re-run `xloc[8]=300.0`):
     189{{{
     190  residual: xloc[11] - Medium.d_ph(100000.0,xloc[10]);
    181191  residual: xloc[9] + (-0.9999999999999998 * source.port.h + -0.00000000000000009999999999999999 * xloc[10]);
    182192  residual: xloc[10] + -0.5 * (300.0 + xloc[9]);
    183193  residual: xloc[6] + (-0.9999999999999999 * xloc[7] + -0.00000000000000006666666666666667 * 300.0);
    184194  residual: xloc[7] + (-0.6666666666666666 * source.port.h + -0.3333333333333333 * xloc[6]);
    185   residual: xloc[5] - Medium.d_ph(100000.0,xloc[6]);}}}
     195  residual: xloc[5] - Medium.d_ph(100000.0,xloc[6]);
     196}}}
    186197
    187198Much simpler to solve :) Feel free to split this into 2 different bugs if needed.
     
    198209  residual: xloc[7] + (-0.6666666666666666 * source.port.h + -0.3333333333333333 * xloc[6]);
    199210Scalar:
    200   residual: xloc[5] = Medium.d_ph(100000.0,xloc[6]);}}}
     211  residual: xloc[5] = Medium.d_ph(100000.0,xloc[6]);
     212}}}
    201213
    202214This equation system screams: Please make me faster, Willi and/or Jens