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

# MLE+ cosimulation. Obtaining outputs without controlling

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 close merge delete

Sort by » oldest newest most voted

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.

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?

( 2017-07-19 13:10:47 -0600 )edit

I'm not sure what those errors mean. Are you using the EnergyPlusToFMU tool (http://simulationresearch.lbl.gov/fmu...) to setup your EnergyPlus file for co-simulation?

( 2017-07-19 13:46:16 -0600 )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.

( 2017-07-19 14:01:37 -0600 )edit

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

( 2017-07-19 18:02:18 -0600 )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 [http://txn.name/mleplus/mlep_manual.h...]

Any ideas?

( 2017-10-07 05:19:39 -0600 )edit