<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>i think i found the problem, even though i do not understand it properly. I had these lines in the program:<div><span style="font-size: 12pt;"><br></span></div><div><span style="font-size: 12pt;">fid=fopen('outputfile.txt','a');</span></div><div><span style="font-size: 12pt;">fprintf(fid,'1) Beginning of time (t=%.1f);\n%f\n',trnTime);</span><div><div>fprintf(fid,'%.2f\n',trnInputs(2));</div><div><br></div><div>looping everytime. 'a' mode in fopen (creates or open a file and append to the already existing content). TRNSYS code was running for 1-2 times and then crashing in the middle of any additional simulation. Like it was kind of "overflow" in the output file, although it is not significantly big.</div><div><br></div><div>now i open the file only once in 'w+' mode in the section </div><div><br></div><div>if ((trnInfo(7)==0) && (trnTime-trnStartTime<1e-6) )  </div><div>      fid1=fopen('CheckFile.txt','w+');</div><div>end'</div><div><br></div><div>and then write on it an any trnsys call. the problems seems to be fixed ;-)</div><div><br></div><div>Thanks anyway</div><div><br>Federico</div></div></div><br><div><hr id="stopSpelling">Date: Mon, 6 Jul 2015 10:07:03 -0500<br>From: d.bradley@tess-inc.com<br>To: trnsys-users@lists.onebuilding.org; thunderfactory@hotmail.it<br>Subject: Re: [TRNSYS-users] random error when using Type155<br><br>
  
    
  
  
    It sounds a little bit as though some other program is performing an
    action that causes the Windows "current directory" to change in the
    middle of your simulation. I have not heard anyone else reporting
    such behavior and I am afraid that I don't have any suggestions for
    how to work around it except to try and close down as many other
    programs as possible and perhaps even disconnect from the internet
    before running the simulation just to see if that solves the
    problem.<br>
    kind regards,<br>
     David<br>
    <br>
    <br>
    <div class="ecxmoz-cite-prefix">On 07/06/2015 02:17, -- Fed -- wrote:<br>
    </div>
    <blockquote cite="mid:DUB126-W4187EC46FAB8C8E717B05AB3930@phx.gbl">
      <style><!--
.ExternalClass .ecxhmmessage P {
padding:0px;
}

.ExternalClass body.ecxhmmessage {
font-size:12pt;
font-family:Calibri;
}

--></style>
      <div dir="ltr">Hi everyone,
        <div>i am using Type 155 to make a trnsys file interact with a
          matlab script, but i get a really weird and random error.</div>
        <div>I make the trnsys file run and usually it works without
          problems. i make it run another couple of times and still
          works, but at some point, after 2/3 runs the file crashes
          immediately and returns the  error "Error(s) in calling the
          M-File"<span style="font-size:12pt;"> with no other info.</span></div>
        <div><span style="font-size:12pt;">I need to close and restart
            trnsys to make it work again. </span><span style="font-size:12pt;">Has anyone experienced the problem and knows how to
            solve it?</span></div>
        <div><span style="font-size:12pt;">thank you in advance!</span></div>
      </div>
      <br>
      <fieldset class="ecxmimeAttachmentHeader"></fieldset>
      <br>
      <pre>_______________________________________________
TRNSYS-users mailing list
<a class="ecxmoz-txt-link-abbreviated" href="mailto:TRNSYS-users@lists.onebuilding.org">TRNSYS-users@lists.onebuilding.org</a>
<a class="ecxmoz-txt-link-freetext" href="http://lists.onebuilding.org/listinfo.cgi/trnsys-users-onebuilding.org" target="_blank">http://lists.onebuilding.org/listinfo.cgi/trnsys-users-onebuilding.org</a>
</pre>
    </blockquote>
    <br>
    <pre class="ecxmoz-signature">-- 
***************************
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="ecxmoz-txt-link-abbreviated" href="mailto:d.bradley@tess-inc.com">d.bradley@tess-inc.com</a>

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