<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    Sergio,<br>
      The caveats first: I have no experience with writing C++
    components and don't have a compiler that I can use to remake your
    dll and test the projects.<br>
    <br>
      That said, try switching TRNSYS into it's "debug" mode. This does
    not mean that the TRNDLL or your Type need to be recompiled in debug
    mode. It simply means that you change a the "debug mode" switch from
    "false" to "true" in the project's control cards (where you set the
    simulation start and stop time). This will activate a number of
    checks when the simulation is run. The checks are time consuming so
    the simulation runs more slowly (thus the switch). Specifically you
    will get a more helpful error message if your Type writes outside of
    the out() array space that it reserved for itself or if one of its
    outputs was set to an NaN condition. From the behavior that you
    describe I would guess that one of these two situations is at fault.<br>
    Kind regards,<br>
     David<br>
    <br>
    <br>
    <div class="moz-cite-prefix">On 10/16/2014 22:40,
      <a class="moz-txt-link-abbreviated" href="mailto:Sergio.Pintaldi@csiro.au">Sergio.Pintaldi@csiro.au</a> wrote:<br>
    </div>
    <blockquote
cite="mid:2B3F6469F7BF7048A0F0F1D13E93AF021BF15F12@exmbx02-cdc.nexus.csiro.au"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=ISO-8859-1">
      <meta name="Generator" content="Microsoft Word 15 (filtered
        medium)">
      <style><!--
/* Font Definitions */
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin-top:0cm;
        margin-right:0cm;
        margin-bottom:0cm;
        margin-left:36.0pt;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:#1F4E79;
        font-weight:normal;
        font-style:normal;
        text-decoration:none none;}
.MsoChpDefault
        {mso-style-type:export-only;
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
/* List Definitions */
@list l0
        {mso-list-id:632174245;
        mso-list-type:hybrid;
        mso-list-template-ids:-1023761504 201916431 201916441 201916443 201916431 201916441 201916443 201916431 201916441 201916443;}
@list l0:level1
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level2
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level3
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l0:level4
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level5
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level6
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l0:level7
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level8
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level9
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l1
        {mso-list-id:1067076114;
        mso-list-type:hybrid;
        mso-list-template-ids:1182407608 1393085978 201916419 201916421 201916417 201916419 201916421 201916417 201916419 201916421;}
@list l1:level1
        {mso-level-start-at:3;
        mso-level-number-format:bullet;
        mso-level-text:-;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:21.75pt;
        text-indent:-18.0pt;
        font-family:"Calibri","sans-serif";
        mso-fareast-font-family:"Times New Roman";
        mso-bidi-font-family:"Times New Roman";}
@list l1:level2
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:57.75pt;
        text-indent:-18.0pt;
        font-family:"Courier New";}
@list l1:level3
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:93.75pt;
        text-indent:-18.0pt;
        font-family:Wingdings;}
@list l1:level4
        {mso-level-number-format:bullet;
        mso-level-text:\F0B7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:129.75pt;
        text-indent:-18.0pt;
        font-family:Symbol;}
@list l1:level5
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:165.75pt;
        text-indent:-18.0pt;
        font-family:"Courier New";}
@list l1:level6
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:201.75pt;
        text-indent:-18.0pt;
        font-family:Wingdings;}
@list l1:level7
        {mso-level-number-format:bullet;
        mso-level-text:\F0B7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:237.75pt;
        text-indent:-18.0pt;
        font-family:Symbol;}
@list l1:level8
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:273.75pt;
        text-indent:-18.0pt;
        font-family:"Courier New";}
@list l1:level9
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:309.75pt;
        text-indent:-18.0pt;
        font-family:Wingdings;}
ol
        {margin-bottom:0cm;}
ul
        {margin-bottom:0cm;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
      <div class="WordSection1">
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU"
            lang="EN-US">Dear TRNSYS users,<o:p></o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU"
            lang="EN-US">I have a problem, when I try to use the storage
            array in TRNSYS using the specific funcions (setstoragesize
            , getstoragevars, setstoragevars). I created a new type and
            use the type65d to see the results while the simulation is
            running. The main problem is that the type on itself works
            properly without any error, but as soon as I link their
            outputs to the input of the online plotter, I obtained a
            “invalid floating point operation” error at the initial
            timestep, forcing the simulation to stop. Also if the two
            types are not linked, it give me the error. Only if I set
            the number of right and left axis variables both to 0, the
            simulation runs properly.<o:p></o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU"
            lang="EN-US">This error has been encountered by others too
            (e.g.
            <a moz-do-not-send="true"
href="http://lists.onebuilding.org/pipermail/trnsys-users-onebuilding.org/2013-April/011470.html">http://lists.onebuilding.org/pipermail/trnsys-users-onebuilding.org/2013-April/011470.html</a>
            ,
            <a moz-do-not-send="true"
href="http://lists.onebuilding.org/pipermail/trnsys-users-onebuilding.org/2012-February/009376.html">http://lists.onebuilding.org/pipermail/trnsys-users-onebuilding.org/2012-February/009376.html</a>
            ,
            <a moz-do-not-send="true"
href="http://lists.onebuilding.org/pipermail/trnsys-users-onebuilding.org/2010-July/006481.html">http://lists.onebuilding.org/pipermail/trnsys-users-onebuilding.org/2010-July/006481.html</a>
            ).<o:p></o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU"
            lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU"
            lang="EN-US">TRNSYS version: 17 OS: Windows 7 64bit, the
            type is compiled as .cpp with Microsoft Visual Studio
            Express 2012 and linked as .dll<o:p></o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU"
            lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU"
            lang="EN-US">TRNSYS.h has been modified to include the
            storage functions:<o:p></o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU">extern
            "C" __declspec(dllimport) double         _cdecl
            SETSTORAGESIZE(int* NSTORE,int info[]);<o:p></o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU">extern
            "C" __declspec(dllimport) double         _cdecl
            SETSTORAGEVARS(double* STORE_IN,int* NSTORE,int info[]);<o:p></o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU">extern
            "C" __declspec(dllimport) double         _cdecl
            GETSTORAGEVARS(double* STORE_OUT,int* NSTORE,int info[]);<o:p></o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU">#define
            SetStorageSize                                               
            SETSTORAGESIZE<o:p></o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU">#define
            SetStorageVars                                              
            SETSTORAGEVARS<o:p></o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU">#define
            GetStorageVars                                             
            GETSTORAGEVARS</span><span
            style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU"
            lang="EN-US"><o:p></o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU"
            lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU"
            lang="EN-US">Below there is a description of my type:<o:p></o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU"
            lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU"
            lang="EN-US">In order to make it simple I created a
            simplified version that takes as input one temperature, as
            parameters the number of nodes of the tube and the shell and
            the initial temperaure, and produces 4 outputs, outlet tube
            temperture and 3 temperatures in the shell. The role of the
            type is to increase the temperatures of the tube and the
            shell by 1, every timestep. The heat exchanger is modelled
            as vary layers (like a storage tank), set by the heat
            transferfluid (htf) nodes.<o:p></o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU"
            lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU"
            lang="EN-US">The purpose of the type is to simulate a shell
            and tube heat exchanger, thus I need to store the “old”
            values at the very end of the timestep into the storage
            arrays, and retrieve them every call of the type. In order
            to simplify the problem let’s assume a single tube in a
            shell.<o:p></o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU"
            lang="EN-US">In order to understand the general idea, I
            should say that I need to use the dynamic allocation in
            order to create the arrays based on the number of nodes,
            defined by the user, in the parameters. Once the user sets
            as parameters the nodes along the tubes direction
            (nodes_htf) and along the radial direction in the shell
            (nodes_shell), a vector for the tube temperatures and a
            matrix (nodes_htf x nodes_shell) for the shell temperatures
            should be created.<o:p></o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU"
            lang="EN-US">I implemented the following steps, compiling
            each time and check the simulation run in trnsys:<o:p></o:p></span></p>
        <p class="MsoListParagraph"
          style="text-indent:-18.0pt;line-height:115%;mso-list:l0 level1
          lfo1">
          <!--[if !supportLists]--><span
            style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU"
            lang="EN-US"><span style="mso-list:Ignore">1.<span
                style="font:7.0pt "Times New Roman"">   
              </span></span></span><!--[endif]--><span
            style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU"
            lang="EN-US">I set up the dimension of the storage array in
            the section “very first call of the simulation” (it works
            perfectly but of course the type does do anything)<o:p></o:p></span></p>
        <p class="MsoListParagraph" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;font-family:"Times
            New
            Roman","serif";mso-fareast-language:EN-AU"
            lang="EN-US">                   int store_size =
            nodes_htf*(nodes_shell+1); //set the storage size to store
            Nhtf + Nhtf * Nshell temperatures<o:p></o:p></span></p>
        <p class="MsoListParagraph" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;font-family:"Times
            New
            Roman","serif";mso-fareast-language:EN-AU"
            lang="EN-US">                  
            SetStorageSize(&store_size,info);<o:p></o:p></span></p>
        <p class="MsoListParagraph"
          style="text-indent:-18.0pt;line-height:115%;mso-list:l0 level1
          lfo1">
          <!--[if !supportLists]--><span
            style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU"
            lang="EN-US"><span style="mso-list:Ignore">2.<span
                style="font:7.0pt "Times New Roman"">   
              </span></span></span><!--[endif]--><span
            style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU"
            lang="EN-US">I set up the initial values of the outputs and
            store them in the section “do all the initial timestep
            manipulations” (it works perfectly but of course the type
            does do anything)<o:p></o:p></span></p>
        <p class="MsoListParagraph" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;font-family:"Times
            New
            Roman","serif";mso-fareast-language:EN-AU"
            lang="EN-US">                             int store_size =
            nodes_htf*(nodes_shell+1);<o:p></o:p></span></p>
        <p class="MsoListParagraph" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;font-family:"Times
            New
            Roman","serif";mso-fareast-language:EN-AU"
            lang="EN-US">                             stored = new
            double[store_size];<o:p></o:p></span></p>
        <p class="MsoListParagraph" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;font-family:"Times
            New
            Roman","serif";mso-fareast-language:EN-AU"
            lang="EN-US">                             for(int
            i=0;i<store_size;i++)<o:p></o:p></span></p>
        <p class="MsoListParagraph" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;font-family:"Times
            New
            Roman","serif";mso-fareast-language:EN-AU"
            lang="EN-US">                             {<o:p></o:p></span></p>
        <p class="MsoListParagraph" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;font-family:"Times
            New
            Roman","serif";mso-fareast-language:EN-AU"
            lang="EN-US">                                     
            stored[i]=Tini;<o:p></o:p></span></p>
        <p class="MsoListParagraph" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;font-family:"Times
            New
            Roman","serif";mso-fareast-language:EN-AU"
            lang="EN-US">                             }<o:p></o:p></span></p>
        <p class="MsoListParagraph" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;font-family:"Times
            New
            Roman","serif";mso-fareast-language:EN-AU"
            lang="EN-US">                            
            SetStorageVars(stored,&store_size,info);<o:p></o:p></span></p>
        <p class="MsoListParagraph" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;font-family:"Times
            New
            Roman","serif";mso-fareast-language:EN-AU"
            lang="EN-US">                             delete[] stored;<o:p></o:p></span></p>
        <p class="MsoListParagraph"
          style="text-indent:-18.0pt;line-height:115%;mso-list:l0 level1
          lfo1">
          <!--[if !supportLists]--><span
            style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU"
            lang="EN-US"><span style="mso-list:Ignore">3.<span
                style="font:7.0pt "Times New Roman"">   
              </span></span></span><!--[endif]--><span
            style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU"
            lang="EN-US">I retrieve the storage values on before make
            chenge to them, section “Retrieve the values in the storage
            array for this iteration” (if I use the type alonein the
            deck it works perfectly, but as soon as I introduce the
            type65 it gives the
            <u>floating point error!!!</u>).<o:p></o:p></span></p>
        <p class="MsoListParagraph" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;font-family:"Times
            New
            Roman","serif";mso-fareast-language:EN-AU"
            lang="EN-US">            int store_size =
            nodes_htf*(nodes_shell+1);<o:p></o:p></span></p>
        <p class="MsoListParagraph" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;font-family:"Times
            New
            Roman","serif";mso-fareast-language:EN-AU"
            lang="EN-US">            stored = new double[store_size];<o:p></o:p></span></p>
        <p class="MsoListParagraph" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;font-family:"Times
            New
            Roman","serif";mso-fareast-language:EN-AU"
            lang="EN-US">           
            GetStorageVars(stored,&store_size,info);<o:p></o:p></span></p>
        <p class="MsoListParagraph" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;font-family:"Times
            New
            Roman","serif";mso-fareast-language:EN-AU"
            lang="EN-US">            delete[] stored;<o:p></o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU"
            lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU"
            lang="EN-US">The files are attached:<o:p></o:p></span></p>
        <p class="MsoListParagraph"
          style="margin-left:21.75pt;text-indent:-18.0pt;line-height:115%;mso-list:l1
          level1 lfo2">
          <!--[if !supportLists]--><span
            style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU"
            lang="EN-US"><span style="mso-list:Ignore">-<span
                style="font:7.0pt "Times New Roman"">        
              </span></span></span><!--[endif]--><span
            style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU"
            lang="EN-US">Type205 cpp<o:p></o:p></span></p>
        <p class="MsoListParagraph"
          style="margin-left:21.75pt;text-indent:-18.0pt;line-height:115%;mso-list:l1
          level1 lfo2">
          <!--[if !supportLists]--><span
            style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU"
            lang="EN-US"><span style="mso-list:Ignore">-<span
                style="font:7.0pt "Times New Roman"">        
              </span></span></span><!--[endif]--><span
            style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU"
            lang="EN-US">Project6: deck with type alone<o:p></o:p></span></p>
        <p class="MsoListParagraph"
          style="margin-left:21.75pt;text-indent:-18.0pt;line-height:115%;mso-list:l1
          level1 lfo2">
          <!--[if !supportLists]--><span
            style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU"
            lang="EN-US"><span style="mso-list:Ignore">-<span
                style="font:7.0pt "Times New Roman"">        
              </span></span></span><!--[endif]--><span
            style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU"
            lang="EN-US">Project7: deck with type205 + type65<o:p></o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU"
            lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU"
            lang="EN-US">Thank you for the help. In you need to
            understand the purpose, you can read the next steps here
            below (which are commented in the type205 code):<o:p></o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU"
            lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoListParagraph"
          style="text-indent:-18.0pt;line-height:115%;mso-list:l0 level1
          lfo1">
          <!--[if !supportLists]--><span
            style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU"
            lang="EN-US"><span style="mso-list:Ignore">4.<span
                style="font:7.0pt "Times New Roman"">   
              </span></span></span><!--[endif]--><span
            style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU"
            lang="EN-US">I save the storage values in the “old” arrays
            for the htf and the shell<o:p></o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;font-family:"Times
            New
            Roman","serif";mso-fareast-language:EN-AU"
            lang="EN-US">            Thtf_old = new double [nodes_htf];<o:p></o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;font-family:"Times
            New
            Roman","serif";mso-fareast-language:EN-AU"
            lang="EN-US">            Tshell_old = new double
            *[nodes_htf];<o:p></o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;font-family:"Times
            New
            Roman","serif";mso-fareast-language:EN-AU"
            lang="EN-US">            for (int
            i=0;i<nodes_htf;i++){Tshell_old[i]=new
            double[nodes_shell];}<o:p></o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;font-family:"Times
            New
            Roman","serif";mso-fareast-language:EN-AU"
            lang="EN-US">            //assign the storage values to the
            old array<o:p></o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;font-family:"Times
            New
            Roman","serif";mso-fareast-language:EN-AU"
            lang="EN-US">            for (int i=0;i<nodes_htf;i++)<o:p></o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;font-family:"Times
            New
            Roman","serif";mso-fareast-language:EN-AU"
            lang="EN-US">            {<o:p></o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;font-family:"Times
            New
            Roman","serif";mso-fareast-language:EN-AU"
            lang="EN-US">                     Thtf_old[i] =
            stored[i*(nodes_shell+1)];// the values are supposed to be
            stored per layer so the first value is for the HTF and the
            others are for the shell<o:p></o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;font-family:"Times
            New
            Roman","serif";mso-fareast-language:EN-AU"
            lang="EN-US">                     for (int
            j=1;j<nodes_shell+1;j++)<o:p></o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;font-family:"Times
            New
            Roman","serif";mso-fareast-language:EN-AU"
            lang="EN-US">                     {<o:p></o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;font-family:"Times
            New
            Roman","serif";mso-fareast-language:EN-AU"
            lang="EN-US">                              
            Tshell_old[i][j-1] = stored[i*(nodes_shell+1)+j];<o:p></o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;font-family:"Times
            New
            Roman","serif";mso-fareast-language:EN-AU"
            lang="EN-US">                     }<o:p></o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;font-family:"Times
            New
            Roman","serif";mso-fareast-language:EN-AU"
            lang="EN-US">            }<o:p></o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;font-family:"Times
            New
            Roman","serif";mso-fareast-language:EN-AU"
            lang="EN-US">            delete[] stored;<o:p></o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU"
            lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoListParagraph"
          style="text-indent:-18.0pt;line-height:115%;mso-list:l0 level1
          lfo1">
          <!--[if !supportLists]--><span
            style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU"
            lang="EN-US"><span style="mso-list:Ignore">5.<span
                style="font:7.0pt "Times New Roman"">   
              </span></span></span><!--[endif]--><span
            style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU"
            lang="EN-US">I create the new values arrays at the first
            iteration for the current timestep (info[6] = 0, otherwise
            if every I create them every call I allocate too much
            memory), and calculate the new values from the old ones and
            set the outputs<o:p></o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;font-family:"Times
            New
            Roman","serif";mso-fareast-language:EN-AU">         
              if (info[6] == 0)<o:p></o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;font-family:"Times
            New
            Roman","serif";mso-fareast-language:EN-AU">         
              {<o:p></o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;font-family:"Times
            New
            Roman","serif";mso-fareast-language:EN-AU">                  
              Thtf = new double[nodes_htf];<o:p></o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;font-family:"Times
            New
            Roman","serif";mso-fareast-language:EN-AU">                  
              Tshell = new double *[nodes_htf];<o:p></o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;font-family:"Times
            New
            Roman","serif";mso-fareast-language:EN-AU">                  
              for (int i=0;i<nodes_htf;i++){Tshell[i] = new
            double[nodes_shell];}<o:p></o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;font-family:"Times
            New
            Roman","serif";mso-fareast-language:EN-AU">         
              }<o:p></o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;font-family:"Times
            New
            Roman","serif";mso-fareast-language:EN-AU">         
              for (int i=0;i<nodes_htf;i++)<o:p></o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;font-family:"Times
            New
            Roman","serif";mso-fareast-language:EN-AU">         
              {<o:p></o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;font-family:"Times
            New
            Roman","serif";mso-fareast-language:EN-AU">                  
              Thtf[i] = Thtf_old[i] + 1.0;<o:p></o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;font-family:"Times
            New
            Roman","serif";mso-fareast-language:EN-AU">                  
              for (int j=0;j<nodes_shell;j++)<o:p></o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;font-family:"Times
            New
            Roman","serif";mso-fareast-language:EN-AU">                  
              {<o:p></o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;font-family:"Times
            New
            Roman","serif";mso-fareast-language:EN-AU">                            
              Tshell[i][j] = Tshell_old[i][j] + 1.0;<o:p></o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;font-family:"Times
            New
            Roman","serif";mso-fareast-language:EN-AU">                  
              }<o:p></o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;font-family:"Times
            New
            Roman","serif";mso-fareast-language:EN-AU">         
              }<o:p></o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;font-family:"Times
            New
            Roman","serif";mso-fareast-language:EN-AU">         
              delete[] Thtf_old;<o:p></o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;font-family:"Times
            New
            Roman","serif";mso-fareast-language:EN-AU">         
              for (int i=0;i<nodes_htf;i++){delete[] Tshell_old[i];}<o:p></o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;font-family:"Times
            New
            Roman","serif";mso-fareast-language:EN-AU">         
              delete[] Tshell_old;<o:p></o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;font-family:"Times
            New
            Roman","serif";mso-fareast-language:EN-AU"><o:p> </o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;font-family:"Times
            New
            Roman","serif";mso-fareast-language:EN-AU">         
              //Set the outputs<o:p></o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;font-family:"Times
            New
            Roman","serif";mso-fareast-language:EN-AU">         
              Tout = Thtf[nodes_htf-1];<o:p></o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;font-family:"Times
            New
            Roman","serif";mso-fareast-language:EN-AU">         
              Tshell_top = Tshell[0][nodes_shell-1];<o:p></o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;font-family:"Times
            New
            Roman","serif";mso-fareast-language:EN-AU">         
              Tshell_mid =
            Tshell[int(floor(nodes_htf/2.0))-1][nodes_shell-1];<o:p></o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;font-family:"Times
            New
            Roman","serif";mso-fareast-language:EN-AU">         
              Tshell_bot = Tshell[nodes_htf-1][nodes_shell-1];<o:p></o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU"><o:p> </o:p></span></p>
        <p class="MsoListParagraph"
          style="text-indent:-18.0pt;line-height:115%;mso-list:l0 level1
          lfo1">
          <!--[if !supportLists]--><span
            style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU"
            lang="EN-US"><span style="mso-list:Ignore">6.<span
                style="font:7.0pt "Times New Roman"">   
              </span></span></span><!--[endif]--><span
            style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU"
            lang="EN-US">I save the new values in the trnsys storage
            array in the after iteration section in oder to make them
            available for the next time step iterations. I should save
            in that section otherwise every call the type would retrieve
            the wrong values.<o:p></o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;font-family:"Times
            New
            Roman","serif";mso-fareast-language:EN-AU"
            lang="EN-US">                     int store_size =
            nodes_htf*(nodes_shell+1);<o:p></o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;font-family:"Times
            New
            Roman","serif";mso-fareast-language:EN-AU"
            lang="EN-US">                     stored = new
            double[store_size];<o:p></o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;font-family:"Times
            New
            Roman","serif";mso-fareast-language:EN-AU"
            lang="EN-US">                     for (int i = 0; i <
            nodes_htf; i++)<o:p></o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;font-family:"Times
            New
            Roman","serif";mso-fareast-language:EN-AU"
            lang="EN-US">                     {<o:p></o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;font-family:"Times
            New
            Roman","serif";mso-fareast-language:EN-AU"
            lang="EN-US">                              
            stored[i*(nodes_shell+1)] = Thtf[i];<o:p></o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;font-family:"Times
            New
            Roman","serif";mso-fareast-language:EN-AU"
            lang="EN-US">                               for (int
            j=1;j<nodes_shell+1;j++)<o:p></o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;font-family:"Times
            New
            Roman","serif";mso-fareast-language:EN-AU"
            lang="EN-US">                               {<o:p></o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;font-family:"Times
            New
            Roman","serif";mso-fareast-language:EN-AU"
            lang="EN-US">                                       
            stored[i*(nodes_shell+1)+j] = Tshell[i][j-1];<o:p></o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;font-family:"Times
            New
            Roman","serif";mso-fareast-language:EN-AU"
            lang="EN-US">                               }<o:p></o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;font-family:"Times
            New
            Roman","serif";mso-fareast-language:EN-AU"
            lang="EN-US">                     }<o:p></o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;font-family:"Times
            New
            Roman","serif";mso-fareast-language:EN-AU"
            lang="EN-US">                     delete[] Thtf;<o:p></o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;font-family:"Times
            New
            Roman","serif";mso-fareast-language:EN-AU"
            lang="EN-US">                     for(int
            i=0;i<nodes_htf;i++){delete[] Tshell[i];}<o:p></o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;font-family:"Times
            New
            Roman","serif";mso-fareast-language:EN-AU"
            lang="EN-US">                     delete[] Tshell;<o:p></o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;font-family:"Times
            New
            Roman","serif";mso-fareast-language:EN-AU"
            lang="EN-US">                    
            SetStorageVars(stored,&store_size,info);<o:p></o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;font-family:"Times
            New
            Roman","serif";mso-fareast-language:EN-AU"
            lang="EN-US">                     delete[] stored;<o:p></o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU"
            lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal" style="margin-top:12.0pt;line-height:115%"><span
style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU"
            lang="EN-US">Thank you very much for the help!
          </span><span
style="font-size:16.0pt;line-height:115%;font-family:Wingdings;mso-fareast-language:EN-AU"
            lang="EN-US">J</span><span
            style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU"
            lang="EN-US"><o:p></o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU"
            lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU"
            lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal" style="line-height:115%"><span
            style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU"
            lang="EN-US">Sergio Pintaldi<o:p></o:p></span></p>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
TRNSYS-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:TRNSYS-users@lists.onebuilding.org">TRNSYS-users@lists.onebuilding.org</a>
<a class="moz-txt-link-freetext" href="http://lists.onebuilding.org/listinfo.cgi/trnsys-users-onebuilding.org">http://lists.onebuilding.org/listinfo.cgi/trnsys-users-onebuilding.org</a>
</pre>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
***************************
David BRADLEY
Principal
Thermal Energy Systems Specialists, LLC
22 North Carroll Street - suite 370
Madison, WI  53703 USA

P:+1.608.274.2577
F:+1.608.278.1475
<a class="moz-txt-link-abbreviated" href="mailto:d.bradley@tess-inc.com">d.bradley@tess-inc.com</a>

<a class="moz-txt-link-freetext" href="http://www.tess-inc.com">http://www.tess-inc.com</a>
<a class="moz-txt-link-freetext" href="http://www.trnsys.com">http://www.trnsys.com</a></pre>
  </body>
</html>