lbl-srg / EnergyPlusToFMU

EnergyPlus export as a Functional Mockup Unit for co-simulation
41 stars 17 forks source link

Error: fmi2EnterInitializationMode: The delta between the FMU stop time 1.000000 and the FMU start time 0.000000 must be a multiple of 86400. This is required by EnergyPlus. The current delta is 1.000000. #61

Closed Hemil911 closed 2 years ago

Hemil911 commented 2 years ago

Hello Guys,

I have Created EnergyPlus .idf file using Energyplus software and generated .fmu file using energyPlusToFmu. Now I want to use this fmu in python environment. But while running this code I am getting error like this: FMIL: module = Model, log level = 2: [error][FMU status:Error] fmi2EnterInitializationMode: The delta between the FMU stop time 1.000000 and the FMU start time 0.000000 must be a multiple of 86400. This is required by EnergyPlus. The current delta is 1.000000. Instantiation of Model failed.

from pyfmi import load_fmu
import numpy as np
import matplotlib.pyplot as plt
import csv

modelname = 'IECC_OfficeSmall_STD2012_SanDiego'
simtime = 0
days = 31
hours = 24
minutes= 60
seconds = 60
timestep = 6
numsteps = days*hours*timestep
timestop = hours*minutes*seconds
secondstep = timestop / numsteps

def rundemo():
    model = load_fmu(modelname+'.fmu')
    opts = model.simulate_options()
    opts['ncp'] = numsteps    
    opts['initialize'] = False
    simtime = 0
    model.Initialize(simtime, timestop)

if __name__ == "__main__":
    rundemo()

Help me for the same. Thank You.
Hemil Shah

tsnouidui commented 2 years ago

Which master algorithm are you using to drive the FMU?

If you are using PyFMI, you may have to call the setup_experiment() prior to calling the initialize() function model.setup_experiment(stop_time=timestop) This shouldn't be required (as discussed here https://unmethours.com/question/56691/do-step-error-when-using-pyfmi/) but depending on the PyFMI version you have, you may need to add it.

BTW: The numsteps you have in your code seems a bit strange especially if you using it to parametrize opts[ncp]. This number should in my opinion be (final_time-start_time)/(timestep_in_idf*60)`