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

MLE+ cosimulation. Obtaining outputs without controlling

asked 2017-06-25 03:55:47 -0500

marinafs1's avatar

updated 2017-06-25 03:56:39 -0500

I am using MLE+ cosimulation tool in order to obtain my building thermal demand. I've been following the examples on the ExternalInterface document, but what I want to implement is slightly different and I'm not able to make it work.

Basically I want to get as an output from the Energyplus simulation the following: Site Outdoor Air Drybulb Temperature Site Direct Solar Radiation Rate per Area Site Diffuse Solar Radiation Rate per Area Zone Ideal Loads Supply Air Total Cooling Energy Zone Ideal Loads Supply Air Total Heating Energy Water Use Connections Plant Hot Water Energy

Then I'll have to add another simulink block, simulating a Heat Pump to translate the thermal demand into an electric demand. This demand will be covered by the grid or the PV pannels depending on availability, that is why I also need the radiation from E+.

So basically I have 6 outputs and no inputs and I keep getting error messages: Error using mlepEncodeRealData (line 28) Not enough arguments: all input arguments are required.

This is because, in this command:

packet = mlepEncodeRealData(vernumber, flag, timevalue, realvalues) Realvalues in BCVTB EXAMPLES nº1 is the setpoint that I now don't have. It says in the mlepEncodeRealData description that realvalues can be an empty vector so I just declare an empty array but this is not working, I am still getting the same error.

Does anybody have an idea on how to do this?I am completely stuck

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2017-06-26 07:37:37 -0500

updated 2017-06-26 11:06:11 -0500

I suspect that you will need to add an ExternalInterface:FuctionalMockupExport:To:Schedule (Variable or Actuator). In other words you will need to add a least one input to EnergyPlus, even if you just feed a value of 0 the whole time.

edit flag offensive delete link more


Sorry for the delay. Could you be more specific? I have tried to define empty schedules. Now I have a different error message:

Error using mlepDecodePacket (line 37) Error while parsing the packet string: a34212 -10

Error in runsimple (line 74) [flag, eptime, outputs] = mlepDecodePacket(packet);

This is on the cmd.exe window:

ExternalInterface initializes. Opaque part contains invalid character: \ Error: Parser error in file 'variables.cfg': mismatched tag

But I have no \ character...

Any ideas?

marinafs1's avatar marinafs1  ( 2017-07-19 13:10:47 -0500 )edit

I'm not sure what those errors mean. Are you using the EnergyPlusToFMU tool ( to setup your EnergyPlus file for co-simulation?

JustinShultz's avatar JustinShultz  ( 2017-07-19 13:46:16 -0500 )edit

For what I read on the ExternalInterfaces Application Guide, and MLE+ blog, the connection is between BCVTB and EnergyPlus . I did set up the Energyplus file inside the Idf editor at the ExternalInterface section, where I declared Ptolemy, as explained in the examples.

marinafs1's avatar marinafs1  ( 2017-07-19 14:01:37 -0500 )edit

Have you tried setting up an input into EnergyPlus, even if it's not used for anything within EnergyPlus?

JustinShultz's avatar JustinShultz  ( 2017-07-19 18:02:18 -0500 )edit

I solved the problem, at least partially. I now get the desired outputs in Matlab code but I cannot obtain the results on the simulink environment. The problem is again the input values.

On the code, i set as input a empty array this way: SP = [];

   % Write to inputs of E+

ep.write(mlepEncodeRealData(VERNUMBER, 0, eptime, SP));  

% Save to logdata
logdata(kStep, :) = [SP outputs];

But when I'm on the simulink environment I don't know what to link to the input port of the E+ cosimulation block []

Any ideas?

marinafs1's avatar marinafs1  ( 2017-10-07 05:19:39 -0500 )edit

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: 2017-06-25 03:55:47 -0500

Seen: 515 times

Last updated: Jun 26 '17