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

Revision history [back]

click to hide/show revision 1
initial version

Thank you for your answers. I was basically executing the function EnergyPlusAPI.runtime.run_energyplus() sequentially in a for loop. This caused the python process to accumulate the handles of each energyplus run.

I took a look into the multiprocessing API of python and implemented each run as a process which solved the issue. Thanks!

A pseudocode for what I did could be like this:

queue = Queue() #Global queue object for the threads(Process)

for ep in range(a2c_agent.EPISODES):
    #--- Process handler ###
    proc = Process(target=Energyplus_manager,args=(queue,)) 
    proc.start()
    while(proc.exitcode == None): #As long as the thread is not closed
        a2c_agent.remember(queue) #Retrieve info from the thread for the RL agent, timeout if no more data is being loaded
    proc.join()

    average = a2c_agent.evaluate_model(episode_rewards[-1], (ep+1)) # evaluate the model
    a2c_agent.replay() # train the network