Model
Main simulation engine: initialization, calibration, and scenario execution.
When to use this module
Use project.model when you need to:
prepare scenario configurations before execution
initialize model state from parsed inputs
run a full simulation programmatically
Common entrypoints include prepare_config and res_irf.
Main module of the model.
This module contains the main functions to run the model. The main function is res_irf that runs the model for a given scenario.
Functions
- res_irf
Res-IRF model.
- calibration_res_irf
Calibrate Res-IRF and returns calibrated parameters.
- get_inputs
Initialize thermal buildings object based on input dictionary.
- config2inputs
Create main Python object from configuration file.
- initialize
Create main Python objects read by model.
- stock_turnover
Update stock vintage due to renovation, demolition and construction.
- select_post_inputs
Inputs used during post-treatment but not used during the iteration.
- get_config
Get the configuration file.
- prepare_config
Prepare the configuration file.
- project.model.calibration_res_irf(path, config=None, level_logger='DEBUG')[source]
Calibrate Res-IRF and returns calibrated parameters. Function is useful for running multiple scenarios with the same calibration. Typical example is for sensitivity analysis or elasticity calculation. :param config: :param path: :param level_logger:
- project.model.config2inputs(config=None, scenario=None)[source]
Create main Python object from configuration file.
- Parameters:
config (dict) –
- project.model.get_config(scenario=None) dict[source]
- project.model.get_inputs(path=None, config=None, variables=None, scenario=None)[source]
Initialize thermal buildings object based on input dictionary.
- Parameters:
path (str, optional) – If None do not write output.
config (dict, optional) – If config is None use configuration file of Reference scenario
variables (list, optional) – ‘buildings’, ‘energy_prices’, ‘cost_insulation’, ‘carbon_emission’, ‘carbon_value_kwh’, ‘health_cost’
- Return type:
dict
- project.model.initialize(inputs, stock, year, taxes, path=None, config=None, logger=None, level_logger='DEBUG')[source]
Create main Python objects read by model.
- Parameters:
inputs –
stock –
year –
taxes –
config –
path –
logger –
- project.model.prepare_config(config)[source]
- project.model.res_irf(config, path, level_logger='DEBUG')[source]
Res-IRF model.
- Parameters:
config (dict) – Scenario-specific input
path (str) – Scenario-specific output path
level_logger (str) –
- Returns:
str – Scenario name
pd.DataFrame – Detailed results
- project.model.select_post_inputs(parsed_inputs)[source]
Inputs used during post-treatment but not used during the iteration.
- Parameters:
parsed_inputs (dict) –
- Return type:
dict
- project.model.stock_turnover(buildings, prices, taxes, cost_heater, cost_insulation, frequency_insulation, p_heater, p_insulation, flow_built, year, post_inputs, calib_heater=None, calib_renovation=None, financing_cost=None, prices_before=None, climate=None, district_heating=None, step=1, demolition_rate=None, memory=False, exogenous_social=None, output_options='full', premature_replacement=None, supply=None, carbon_content=None, carbon_content_before=None, default_quality=None, credit_constraint=True)[source]
Update stock vintage due to renovation, demolition and construction.
- Returns:
buildings (AgentBuildings) – Updated AgentBuildings object.
stock (: Series)
output (Series)