SimpleGMTBase

class geojson_modelica_translator.modelica.simple_gmt_base.SimpleGMTBase(system_parameters, template_dir)

Bases: ModelBase

Base class for simple GMT models.

__init__(system_parameters, template_dir)

Initialize the SimpleGMT object.

Methods

__init__(system_parameters, template_dir)

Initialize the SimpleGMT object.

copy_required_mo_files(dest_folder[, within])

Copy any required_mo_files to the destination and update the within clause if defined.

ft2_to_m2(area_in_ft2)

Converts square feet to square meters

render_instance(template_params)

Templates the *_Instance file for the model. The templated result will be inserted into the final District Energy System model in order to instantiate/define the model instance.

run_template(template, save_file_name[, ...])

Helper method to create the file from Jinja2's templating framework.

to_dict(scaffold)

to_modelica(output_dir, model_name, param_data)

Render the template to a Modelica file.

Attributes

instance_template_path

model_name

copy_required_mo_files(dest_folder, within=None)

Copy any required_mo_files to the destination and update the within clause if defined. The required mo files need to be added as full paths to the required_mo_files member variable in the connectors derived classes.

Parameters:
  • dest_folder – String, folder to copy the resulting MO files into.

  • within – String, within clause to be replaced in the .mo file. Note that the original MO file needs to

have a within clause defined to be replaced.

ft2_to_m2(area_in_ft2: float) float

Converts square feet to square meters

Parameters:

area_in_ft2 – Area in square feet to be converted to square meters

render_instance(template_params)

Templates the *_Instance file for the model. The templated result will be inserted into the final District Energy System model in order to instantiate/define the model instance.

Parameters:

template_params – dict, parameters for the template

Returns:

tuple (str, str), the templated result followed by the name of the file used for templating

run_template(template, save_file_name, do_not_add_to_list=False, **kwargs)

Helper method to create the file from Jinja2’s templating framework.

Parameters:
  • template – object, Jinja template from the template_env.get_template() command.

  • save_file_name – string, fully qualified path to save the rendered template to.

  • do_not_add_to_list – boolean, set to true if you do not want the file to be added to the package.order

  • kwargs – These are the arguments that need to be passed to the template.

Returns:

None

to_modelica(output_dir: Path, model_name: str, param_data: dict, iteration=None, save_file_name=None, generate_package=False, partial_files: dict = None) None

Render the template to a Modelica file.

Parameters:
  • output_dir (Path) – Directory to save the resulting template (modelica file) to.

  • model_name (str) – Model to render and also the name of the saved file (if save_file_name is None).

  • param_data (dict) – Data to pass to the rendering template.

  • iteration (Int, optional) – If dynamically creating filenames, then this is the iteration to be appended to the filename. Defaults to None.

  • save_file_name (Str, optional) – Name that the file will be saved as, if None, then will default. Do not include the directory, only the filename (with extension). Defaults to None.

  • generate_package (bool, optional) – If True, then a package.mo and package.order file will be created alongside the rendered template (Modelica) file. Defaults to False.

  • partial_files (dict, optional) – If the model has partial files, then this is a dictionary of the partial file name and the Modelica file name to save it as. Defaults to None.