[TRNSYS-users] MATLAB iterative part loops twice in one timestep

Weber Daniel webedani at student.ethz.ch
Thu Aug 9 16:22:07 PDT 2018


Dear TRNSYS users,

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):

TIME

counter_1

counter_2

counter_3

0.00E+00

1.00E+00

1.00E+00

1.00E+00

1.00E+00

2.00E+00

2.00E+00

2.00E+00

2.00E+00

3.00E+00

3.00E+00

3.00E+00

3.00E+00

4.00E+00

4.00E+00

4.00E+00


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:

TIME

counter_1

counter_2

counter_3

0.00E+00

1.00E+00

1.00E+00

1.00E+00

1.00E+00

3.00E+00

2.00E+00

2.00E+00

2.00E+00

4.00E+00

3.00E+00

3.00E+00

3.00E+00

5.00E+00

4.00E+00

4.00E+00


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?

I made sure to read my inputs in each MATLAB like this,

file1:
MyInputs1 = trnInputs(1:nI);

file2:
MyInputs2 = trnInputs(1:nI);

file3:
MyInputs3 = trnInputs(1:nI);


as is stated in the example file. Same goes for the outputs.

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?

Any help is appreciated.

Best regards,

Daniel Weber

PS: This is regarding the topic "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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.onebuilding.org/pipermail/trnsys-users-onebuilding.org/attachments/20180809/712acdc3/attachment-0001.html>


More information about the TRNSYS-users mailing list