<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<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]-->
</head>
<body lang="EN-AU" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal" style="line-height:115%"><span lang="EN-US" style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU">Dear TRNSYS users,<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:115%"><span lang="EN-US" style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU">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 lang="EN-US" style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU">This error has been encountered by others too (e.g.
<a 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 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 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 lang="EN-US" style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU"><o:p> </o:p></span></p>
<p class="MsoNormal" style="line-height:115%"><span lang="EN-US" style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU">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 lang="EN-US" style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU"><o:p> </o:p></span></p>
<p class="MsoNormal" style="line-height:115%"><span lang="EN-US" style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU">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 lang="EN-US" style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU"><o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:115%"><span lang="EN-US" style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU"><o:p> </o:p></span></p>
<p class="MsoNormal" style="line-height:115%"><span lang="EN-US" style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU">Below there is a description of my type:<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:115%"><span lang="EN-US" style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU"><o:p> </o:p></span></p>
<p class="MsoNormal" style="line-height:115%"><span lang="EN-US" style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU">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 lang="EN-US" style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU"><o:p> </o:p></span></p>
<p class="MsoNormal" style="line-height:115%"><span lang="EN-US" style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU">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 lang="EN-US" style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU">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 lang="EN-US" style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU">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 lang="EN-US" style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU"><span style="mso-list:Ignore">1.<span style="font:7.0pt "Times New Roman"">   
</span></span></span><![endif]><span lang="EN-US" style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU">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 lang="EN-US" style="font-size:16.0pt;line-height:115%;font-family:"Times New Roman","serif";mso-fareast-language:EN-AU">                   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 lang="EN-US" style="font-size:16.0pt;line-height:115%;font-family:"Times New Roman","serif";mso-fareast-language:EN-AU">                   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 lang="EN-US" style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU"><span style="mso-list:Ignore">2.<span style="font:7.0pt "Times New Roman"">   
</span></span></span><![endif]><span lang="EN-US" style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU">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 lang="EN-US" style="font-size:16.0pt;line-height:115%;font-family:"Times New Roman","serif";mso-fareast-language:EN-AU">                             int store_size = nodes_htf*(nodes_shell+1);<o:p></o:p></span></p>
<p class="MsoListParagraph" style="line-height:115%"><span lang="EN-US" style="font-size:16.0pt;line-height:115%;font-family:"Times New Roman","serif";mso-fareast-language:EN-AU">                             stored = new double[store_size];<o:p></o:p></span></p>
<p class="MsoListParagraph" style="line-height:115%"><span lang="EN-US" style="font-size:16.0pt;line-height:115%;font-family:"Times New Roman","serif";mso-fareast-language:EN-AU">                             for(int i=0;i<store_size;i++)<o:p></o:p></span></p>
<p class="MsoListParagraph" style="line-height:115%"><span lang="EN-US" 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="MsoListParagraph" style="line-height:115%"><span lang="EN-US" style="font-size:16.0pt;line-height:115%;font-family:"Times New Roman","serif";mso-fareast-language:EN-AU">                                      stored[i]=Tini;<o:p></o:p></span></p>
<p class="MsoListParagraph" style="line-height:115%"><span lang="EN-US" 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="MsoListParagraph" style="line-height:115%"><span lang="EN-US" style="font-size:16.0pt;line-height:115%;font-family:"Times New Roman","serif";mso-fareast-language:EN-AU">                             SetStorageVars(stored,&store_size,info);<o:p></o:p></span></p>
<p class="MsoListParagraph" style="line-height:115%"><span lang="EN-US" style="font-size:16.0pt;line-height:115%;font-family:"Times New Roman","serif";mso-fareast-language:EN-AU">                             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 lang="EN-US" style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU"><span style="mso-list:Ignore">3.<span style="font:7.0pt "Times New Roman"">   
</span></span></span><![endif]><span lang="EN-US" style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU">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 lang="EN-US" style="font-size:16.0pt;line-height:115%;font-family:"Times New Roman","serif";mso-fareast-language:EN-AU">            int store_size = nodes_htf*(nodes_shell+1);<o:p></o:p></span></p>
<p class="MsoListParagraph" style="line-height:115%"><span lang="EN-US" style="font-size:16.0pt;line-height:115%;font-family:"Times New Roman","serif";mso-fareast-language:EN-AU">            stored = new double[store_size];<o:p></o:p></span></p>
<p class="MsoListParagraph" style="line-height:115%"><span lang="EN-US" style="font-size:16.0pt;line-height:115%;font-family:"Times New Roman","serif";mso-fareast-language:EN-AU">            GetStorageVars(stored,&store_size,info);<o:p></o:p></span></p>
<p class="MsoListParagraph" style="line-height:115%"><span lang="EN-US" style="font-size:16.0pt;line-height:115%;font-family:"Times New Roman","serif";mso-fareast-language:EN-AU">            delete[] stored;<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:115%"><span lang="EN-US" style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU"><o:p> </o:p></span></p>
<p class="MsoNormal" style="line-height:115%"><span lang="EN-US" style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU">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 lang="EN-US" style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU"><span style="mso-list:Ignore">-<span style="font:7.0pt "Times New Roman"">        
</span></span></span><![endif]><span lang="EN-US" style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU">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 lang="EN-US" style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU"><span style="mso-list:Ignore">-<span style="font:7.0pt "Times New Roman"">        
</span></span></span><![endif]><span lang="EN-US" style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU">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 lang="EN-US" style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU"><span style="mso-list:Ignore">-<span style="font:7.0pt "Times New Roman"">        
</span></span></span><![endif]><span lang="EN-US" style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU">Project7: deck with type205 + type65<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:115%"><span lang="EN-US" style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU"><o:p> </o:p></span></p>
<p class="MsoNormal" style="line-height:115%"><span lang="EN-US" style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU">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 lang="EN-US" 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 lang="EN-US" style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU"><span style="mso-list:Ignore">4.<span style="font:7.0pt "Times New Roman"">   
</span></span></span><![endif]><span lang="EN-US" style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU">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 lang="EN-US" style="font-size:16.0pt;line-height:115%;font-family:"Times New Roman","serif";mso-fareast-language:EN-AU">            Thtf_old = new double [nodes_htf];<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:115%"><span lang="EN-US" style="font-size:16.0pt;line-height:115%;font-family:"Times New Roman","serif";mso-fareast-language:EN-AU">            Tshell_old = new double *[nodes_htf];<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:115%"><span lang="EN-US" 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_old[i]=new double[nodes_shell];}<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:115%"><span lang="EN-US" style="font-size:16.0pt;line-height:115%;font-family:"Times New Roman","serif";mso-fareast-language:EN-AU">            //assign the storage values to the old array<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:115%"><span lang="EN-US" 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 lang="EN-US" 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 lang="EN-US" style="font-size:16.0pt;line-height:115%;font-family:"Times New Roman","serif";mso-fareast-language:EN-AU">                     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 lang="EN-US" style="font-size:16.0pt;line-height:115%;font-family:"Times New Roman","serif";mso-fareast-language:EN-AU">                     for (int j=1;j<nodes_shell+1;j++)<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:115%"><span lang="EN-US" 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 lang="EN-US" style="font-size:16.0pt;line-height:115%;font-family:"Times New Roman","serif";mso-fareast-language:EN-AU">                               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 lang="EN-US" 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 lang="EN-US" 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 lang="EN-US" style="font-size:16.0pt;line-height:115%;font-family:"Times New Roman","serif";mso-fareast-language:EN-AU">            delete[] stored;<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:115%"><span lang="EN-US" 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 lang="EN-US" style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU"><span style="mso-list:Ignore">5.<span style="font:7.0pt "Times New Roman"">   
</span></span></span><![endif]><span lang="EN-US" style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU">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 lang="EN-US" style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU"><span style="mso-list:Ignore">6.<span style="font:7.0pt "Times New Roman"">   
</span></span></span><![endif]><span lang="EN-US" style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU">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 lang="EN-US" style="font-size:16.0pt;line-height:115%;font-family:"Times New Roman","serif";mso-fareast-language:EN-AU">                     int store_size = nodes_htf*(nodes_shell+1);<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:115%"><span lang="EN-US" style="font-size:16.0pt;line-height:115%;font-family:"Times New Roman","serif";mso-fareast-language:EN-AU">                     stored = new double[store_size];<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:115%"><span lang="EN-US" 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 lang="EN-US" 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 lang="EN-US" style="font-size:16.0pt;line-height:115%;font-family:"Times New Roman","serif";mso-fareast-language:EN-AU">                               stored[i*(nodes_shell+1)] = Thtf[i];<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:115%"><span lang="EN-US" style="font-size:16.0pt;line-height:115%;font-family:"Times New Roman","serif";mso-fareast-language:EN-AU">                               for (int j=1;j<nodes_shell+1;j++)<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:115%"><span lang="EN-US" 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 lang="EN-US" style="font-size:16.0pt;line-height:115%;font-family:"Times New Roman","serif";mso-fareast-language:EN-AU">                                        stored[i*(nodes_shell+1)+j] = Tshell[i][j-1];<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:115%"><span lang="EN-US" 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 lang="EN-US" 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 lang="EN-US" style="font-size:16.0pt;line-height:115%;font-family:"Times New Roman","serif";mso-fareast-language:EN-AU">                     delete[] Thtf;<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:115%"><span lang="EN-US" 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[i];}<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:115%"><span lang="EN-US" style="font-size:16.0pt;line-height:115%;font-family:"Times New Roman","serif";mso-fareast-language:EN-AU">                     delete[] Tshell;<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:115%"><span lang="EN-US" style="font-size:16.0pt;line-height:115%;font-family:"Times New Roman","serif";mso-fareast-language:EN-AU">                     SetStorageVars(stored,&store_size,info);<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:115%"><span lang="EN-US" style="font-size:16.0pt;line-height:115%;font-family:"Times New Roman","serif";mso-fareast-language:EN-AU">                     delete[] stored;<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:115%"><span lang="EN-US" style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU"><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-top:12.0pt;line-height:115%"><span lang="EN-US" style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU">Thank you very much for the help!
</span><span lang="EN-US" style="font-size:16.0pt;line-height:115%;font-family:Wingdings;mso-fareast-language:EN-AU">J</span><span lang="EN-US" style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU"><o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:115%"><span lang="EN-US" style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU"><o:p> </o:p></span></p>
<p class="MsoNormal" style="line-height:115%"><span lang="EN-US" style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU"><o:p> </o:p></span></p>
<p class="MsoNormal" style="line-height:115%"><span lang="EN-US" style="font-size:16.0pt;line-height:115%;mso-fareast-language:EN-AU">Sergio Pintaldi<o:p></o:p></span></p>
</div>
</body>
</html>