<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" id="owaParaStyle"></style>
</head>
<body fpstyle="1" ocsi="0">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">
<div>
<div>Dear TRNSYS users,</div>
<div><br>
</div>
<div>I am modelling a 3D multizone building with Type 56. In my deck file I have 3 different MATLAB Type 155 units which do all the same thing: increase a step variable by 1 each time step (just for debugging). The variable names are all different as I know
 the 3 .m files share the same workspace. I output the step counter each time step and they all go up 1 at a time, as you can see in the output file (I hope the formatting turns out alright):</div>
<div><br>
</div>
<div>
<div style="font-size: 13.3333px;"> TIME                    <span style="white-space: pre;">
</span>counter_1              <span style="white-space:pre"></span>  <span style="white-space: pre;">
</span>counter_2             <span style="white-space:pre"> </span>       <span style="white-space: pre;">
</span>counter_3 <span style="white-space: pre;"> </span></div>
<div style="font-size: 13.3333px;">  +0.0000000000000000E+00<span style="white-space: pre;">
</span>  +1.0000000000000000E+00<span style="white-space: pre;"> </span>  +1.0000000000000000E+00<span style="white-space: pre;">
</span>  +1.0000000000000000E+00<span style="white-space: pre;"> </span></div>
<div style="font-size: 13.3333px;">  +1.0000000000000000E+00<span style="white-space: pre;">
</span>  +2.0000000000000000E+00<span style="white-space: pre;"> </span>  +2.0000000000000000E+00<span style="white-space: pre;">
</span>  +2.0000000000000000E+00<span style="white-space: pre;"> </span></div>
<div style="font-size: 13.3333px;">  +2.0000000000000000E+00<span style="white-space: pre;">
</span>  +3.0000000000000000E+00<span style="white-space: pre;"> </span>  +3.0000000000000000E+00<span style="white-space: pre;">
</span>  +3.0000000000000000E+00<span style="white-space: pre;"> </span></div>
<div style="font-size: 13.3333px;">  +3.0000000000000000E+00<span style="white-space: pre;">
</span>  +4.0000000000000000E+00<span style="white-space: pre;"> </span>  +4.0000000000000000E+00<span style="white-space: pre;">
</span>  +4.0000000000000000E+00<span style="white-space: pre;"> </span></div>
</div>
<div><br>
</div>
<div><br>
</div>
<div>But when I now connect Type 56 (e.g. some air node temp) output to one of the MATLAB Type 155 (counter_1) as an input, I get a different results:</div>
<div><br>
</div>
<div>
<div> TIME                    <span style="white-space:pre"></span><span style="white-space:pre"></span>counter_1           
<span style="white-space:pre"></span>    <span style="white-space:pre"></span>counter_2               <span style="white-space:pre">
</span><span style="white-space:pre"></span>counter_3 <span style="white-space:pre">
</span></div>
<div>  +0.0000000000000000E+00<span style="white-space:pre"> </span>  +1.0000000000000000E+00<span style="white-space:pre">
</span>  +1.0000000000000000E+00<span style="white-space:pre"> </span>  +1.0000000000000000E+00<span style="white-space:pre">
</span></div>
<div>  +1.0000000000000000E+00<span style="white-space:pre"> </span>  +3.0000000000000000E+00<span style="white-space:pre">
</span>  +2.0000000000000000E+00<span style="white-space:pre"> </span>  +2.0000000000000000E+00<span style="white-space:pre">
</span></div>
<div>  +2.0000000000000000E+00<span style="white-space:pre"> </span>  +4.0000000000000000E+00<span style="white-space:pre">
</span>  +3.0000000000000000E+00<span style="white-space:pre"> </span>  +3.0000000000000000E+00<span style="white-space:pre">
</span></div>
<div>  +3.0000000000000000E+00<span style="white-space:pre"> </span>  +5.0000000000000000E+00<span style="white-space:pre">
</span>  +4.0000000000000000E+00<span style="white-space:pre"> </span>  +4.0000000000000000E+00</div>
</div>
</div>
<div><br>
</div>
<div><br>
</div>
<div>Counter_1 goes from 1 directly to 3. It seems as if the iterative call in that MATLAB unit is done twice, therefore going from 1 to 3, before outputting 3 as a result. But only after the first call and then never again?</div>
<div><br>
</div>
<div>I made sure to read my inputs in each MATLAB like this,</div>
<div><br>
</div>
<div>file1:</div>
<div>MyInputs1 = trnInputs(1:nI);</div>
<div><br>
</div>
<div>file2:</div>
<div><span style="font-size: 13.3333px;">MyInputs2 = trnInputs(1:nI);</span></div>
<div><span style="font-size: 13.3333px;"><br>
</span></div>
<div><span style="font-size: 13.3333px;">file3:</span></div>
<div><span style="font-size: 13.3333px;">MyInputs3 = trnInputs(1:nI);</span></div>
<div><span style="font-size: 13.3333px;"><br>
</span></div>
<div><span style="font-size: 13.3333px;"><br>
</span></div>
<div>as is stated in the example file. Same goes for the outputs.</div>
<div><br>
</div>
<div>What am I missing here? Why is a Type 56 output looping my iterative MATLAB step twice after the first timestep? Is it not advised to have multiple MATLAB units in the deck file?</div>
<div><br>
</div>
<div>Any help is appreciated.</div>
<div><br>
</div>
<div>Best regards,</div>
<div><br>
</div>
<div>Daniel Weber</div>
<div><br>
</div>
<div>PS: This is regarding the topic "<span style="background-color: rgb(255, 255, 255); font-family: "Segoe UI", Helvetica, Arial, sans-serif; font-size: 13px;">Surface Gain Inside - Pane Temp Error" that I've asked before. I've narrowed it down to this now,
 so you can close the other one.</span></div>
</div>
</body>
</html>