accim.parametric_and_optimisation package
Subpackages
- accim.parametric_and_optimisation.funcs_for_besos package
- Submodules
- accim.parametric_and_optimisation.funcs_for_besos.param_accis module
drop_invalid_param_combinations()get_valid_param_combinations()modify_ASTtol()modify_CAT()modify_CATcoolOffset()modify_CATheatOffset()modify_ComfMod()modify_ComfStand()modify_CoolSeasonEnd()modify_CoolSeasonStart()modify_CustAST_ACSTall()modify_CustAST_ACSTaul()modify_CustAST_ACSToffset()modify_CustAST_AHSTall()modify_CustAST_AHSTaul()modify_CustAST_AHSToffset()modify_CustAST_ASTall()modify_CustAST_ASTaul()modify_CustAST_ASToffset()modify_CustAST_m()modify_CustAST_n()modify_HVACmode()modify_MaxTempDiffVOF()modify_MaxWindSpeed()modify_MinOToffset()modify_MinTempDiffVOF()modify_MultiplierVOF()modify_SetpointAcc()modify_VSToffset()modify_VentCtrl()
- accim.parametric_and_optimisation.funcs_for_besos.param_apmv module
- Module contents
Submodules
accim.parametric_and_optimisation.main module
- class accim.parametric_and_optimisation.main.AccimPredefModelsParamSim(building: <module 'besos.IDF_class' from '/home/docs/checkouts/readthedocs.org/user_builds/accim/envs/v0.7.6/lib/python3.9/site-packages/besos/IDF_class.py'>, output_type: str = 'standard', output_keep_existing: bool = False, output_freqs: list = ['hourly'], ScriptType: str = 'vrf_mm', SupplyAirTempInputMethod: str = 'temperature difference', debugging: bool = False)[source]
Bases:
OptimParamSimulation
- class accim.parametric_and_optimisation.main.OptimParamSimulation(building: <module 'besos.IDF_class' from '/home/docs/checkouts/readthedocs.org/user_builds/accim/envs/v0.7.6/lib/python3.9/site-packages/besos/IDF_class.py'>, parameters_type: ~typing.Literal['accim custom model', 'accim predefined model', 'apmv setpoints'], output_type: ~typing.Literal['standard', 'custom', 'detailed', 'simplified'] = 'standard', output_keep_existing: bool = False, output_freqs: ~typing.List[~typing.Literal['timestep', 'hourly', 'daily', 'monthly', 'runperiod']] = ['hourly'], ScriptType: ~typing.Literal['vrf_mm', 'vrf_ac', 'ex_ac'] = 'vrf_mm', SupplyAirTempInputMethod: ~typing.Literal['temperature difference', 'supply air temperature'] = 'temperature difference', make_averages: bool = False, debugging: bool = False, verbosemode: bool = True)[source]
Bases:
object- get_available_parameters() list[source]
Returns a list containing the available parameters depending on the parameters_type argument previously input.
- Returns:
a list containing the available parameters depending on the parameters_type argument previously input
- get_hourly_df(start_date: str = '2024-01-01 01')[source]
- Transforms the hourly values of outputs_param_simulation to a new pandas DataFrame, saved in the
internal variable named outputs_param_simulation_hourly.
- Parameters:
start_date – the start date for the simulation results, in format ‘YYY-MM-DD HH’
- get_hourly_df_columns()[source]
Identifies the columns which contain hourly values, and save the names in a list, saved in the internal variable named outputs_hourly_columns
- get_output_meter_df_from_idf() DataFrame[source]
Gets a pandas DataFrame which contains the Output:Meter objects from the idf.
- Returns:
a pandas DataFrame which contains the Output:Meter objects from the idf
- get_output_var_df_from_idf() DataFrame[source]
Gets a pandas DataFrame which contains the Output:Variable objects from the idf. Therefore, it may contain wildcards such as ‘*’, which means the variable is requested for all zones.
- Returns:
a pandas DataFrame which contains the Output:Variable objects from the idf
- get_outputs_df_from_testsim(reduce_sim_time: bool = True) tuple[DataFrame, DataFrame][source]
Gets two pandas DataFrames which contain the Output:Variable and Output:Meter objects from a test simulation. Therefore, it won’t contain wildcards such as ‘*’.
- Parameters:
reduce_sim_time – True to reduce the simulation runtime
- Returns:
a tuple containing the DataFrames containing Output:Variable and Output:Meter
- run_optimisation(epws: list, out_dir: str, evaluations: int, population_size: int, algorithm: str = 'NSGAII', **kwargs) DataFrame[source]
Runs the optimisation using
- Parameters:
epws – The epw filename
out_dir – the directory name to save the outputs
evaluations – The algorithm will be stopped once it uses more than this many evaluations. For more information, refer to besos.optimizer.platypus_alg
population_size – The number of simulations to run
- Returns:
a pandas DataFrame
- run_parametric_simulation(epws: list, out_dir: str, df: DataFrame, processes: int = 2, keep_input: bool = True, keep_dirs: bool = True) DataFrame[source]
Runs the parametric simulation.
- Parameters:
epws – a list of .epw filenames
out_dir – the name of the directory to store the outputs
df – a pandas DataFrame which contains the values of the parameters to simulate
processes – the number of CPUs to be used in simulation
keep_input – True to keep the input DataFrame in the results
keep_dirs – True to keep the simulation results
- Returns:
a pandas DataFrame
- sampling_full_factorial(level: int)[source]
Split the range of every parameter in the number of parts specified in argument level, and saves it into a pandas DataFrame, stored in an internal variable named parameters_values_df. For more information, see besos.sampling.dist_sampler and besos.sampling.full_factorial
- Parameters:
level – an integer; represents the number of parts to split each parameter’s range
- sampling_full_set()[source]
Combines all values from all parameters and saves it into a pandas DataFrame, stored in an internal variable named parameters_values_df.
- sampling_lhs(num_samples: int)[source]
Uses Latin Hypercube Sampling to make samples, where the total number is specified in the num_samples argument, and saves it into a pandas DataFrame, stored in an internal variable named parameters_values_df. For more information, see besos.sampling.dist_sampler and besos.sampling.lhs
- Parameters:
num_samples – an integer; represents the total number of samples
- set_evaluator(epw: str, out_dir: str) EvaluatorEP[source]
Used internally for setting the evaluator in run_parametric_simulation and run_optimisation methods.
- Parameters:
epw – The epw file name
out_dir – The name of the output directory to save the results.
- Returns:
the besos.evaluator.EvaluatorEP class instance
- set_output_met_objects_to_idf(output_meters: list)[source]
Adds the Output:Meter objects from the output_meters argument.
- Parameters:
output_meters (list) – a list containing Output:Meter objects to be added
- Returns:
- set_output_var_df_to_idf(outputs_df: DataFrame | None = None)[source]
Keeps the Output:Variable objects contained in the input pandas DataFrame and removes all others. This is important to save space if thousands of simulations with heavy outputs are run.
- Parameters:
outputs_df (pd.DataFrame) – the DataFrame containing Output:Variable objects to be kept
- Returns:
- set_outputs_for_simulation(df_output_variable: DataFrame | None = None, df_output_meter: DataFrame | None = None)[source]
Sets the outputs for the parametric analysis or optimisation based on the input pandas DataFrames for Output:Variable and/or Output:Meter objects. These DataFrames can include columns for the output name and the aggregation function (see the ‘func’ argument of MeterReader and VariableReader classes in besos), respectively named ‘name’ and ‘func’. If no ‘name’ and/or ‘func’ columns are provided, the names will be the variable and meter names, and the hourly values will be summed.
- Parameters:
df_output_variable – a pandas DataFrame containing the Output:Variable objects, similar to that one returned from method get_outputs_df_from_testsim()
df_output_meter – a pandas DataFrame containing the Output:Meter objects, similar to that one returned from method get_outputs_df_from_testsim()
- set_parameters(accis_params_dict: dict, additional_params: list | None = None, use_dflt_values: bool = False)[source]
Sets the parameters for the parametric analysis or optimisation.
- Parameters:
accis_params_dict – a dictionary containing the parameters names in the keys, and in the values, the options or range of values using respectively a list or tuple with min and max values.
additional_params – any other additional parameter, as it would be added in besos
HVACmode – only used in accim predefined and custom models; sets the HVACmode argument; for more information, refer to addAccis
VentCtrl – only used in accim predefined and custom models; sets the VentCtrl argument; for more information, refer to addAccis
- set_problem(minimize_outputs: list | None = None, constraints: list | None = None, constraint_bounds: list | None = None, **kwargs)[source]
Sets the besos EPProblem class instance, using for inputs the parameters previously set in the set_parameters method, and for outputs, those set using the set_outputs_for_simulation method.
- Parameters:
minimize_outputs – only used in optimisation; a list containing booleans to specify if the outputs must be minimized (True), maximized (False), or just show the output (None).
constraints – only used in optimisation; a list containing the Output:Meter key names to be considered as constraints
constraint_bounds – only used in optimisation; a list containing the logical expressions for the constraints
- accim.parametric_and_optimisation.main.get_mdd_file_as_df()[source]
Returns the .mdd file from the test simulation as a pandas DataFrame
- Returns:
a pandas DataFrame containing the .mdd file from the test simulation
accim.parametric_and_optimisation.objectives module
accim.parametric_and_optimisation.parameters module
accim.parametric_and_optimisation.params_dicts module
accim.parametric_and_optimisation.utils module
- accim.parametric_and_optimisation.utils.expand_to_hourly_dataframe(df: DataFrame, parameter_columns: list, start_date: str = '2024-01-01 01', hourly_columns: list | None = None)[source]
Expands a dataframe with hourly data columns into an hourly dataframe.
Parameters: df (pd.DataFrame): The input dataframe containing parameters and hourly data columns. parameter_columns (list): The list of column names that contain input parameters. start_date (str): The start date and time in the format ‘YYYY-MM-DD HH’.
Returns: pd.DataFrame: The expanded dataframe with an additional datetime column.
- accim.parametric_and_optimisation.utils.identify_hourly_columns(df)[source]
Identifies the columns which contains strings representing lists.
- Parameters:
df – the pandas DataFrame
- Returns:
the list of column names
- accim.parametric_and_optimisation.utils.make_all_combinations(parameters_values_dict: dict) DataFrame[source]
Takes all values from all the parameters and return a pandas DataFrame with all possible combinations.
- Parameters:
parameters_values_dict – a dictionary in the format {‘parameter name’: list_of_values}
- Returns:
a pandas DataFrame with all possible combinations