Problem about EnergyPlus Co-simulation Toolbox, java.net.S​ocketTimeo​utExceptio​n: Accept timed out

27 views (last 30 days)
I'm a new user trying to use the energplus co-simulation toolbox, which is from below webstie
I use Matlab R2018b and energyplus 9.2.
However, when I try to run the example file, following problem occurs
Error using mlep/acceptSocket (line 1144)
Java exception occurred:
java.net.SocketTimeoutException: Accept timed out
at java.net.DualStackPlainSocketImpl.waitForNewConnection(Native Method)
at java.net.DualStackPlainSocketImpl.socketAccept(Unknown Source)
at java.net.AbstractPlainSocketImpl.accept(Unknown Source)
at java.net.PlainSocketImpl.accept(Unknown Source)
at java.net.ServerSocket.implAccept(Unknown Source)
at java.net.ServerSocket.accept(Unknown Source)
Error in mlep/start (line 289)
obj.acceptSocket;
Error in mlepMatlab_example (line 47)
ep.start
Do you have any tips or suggestions? Thanks in advance!
  1 Comment
Jiri Dostal
Jiri Dostal on 11 Sep 2020
I have experienced these issues when the EnergyPlus has some fundamental problem and could not run properly. I'd suggest running EnergyPlus alone with some of its own examples first.
The toolbox runs an EP simulation in the background and tries to connect to its external interface (the socket). It this connection fails, then either EP is not working or there are some communication restrictions at place in your OS.
I sorry, I can't help you more at the moment.
Jiri

Sign in to comment.

Answers (5)

Urmila Rajpurohith
Urmila Rajpurohith on 26 Aug 2020

Jiri Dostal
Jiri Dostal on 11 Sep 2020
Edited: Jiri Dostal on 11 Sep 2020
I have experienced these issues when the EnergyPlus had some fundamental problem and could not run properly. I'd suggest running EnergyPlus alone with some of its own examples first.
The toolbox runs an EP simulation in the background and tries to connect to its external interface (the socket). It this connection fails, then either EP is not working or there are some communication restrictions at place in your OS.
I sorry, I can't help you more at the moment.
Jiri

Dongxue Zhan
Dongxue Zhan on 3 Dec 2020
Hello, I faced the same problem, can you share how did you fix it finally?

Mariam Ahmed
Mariam Ahmed on 30 Jan 2022
Edited: Mariam Ahmed on 30 Jan 2022
I have faced this issue with some of my E+ models. This is a summary of what I found/did:
1- My simple E+ models worked fine but the sophisticated ones had this issue you reported.
2- I used MATLAB/Simulink debugger to try to figure where the simulation fails and the error was indeed from E+ simulation as Mr. Jiri indicated.
3- The reason why the co-simulation fails is the communication between E+ and MATLAB/simulnk could not be established. see below:
"EP: **FATAL:Error in ExternalInterface: Check EnergyPlus *.err file"
4- The .err file of E+ simulation (generated after the co-simulation of MATLAB/simulink and E+ fails/terminates) was not very useful as it did not indicate what is casuing the communication error when connecting to socket. This what was in the .err file
""EP: Error when connecting to socket: WSAGetLastError"
5- I compared the socket.cfg file for the E+ models that worked fine with the E+ co-simulation toolbox AND those that had this issue you reported, And they were exactly the same.
6- I tried to fix all E+ errors and almost all of the warnings and still the E+ co-simuation fails
7- After over 2 days of inspecting my E+ model, removing some of my shading planes, under Class "Shading:Building:Detailed" solved the issue.
8- I still do not know why those planes cause the error. That is, E+ model run PERFECTLY fine if I replace the ExternalInterface Schedules with EMS Schedules and run the simulation using EP-Launch (without using Matlab/Simulink).
I am still trying to figure out the actual cause of the error, but for now, the simulation runs fine following Step 6 and the results are more or less reasonable And I have no new E+ errors or warnings

Jiri Dostal
Jiri Dostal on 31 Jan 2022
Dear all,
EP calculates pre-simulation steps to determine intial value for simulation. Simulink starts EP and waits for EP to communicate. EP starts communication when all pre-simulation tasks are ready. But on the other hand, when EP fails, then Simulink waits for the same timeout to return.
For EP files with long pre-simulation calculations increase the "acceptTimeout" parameter in the "mlep.m" class.
Jiri
  1 Comment
Ouo Adeline Ouattara
Ouo Adeline Ouattara on 10 Feb 2022
Thank you for your suggestion dear Jiri.
Do you have some suggestion for the error messages below that I get when I try to run an cosimulation whith ExternalInterface:Variable or EnergyManagementSystem:Actuator
Error using mlep/loadIdf (line 782)
Subscripting into a table using one subscript (as in
t(i)) or three or more subscripts (as in t(i,j,k)) is
not supported. Always specify a row subscript and a
variable subscript, as in t(rows,vars).
Error in mlep/initialize (line 196)
obj.loadIdf;
Error using mlep/loadIdf (line 772)
Subscripting into a table using one subscript (as in
t(i)) or three or more subscripts (as in t(i,j,k)) is
not supported. Always specify a row subscript and a
variable subscript, as in t(rows,vars).
Error in mlep/initialize (line 196)
obj.loadIdf;

Sign in to comment.

Categories

Find more on Software Development Tools in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!