Matlab Input Vector Issue with BCVTB and EnergyPlus

122 views
Skip to first unread message

Zachary Berzolla

unread,
Dec 10, 2019, 12:10:24 AM12/10/19
to bcvtb
Hello,

I am trying to simulate a district system in Matlab using E+ to determine the building loads and couple them via the BCVTB. I am currently using a simple example I edited from the provided BCVTB examples to test the connection but Matlab throws this error: "Error using exchangeDoubleWithSocket(line 83) Read 1 double values but expected to read 2."  I am trying to pass both relative humidity and temperature as inputs to Matlab from E+, so I define "input = [0,0]". The input definition is why it expects to read 2 doubles. I do have two output variables in my variables.cfg file so there should be two double values provided, but it does not seem to work. 

The simulation runs fine when I set the input to only 1 double, e.g. "input = [0]" however then I can only use temperature and not relative humidity. I'm running Matlab 2019b and E+ 9.1 but haven't had any compatibility issues running many other examples/test cases. 

Does anyone have any suggestions? I've attached my idf, Matlab, system, and variables.cfg files. I currently have the simulation set to run for only 3 months for testing expediency. 

Thank you in advance,
Zach 

Zachary Berzolla
Massachusetts Institute of Technology, S.M.B.T. Student
MIT Sustainable Design Lab
zbz at mit dot edu

 









BCVTBFiles.zip

Thierry Stephane Nouidui

unread,
Dec 10, 2019, 6:59:59 AM12/10/19
to bc...@googlegroups.com
I don't have Matlab so I cannot reproduce the problem. 
However I suggest to change your "input" from input=[0,0] to input=[0 0]? 
Let me know if that fixes the problem.

Thanks! 

Am Dienstag, 10. Dezember 2019, 06:10:30 MEZ hat Zachary Berzolla <zber...@gmail.com> Folgendes geschrieben:


--
You received this message because you are subscribed to the Google Groups "bcvtb" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bcvtb+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bcvtb/b0da8933-3006-4d03-b76e-82d95922075f%40googlegroups.com.

Zachary Berzolla

unread,
Dec 10, 2019, 10:36:38 AM12/10/19
to bc...@googlegroups.com

Hi Thierry,

 

I made that change but it did not fix the problem. I have also tried rows instead of columns but that caused other issues.   

 

Best,

Zach

Thierry Stephane Nouidui

unread,
Dec 11, 2019, 3:32:12 AM12/11/19
to bc...@googlegroups.com
Hi Zach,

It is actually good that it works since they mean the same thing. I thought they may have been some issues with the conversion.

Now, I have looked at your system a bit more carefully and I suspect that the problem comes from the feedback you have from EnergyPlus to Matlab. 

The line which is fed back from the E+ simulator to the Matlab simulator carries only a single double value as opposed to a vector of doubles. This is the reason why Matlab is complaining (I think). 
If you were to feed the outputs of EnergyPlus (which is a vector of two doubles) straight to the input of Matlab (removing all the VectorDissambler), this may work. 

Note: You should remember that the order of the variables in your variables.cfg determines the order of the vector inputs.


Am Dienstag, 10. Dezember 2019, 16:36:39 MEZ hat Zachary Berzolla <zber...@gmail.com> Folgendes geschrieben:


Zachary Berzolla

unread,
Dec 11, 2019, 9:53:07 PM12/11/19
to bc...@googlegroups.com

Thierry,

 

Thank you! That was the issue. I was able to get the system running with both variables by deleting all the other connections and just putting in the feedback loop from E+ to Matlab.

 

Thank you again,

Zach

Cahyo Adisaputro

unread,
May 21, 2020, 11:44:01 AM5/21/20
to bcvtb
Hello Zach and Prof. Thierry

I was doing the simulation that Zach did and received this message :

Warning:.complexSystem2Share.Simulator terminated communication by sending flag = 1 at 7948800.0. Simulation will continue without updated values from client program.

Was that suppose to mean ? Is it related to NDBLMAX ?

Thank you in advance,
Cahyo Adisaputro

To unsubscribe from this group and stop receiving emails from it, send an email to bc...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "bcvtb" group.

To unsubscribe from this group and stop receiving emails from it, send an email to bc...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "bcvtb" group.

To unsubscribe from this group and stop receiving emails from it, send an email to bc...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "bcvtb" group.

To unsubscribe from this group and stop receiving emails from it, send an email to bc...@googlegroups.com.

Thierry Nouidui

unread,
May 22, 2020, 9:11:17 AM5/22/20
to bc...@googlegroups.com
I suggest to make sure that the simulation end time specified in all your simulator actors (EnergyPlus IDF, ...) are the same. You should also make sure that the end time defines in the SDFDirector matches those times.


To unsubscribe from this group and stop receiving emails from it, send an email to bcvtb+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bcvtb/c6b977f3-95ad-4e6c-82d3-ec7b38c0f8f9%40googlegroups.com.


--
Prof. Thierry Nouidui
Nouidui Consulting Group
https://nouidui.com/index.php/consulting/

Cahyo Adisaputro

unread,
May 28, 2020, 10:33:02 AM5/28/20
to bcvtb
Dear Dr.Thierry

Just read your suggestion, and it works very well now. Thanks a lot!

Regards
Cahyo Adisaputro

On Friday, 22 May 2020 15:11:17 UTC+2, Thierry Nouidui wrote:
I suggest to make sure that the simulation end time specified in all your simulator actors (EnergyPlus IDF, ...) are the same. You should also make sure that the end time defines in the SDFDirector matches those times.


Kevin

unread,
Sep 21, 2022, 12:51:35 AM9/21/22
to bcvtb
Dear Zach and Thierry

I did the same simulation which Zach had been uploaded. And I have modified the system as Thierry suggested. Here is the figure of the system I have been revised:
2022-09-21_12-23-12.jpg    
However, when I run the program, the following error occur:

Function or variable "simulateAndExit3" can't recognized
2022-09-21_12-39-55.jpg
2022-09-21_12-40-14.jpg
2022-09-21_12-41-09.jpg

I really wonder how to fix the issue. Looking forward to your warm reply, thank you very much.

Kevin

Thierry Nouidui

unread,
Sep 21, 2022, 1:04:37 AM9/21/22
to bc...@googlegroups.com
Kevin,


Could you please share the complete system model including the XML files, the Matlab files and etc so I see where the problem could be?

Thanks

To unsubscribe from this group and stop receiving emails from it, send an email to bcvtb+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bcvtb/5bbd338f-e62e-437f-a292-ae763fed426en%40googlegroups.com.

Kevin

unread,
Sep 21, 2022, 4:21:55 AM9/21/22
to bcvtb

Thank you for your warm reply, I have uploaded all my files:

test_3

Thierry Nouidui

unread,
Sep 21, 2022, 4:30:05 AM9/21/22
to bc...@googlegroups.com
When I double click on the Matlab Simulator Actor, I see that that Actor is calling simulateAndExit3 but when I go into the Matlab folder I see a file called simulateAndExit2.m. So there is no file named simulateAndExit3.m. Could that be the problem?

Below is what I see after clicking the Matlab Simulator actor. Please check the file name for consistency.

image.png

Thanks!

Kevin

unread,
Sep 21, 2022, 4:49:06 AM9/21/22
to bcvtb
Thanks a lot, I have changed the name as you suggested, but it turns out new issue:

2022-09-21_16-38-27.jpg

I checked the time step set by Matalb, EP+ and Ptolemy. It seems all right. Could you give me another look? Thanks again.
2022-09-21_16-37-21.jpg


2022-09-21_16-36-27.jpg

2022-09-21_16-37-53.jpg

Thierry Nouidui

unread,
Sep 21, 2022, 9:19:59 AM9/21/22
to bc...@googlegroups.com
I don't understand why your actors seem to be out of sync. 
Did you manage to run the example files (EnergyPlus, Matlab) that come with the BCVTB?
I suggest for simplification to run an open loop system (with either E+ or Matlab only) and see if there is a fundamental issue.
I myself can't run the system model since I don't have Matlab right now.
You should also delete any auxiliary files produced from previous runs prior to conducting a new run. This is not required but just in case. 

Reply all
Reply to author
Forward
0 new messages