optihood package
Submodules
optihood.buildings module
optihood.constraints module
- optihood.constraints.connectInvestmentRule(om)[source]
Constraint to equate the investment objects of all the output flows of a Link
- optihood.constraints.dailySHStorageConstraint(om)[source]
Function to limit the SH storage capacity to 2 days :param om: optimization model :return: om: optimization model
- optihood.constraints.electricRodCapacityConstaint(om, numBuildings)[source]
constraint to set the total capacity of electric rod equal to sum of total capacity selected for HP
- optihood.constraints.environmentalImpactlimit(om, keyword1, keyword2, limit=None)[source]
Based on: oemof.solph.constraints.emission_limit Function to limit the environmental impacts during the multi-objective optimization :param om: model :param keyword1: keyword for environmental impacts per flow, placed in a solph.Flow() object :param keyword2: keyword for environmental impacts per capacity installed, placed in a solph.Investment() object :param limit: limit not to be reached :return:
- optihood.constraints.roof_area_limit(model, keyword1, keyword2, nb)[source]
Based on: oemof.solph.constraints.additional_investment_flow_limit Constraint to limit the capacity of solar panels installed considering the roof area available :param model: Model to which constraints are added. :type model: oemof.solph.Model :param keyword1: Coefficient representing the area used by one unit of capacity of a solar panel :type keyword1: attribute to consider :param keyword2: Total roof area available for panels. :type keyword2: attribute to consider :param nb: Number of buildings in the neighbourhood :type nb: int
Note
The Investment attribute of the considered (Investment-)flows requires an attribute named like keyword!
optihood.converters module
- class optihood.converters.CHP(buildingLabel, input, outputEl, outputSH, outputDHW, efficiencyEl, efficiencySH, efficiencyDHW, capacityMin, capacityEl, capacitySH, capacityDHW, epc, base, varc1, varc2, env_flow1, env_flow2, env_capa, timesteps)[source]
Bases:
objectInformation about the model can be found in combined_pro.py CombinedCHP
- class optihood.converters.ElectricRod(buildingLabel, input, outputSH, outputDHW, efficiency, capacityMin, capacityMax, epc, base, varc, env_flow, env_capa)[source]
Bases:
CombinedTransformer
- class optihood.converters.ElectricRodFixed(buildingLabel, input, outputSH, outputDHW, efficiency, varc, env_flow, capacity)[source]
Bases:
CombinedTransformer
- class optihood.converters.GasBoiler(buildingLabel, input, outputSH, outputDHW, efficiencySH, efficiencyDHW, capacityMin, capacityMax, epc, base, varc, env_flow, env_capa)[source]
Bases:
CombinedTransformerInformation about the model can be found in combined_pro.py CombinedTransformer
- class optihood.converters.GeothermalHeatPumpLinear(buildingLabel, temperatureDHW, temperatureSH, temperatureLow, input, outputSH, outputDHW, capacityMin, capacityMax, nomEff, epc, base, varc, env_flow, env_capa)[source]
Bases:
objectInformation about the model can be found in combined_pro.py CombinedTransformer
- class optihood.converters.GeothermalHeatPumpLinearSingleUse(buildingLabel, temperatureH, temperatureLow, input, outputH, capacityMin, capacityMax, epc, base, varc, env_flow, env_capa)[source]
Bases:
objectClass implementing a linear model for geothermal heat pump for single use only (either DHW or SH but not both)
- class optihood.converters.HeatPumpLinear(buildingLabel, temperatureDHW, temperatureSH, temperatureLow, input, outputSH, outputDHW, capacityMin, capacityMax, nomEff, epc, base, varc, env_flow, env_capa)[source]
Bases:
objectInformation about the model can be found in combined_pro.py CombinedTransformer
- class optihood.converters.SolarCollector(label, buildingLabel, inputs, outputs, connector, electrical_consumption, peripheral_losses, latitude, longitude, collector_tilt, roof_area, zenith_angle, collector_azimuth, eta_0, a_1, a_2, temp_collector_inlet, delta_temp_n, irradiance_global, irradiance_diffuse, temp_amb_col, capacityMin, capacityMax, epc, base, env_capa, env_flow, varc)[source]
Bases:
Transformer
optihood.energy_network module
- class optihood.energy_network.EnergyNetworkClass(timestamp)[source]
Bases:
EnergySystem
- class optihood.energy_network.EnergyNetworkGroup(timestamp)[source]
Bases:
EnergyNetworkClass
- class optihood.energy_network.EnergyNetworkIndiv(timestamp)[source]
Bases:
EnergyNetworkClass
optihood.labelDict module
optihood.plot_functions module
- optihood.plot_functions.createPlot(resultFilePath, basePath, numberOfBuildings, plotLevel, plotType, flowType, plotAnnualHorizontalBar, newLegends)[source]
- optihood.plot_functions.deduplicateLegend(handles, labels)[source]
Function from the URBS platform https://github.com/ojdo/urbs/blob/1house/comp.py Remove double entries from figure legend. :param handles: list of legend entry handles :param labels: list of legend entry labels :return: (handles, labels) tuple of lists with duplicate labels removed
- optihood.plot_functions.getData(filepath)[source]
Function for the results recovery from an Excel file :param filepath: path to the Excel containing the results of the optimization :return: the different dicts created during the optimization
- optihood.plot_functions.groupHbarPlots(ax, group_size, inner_sep=None)[source]
Function from the URBS platform https://github.com/ojdo/urbs/blob/1house/comp.py Group bars of a horizontal barplot closer together. Given an existing horizontal bar plot handle ax, move bars of a given group size (>=2) closer together, reducing the distance within the bars of a group, but increasing the distance between different groups. By default, bars are placed within a coordinate system 1 unit apart. The space between two bars has size 1 - bar_height, which can be specified in matplotlib (and pandas) using the width argument. :param ax: matplotlib axis :param group_size: int type, how many bars to group together :param inner_sep: float type, vertical spacing within group (optional). Default: reduce the distance to a half :return:
- optihood.plot_functions.hourlyDailyPlot(data, bus, palette, new_legends)[source]
Function for the bokeh plot of hourly and daily balance of a bus :param data: list of dict type, results from the optimization :param bus: list of str type, buses from which the summary is required :param palette: palette type form bokeh.palettes (For example, Category10_8), different types can be found on https://docs.bokeh.org/en/latest/docs/reference/palettes.html or https://docs.bokeh.org/en/latest/_modules/bokeh/palettes.html :param new_legends: dict type, new legends to plot on the graph For example, Category10_8 :return:
- optihood.plot_functions.loadPlottingData(resultFilePath, numberOfBuildings)[source]
Function for loading the data from excel file into variables :param resultFilePath: path to the Excel containing the results of the optimization :return: the different variables created after reading the excel file
- optihood.plot_functions.monthlyBalance(data, bus, new_legends)[source]
Function for the definition of the monthly summary of a bus :param data: dict type, results from the optimization applied to one bus :param bus: str type, bus from which the summary is required :param new_legends: dict type, new legends to plot on the graph :return:
- optihood.plot_functions.plot(excelFileName, figureFilePath, numberOfBuildings, plotLevel, plotType, flowType, plotlabels='default', plotAnnualHorizontalBar=False)[source]
- optihood.plot_functions.resultingDataDemandDiagram(elBus, shBus, dhwBus, COLORS, building, newLegends)[source]
Function inspired from the URBS platform https://github.com/ojdo/urbs/blob/1house/comp.py Function plotting the different results of the optimization. First, costs will be plotted, then the energy produced, comparing energy for electricity bus, sh and dhw bus, and finally the retrieved energy from the storages. :param elBus: dict type, results from the optimization applied to one bus. Called like “solph.views.node(results, bus)” :param shBus: dict type, results from the optimization applied to one bus. Called like “solph.views.node(results, bus)” :param dhwBus: dict type, results from the optimization applied to one bus. Called like “solph.views.node(results, bus)” :param COLORS: list type, different colors for the different components of the system :param building: str type, name of the building :return: Three bar plots and the elec, sh and dhw dict created
- optihood.plot_functions.resultingDataDemandDiagramLoop(elec, sh, dhw, colors, buildings, newLegends)[source]
Function inspired from the URBS platform https://github.com/ojdo/urbs/blob/1house/comp.py Function plotting the graph comparing the different buildings/scenarios on costs, energy produced and energy retrieved from storages :param elec: list of dict type, optimization results :param sh: list of dict type, optimization results :param dhw: list of dict type, optimization results :param colors: list type, different colors for the different components of the system :param buildings: list of str type, name of the different buildings :return: figure created
- optihood.plot_functions.resultingDataDiagram(elBus, shBus, dhwBus, costs, env, COLORS, building, newLegends)[source]
Function inspired from the URBS platform https://github.com/ojdo/urbs/blob/1house/comp.py Function plotting the different results of the optimization. First, costs will be plotted, then the energy produced, comparing energy for electricity bus, sh and dhw bus, and finally the retrieved energy from the storages. :param elBus: dict type, results from the optimization applied to one bus. :param shBus: dict type, results from the optimization applied to one bus. :param dhwBus: dict type, results from the optimization applied to one bus. :param costs: dict type, resulting costs from the optimization :param env: dict type, resulting environmental impacts from the optimization :param COLORS: list type, different colors for the different components of the system :param building: str type, name of the building :return: Four bar plots and the costs, environmental impacts, production and storage dict created
- optihood.plot_functions.resultingDataDiagramLoop(elec, sh, dhw, costs, env, colors, buildings, newLegends)[source]
Function inspired from the URBS platform https://github.com/ojdo/urbs/blob/1house/comp.py Function plotting the graph comparing the different buildings/scenarios on costs, energy produced and energy retrieved from storages :param elec: list of dict type, optimization results :param sh: list of dict type, optimization results :param dhw: list of dict type, optimization results :param costs: list of dict type, optimization results :param env: list of dict type, optimization results :param colors: list type, different colors for the different components of the system :param buildings: list of str type, name of the different buildings :return: figure created
- optihood.plot_functions.toColor(COLORS, obj=None)[source]
Function from the URBS platform https://github.com/ojdo/urbs/blob/1house/comp.py Assign a deterministic pseudo-random color to argument. If COLORS[obj] is set, return that. For strings, this value depends only on the string content, so that same strings always yield the same color. :param COLORS: dict of components and their assigned color :param obj: any hashable object :return: a (r, g, b) color tuple if COLORS[obj] is set, otherwise a hexstring
optihood.plot_sankey module
- optihood.plot_sankey.addCapacities(nodes, dataDict, buildings, UseLabelDict, labelDict, mergedLinks)[source]
- optihood.plot_sankey.createSankeyData(dataDict, keys, UseLabelDict, labelDict, PositionDict, buildings=[], mergedLinks=False)[source]
- optihood.plot_sankey.displaySankey(fileName, UseLabelDict, labelDict, positionDict, labels, buildings, mergedLinks, hideBuildingNumber)[source]
- optihood.plot_sankey.plot(excelFileName, outputFileName, numberOfBuildings, UseLabelDict, labels, optimType, mergedLinks=False, hideBuildingNumber=False)[source]
- optihood.plot_sankey.random() x in the interval [0, 1).
optihood.sinks module
under-development component for a linear RC model for heating a Building
- class optihood.sinks.SinkRCModel(tAmbient, totalIrradiationHorizontal, heatGainOccupants, rDistribution=0.75, cDistribution=0.26, rIndoor=0.09, cIndoor=0.97, rWall=1.7, cWall=226.3, areaWindows=0.09, qDistributionMin=0, qDistributionMax=1000, tIndoorMin=19, tIndoorMax=23, tIndoorInit=19, tWallInit=19, tDistributionInit=19, **kwargs)[source]
Bases:
SinkBuilding RC Model implemented as a custom Sink component
- Parameters:
rDistribution (Thermal resistance between indoor and distribution system states [K/kW]) –
cDistribution (Thermal capacity of distribution system state [kWh/K]) –
rIndoor (Thermal resistance between indoor and wall states [K/kW]) –
cIndoor (Thermal capacity of indoor air state [kWh/K]) –
rWall (Thermal resistance between wall state and outside [K/kW]) –
cWall (Thermal capacity of wall state [kWh/K]) –
areaWindows (aperture area of windows [m^2]) –
qDistributionMin (Minimum operating power from the SC tank to the distribution system [kW]) –
qDistributionMax (Maximum operating power from the SC tank to the distribution system [kW]) –
tIndoorMin (Indoor minimum comfort temperature [ºC]) –
tIndoorMax (Indoor maximum comfort temperature [ºC]) –
tIndoorInit (Indoor initial temperature [ºC]) –
tWallInit (Wall initial temperature [ºC]) –
tDistributionInit (Distribution system initial temperature [ºC]) –
tAmbient (Ambient outside air temperature at each timestep [ºC]) –
totalIrradiationHorizontal (Total horizontal irradiation at each timestep [kW/m^2]) –
heatGainOccupants (Internal heat gains from occupants at each timestep [kW]) –
optihood.sources module
- class optihood.sources.PV(label, buildingLabel, outputs, peripheral_losses, latitude, longitude, pv_tilt, pv_efficiency, roof_area, zenith_angle, pv_azimuth, irradiance_global, irradiance_diffuse, temp_amb_pv, capacityMin, capacityMax, epc, base, env_capa, env_flow, varc)[source]
Bases:
Source