Code documentation

1. Site data builder

S1_SiteDataBuilder._make_Site(c)

Small function to build a site recap from reading all given B18 geometrics files descriptions. Return a small CSV with recap of surfaces by Subbuilding, Building, Number of floor and enduse.

Args:

c (ClassConfiguration): A ClassConfiguration object containing all path and parameters of tool.

S1_SiteDataBuilder._make_Buildings(c)

Small function to build a an input surface file for every building given as an b18 input file. Should be used for a « real » or detailed or reference approach to get wanted surface for site. Be careful if you model building with only 1 central floor, you must manually update CSV file to match what you really want. Return a small CSV with recap of surfaces by Subbuilding, Building, Number of floor and enduse.

Paramètres:

c – A ClassConfiguration object containing all path and parameters of tool.

S1_SiteDataBuilder._schedules_generator(weekday, saturday, sunday, dayoff=[], holiday=[])

This function takes several daily schedules, for weekdays, saturday, sunday, dayoff and holidays. Then it build an annual based on those schedules values and predetermined dayoff and holiday dates.

Return:

schedule (list): List of the hourly values of schedules during one year.

Args:

weekday (list): daily schedule values for weekday. saturday (list): daily schedule values for saturday. sunday (list): daily schedule values for sunday. dayoff (list): daily schedule values for a typical dayoff. holiday (list): daily schedule values for a typical holiday day.

S1_SiteDataBuilder._get_scheduleList_FromSpacetype(spacetype_dict, c)

This function will recursively parse a json_object, returning every instance of a specific string target. We use this function to detect every schedule used in a JSON spacetype file.

Args:

spacetype_dict (dict): The JSON object we want to parse (so the JSON spacetype file). c (ClassConfiguration): A ClassConfiguration object containing all path and parameters of tool.

S1_SiteDataBuilder._generate_InputSchedule(c, input_schedule_family=['horexA', 'horexB', 'horexC', 'horexG', 'horexD', 'horexK'], input_schedule_subfamily=['occ', 'lum', 'eq', 'dhw', 'cool', 'heat', 'vent'], input_schedule_daytype=['WD', 'Sat', 'Sun'])

This function will read the input schedule file (detected at c.path_ScheduleInput). Then it will create an annual schedule using _schedules_generator() function and daily schedules found in inpout schedule file. Schedules names must follows « Schedule family » + « _ » + « Schedule category » + « Schedule daytype ». For instance: horexA_occSat, horexB_lumSat…

Args:

c (ClassConfiguration): A ClassConfiguration object containing all path and parameters of tool. input_schedule_family (list): Schedule family (for instance: CNEB Schedule G for residential). Used in schedule name definition. input_schedule_subfamily (list): Schedule categories (for instance: occupant schedule, light schedule…). Used in schedule name definition. input_schedule_daytype (list): Schedule daytype identifier (for isntance: WD for Weekday, Sat for Saturday…). Used in schedule name definition.

S1_SiteDataBuilder._update_json_with_trnsys_schedules(file, json_dict, k, time_column='TIME', value_column='VALUES', schedName='')

This function aims to convert a schedule in csv format (list-like) to a TRNBuild schedule. It will retrieve the timeColumn and valueColumn columns from the csv file using pandas and convert it to an annual schedule. Then the schedule definition will be added as a schedule in the spacetype given in json_dict.

Args:

file (str): A string containing the path to the csv file. json_dict (dict): A spacetype JSON definition stored in a dictionary. k (dict): keys equivalence dictionary from ClassConfiguration. time_column (str): The name of the column to look for timestep values. Must be in hours. value_column (str): The name of the column to look for schedule values. Must be in interval [0,1]. schedName (str): The name tu use for the schedule.

Return:

json_dict (dict): The spacetype definition where to add the schedule

S1_SiteDataBuilder._update_json_with_input_schedules(json_dict, k, schedName='')

This function will write the schedule schedName in json_dict JSON spacetype file. No time and values series are given because this schedule is an input in the B18 file. The schedule type will be input so that B18 update will interprete this schedule as an input.

Return:

json_dict (dict): The spacetype definition where to add the schedule

Args:

json_dict (dict): A spacetype JSON definition stored in a dictionary. k (dict): keys equivalence dictionary from ClassConfiguration. schedName (str): The name tu use for the schedule.

S1_SiteDataBuilder._loadAllSchedules_InAllSpacetypes(c)

This function loads all schedules from c.path_ScheduleHourlyTRNSYS, c.path_ScheduleDailyTRNSYS, c.path_ScheduleAnnualTRNSYS and c.path_ScheduleInput files. Then those schedules are written in spacetypes where the schedule is used (where its name is detected in a spacetype JSON file).

Args:

c (ClassConfiguration): A ClassConfiguration object containing all path and parameters of tool.

2. JSON builder

S2_JsonBuilder._BuildSpacetypeSurface(c)

Function used to initialize Spacetype surfaces in the building surfaces CSV files. Read the building surface file, create new columns for each spacetype, update surface value for each {cluster, spacetype} according to cluster enduse surface, weight, and spacetype probability from parameters SpacetypeDict in ClassConfiguration object c.

Args:

c (ClassConfiguration): A ClassConfiguration object containing all path and parameters of tool.

S2_JsonBuilder._ChooseSpacetype_Probability(b18_dict_zone, file, c)

This function is used for stochastic attribution of spacetype. A « leftover » surface is first created. Then, zones are read randomly and each time a spacetype is chosen using weighted probability coefficient fron c.SpacetypeDict

Args:

c (ClassConfiguration): A ClassConfiguration object containing all path and parameters of tool. b18_dict_zone (dict): Dictionnary of a JSON file description of zones properties. file (str): name of surface file stored in c.path_GeneratedSurfaceRecap (name without file extension)

Return:

b18_dict_zone (dict): Dictionnary of a JSON file description of zones properties. Updated with spacetypes.

S2_JsonBuilder._ChooseSpacetype_Manually(b18_dict_zone, file, c)

This function is used for manually attributing spacetype based on rules on zone names.

Args:

c (ClassConfiguration): A ClassConfiguration object containing all path and parameters of tool. b18_dict_zone (dict): Dictionnary of a JSON file description of zones properties. file (str): name of surface file stored in c.path_GeneratedSurfaceRecap (name without file extension)

Return:

b18_dict_zone (dict): Dictionnary of a JSON file description of zones properties. Updated with spacetypes.

S2_JsonBuilder._BuildJSONFile(c)

This function completely build a JSOn file for each building. The JSON file contains each zones: - Properties - Spacetype - Schedules and type of schedules - Deep hot water peak value This function also replace zone dependant equations by their results using zone properties.

Args:

c (ClassConfiguration): A ClassConfiguration object containing all path and parameters of tool.

3. Noise builder

S3_NoiseBuilder.randomIntervalSelection(ListOfValues, Coef)

This function introduce a random noise from a controlled interval to the values of a specific attribute of eeach zone. This function keep the specific attribute mean constant. For instance, a noise of +- Coef % will be introduced to every zone lighting gains, while keeping the total/mean lighting gain of the building identical.

Args:

ListOfValues (List): A list of all zones nominal value for a specific category. For instance, it could be a list of all nominal values for equipment gains. Coef (Float): Interval coefficient for introducing noise.

Return:

ListOfValues (List): The previous ListOfValues, updated with the noise.

S3_NoiseBuilder.noiseValues(c)

Generate noise for nominal value of zone’s dhw, gains and ventilation, using the previously defined randomIntervalSelection() function. Sum of building radiative, convective and humidification gains are kept constant for the 3 categories (people, equipment, lights)

Args:

c (ClassConfiguration): A ClassConfiguration object containing all path and parameters of tool.

S3_NoiseBuilder.noiseSchedules(c)

Generate noise to schedules. Annual occupancy schedule is read,every changes in occupancy are identified. Then those changes are moved by in an interval +- 2h with a gaussian-like probability. Schedules variation implies differents total electric consumption at the end of the day.

Args:

c (ClassConfiguration): A ClassConfiguration object containing all path and parameters of tool.

S3_NoiseBuilder.noiseTsetpoint(c)

Generate noise on schedule setpoint base value of every residential area for every schedule file. Using interval and wieght:

  • interval = [-3, -2 , -1 , 0 , 1 , 2 , 3 ]

  • weight = [5%, 10%, 10%, 25% , 25% , 15%, 10%]

Args:

c (ClassConfiguration): A ClassConfiguration object containing all path and parameters of tool.

S3_NoiseBuilder.noise(c)

Main function for noise. Will call noise function if precision of occupancy is stochastic.

Args:

c (ClassConfiguration): A ClassConfiguration object containing all path and parameters of tool.

4. Deck builder

S4_DeckBuilder._buildDeck_FromB18(B18_InputPath, c, DCK_TemplatePath, DCK_OutputPathDir, PATH_METEO_FILE, PATH_SCHEDULE_FILE, filename, KEY_sched, KEY_input, PRINTER_MAX_INPUT=75)

This function allows to update a template Deck file with saved configuration and buildings informations. It includes update path to meteo file, path to external schedule file, path to building file. It also includes linking all of the building’s output to different Type25 in deck file. If maximum number of input is reached, then multiples deck are generated until all outputs are linked to one Type25 input.

Args:

B18_InputPath (string): Path to .b18 building file. c (ClassConfiguration): A ClassConfiguration object containing all path and parameters of tool. DCK_TemplatePath (string): Path to .dck template used to write output in. DCK_OutputPathDir (string): Path to output directory where to save updated .dck file. PATH_METEO_FILE (string): Relative path to meteo file. PATH_SCHEDULE_FILE (string): Relative path to schedule file. filename (string): A string containing the name of the output file, without it’s extension (.dck). schedKEY (string): A string of the common identifier found a the begening of every schedule name. Used for importing only specific columns from CSV file. schedFILEUNIT (string): A string of an integer corresponding to the fileUNIT of the CSV (defined in the assign line of CSV import block). PRINTER_MAX_INPUT (int): Maximum number of input allowed per Type25c logger.infoer. If total outputs is greater than PRINTER_MAX_INPUT, multiple deck files will be generated.

This functions allows one to write TRNSYS links between the outputs of Type56 stored in list_output_name and the inputs of the Type25c where fcount is pointing. The list_output_name and list_output_id are sublist extracted from Type56 list of output to make sure this Type25c doesn’t have too much inputs.

Args:

dck_lines (list-like): a list-like object of a .dck file. list_output_name (list): A list of output found in the path_b18 file used by Type56 building model. list_output_id (list): Unique ID for each output of list_output_name. fcount (int): The line from which to start reading the dck_lines file (i.e. the line of the current Type25c where to write the nexts outputs.)

This functions allows one to write TRNSYS links between the outputs of Type56 stored in list_output_name and the inputs of the Type25c where fcount is pointing. The list_output_name and list_output_id are sublist extracted from Type56 list of output to make sure this Type25c doesn’t have too much inputs.

Args:

dck_lines (list-like): a list-like object of a .dck file. list_sched_name (list): A list of schedule found in the schedule files columns used by Type9c file reader model. list_sched_id (list): Unique ID for each scuedule input of list_sched_name. fcount (int): The line from which to start reading the dck_lines file (i.e. the line of the current Type56 where to write the nexts inputs.) schedKEY (string): A string of the common identifier found a the begening of every schedule name. Used for importing only specific columns from CSV file. schedFILEUNIT (string): A string of an integer corresponding to the fileUNIT of the CSV (defined in the assign line of CSV import block).

S4_DeckBuilder.generate_AllDeckForSimulations(c)

Main function for deck generation. Iterates on the file found in building file directory and call _buildDeck_FromB18() function for each file.

Args:

c (ClassConfiguration): A ClassConfiguration object containing all path and parameters of tool.

5. Load builder

S6_LoadBuilder._get_ModelLoads_FromCSV(c, filee, Model_DictOfZonesProperties, path='', starttime=0.0)

Read a bunch of files found in directory “path”. Read those files and stored them in a pandas dataframe. Make sure every files have the same time series, because this function will append on columns.

Returns:

Model_Loads (DataFrame): A panda DataFrame containing all columns in list_key categories for each files read.

Args:

c (ClassConfiguration): A ClassConfiguration object containing all path and parameters of tool. filee (str): Name of an annual schedule file used (taken from c.path_OutpuSCH). Model_DictOfZonesProperties (Dict): JSON file description of zones properties. path (str): Path to the directory containing the loads resulting from a TRNSYS simulation of a deck. starttime (float): Starttime used to read the time series of the files.

S6_LoadBuilder._print_stats(DF, c, file, SurfaceSerie)

This function calculate and save annual statistics of a dataframe. It calculate total annual consumption (kJ and GWh), min and max power values (kJ/hr and MW), and surfacic annual consumption (kWh/m²) Statistics are saved in c.path_OutputLOADS dircetory, under “file + _STATS.csv” name.

Args:

DF (pd.DataFrame): A pandas dataframe (in [kJ/hr]) containing the building loads. c (ClassConfiguration): A ClassConfiguration object containing all path and parameters of tool. file (str): Name of dir/file in which to read simulations results. SurfaceSerie (pd.Series): A pandas series containing total surfaces on which columns loads are applicable to. It is used to calculate surfacic loads.

S6_LoadBuilder._ModelsLoader(c, deckList)

Function for creating load files and loading zone’s properties for each building. THen returning Dictionnary with loads files and zones properties for each building.

Args:

c (ClassConfiguration): A ClassConfiguration object containing all path and parameters of tool. deckList (List): List of the names of each deck folder (i.e. each building)

Return:

DictOf_Model_Loads (Dict): Dictionnary of buildings loads dataframe generated using _get_ModelLoads_FromCSV() function. DictOf_Model_DictOfZonesProperties (Dict): Dictionnary of buildings’s dictionnary of zone’s properties.

S6_LoadBuilder._GetClusterLoads(Cluster_Dict, Model_Loads, Model_DictOfZonesProperties)

Function to calculate the loads of each cluster defined in Cluster_Dict.

Args:

Cluster_Dict (Dict): Dictionnary containing properties of cluster (name, surface in model, surface in building) Model_Loads (Dict): Model loads dataframe generated using _get_ModelLoads_FromCSV() function. Model_DictOfZonesProperties (Dict): Model dictionnary of zone’s properties.

Return:

Cluster_Dict (Dict): Dictionnary containing properties of cluster. Updated with cluster loads.

S6_LoadBuilder._GetBuildingLoads(Cluster_Dict, Model_Loads)

Function to calculate the loads of each buildings by using cluster loads, and cluster ratio of surface between model and building.

Args:

Cluster_Dict (Dict): Dictionnary containing properties of cluster (name, surface in model, surface in building, loads) Model_Loads (Dict): Model loads dataframe generated using _get_ModelLoads_FromCSV() function.

Return:

Building_Loads (Dict): Buildings loads dataframe.

S6_LoadBuilder._GetSurfacicZoneLoads(c, Model_Loads, Model_DictOfZonesProperties)

Function built to generate a CSV file with surfacic loads of every building.

Args:

c (ClassConfiguration): A ClassConfiguration object containing all path and parameters of tool. Model_Loads (Dict): Model loads dataframe generated using _get_ModelLoads_FromCSV() function. Model_DictOfZonesProperties (Dict): Buildings’s dictionnary of zone’s properties.

S6_LoadBuilder._UpdateSiteLoads(Model_Loads, Site_Loads, Site_Surface, Building_Loads, Building_Surface)

Function to update values of Site_Loads dataframe and Site_Surface variable with a building loads and surface.

Args:

Model_Loads (Dict): Model loads dataframe generated using _get_ModelLoads_FromCSV() function. Site_Loads (Dict): Dataframe where we sum all buildings loads to obtain site loads dataframe. Site_Surface (Float): Total floor surface of all building already considered. Building_Loads (Dict): Buildings loads dataframe. Building_Surface (Float): Total floor surface of a building.

Return:

Site_Loads (Dict): Dataframe where we sum all buildings loads to obtain site loads dataframe. Updated with Building_Loads. Site_Surface (Float): Total floor surface of all building already considered. Updated with Building_Surface.

S6_LoadBuilder._UpdateSpacetypeLoads(Model_Loads, Model_DictOfZonesProperties, Spacetype_Loads, Spacetype_Surface)

Function to update values of Spacetype_Loads dataframe and Spacetype_Surface variable with a model loads and surface.

Args:

Model_Loads (Dict): Model loads dataframe generated using _get_ModelLoads_FromCSV() function. Model_DictOfZonesProperties (Dict): Model dictionnary of zone’s properties. Spacetype_Loads (Dict): Dataframe where we sum all loads of zone with same spacetype to obtain spacetype loads dataframe. Spacetype_Surface (Float): Variable to sum floor surface of all zones into total floor surface of each spacetype.

Return:

Spacetype_Loads (Dict): Dataframe where we sum all loads of zone with same spacetype to obtain spacetype loads dataframe. Updated with loads of a model. Spacetype_Surface (Float): Variable to sum floor surface of all zones into total floor surface of each spacetype. Updated with surfaces of a model.

S6_LoadBuilder.smoothing(c)

Small function to smooth data with weight function [0.05, 0.2, 0.5, 0.2, 0.05].

Args:

c (ClassConfiguration): A ClassConfiguration object containing all path and parameters of tool.

S6_LoadBuilder.scaling_detailed(c)

Scaling up for Detailed approach. Cluster are define as {Subbuilding, Floor}. For instance (Main_F0).

Args:

c (ClassConfiguration): A ClassConfiguration object containing all path and parameters of tool.

S6_LoadBuilder.scaling_archetype(c)

Scaling up for Archetype approach. Cluster are define as {Spacetype, Floor}. For instance (Office_F0).

Args:

c (ClassConfiguration): A ClassConfiguration object containing all path and parameters of tool.

S6_LoadBuilder.scaling_prototype(c)

Scaling up for Prototype approach. In each building, clusters are define as {Spacetype}. For instance (Office).

Args:

c (ClassConfiguration): A ClassConfiguration object containing all path and parameters of tool.

S6_LoadBuilder.Scaling(c)

Main function for scaling, depending on c.Precision_BLD, will call adapted scaling method. Then use smoothing algorithm.

Args:

c (ClassConfiguration): A ClassConfiguration object containing all path and parameters of tool.

6. Thermal network builder

S8_ThnBuilder.update_RTh(c)

Function to size a template thermal network deck model (.dck). Depending on c.Precision_RTU, will use appropriate template, then: Read pipes.csv file to overwrite pipes properties and pumps sizing in template. Read total loads file to overwrite heat pump and chiller sizing in template. Then export resize deck so it’s ready to be simulated.

Args:

c (ClassConfiguration): A ClassConfiguration object containing all path and parameters of tool.

7. Log file builder

class _Logging.CallCounted(method)

Decorator to determine number of calls for a method

_Logging.log_recap(logger)

Print a recap of the number of info, warning and critical message in the object logger.

8. Translate to B18

_TranslateToB18.convert_FromJSON_ToB18(c)

Main function for writing a set of template spacetype on a set of B18 building input files (i.e. structurals archetypes). It gets the different files and call writeSpacetypeJSON_InB18() to write each spacetype in corresponding subset of zones in every B18 file.

Args:

c (ClassConfiguration): A ClassConfiguration object containing all path and parameters of tool.

_TranslateToB18.update_json_with_b18_coolings(b18_name, b18_lines, json_dict, k)

Given a b18 list-like file, this function will update the json dict with all cooling defined in the file.

Return:

json_dict (dict): The json_dict udapted with all the cooling defined in b18_lines.

Args:

b18_name (str): Name of the spacetype we are reading. b18_lines (list-like): a list-like object of a spacetype (as a TRNSYS building). json_dict (dict): a nested dictionnaries where the spacetype data is to be stored. key (dict): A subset of the json key dictionnary containing keys for coolings definition.

_TranslateToB18.update_json_with_b18_gains(b18_name, b18_lines, json_dict, k)

Given a b18 list-like file, this function will update the json dict with all gains defined in the file.

Return:

json_dict (dict): The json_dict udapted with all the gains defined in b18_lines.

Args:

b18_name (str): Name of the spacetype we are reading. b18_lines (list-like): a list-like object of a spacetype (as a TRNSYS building). json_dict (list-like): a nested dictionnaries where the spacetype data is to be stored. key (dict): A subset of the json key dictionnary containing keys for gains definition.

_TranslateToB18.update_json_with_b18_heatings(b18_name, b18_lines, json_dict, k)

Given a b18 list-like file, this function will update the json dict with all heating defined in the file.

Return:

json_dict (dict): The json_dict udapted with all the heating defined in b18_lines.

Args:

b18_name (str): Name of the spacetype we are reading. b18_lines (list-like): a list-like object of a spacetype (as a TRNSYS building). json_dict (list-like): a nested dictionnaries where the spacetype data is to be stored.

_TranslateToB18.update_json_with_b18_infiltrations(b18_name, b18_lines, json_dict, k)

Given a b18 list-like file, this function will update the json dict with all infiltration defined in the file.

Return:

json_dict (dict): The json_dict udapted with all the infiltration defined in b18_lines.

Args:

b18_name (str): Name of the spacetype we are reading. b18_lines (list-like): a list-like object of a spacetype (as a TRNSYS building). json_dict (list-like): a nested dictionnaries where the spacetype data is to be stored. key (dict): A subset of the json key dictionnary containing keys for infiltration definition.

_TranslateToB18.update_json_with_b18_schedules(b18_name, b18_lines, json_dict, k)

Given a b18 list-like file, this function will update the json dict with all schedules defined in the file.

Return:

json_dict (dict): The json_dict udapted with all the schedules defined in b18_lines.

Args:

b18_name (str): Name of the spacetype we are reading. b18_lines (list-like): a list-like object of a spacetype (as a TRNSYS building). json_dict (list-like): a nested dictionnaries where the spacetype data is to be stored. key (dict): A subset of the json key dictionnary containing keys for schedules definition.

_TranslateToB18.update_json_with_b18_ventilations(b18_name, b18_lines, json_dict, k)

Given a b18 list-like file, this function will update the json dict with all ventilation defined in the file.

Return:

json_dict (dict): The json_dict udapted with all the ventilation defined in b18_lines.

Args:

b18_name (str): Name of the spacetype we are reading. b18_lines (list-like): a list-like object of a spacetype (as a TRNSYS building). json_dict (list-like): a nested dictionnaries where the spacetype data is to be stored. key (dict): A subset of the json key dictionnary containing keys for ventilation definition.

_TranslateToB18.write_JSONDefCooling_ToB18(b18_lines, c, key)

Write a cooling definition in a b18_lines object representing a .b18 file. The function type indicate if TdbConsigne data is given as a constant, as an input in the file or as a schedule in the file.

Args:

b18_lines (list-like): a list-like object of a .b18 file. c (dict): A subset of a JSON dict containing the cooling definition. key (dict): A subset of the json key dictionnary containing keys for cooling definition.

_TranslateToB18.write_JSONDefGain_ToB18(b18_lines, g, key)

Write a gain definition in a b18_lines object representing a .b18 file. The gains category are the ones recognized by TRNBuild (people, light, equipment, thermal bridges and miscellanious).

Args:

b18_lines (list-like): a list-like object of a .b18 file. g (dict): A subset of a JSON dict containing the gain definition. key (dict): A subset of the json key dictionnary containing keys for gain definition.

_TranslateToB18.write_JSONDefHeating_ToB18(b18_lines, h, key)

Write a heating definition in a b18_lines object representing a .b18 file. The function type indicate if TdbConsigne data is given as a constant, as an input in the file or as a schedule in the file.

Args:

b18_lines (list-like): a list-like object of a .b18 file. h (dict): A subset of a JSON dict containing the heating definition. key (dict): A subset of the json key dictionnary containing keys for heating definition.

_TranslateToB18.write_JSONDefInfiltration_ToB18(b18_lines, f, key)

Function to write the definition of an infiltration in a .b18 file. The InfType indicate if InfRate data is given as a constant, as an input in the file or as a schedule in the file.

Arg:

b18_lines :: list-liked containing the lines of the .b18 f (dict): A subset of a JSON dict containing the infiltration definition. key (dict): A subset of the json key dictionnary containing keys for infiltration definition.

_TranslateToB18.write_JSONDefVentilation_ToB18(b18_lines, v, key)

Write a ventilation definition in a b18_lines object representing a .b18 file. The function type indicate if ventAirflow data is given as a constant, as an input in the file or as a schedule in the file. The function mode indicate the ventilation method to be used (so ventAirflow unit is linked to the Mode parameter).

Args:

b18_lines (list-like): a list-like object of a .b18 file. v (dict): A subset of a JSON dict containing the ventilation definition. key (dict): A subset of the json key dictionnary containing keys for ventilation definition.

_TranslateToB18.write_JSONZoneCooling_ToB18(b18_lines, zones, c, key)

This function will write the cooling coolName in all TRNbuild zones given in the zones list argument.

Args:

b18_lines (list-like): a list-like object of a .b18 file. zones (list of string): List of zone where the cooling is to be used. c (dict): A subset of a JSON dict containing the cooling definition. key (dict): A subset of the json key dictionnary containing keys for cooling definition.

_TranslateToB18.write_JSONZoneGain_ToB18(b18_lines, zones, g, key, scale1='1', scale2='1', scale1Type='CONSTANT', scale2Type='CONSTANT')

This function will write the gain in all TRnbuild zones given in the zones list argument. The scale parameters are used to add multiplier (such as occupation or use schedules…).

Args:

b18_lines (list-like): a list-like object of a .b18 file. zones (list of string): List of zone where the gain is to be used. g (dict): A subset of a JSON dict containing the gains definition. key (dict): A subset of the json key dictionnary containing keys for gains definition. scale1 (string): String used as a multiplicator for the gain. scale2 (string): String used as a multiplicator for the gain. scale1Type (string): Default is « CONSTANT » : scale1 must be an existing schedule name. scale1Type can also be « CONSTANT »

(then scale1 must be float-convertible) or « INPUT » (then scale1 must be an existing input name).

scale2Type (string): Default is « CONSTANT »scale2 must be an existing schedule name. scale2Type can also be « CONSTANT »

(then scale2 must be float-convertible) or « INPUT » (then scale2 must be an existing input name).

_TranslateToB18.write_JSONZoneHeating_ToB18(b18_lines, zones, h, key)

This function will write the heating heatName in all TRNbuild zones given in the zones list argument.

Args:

b18_lines (list-like): a list-like object of a .b18 file. zones (list of string): List of zone where the heating is to be used. h (dict): A subset of a JSON dict containing the heating definition. key (dict): A subset of the json key dictionnary containing keys for heating definition.

_TranslateToB18.write_JSONZoneInfiltration_ToB18(b18_lines, zones, f, key)

This function will write the infiltration infName in all TRNbuild zones given in the zones list argument.

Args:

b18_lines (list-like): a list-like object of a .b18 file. zones (list of string): List of zone where the infiltration is to be used. f (dict): A subset of a JSON dict containing the infiltration definition. key (dict): A subset of the json key dictionnary containing keys for infiltration definition.

_TranslateToB18.write_JSONZoneVentilation_ToB18(b18_lines, zones, v, key)

This function will write the ventilation ventName in all TRNbuild zones given in the zones list argument.

Args:

b18_lines (list-like): a list-like object of a .b18 file. zones (list of string): List of zone where the ventilation is to be used. v (dict): A subset of a JSON dict containing the ventilation definition. key (dict): A subset of the json key dictionnary containing keys for ventilation definition.

_TranslateToB18.write_furnitures_ToB18(b18_lines, c)

This function change the CAPACITANCE parameter of each thermal zone to account for room furnitures. We choose to have a capacitance ten times higher than what is proposed for each thermal zone to represent the furniture.

Args:

b18_lines (list-like): a list-like object of a .b18 file. c (ClassConfiguration): A ClassConfiguration object containing all path and parameters of tool.

_TranslateToB18.write_input_ToB18(b18_lines, inputName)

Write a new input in a new line right after last input line of a B18 file.

Args:

b18_lines (list-like): a list-like object of a .b18 file. inputName (string): A input name.

_TranslateToB18.write_outputs_ToB18(b18_lines, c)

A simple function that remove every single outputs for every airnodes in a B18 file (as list-like object of lines). Then, for each airnode, the function will add every output defined in the OutputDict defined in the parameters in c ClassConfiguration object.

Args:

b18_lines (list-like): a list-like object of a .b18 file. c (ClassConfiguration): A ClassConfiguration object containing all path and parameters of tool.

_TranslateToB18.write_schedule_ToB18(b18_lines, s, key, c)

This function add a schedule to a B18 file. If the schedule is defined as an input, then it is added to the file input. If the schedule is to be defined locally, then the schedule is written in Schedules definition The function allows the definition of schedules of type « HOUR », « DAY », « ANNUAL ».

Args:

b18_lines (list-like): a list-like object of a .b18 file. s (dict): A subset of a JSON dict containing the schedules definition. key (dict): A subset of the json key dictionnary containing keys for schedules definition. c (ClassConfiguration): A ClassConfiguration object containing all path and parameters of tool.

_TranslateToB18.write_surfaceComposition_FromTemplate_ToB18(b18_lines, c)

This function basically copy&paste a template surface composition in the B18_lines given as an entry. The template is taken from ClassConfiguration attribute c.path_TemplateB18_ForSurfaceComposition. Surface composition of the B18 lines where to paste will be overwritten.

Args:

b18_lines (list-like): a list-like object of a .b18 file. c (ClassConfiguration): A ClassConfiguration object containing all path and parameters of tool.

_TranslateToB18.write_zone_spacetype(b18_lines, zone, c)

This function will write all gains, coolings, heatings, infiltrations, ventilations of a spacetype in a set of thermal zones. This thermal zone set is obtain from zone-spacetype attribution results stored in JSON files.

Args:

b18_lines (list-like): a list-like object of a .b18 file. zone (string): Zone name. c (ClassConfiguration): A ClassConfiguration object containing all path and parameters of tool.

9. Utilities