Question-and-Answer Resource for the Building Energy Modeling Community
Get started with the Help page
Ask Your Question

BCVTB coupling error with matlab and Energyplus

asked 2018-01-09 07:32:12 -0500

Dr. Fan's avatar

updated 2018-01-10 22:08:56 -0500

Hello everyone, I am trying to carryout a co-simulation of energyplus and matlab through using the BCVTB. But after the simulation starts i got an error. The version of my energyplus is 8.8 and my BCVTB system is modified from the example file of 'ePlus85Simulink-simple' which comes along with BCVTB. In my system the energyplus creates two external interface:shcedule (one is the schedule of outdoor wetbulb temperature and the other is wetbuld temperature) to exchange the data with the matlab. 1 output variables from Energyplus is received by the matlab script and two outputs from the matlab are transferred to energyplus external schedule. The stack trace of the error is shown below: image description The energyplus simulation log is shown below: image description

Update of my question: The problem in the above question is already solved. The error described in the above texts was caused by the wrong input arguments in the exchangeDoublesWithSocket function which is used in the matlab script to exchange data with the BCVTB. The variable vector as an input argument read by the matlab should be in the left handside of the exchangeDoublesWithSocket function, however in my previous version i put this argument in the right hand side. However now i got some new concerns about my model: In my model, only one output variable from Energyplus (environment: on site air drybuld temperature) is expected to be read by the matlab and i have declared this in the variable.cfg in the energyplus folder. However, when i started running the simulation, the matlab trigger some warning message: two double variables are read by matlab while only one variable is expected.Then the simulation stoped and shows errors. I donot understand why two variables are read. To look insight this problem, i just difined the vector u (the variable vector read by the Matlab) to be two dimensional and assigned the initial value (u=[20,50]) and then i re-run the model and got no errors. From the results, i find the first the variable written to the vector u is the value of timestep and the second variable is my target value (on site air dry buld temperature). I donot understand why the value of time step was written into the vector u. Please give me some comments if you know the possible causes and i will quite appreciate your help. Thanks a lot!. The links to download my model is in the following: link text

edit retag flag offensive close merge delete



I can't download your files. Could you resend the link?

Thierry Nouidui's avatar Thierry Nouidui  ( 2018-01-10 13:45:33 -0500 )edit

Thanks a lot, Thierry. The initial problem i had in this question has been solved, but now i get a new question. i just update my question here and send a new link to download the BCVTB model.

Dr. Fan's avatar Dr. Fan  ( 2018-01-10 21:31:49 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2018-02-28 12:01:39 -0500

Samuel de Vries's avatar

updated 2018-02-28 12:05:05 -0500

The link you are sharing is not publically accessible. As for your second question; it sounds like your are not requesting enough output variables from the function exchangeDoublesWithSocket. Are you using the following manner of calling this function?

[retVal, flaRea, simTimRea,variableFromEPtoMlab ] = exchangeDoublesWithSocket(sockfd, flaWri,... length(variableFromEPtoMlab), simTimWri, variableFromMlabtoEP);

It sounds like you might not be requesting simTimRea (Current simulation time in read from the socket) and that this values is written to your vector u instead. If this is the case then you should take a look at the Matlab script simulateAndExit which also comes with BCVTB as well as the description in the header of the exchangeDoublesWithSocket function.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer


Question Tools



Asked: 2018-01-09 07:32:12 -0500

Seen: 573 times

Last updated: Feb 28 '18