Beispiel #1
0
def main():

    # Initialize the FMU model empty
    m = Model.Model()

    # Assign an existing FMU to the model
    filePath = "../../../modelica/FmuExamples/Resources/FMUs/Pump_MBL3.fmu"

    # ReInit the model with the new FMU
    m.ReInit(filePath)

    # Show details
    print m

    # Show the inputs
    print "The names of the FMU inputs are: ", m.GetInputNames(), "\n"

    # Show the outputs
    print "The names of the FMU outputs are:", m.GetOutputNames(), "\n"

    # Path of the csv file containing the data series
    #csvPath = "../../../modelica/FmuExamples/Resources/data/DataPumpVeryShort.csv"
    csvPath = "../../../modelica/FmuExamples/Resources/data/DataPump_16to19_Oct2012.csv"
    #csvPath = "../../../modelica/FmuExamples/Resources/data/DataPump_16to19_Oct2012_variableStep.csv"

    # Set the CSV file associated to the input, and its covariance
    input = m.GetInputByName("Nrpm")
    input.GetCsvReader().OpenCSV(csvPath)
    input.GetCsvReader().SetSelectedColumn("Pump.Speed")

    # Initialize the model for the simulation
    m.InitializeSimulator()

    #pars = [0.106,  0.50041746, 0.9, 1.]
    #pars = [0.11574544, 0.67699191, 0.8862938, 1.]
    pars = [0.11992406, 0.11864333, 0.88393507, 1.]
    #pars = [0.1222095,  0.1210177,  0.12177384, 1.]

    # Set the parameters of the model
    par_1 = m.GetVariableObject("pump.power.P[1]")
    m.SetReal(par_1, pars[0])

    par_2 = m.GetVariableObject("pump.power.P[2]")
    m.SetReal(par_2, pars[1])

    par_3 = m.GetVariableObject("pump.power.P[3]")
    m.SetReal(par_3, pars[2])

    par_4 = m.GetVariableObject("pump.power.P[4]")
    m.SetReal(par_4, pars[3])

    # Simulate
    time, results = m.Simulate()

    # Show the results
    showResults(time, results, csvPath, pars)
Beispiel #2
0
def main():

    # Assign an existing FMU to the model
    filePath = "../../../modelica/FmuExamples/Resources/FMUs/Pump_MBL2.fmu"

    # Initialize the FMU model empty
    m = Model.Model(filePath, atol=1e-4, rtol=1e-4)

    # Show details of the model
    print(m)

    # Path of the csv file containing the data series
    # csvPath = "../../../modelica/FmuExamples/Resources/data/DataPumpShort.csv"
    csvPath = "../../../modelica/FmuExamples/Resources/data/DataPump_16to19_Oct2012.csv"

    # Show the inputs
    print("The names of the FMU inputs are: ", m.GetInputNames(), "\n")

    # Show the outputs
    print("The names of the FMU outputs are:", m.GetOutputNames(), "\n")

    # Set the CSV file associated to the input, and its covariance
    input = m.GetInputByName("Nrpm")
    input.GetCsvReader().OpenCSV(csvPath)
    input.GetCsvReader().SetSelectedColumn("Pump.Speed")

    # Select the states to be modified
    m.AddParameter(m.GetVariableObject("pump.power.P[1]"))
    m.AddParameter(m.GetVariableObject("pump.power.P[2]"))
    m.AddParameter(m.GetVariableObject("pump.power.P[3]"))

    # Initialize the simulator
    m.InitializeSimulator()

    # Instantiate the pool
    pool = FmuPool(m, debug=True)

    # define the vector of initial conditions for which the simulations
    # have to be performed.
    # values has to be a list of state vectors
    # values = [ [x0_0], [x0_1], ... [x0_n]]
    vectorValues = numpy.linspace(0.2, 1.0, 5)
    values = []
    for v in vectorValues:
        temp = {"state": [], "parameters": numpy.array([v, v, v])}
        values.append(temp)

    # Run simulations in parallel
    poolResults = pool.Run(values)

    # plot all the results
    showResults(poolResults)
Beispiel #3
0
def main():

    # Initialize the FMU model empty
    m = Model.Model()

    # Assign an existing FMU to the model
    filePath = "../../../modelica/FmuExamples/Resources/FMUs/HeatExchanger.fmu"

    # ReInit the model with the new FMU
    m.ReInit(filePath, atol=1e-5, rtol=1e-6)

    # Show details
    print m

    # Show the inputs
    print "The names of the FMU inputs are: ", m.GetInputNames(), "\n"

    # Show the outputs
    print "The names of the FMU outputs are:", m.GetOutputNames(), "\n"

    # Set the CSV file associated to the input
    inputPath = "../../../modelica/FmuExamples/Resources/data/SimulationData_HeatExchanger.csv"
    input = m.GetInputByName("mFlow_cold")
    input.GetCsvReader().OpenCSV(inputPath)
    input.GetCsvReader().SetSelectedColumn("heatExchanger.mFlow_COLD")

    input = m.GetInputByName("mFlow_hot")
    input.GetCsvReader().OpenCSV(inputPath)
    input.GetCsvReader().SetSelectedColumn("heatExchanger.mFlow_HOT")

    input = m.GetInputByName("T_hot")
    input.GetCsvReader().OpenCSV(inputPath)
    input.GetCsvReader().SetSelectedColumn("heatExchanger.Thot_IN")

    input = m.GetInputByName("T_cold")
    input.GetCsvReader().OpenCSV(inputPath)
    input.GetCsvReader().SetSelectedColumn("heatExchanger.Tcold_IN")

    m.GetState()

    # Initialize the model for the simulation
    m.InitializeSimulator()

    # Simulate
    time, results = m.Simulate()

    # Show the results
    showResults(time, results)
def main():
    
    # Assign an existing FMU to the model
    filePath = "../../../modelica/FmuExamples/Resources/FMUs/Pump_MBL3.fmu"
    
    # Initialize the FMU model empty
    m = Model.Model(filePath, atol=1e-4, rtol=1e-3)
    
    # Path of the csv file containing the data series
    #csvPath = "../../../modelica/FmuExamples/Resources/data/DataPumpVeryShort.csv"
    #csvPath = "../../../modelica/FmuExamples/Resources/data/DataPump_16to19_Oct2012.csv"
    csvPath = "../../../modelica/FmuExamples/Resources/data/DataPump_16to19_Oct2012_variableStep.csv"
    
    # Set the CSV file associated to the input, and its covariance
    input = m.GetInputByName("Nrpm")
    input.GetCsvReader().OpenCSV(csvPath)
    input.GetCsvReader().SetSelectedColumn("Pump.Speed")
    
    
    # Set the CSV file associated to the output, and its covariance
    output = m.GetOutputByName("P_el")
    output.GetCsvReader().OpenCSV(csvPath)
    output.GetCsvReader().SetSelectedColumn("Pump.kW")
    output.SetMeasuredOutput()
    output.SetCovariance(0.15)
    
    """
    # Set the CSV file associated to the output, and its covariance
    output = m.GetOutputByName("V_flow")
    output.GetCsvReader().OpenCSV(csvPath)
    output.GetCsvReader().SetSelectedColumn("Pump.gpm")
    output.SetMeasuredOutput()
    output.SetCovariance(50.0)
    """
    p_start = [0.30000000, 0.40000000, 0.60000000, 0.8] # 0
    #p_start = [0.20000000, 0.40000000, 0.60000000, 0.8] # 0
    #p_start = [0.28538255, 0.50017618, 0.71668581, 1.] # 7
    #p_start = [0.21517598, 0.50276898, 0.79260251, 1.] # 25
    #p_start = [0.19080228, 0.50549745, 0.81889495, 1.] # 35
    #p_start = [0.11824324, 0.5869894,  0.8849001,  1.]
    #p_start = [0.11574544, 0.67699191, 0.8862938, 1.]
    
    cov = 0.1
    
    #################################################################
    # Select the parameter to be identified
    m.AddParameter(m.GetVariableObject("pump.power.P[1]"))
    
    # Set initial value of parameter, and its covariance and the limits (if any)
    par = m.GetParameters()[0]
    par.SetInitialValue(p_start[0])
    par.SetCovariance(cov)
    par.SetMinValue(0.0)
    par.SetConstraintLow(True)
    par.SetMaxValue(1.0)
    par.SetConstraintHigh(True)
    
    
    # Select the parameter to be identified
    m.AddParameter(m.GetVariableObject("pump.power.P[2]"))
    
    # Set initial value of parameter, and its covariance and the limits (if any)
    par = m.GetParameters()[1]
    par.SetInitialValue(p_start[1])
    par.SetCovariance(cov)
    par.SetMinValue(0.0)
    par.SetConstraintLow(True)
    par.SetMaxValue(1.0)
    par.SetConstraintHigh(True)
    
    # Select the parameter to be identified
    m.AddParameter(m.GetVariableObject("pump.power.P[3]"))
    
    # Set initial value of parameter, and its covariance and the limits (if any)
    par = m.GetParameters()[2]
    par.SetInitialValue(p_start[2])
    par.SetCovariance(cov)
    par.SetMinValue(0.0)
    par.SetConstraintLow(True)
    par.SetMaxValue(1.0)
    par.SetConstraintHigh(True)
    
    # Select the parameter to be identified
    m.AddParameter(m.GetVariableObject("pump.power.P[4]"))
    
    # Set initial value of parameter, and its covariance and the limits (if any)
    par = m.GetParameters()[3]
    par.SetInitialValue(p_start[3])
    par.SetCovariance(cov)
    par.SetMinValue(0.0)
    par.SetConstraintLow(True)
    par.SetMaxValue(1.0)
    par.SetConstraintHigh(True)
    
    # Initialize the model for the simulation
    m.InitializeSimulator()
    
    # instantiate the UKF for the FMU
    ukf_FMU = ukfFMU(m, augmented = False)
    ukf_FMU.setUKFparams()
    
    pars = ukf_FMU.ParameterEstimation(maxIter = 500)
    print(pars)
    
    ShowResults(pars)
Beispiel #5
0
def main():
    # Assign an existing FMU to the model, depending on the platform identified
    dir_path = os.path.dirname(__file__)
    if platform.architecture()[0] == "32bit":
        print "32-bit architecture"
        filePath = os.path.join(dir_path, "..", "..", "..", "modelica",
                                "FmuExamples", "Resources", "FMUs",
                                "ChillerFDD.fmu")
    else:
        print "64-bit architecture"
        filePath = os.path.join(dir_path, "..", "..", "..", "modelica",
                                "FmuExamples", "Resources", "FMUs",
                                "ChillerFDD_64bit.fmu")

    # Initialize the FMU model empty
    m = Model.Model(filePath)

    # Description of the model
    print m

    # Show the inputs
    print "The names of the FMU inputs are: ", m.GetInputNames(), "\n"

    # Show the outputs
    print "The names of the FMU outputs are:", m.GetOutputNames(), "\n"

    # Path of the csv file containing the data series
    #csvPath = os.path.join(dir_path, "ChillerResults7.csv")
    #csvPath = os.path.join(dir_path, "ChillerResults1_noisyLow.csv")
    #csvPath = os.path.join(dir_path, "ChillerResults1_noisyHigh.csv")
    #csvPath = os.path.join(dir_path, "ChillerResults7_noisyLow.csv")
    #csvPath = os.path.join(dir_path, "ChillerResults7_noisyHigh.csv")
    csvPath = os.path.join(dir_path, "ChillerResults7_noisyHigh.csv")

    input = m.GetInputByName("m_flow_CW")
    input.GetCsvReader().OpenCSV(csvPath)
    input.GetCsvReader().SetSelectedColumn("m_flow_CW")

    input = m.GetInputByName("m_flow_CH")
    input.GetCsvReader().OpenCSV(csvPath)
    input.GetCsvReader().SetSelectedColumn("m_flow_CH")

    input = m.GetInputByName("T_CW_in")
    input.GetCsvReader().OpenCSV(csvPath)
    input.GetCsvReader().SetSelectedColumn("T_CW_in")

    input = m.GetInputByName("T_CH_in")
    input.GetCsvReader().OpenCSV(csvPath)
    input.GetCsvReader().SetSelectedColumn("T_CH_in")

    input = m.GetInputByName("Pin")
    input.GetCsvReader().OpenCSV(csvPath)
    input.GetCsvReader().SetSelectedColumn("P")

    # Set the CSV file associated to the output, and its covariance

    output = m.GetOutputByName("T_CH_Lea")
    output.GetCsvReader().OpenCSV(csvPath)
    output.GetCsvReader().SetSelectedColumn("T_CH_Lea")
    output.SetMeasuredOutput()
    output.SetCovariance(0.5)

    output = m.GetOutputByName("T_CW_lea")
    output.GetCsvReader().OpenCSV(csvPath)
    output.GetCsvReader().SetSelectedColumn("T_CW_lea")
    output.SetMeasuredOutput()
    output.SetCovariance(0.5)

    # Select the states to be identified, and add it to the list
    m.AddVariable(m.GetVariableObject("chi.vol1.dynBal.medium.T"))
    m.AddVariable(m.GetVariableObject("chi.vol2.dynBal.medium.T"))

    # Set initial value of state, and its covariance and the limits (if any)
    var = m.GetVariables()[0]
    var.SetInitialValue(300)
    var.SetCovariance(0.5)
    var.SetMinValue(273.15)
    var.SetConstraintLow(True)

    var = m.GetVariables()[1]
    var.SetInitialValue(279)
    var.SetCovariance(0.5)
    var.SetMinValue(273.15)
    var.SetConstraintLow(True)

    # Select the states to be identified, and add it to the list
    m.AddParameter(m.GetVariableObject("eta_PL"))

    # Set initial value of state, and its covariance and the limits (if any)
    par = m.GetParameters()[0]
    par.SetInitialValue(0.5)
    par.SetCovariance(0.02)
    par.SetMinValue(0.0)
    par.SetMaxValue(1.2)
    par.SetConstraintLow(True)
    par.SetConstraintHigh(True)

    # Initialize the model for the simulation
    m.InitializeSimulator()

    # Allow to identify eta PL externally
    #m.SetReal(m.GetVariableObject("chi.external_etaPL"), True)
    #m.SetReal(m.GetVariableObject("chi.external_COP"), False)

    # Change the nominal power of the compressor
    m.SetReal(m.GetVariableObject("P_nominal"), 1500e3)

    # Instantiate the UKF for the FMU
    ukf_FMU = ukfFMU(m, augmented=False)

    # Start filter
    t0 = pd.to_datetime(0.0, unit="s")
    t1 = pd.to_datetime(3600.0 * 12, unit="s")
    time, x, sqrtP, y, Sy, y_full = ukf_FMU.filter(start=t0,
                                                   stop=t1,
                                                   verbose=False)

    # Get the measured outputs
    showResults(time, x, sqrtP, y, Sy, y_full, csvPath, m)
Beispiel #6
0
def main():

    # Assign an existing FMU to the model
    filePath = "../../../modelica/FmuExamples/Resources/FMUs/Pump_MBL3.fmu"

    # Initialize the FMU model empty
    m = Model.Model(filePath, atol=1e-4, rtol=1e-3)

    # Path of the csv file containing the data series
    #csvPath = "../../../modelica/FmuExamples/Resources/data/DataPumpVeryShort.csv"
    #csvPath = "../../../modelica/FmuExamples/Resources/data/DataPump_16to19_Oct2012.csv"
    csvPath = "../../../modelica/FmuExamples/Resources/data/DataPump_16to19_Oct2012_variableStep.csv"

    # Set the CSV file associated to the input, and its covariance
    input = m.GetInputByName("Nrpm")
    input.GetCsvReader().OpenCSV(csvPath)
    input.GetCsvReader().SetSelectedColumn("Pump.Speed")

    # Set the CSV file associated to the output, and its covariance
    output = m.GetOutputByName("P_el")
    output.GetCsvReader().OpenCSV(csvPath)
    output.GetCsvReader().SetSelectedColumn("Pump.kW")
    output.SetMeasuredOutput()
    output.SetCovariance(0.15)
    """
    # Set the CSV file associated to the output, and its covariance
    output = m.GetOutputByName("V_flow")
    output.GetCsvReader().OpenCSV(csvPath)
    output.GetCsvReader().SetSelectedColumn("Pump.gpm")
    output.SetMeasuredOutput()
    output.SetCovariance(50.0)
    """

    #################################################################
    # Select the parameter to be identified
    m.AddParameter(m.GetVariableObject("pump.power.P[1]"))

    ppp = [0.3, 0.5, 0.7, 0.9]
    ppp = [0.2970953, 0.50003122, 0.70334771, 0.94678875]
    ppp = [0.294192, 0.50006441, 0.7066786, 0.97122915]
    ppp = [0.29129089, 0.5000997, 0.70999068, 0.98621258]
    ppp = [0.28839297, 0.50013721, 0.71328358, 0.99633567]
    ppp = [0.28549929, 0.50017709, 0.71655701, 1.]
    ppp = [0.28261104, 0.50021948, 0.71981114, 1.]
    ppp = [0.27972849, 0.50026454, 0.72306009, 1.]
    ppp = [0.27683613, 0.50031244, 0.72630686, 1.]
    ppp = [0.27393511, 0.50036335, 0.72955037, 1.]
    ppp = [0.106, 0.50041746, 0.9, 1.]
    ppp = [0.28538255, 0.50017618, 0.71668581, 1.]

    cov = 0.005
    # Set initial value of parameter, and its covariance and the limits (if any)
    par = m.GetParameters()[0]
    par.SetInitialValue(ppp[0])
    par.SetCovariance(cov)
    par.SetMinValue(0.0)
    par.SetConstraintLow(True)
    par.SetMaxValue(1.0)
    par.SetConstraintHigh(True)

    # Select the parameter to be identified
    m.AddParameter(m.GetVariableObject("pump.power.P[2]"))

    # Set initial value of parameter, and its covariance and the limits (if any)
    par = m.GetParameters()[1]
    par.SetInitialValue(ppp[1])
    par.SetCovariance(cov)
    par.SetMinValue(0.0)
    par.SetConstraintLow(True)
    par.SetMaxValue(1.0)
    par.SetConstraintHigh(True)

    # Select the parameter to be identified
    m.AddParameter(m.GetVariableObject("pump.power.P[3]"))

    # Set initial value of parameter, and its covariance and the limits (if any)
    par = m.GetParameters()[2]
    par.SetInitialValue(ppp[2])
    par.SetCovariance(cov)
    par.SetMinValue(0.0)
    par.SetConstraintLow(True)
    par.SetMaxValue(1.0)
    par.SetConstraintHigh(True)

    # Select the parameter to be identified
    m.AddParameter(m.GetVariableObject("pump.power.P[4]"))

    # Set initial value of parameter, and its covariance and the limits (if any)
    par = m.GetParameters()[3]
    par.SetInitialValue(ppp[3])
    par.SetCovariance(cov)
    par.SetMinValue(0.0)
    par.SetConstraintLow(True)
    par.SetMaxValue(1.0)
    par.SetConstraintHigh(True)

    # Initialize the model for the simulation
    m.InitializeSimulator()

    # instantiate the UKF for the FMU
    ukf_FMU = ukfFMU(m, augmented=False)
    ukf_FMU.setUKFparams()

    # start filter
    time, x, sqrtP, y, Sy, y_full, Xsmooth, Ssmooth, Yfull_smooth = ukf_FMU.filterAndSmooth(
        0.0, 5.0, verbose=False)

    # Get the measured outputs
    showResults(time, x, sqrtP, y, Sy, y_full, Xsmooth, Ssmooth, Yfull_smooth,
                csvPath)
Beispiel #7
0
def main():

    # Assign an existing FMU to the model
    filePath = "../../../modelica/FmuExamples/Resources/FMUs/HeatExchanger.fmu"

    # Initialize the FMU model empty
    m = Model.Model(filePath, atol=1e-5, rtol=1e-6)

    # Path of the csv file containing the data series
    csvPath = "../../../modelica/FmuExamples/Resources/data/NoisySimulationData_HeatExchanger.csv"

    ###################################################################
    # Set the CSV file associated to the input, and its covariance
    input = m.GetInputByName("mFlow_cold")
    input.GetCsvReader().OpenCSV(csvPath)
    input.GetCsvReader().SetSelectedColumn("heatExchanger.mFlow_COLD")
    input.SetCovariance(2.0)

    # Set the CSV file associated to the input, and its covariance
    input = m.GetInputByName("mFlow_hot")
    input.GetCsvReader().OpenCSV(csvPath)
    input.GetCsvReader().SetSelectedColumn("heatExchanger.mFlow_HOT")
    input.SetCovariance(2.0)

    # Set the CSV file associated to the input, and its covariance
    input = m.GetInputByName("T_hot")
    input.GetCsvReader().OpenCSV(csvPath)
    input.GetCsvReader().SetSelectedColumn("heatExchanger.Thot_IN")
    input.SetCovariance(1.0)

    # Set the CSV file associated to the input, and its covariance
    input = m.GetInputByName("T_cold")
    input.GetCsvReader().OpenCSV(csvPath)
    input.GetCsvReader().SetSelectedColumn("heatExchanger.Tcold_IN")
    input.SetCovariance(1.0)

    #################################################################
    # Set the CSV file associated to the output, and its covariance
    output = m.GetOutputByName("Tcold_OUT")
    output.GetCsvReader().OpenCSV(csvPath)
    output.GetCsvReader().SetSelectedColumn("heatExchanger.Tcold_OUT")
    output.SetMeasuredOutput()
    output.SetCovariance(1.0)

    # Set the CSV file associated to the output, and its covariance
    output = m.GetOutputByName("Thot_OUT")
    output.GetCsvReader().OpenCSV(csvPath)
    output.GetCsvReader().SetSelectedColumn("heatExchanger.Thot_OUT")
    output.SetMeasuredOutput()
    output.SetCovariance(1.0)

    #################################################################
    # Select the states to be estimated
    m.AddVariable(m.GetVariableObject("metal.T"))

    # Set initial value of state, and its covariance and the limits (if any)
    var = m.GetVariables()[0]
    var.SetInitialValue(310.15)
    var.SetCovariance(1.5)
    var.SetMinValue(273.15)
    var.SetConstraintLow(True)

    # show the info about the variable to be estimated
    print var.Info()

    #################################################################
    # Select the parameter to be identified
    m.AddParameter(m.GetVariableObject("G_hot"))

    # Set initial value of parameter, and its covariance and the limits (if any)
    par = m.GetParameters()[0]
    par.SetInitialValue(1000.0)
    par.SetCovariance(50.0)
    par.SetMinValue(50.0)
    par.SetConstraintLow(True)

    # show the info about the parameter to be identified
    print par.Info()

    # Select the parameter to be identified
    m.AddParameter(m.GetVariableObject("G_cold"))

    # Set initial value of parameter, and its covariance and the limits (if any)
    par = m.GetParameters()[1]
    par.SetInitialValue(1000.0)
    par.SetCovariance(50.0)
    par.SetMinValue(50.0)
    par.SetConstraintLow(True)

    # show the info about the parameter to be identified
    print par.Info()

    #################################################################
    # Initialize the model for the simulation
    #print "Before initialization: ", m.GetState()
    #print "State observed:",m.GetStateObservedValues()
    #print "Parameters estimated:",m.GetParametersValues()
    m.InitializeSimulator()
    print "After initialization: ", m.GetState()
    print "State observed:", m.GetStateObservedValues()
    print "Parameters estimated:", m.GetParametersValues()

    #################################################################
    # instantiate the UKF for the FMU
    ukf_FMU = ukfFMU(m, augmented=False)

    # Show details
    print ukf_FMU

    # start filter
    time, x, sqrtP, y, Sy, y_full = ukf_FMU.filter(0.0, 5.0)

    # Path of the csv file containing the True data series
    csvTrue = "../../../modelica/FmuExamples/Resources/data/SimulationData_HeatExchanger.csv"

    # Get the measured outputs
    showResults(time, x, sqrtP, y, Sy, y_full, csvTrue)
Beispiel #8
0
def main(days=1):

    # Assign an existing FMU to the model, depending on the platform identified
    dir_path = os.path.dirname(__file__)
    if platform.architecture()[0] == "32bit":
        print "32-bit architecture"
        filePath = os.path.join(dir_path, "..", "..", "..", "modelica",
                                "FmuExamples", "Resources", "FMUs",
                                "Chiller_dymola2015_etaPL.fmu")
    else:
        print "64-bit architecture"
        filePath = os.path.join(dir_path, "..", "..", "..", "modelica",
                                "FmuExamples", "Resources", "FMUs",
                                "ChillerSim_64bit.fmu")

    # Initialize the FMU model empty
    m = Model.Model()

    # ReInit the model with the new FMU
    m.ReInit(filePath)

    # Show details
    print m

    # Show the inputs
    print "The names of the FMU inputs are: ", m.GetInputNames(), "\n"

    # Show the outputs
    print "The names of the FMU outputs are:", m.GetOutputNames(), "\n"

    # Set the CSV file associated to the input
    inputPath = os.path.join(dir_path, "..", "..", "..", "modelica",
                             "FmuExamples", "Resources", "data", "Jun11.csv")
    input = m.GetInputByName("On")
    input.GetCsvReader().OpenCSV(inputPath)
    input.GetCsvReader().SetSelectedColumn("ON")

    input = m.GetInputByName("m_flow_CW")
    input.GetCsvReader().OpenCSV(inputPath)
    input.GetCsvReader().SetSelectedColumn("CD_flow_kgs")

    input = m.GetInputByName("m_flow_CH")
    input.GetCsvReader().OpenCSV(inputPath)
    input.GetCsvReader().SetSelectedColumn("CH_flow_kgs")

    input = m.GetInputByName("T_CW_in")
    input.GetCsvReader().OpenCSV(inputPath)
    input.GetCsvReader().SetSelectedColumn("CD_T_k")

    input = m.GetInputByName("T_CH_in")
    input.GetCsvReader().OpenCSV(inputPath)
    input.GetCsvReader().SetSelectedColumn("CH_T_k")

    input = m.GetInputByName("TCHWSet")
    input.GetCsvReader().OpenCSV(inputPath)
    input.GetCsvReader().SetSelectedColumn("CH_SP_k")

    # Initialize the model for the simulation
    m.InitializeSimulator()

    # Reinitialize state variables (temperatures in the volumes, of the sensors, and control action)
    m.SetReal(m.GetVariableObject("chi.vol1.dynBal.medium.T"), 300)
    #m.SetReal(m.GetVariableObject("TCDWlea.T"), 300)
    m.SetReal(m.GetVariableObject("chi.vol2.dynBal.medium.T"), 279)
    #m.SetReal(m.GetVariableObject("TCHWleachi.T"), 279)
    m.SetReal(m.GetVariableObject("conPI.I.y"), 0.83)

    # Change the nominal power of the compressor
    m.SetReal(m.GetVariableObject("P_nominal"), 1500e3)

    # Decide to use a fixed efficiency or not
    #m.SetReal(m.GetVariableObject("chi.external_etaPL"), False)
    #m.SetReal(m.GetVariableObject("eta_PL"), 0.7)

    # Show the values of the state variables
    print "The state vector is:", m.GetState()

    ####################################################################################
    # Take the data series from the CSV file and create modified input time series
    JuneData = np.genfromtxt(inputPath, delimiter=",", skip_header=1)

    time = pd.to_datetime(JuneData[:, 0], unit="s")
    OAT = JuneData[:, 14]

    ON = JuneData[:, 13]
    CD_flow = flow_generator(236.0, time)
    CH_flow = flow_generator(195.0, time)
    CD_T = condenser_water_temperature(OAT, 273.15 + 28, 273.15 + 15,
                                       273.15 + 20)
    CH_T = JuneData[:, 15]
    SP_T = JuneData[:, 17]
    input_data = np.vstack((ON, CD_flow, CD_T, CH_T, CH_flow, SP_T))
    input_data = np.transpose(input_data)

    ####################################################################################
    # Simulate
    t0 = pd.to_datetime(0.0, unit="s")
    t1 = pd.to_datetime(3600.0 * 24 * days, unit="s")
    time, results = m.Simulate(start_time=t0,
                               final_time=t1,
                               time=time,
                               Input=input_data,
                               complete_res=True)

    return (time, results)