Exemplo n.º 1
0
def preparation():
    project_path = 'C:\\Users\\FrancescoBaldi\\switchdrive\\Work in progress\\Paper 0\\Ecos2015PaperExtension\\'
    path_files = project_path + os.sep
    sys.path.append(path_files)
    filenames = input.filenames(project_path)  # Note: this is just a test
    CONSTANTS = kk.constantsSetting()
    CONSTANTS["filenames"] = filenames
    processed_temp = pd.read_hdf(CONSTANTS["filenames"]["dataset_output"], 'processed')
    dataset_raw = pd.read_hdf(filenames["dataset_raw"], 'table')
    data = pd.DataFrame(index=processed_temp.index)
    indexes_2_save_processed = {"Passengers_calc", "Demands:Electricity:HVAC:Edot", "T_air",
                      "AE1:Cyl:FuelPh_in:mdot", "AE2:Cyl:FuelPh_in:mdot", "AE3:Cyl:FuelPh_in:mdot", "AE4:Cyl:FuelPh_in:mdot",
                      "ME1:Cyl:FuelPh_in:mdot", "ME2:Cyl:FuelPh_in:mdot", "ME3:Cyl:FuelPh_in:mdot","ME4:Cyl:FuelPh_in:mdot",
                      "ME2:HRSG:Steam_in:mdot", "ME3:HRSG:Steam_in:mdot",
                      "AE1:HRSG:Steam_in:mdot", "AE2:HRSG:Steam_in:mdot", "AE3:HRSG:Steam_in:mdot", "AE4:HRSG:Steam_in:mdot",
                      "CoolingSystems:HTcollector24:HTWater_out:mdot", "CoolingSystems:HTcollector13:HTWater_out:mdot",
                      "CoolingSystems:HTcollector24:HTWater_out:T", "CoolingSystems:HTcollector13:HTWater_out:T",
                      "ME1:on", "ME2:on", "ME3:on", "ME4:on", "AE1:on", "AE2:on", "AE3:on", "AE4:on",
                      }
    indexes_2_save_raw = {"SBO 1 OUTLET PRESSUR:7313:bar:Average:900", "SBO 2 OUTLET PRESSUR:7333:bar:Average:900", "Boiler_Port", "Boiler_starbord"}
    for idx in indexes_2_save_processed:
        data[idx] = processed_temp[idx]
    for idx in indexes_2_save_raw:
        data[idx] = dataset_raw[idx]
    # Prepare the input
    constant_input = (data, CONSTANTS, "optimization")
    # Set the boundaries
    lb = [0.0,  0.0,  0.0, 0.5, 0.5, 0.5, 0.2, 343, 0.5, 1e2, 2000]
    ub = [1000, 1000, 1.0, 1.0, 1.0, 1.0, 1.0, 353, 0.9, 1e5, 8000]
    # param[0] = Constant demand to the HTHR systems
    # param[1] = Constant steam demand
    # param[2] = a1 factor of the HVAC re-heater     (HVAC,RH)
    # param[3] = a1 factor of the hot water heater   (HWH)
    # param[4] = a1 factor of the HVAC pre-heater    (HVAC,PH)
    # param[5] = a1 factor of the Galley             (G)
    # param[6] = a1 factor of the Other users        (TH, OT, HFOT)
    # param[7] = Fixed temperature of the HRHT
    # param[8] = Effectiveness of the HTHR heat exchangers
    # param[9] = Boiler drum steam storage capacity [MJ, energy]
    # param[10] = Boiler heat rate when in use [kW]

    # Launch the optimization
    # xopt, fopt = pso(fitnessFunction, lb, ub, args=constant_input, debug=True)
    # Test 1: Storage size lower boundary = 1e4
    # xopt = [2.91644687e+02, 8.17208680e+01, 5.53887266e-01, 9.09731971e-01, 9.94747229e-01, 5.00805591e-01, 2.77852293e-01, 3.44650539e+02, 8.61087194e-01, 1.00000000e+04, 7.81351743e+03]
    # opt = 0.37162408752748827
    # Test 2: Storage size lower boundary = 1e3
    # Note: the 3* factor in param[9] comes from trying to manually adapt the frequency of the start-stops to the boiler pressure signal
    xopt = [1.36929841e+02, 1.76569058e+02, 5.90926596e-01, 7.06974933e-01, 9.98138178e-01, 5.47476618e-01, 2.69942265e-01, 3.45398252e+02, 7.18364651e-01, 3*2.06480953e+03, 2.92188518e+03]
    fopt = 0.3633742911019279
    fitnessFunction(xopt, data, CONSTANTS, "test")
    return (xopt, fopt)
Exemplo n.º 2
0
def preparation():
    project_path = 'C:\\Users\\FrancescoBaldi\\switchdrive\\Work in progress\\Paper 0\\Ecos2015PaperExtension\\'
    path_files = project_path + os.sep
    sys.path.append(path_files)
    filenames = input.filenames(project_path)  # Note: this is just a test
    CONSTANTS = kk.constantsSetting()
    CONSTANTS["filenames"] = filenames
    processed_temp = pd.read_hdf(CONSTANTS["filenames"]["dataset_output"], 'processed')
    dataset_raw = pd.read_hdf(filenames["dataset_raw"], 'table')
    data = pd.DataFrame(index=processed_temp.index)
    indexes_2_save_processed = {"Passengers_calc", "Demands:Electricity:HVAC:Edot", "T_air",
                      "AE1:Cyl:FuelPh_in:mdot", "AE2:Cyl:FuelPh_in:mdot", "AE3:Cyl:FuelPh_in:mdot", "AE4:Cyl:FuelPh_in:mdot",
                      "ME1:Cyl:FuelPh_in:mdot", "ME2:Cyl:FuelPh_in:mdot", "ME3:Cyl:FuelPh_in:mdot","ME4:Cyl:FuelPh_in:mdot",
                      "ME2:HRSG:Steam_in:mdot", "ME3:HRSG:Steam_in:mdot",
                      "AE1:HRSG:Steam_in:mdot", "AE2:HRSG:Steam_in:mdot", "AE3:HRSG:Steam_in:mdot", "AE4:HRSG:Steam_in:mdot",
                      "CoolingSystems:HTcollector24:HTWater_out:mdot", "CoolingSystems:HTcollector13:HTWater_out:mdot",
                      "CoolingSystems:HTcollector24:HTWater_out:T", "CoolingSystems:HTcollector13:HTWater_out:T",
                      "ME1:on", "ME2:on", "ME3:on", "ME4:on", "AE1:on", "AE2:on", "AE3:on", "AE4:on",
                      }
    indexes_2_save_raw = {"SBO 1 OUTLET PRESSUR:7313:bar:Average:900", "SBO 2 OUTLET PRESSUR:7333:bar:Average:900", "Boiler_Port", "Boiler_starbord"}
    for idx in indexes_2_save_processed:
        data[idx] = processed_temp[idx]
    for idx in indexes_2_save_raw:
        data[idx] = dataset_raw[idx]
    # Prepare the input
    constant_input = (data, CONSTANTS, "optimization")
    # Set the boundaries
    lb = [0.0, 0.5, 0.5, 0.5, 0.0, 0.0, 343, 1e4, 2000]
    ub = [1.2, 1.5, 1.2, 1.2, 1.0, 1.0, 353, 1e5, 8000]
    # param[0] = weighting factor of the HVAC re-heater     (HVAC,RH)
    # param[1] = weighting factor of the hot water heater   (HWH)
    # param[2] = weighting factor of the HVAC pre-heater    (HVAC,PH)
    # param[3] = weighting factor of the Galley             (G)
    # param[4] = 0-lev weighting factor of the Other users        (TH, OT, HFOT)
    # param[5] = 1-lev weighting factor of the Other users        (TH, OT, HFOT)
    # param[6] = Fixed temperature of the HRHT
    # param[7] = Boiler drum steam storage capacity [MJ, energy]
    # param[8] = Boiler heat rate when in use [kW]
    # Launch the optimization
    xopt, fopt = pso(fitnessFunction, lb, ub, args=constant_input, debug=True)
    # xopt = [4.52478586e-01, 1.00615880e+00, 9.43346251e-01, 7.99418205e-01, 1.81078383e-01, 4.62759293e-01, 3.48521369e+02, 1.07001004e+04, 6.84890150e+03]
    # xopt = [6.91524220e-02, 8.88251348e-01, 7.05557625e-01, 9.16916717e-01, 5.84153147e-01, 6.79672716e-01, 3.45217955e+02, 5.08353465e+04, 6.00408344e+03]
    fopt = 0.36495629012944736
    fitnessFunction(xopt, data, CONSTANTS, "test")
    return (xopt, fopt)
Exemplo n.º 3
0
# - DATA READING
# - DATA CLEANING
# - DATA PROCESSING
# - EXPLORATORY DATA ANALYSIS
# - ENERGY ANALYSIS
# - EXERGY ANALYSIS

######################################
## INPUT			##
######################################

# Loading appropriate modules
import pandas as pd
import input

filenames = input.filenames()  # Note: this is just a test

######################################
## DATA READING			##
######################################

# Responsible: FA

import datareading as dr

data_path = 'C:\\Users\\FrancescoBaldi\\Dropbox\\Energy and exergy analysis of a cruise ship - Journal Extension\\'
dataset_raw = pd.read_hdf(data_path + 'birka_all_data.h5', 'table')

#N_POINTS = 319* 4 * 24
#temp = CONSTANTS.monthLimits(N_POINTS)
#MONTH_LIMIT_IDX = temp[0]
Exemplo n.º 4
0
def preparation():
    project_path = 'C:\\Users\\FrancescoBaldi\\switchdrive\\Work in progress\\Paper 0\\Ecos2015PaperExtension\\'
    path_files = project_path + os.sep
    sys.path.append(path_files)
    filenames = input.filenames(project_path)  # Note: this is just a test
    CONSTANTS = kk.constantsSetting()
    CONSTANTS["filenames"] = filenames
    processed_temp = pd.read_hdf(CONSTANTS["filenames"]["dataset_output"],
                                 'processed')
    dataset_raw = pd.read_hdf(filenames["dataset_raw"], 'table')
    data = pd.DataFrame(index=processed_temp.index)
    indexes_2_save_processed = {
        "Passengers_calc",
        "Demands:Electricity:HVAC:Edot",
        "T_air",
        "AE1:Cyl:FuelPh_in:mdot",
        "AE2:Cyl:FuelPh_in:mdot",
        "AE3:Cyl:FuelPh_in:mdot",
        "AE4:Cyl:FuelPh_in:mdot",
        "ME1:Cyl:FuelPh_in:mdot",
        "ME2:Cyl:FuelPh_in:mdot",
        "ME3:Cyl:FuelPh_in:mdot",
        "ME4:Cyl:FuelPh_in:mdot",
        "ME2:HRSG:Steam_in:mdot",
        "ME3:HRSG:Steam_in:mdot",
        "AE1:HRSG:Steam_in:mdot",
        "AE2:HRSG:Steam_in:mdot",
        "AE3:HRSG:Steam_in:mdot",
        "AE4:HRSG:Steam_in:mdot",
        "CoolingSystems:HTcollector24:HTWater_out:mdot",
        "CoolingSystems:HTcollector13:HTWater_out:mdot",
        "CoolingSystems:HTcollector24:HTWater_out:T",
        "CoolingSystems:HTcollector13:HTWater_out:T",
        "ME1:on",
        "ME2:on",
        "ME3:on",
        "ME4:on",
        "AE1:on",
        "AE2:on",
        "AE3:on",
        "AE4:on",
    }
    indexes_2_save_raw = {
        "SBO 1 OUTLET PRESSUR:7313:bar:Average:900",
        "SBO 2 OUTLET PRESSUR:7333:bar:Average:900", "Boiler_Port",
        "Boiler_starbord"
    }
    for idx in indexes_2_save_processed:
        data[idx] = processed_temp[idx]
    for idx in indexes_2_save_raw:
        data[idx] = dataset_raw[idx]
    # Prepare the input
    constant_input = (data, CONSTANTS, "optimization")
    # Set the boundaries
    lb = [0.0, 0.0, 0.0, 0.5, 0.5, 0.5, 0.2, 343, 0.5, 1e4, 2000]
    ub = [1000, 1000, 1.0, 1.0, 1.0, 1.0, 1.0, 353, 0.9, 1e7, 8000]
    # param[0] = Constant demand to the HTHR systems
    # param[1] = Constant steam demand
    # param[2] = a1 factor of the HVAC re-heater     (HVAC,RH)
    # param[3] = a1 factor of the hot water heater   (HWH)
    # param[4] = a1 factor of the HVAC pre-heater    (HVAC,PH)
    # param[5] = a1 factor of the Galley             (G)
    # param[6] = a1 factor of the Other users        (TH, OT, HFOT)
    # param[7] = Fixed temperature of the HRHT
    # param[8] = Effectiveness of the HTHR heat exchangers
    # param[9] = Boiler drum steam storage capacity [MJ, energy]
    # param[10] = Boiler heat rate when in use [kW]

    # Launch the optimization
    xopt, fopt = pso(fitnessFunction, lb, ub, args=constant_input, debug=True)
    # Test 1
    # xopt = [0.00000000e+00, 0.00000000e+00, 2.54803569e-01, 9.99957005e-01, 1.00000000e+00, 5.48135386e-01, 2.02497633e-01, 3.46800156e+02, 5.00000000e-01, 9.91841867e+06, 7.92913650e+03]
    # xopt = [1.11658780e+02, 1.01578823e+01, 2.58777430e-01, 7.33523799e-01, 1.00000000e+00, 7.31005444e-01, 2.00407605e-01, 3.43000000e+02, 5.00000000e-01, 1.00000000e+07, 2.83632523e+03]
    # fopt = 0.3632706766877296
    fitnessFunction(xopt, data, CONSTANTS, "test")
    return (xopt, fopt)
Exemplo n.º 5
0
import preprocessingO as ppo
import energyanalysis as ea
import auxiliaryDemand as aux
import coolingsystems as cs
from helpers import d2df
import export as ex
import clustering
import postProcessing as post

#%%
######################################
## DATA READING			##
######################################
# Responsible: FA
# Setting the filenames
filenames = input.filenames(project_path)  # Note: this is just a test
# Reading the input data (measurements)
dataset_raw = pd.read_hdf(filenames["dataset_raw"], 'table')
# load the dictionary with the header names
header_names = dr.keysRenaming(dataset_raw, filenames["headers_translate"])

######################################
## DATA PROCESSING		##
######################################
# Responsible: FB
#%%
# Setting the important constants
CONSTANTS = kk.constantsSetting()
CONSTANTS["filenames"] = filenames
(dict_structure, processed) = us.structurePreparation(
    CONSTANTS, dataset_raw.index,