<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=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@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;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
p.xmsonormal, li.xmsonormal, div.xmsonormal
        {mso-style-name:x_msonormal;
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
p.xxmsonormal, li.xxmsonormal, div.xxmsonormal
        {mso-style-name:x_xmsonormal;
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 2.0cm 2.0cm 2.0cm;}
div.WordSection1
        {page:WordSection1;}
--></style></head><body lang=IT link=blue vlink="#954F72"><div class=WordSection1><p class=MsoNormal><span style='font-size:10.5pt;font-family:"Arial",sans-serif;color:#111111;background:white'>I find that GenOpt rewrite the .dck file with all capital characters, so it changed the name to m-file, this is the origin of my problem.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.5pt;font-family:"Arial",sans-serif;color:#111111;background:white'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:10.5pt;font-family:"Arial",sans-serif;color:#111111;background:white'>Thanks all for the support.</span></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Elisa</p><p class=MsoNormal><o:p> </o:p></p><div style='mso-element:para-border-div;border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal style='border:none;padding:0cm'><b>Da: </b><a href="mailto:trnsys-users@lists.onebuilding.org">Riccardo Nesa via TRNSYS-users</a><br><b>Inviato: </b>lunedì 22 gennaio 2018 15:11<br><b>A: </b><a href="mailto:trnsys-users@lists.onebuilding.org">TRNSYS users mailing list at OneBuilding.org</a><br><b>Cc: </b><a href="mailto:riccardo_sas@hotmail.it">Riccardo Nesa</a><br><b>Oggetto: </b>Re: [TRNSYS-users] R: type 155 and GenOpt</p></div><p class=MsoNormal><o:p> </o:p></p><p><span style='font-size:12.0pt;color:black'>Maybe you are right;<o:p></o:p></span></p><p><span style='font-size:12.0pt;color:black'>you can read the help documentation of trnsys (mathematical reference, 4.13.20 type 155: calling matlab, pag. 451) for some clarification.<o:p></o:p></span></p><p><span style='font-size:12.0pt;color:black'>To avoid some problems i have installed matlab 2011b 32 bit with trnsys 17.<o:p></o:p></span></p><p><span style='font-size:12.0pt;color:black'>check trnsys17/exe/DLLs. there you can see the dlls for type 155. <o:p></o:p></span></p><p><span style='font-size:12.0pt;color:black'><img border=0 width=236 height=293 style='width:2.4583in;height:3.052in' id=img410476 src="cid:767d1ada-c3ec-4a20-9489-09bf067b6a59" alt="cid:767d1ada-c3ec-4a20-9489-09bf067b6a59"></span><span style='font-size:12.0pt;color:black'><o:p></o:p></span></p><p><span style='font-size:12.0pt;color:black'>if you don't see your matlab version i think the software can't work.<o:p></o:p></span></p><p><span style='font-size:12.0pt;color:black'>these are what i know, let me know if you can fix it.<o:p></o:p></span></p><p class=MsoNormal style='margin-bottom:12.0pt'><span style='font-size:12.0pt;color:black'><o:p> </o:p></span></p><div><p class=MsoNormal><span style='font-size:12.0pt;color:black'><img border=0 width=694 height=2 style='width:7.2291in;height:.0208in' id="Horizontal_x0020_Line_x0020_2" src="cid:image003.png@01D3969E.29907AD0"></span><span style='font-size:12.0pt;color:black'><o:p></o:p></span></p><div id=divRplyFwdMsg><p class=MsoNormal><b><span style='color:black'>Da:</span></b><span style='color:black'> TRNSYS-users <trnsys-users-bounces@lists.onebuilding.org> per conto di Elisa Ghirardi via TRNSYS-users <trnsys-users@lists.onebuilding.org><br><b>Inviato:</b> lunedì 22 gennaio 2018 14:35<br><b>A:</b> TRNSYS users mailing list at OneBuilding.org<br><b>Cc:</b> Elisa Ghirardi<br><b>Oggetto:</b> [TRNSYS-users] R: type 155 and GenOpt</span><span style='font-size:12.0pt;color:black'> <o:p></o:p></span></p><div><p class=MsoNormal><span style='font-size:12.0pt;color:black'> <o:p></o:p></span></p></div></div><div><div><p class=xmsonormal><span lang=EN-GB style='font-size:12.0pt;color:black'>thanks Riccardo for your reply and your help. </span><span style='font-size:12.0pt;color:black'><o:p></o:p></span></p><p class=xmsonormal><span lang=EN-GB style='font-size:12.0pt;color:black'>Unfortunately I have already set all the mFileErrorCode like your suggestion but I still have the same error.</span><span style='font-size:12.0pt;color:black'><o:p></o:p></span></p><p class=xmsonormal><span lang=EN-GB style='font-size:12.0pt;color:black'> </span><span style='font-size:12.0pt;color:black'><o:p></o:p></span></p><p class=xmsonormal><span lang=EN-GB style='font-size:12.0pt;color:black'>It would be an issue with a too recent version of Matlab? (I’m using a 64-bit version of Trnsys 18 (18.00.0016) with a 64-bit version of Matlab 2016a)</span><span style='font-size:12.0pt;color:black'><o:p></o:p></span></p><p class=xmsonormal><span style='font-size:12.0pt;color:black'> <o:p></o:p></span></p><p class=xmsonormal><span style='font-size:12.0pt;color:black'>Elisa Ghirardi<o:p></o:p></span></p><p class=xmsonormal><span style='font-size:12.0pt;color:black'> <o:p></o:p></span></p><div style='border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=xmsonormal><b><span style='font-size:12.0pt;color:black'>Da: </span></b><span style='font-size:12.0pt;color:black'><a href="mailto:trnsys-users@lists.onebuilding.org">Riccardo Nesa via TRNSYS-users</a><br><b>Inviato: </b>lunedì 22 gennaio 2018 12:13<br><b>A: </b><a href="mailto:trnsys-users@lists.onebuilding.org">TRNSYS users mailing list at OneBuilding.org</a><br><b>Cc: </b><a href="mailto:riccardo_sas@hotmail.it">Riccardo Nesa</a><br><b>Oggetto: </b>Re: [TRNSYS-users] type 155 and GenOpt<o:p></o:p></span></p></div><p class=xmsonormal><span style='font-size:12.0pt;color:black'> <o:p></o:p></span></p><p><span style='font-size:12.0pt;color:black'>Hi elisa<o:p></o:p></span></p><p><span style='font-size:12.0pt;color:black'> <o:p></o:p></span></p><p><span style='font-size:12.0pt;color:black'>you have to put "mFileErrorCode=some_number" in the m.file to get the point when your script fails and you MUST write "mFileErrorCode=0" at the end of the m.file.<o:p></o:p></span></p><p><span style='font-size:12.0pt;color:black'><img border=0 width=794 height=111 style='width:8.2708in;height:1.1562in' id="_x0000_i1026" src="cid:ec28adef-8cbc-4f0a-9b64-5e7b386b2d6f" alt="cid:ec28adef-8cbc-4f0a-9b64-5e7b386b2d6f"></span><span style='font-size:12.0pt;color:black'><o:p></o:p></span></p><p><span style='font-size:12.0pt;color:black'> <o:p></o:p></span></p><p><span style='font-size:12.0pt;color:black'> <o:p></o:p></span></p><p><span style='font-size:12.0pt;color:black'>you have to write <o:p></o:p></span></p><p><span style='font-size:12.0pt;color:black'> <o:p></o:p></span></p><p><span style='font-size:12.0pt;color:black'>"mFileErrorCode=0<o:p></o:p></span></p><p><span style='font-size:12.0pt;color:black'>return<o:p></o:p></span></p><p><span style='font-size:12.0pt;color:black'>"<o:p></o:p></span></p><p><span style='font-size:12.0pt;color:black'>also at the end of some particular  "if statment" like:<o:p></o:p></span></p><p><span style='font-size:12.0pt;color:black'> <o:p></o:p></span></p><p><span style='font-size:12.0pt;color:black'> <o:p></o:p></span></p><p><span style='font-size:12.0pt;color:black'>if trnInfo(8)==-1<o:p></o:p></span></p><p><span style='font-size:12.0pt;color:black'>...<o:p></o:p></span></p><p><span style='font-size:12.0pt;color:black'>...<o:p></o:p></span></p><p><span style='font-size:12.0pt;color:black'>...<o:p></o:p></span></p><p><span style='font-size:12.0pt;color:black'>mFileErrorCode=0<o:p></o:p></span></p><p><span style='font-size:12.0pt;color:black'>return<o:p></o:p></span></p><p><span style='font-size:12.0pt;color:black'> <o:p></o:p></span></p><p><span style='font-size:12.0pt;color:black'> <o:p></o:p></span></p><p><span style='font-size:12.0pt;color:black'> <o:p></o:p></span></p><p class=xmsonormal style='margin-bottom:12.0pt'><span style='font-size:12.0pt;color:black'> <o:p></o:p></span></p><div><p class=xmsonormal><span style='font-size:12.0pt;color:black'><img border=0 width=694 height=2 style='width:7.2291in;height:.0208in' id="x_Horizontal_x0020_Line_x0020_2" src="cid:image002.png@01D3938E.507A2E60" alt="cid:image002.png@01D3938E.507A2E60"></span><span style='font-size:12.0pt;color:black'><o:p></o:p></span></p><div id="x_divRplyFwdMsg"><p class=xmsonormal><b><span style='font-size:12.0pt;color:black'>Da:</span></b><span style='font-size:12.0pt;color:black'> TRNSYS-users <trnsys-users-bounces@lists.onebuilding.org> per conto di Elisa Ghirardi via TRNSYS-users <trnsys-users@lists.onebuilding.org><br><b>Inviato:</b> lunedì 22 gennaio 2018 09:30<br><b>A:</b> trnsys-users@lists.onebuilding.org<br><b>Cc:</b> Elisa Ghirardi<br><b>Oggetto:</b> [TRNSYS-users] type 155 and GenOpt <o:p></o:p></span></p><div><p class=xmsonormal><span style='font-size:12.0pt;color:black'> <o:p></o:p></span></p></div></div><div><div><p class=xxmsonormal><span style='font-size:12.0pt;color:black'>Hi TRNSYS users,<o:p></o:p></span></p><p class=xxmsonormal><span style='font-size:12.0pt;color:black'> <o:p></o:p></span></p><p class=xxmsonormal><span style='font-size:12.0pt;color:black'>I’m trying to run an optimization with TrnOpt with a link with matlab (type 155). The single simulation works, but when I run the optimization I have always the same error: “<i>The M-File did not properly set 'mFileErrorCode' to 0 when it was called. This may indicate that an error occurred in Matlab while running the M-File. 'mFileErrorCode' was left to 1 by the M-File. You can set ignoreEngineClose to 1 and run the 'lasterr' command in Matlab to help diagnose the  problem. The error occurred at info(7) =            0 , info(13) =            0</i>”.<o:p></o:p></span></p><p class=xxmsonormal><span style='font-size:12.0pt;color:black'>I think it’s a problem  with matlab file access because , despite the .m file being inserted into the GenOpt input file, the GenOpt seems unable to start it, in fact GenOpt starts matlab but then fails to open the file. <o:p></o:p></span></p><p class=xxmsonormal><span style='font-size:12.0pt;color:black'> <o:p></o:p></span></p><p class=xxmsonormal><span style='font-size:12.0pt;color:black'>Someone of you has already dealt with this issue?<o:p></o:p></span></p><p class=xxmsonormal><span style='font-size:12.0pt;color:black'> <o:p></o:p></span></p><p class=xxmsonormal><span style='font-size:12.0pt;color:black'>Kind regards,<o:p></o:p></span></p><p class=xxmsonormal><span style='font-size:12.0pt;color:black'> <o:p></o:p></span></p><p class=xxmsonormal><span style='font-size:12.0pt;color:black'>Elisa Ghirardi<o:p></o:p></span></p></div></div></div><p class=xxmsonormal><span style='font-size:12.0pt;color:black'>University of Bergamo, Italy.<o:p></o:p></span></p></div></div></div><p class=xmsonormal><span style='font-size:12.0pt;color:black'> <o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p></div></body></html>