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

Revision history [back]

You need to pass the state manager

import sys
from pyenergyplus.api import EnergyPlusAPI

def dummy_callback_function(state_argument):
    print("My argument is called state_argument to avoid duplicating the outer variable below called state")

api = EnergyPlusAPI()
state = api.state_manager.new_state()
api.runtime.callback_begin_new_environment(state, dummy_callback_function)
api.runtime.run_energyplus(state, 
    [
        '-d','C:/Users/Sajit/OneDrive/Documents/EnergyPlusExamplesForFMU/DirectPy',
        '-w', 'C:/EnergyPlusV9-4-0/WeatherData/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.epw',
        'C:/Users/Sajit/OneDrive/Documents/EnergyPlusExamplesForFMU/EX1_9_4/TEST_NF_VFMU.idf'
    ]
)

You need to pass the state manager

import sys
from pyenergyplus.api import EnergyPlusAPI

def dummy_callback_function(state_argument):
    print("My argument is called state_argument to avoid duplicating the outer variable below called state")

api = EnergyPlusAPI()
state = api.state_manager.new_state()
api.runtime.callback_begin_new_environment(state, dummy_callback_function)
api.runtime.run_energyplus(state, 
    [
        '-d','C:/Users/Sajit/OneDrive/Documents/EnergyPlusExamplesForFMU/DirectPy',
        '-w', 'C:/EnergyPlusV9-4-0/WeatherData/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.epw',
        'C:/Users/Sajit/OneDrive/Documents/EnergyPlusExamplesForFMU/EX1_9_4/TEST_NF_VFMU.idf'
    ]
)
# If you need to call run_energyplus again, then reset the state first
api.state_manager.reset_state(state)