power_balance.models#
Source: power_balance/models/__init__.py
Power Balance Models model objects
Creates an importable Python dictionary giving the addresses of the models contained within the power_balance/models directory.
Class Model#
Model(name, location, package, submodels, binary_folder, compiled)
Attributes#
-
name
:str
model name
-
location
:str
file address of model source
-
package
:str
package in source containing model
-
submodels
:Dict[str, List[str]]
dictionary of submodel type instances (if any) which form part of this model sorted by submodel type name
-
binary_folder
:str
location of compiled binary (may be temporary)
extract_models_from_file#
extract_models_from_file(input_file: str, profile_dir: str, original_model_dir: str, parameter_set: power_balance.parameters.PBMParameterSet = None, session: pydelica.Session = None, model_name_list: List[str] = None, names_only: bool = False, quiet: bool = False) -> Dict[str, power_balance.models.Model]
Extracts all models from a Modelica '.mo' file
Parameters#
-
input_file
:str
name of OpenModelica input file with suffix '.mo'
-
profile_dir
:str
location of input files
-
original_model_dir
:str
directory containing models to parse
-
parameter_set
:power_balance.parameters.PBMParameterSet
, defaultNone
PowerBalance Models session parameter set
-
session
:pydelica.Session
, defaultNone
PyDelica session instance
-
model_name_list
:typing.List
, defaultNone
specify which models of all of those within the file should be compiled and imported, by default all
-
names_only
:bool
, defaultFalse
do not compile the models just return a list of names, by default False
-
quiet
:bool
, defaultFalse
suppress printouts, by default False
Returns#
-
typing.Dict
a dictionary of tuples each containing: - name - package name - submodels submodels for this model - compiled (for later storage of compiled object)
get_local_models#
get_local_models(model_file_dir: str, parameter_set: power_balance.parameters.PBMParameterSet = None, session: pydelica.Session = None, profile_dir: str = '', model_name_list: List[str] = None, names_only: bool = False, quiet: bool = False) -> Dict[str, power_balance.models.Model]
Retrieve list of models from this directory to create an importable Python dictionary object. Models are stored as namedtuples
Parameters#
-
model_file_dir
:str
directory containing Modelica model files
-
parameter_set
:power_balance.parameters.PBMParameterSet
, defaultNone
PowerBalance Models session parameter set
-
session
:pydelica.Session
, defaultNone
PyDelica Modelica session
-
profile_dir
:str
, default ````profile inputs directory
-
model_name_list
:typing.List
, defaultNone
specify which models of all of those within the file should be compiled and imported, by default all
-
names_only
:bool
, defaultFalse
do not compile the models just return a list of names, by default False
-
quiet
:bool
, defaultFalse
suppress printouts, by default False
Returns#
-
typing.Dict
a dictionary of tuples each containing: - name - package name - submodels submodels for this model - compiled (for later storage of compiled object)