PCSSP Top model API documentation¶
- class pcssp_top_class¶
pcssp_top_class class implements a top model class for simulink models with many layers in the hierarchy. Heavily inspired by the scdds ‘Expcode’ class.
- Constructor Summary
- pcssp_top_class(name)¶
Class constructor
- Property Summary
- ddname¶
top model data dictionary name
- loadverbose¶
Verbosity level of the loading (currently 0 or 1)
- mainslxname¶
Top-level SLX name
- modulenamelist¶
List of directly loaded algorithm names
- moduleobjlist¶
list of directly loaded algorithm objects with configured inits
- name¶
top-level model name
- status¶
Main properties
- wrappers¶
list of wrapper objects
- Method Summary
- addmodule(module)¶
Adds a pcssp module object to the top-model class instance.
syntax: topm_obj = topm_obj.addmodule(pcssp_module_obj)
- Parameters:
module – instance of pcssp module class to be attached
- addwrapper(wrapperObj)¶
Adds a wrapper instance to the top model. This wrapper must be an instance of the pcssp wrapper class
Syntax: topm_obj = topm_obj.addwrapper(wrapper_obj)
- Parameters:
wrapperObj – instance of the wrapper class to be attached to
the top model
- compile()¶
Compiles the top model attached to this class (equivalent to ctrl+D in Simulink)
Syntax: obj.compile
- Parameters:
none
- grab_module_ind(module_name)¶
returns the index of the module ‘module_name’ in the list of modules attached to this top model class. Useful function when accessing module class methods such as topm.moduleobjlist{topm.grab_module_ind(‘KCURR’)}
- init()¶
Initializes the top model by calling inits of all children, both wrappers and modules. It sorts the referenced modules to make sure they are initialized in the correct order
syntax: obj.init
- Parameters:
none
- open()¶
Physically opens the top-level slx model
syntax: obj.open
- Parameters:
none
- print_model_arguments(model_path)¶
prints the model arguments associated with a model reference in the top model
syntax: obj.prin_model_arguments(‘path_to_model’)
- Parameters:
model_path – relative path to the referenced model in the top model hierarchy
- set_model_argument_value(model_path, var_name, value)¶
Sets the model argument (or model instance parameters) in a referenced model. This is useful to inject parameters from the top model in a parametrized model reference. Before calling this function the referenced model needs to have model arguments defined. You may call the set_model_argument method of the pcssp_module class for this purpose.
syntax:
obj.set_model_argument_value(‘path_to_model_in_hierarchy’,’var_name’,’var_value’)
- Parameters:
model_path – (string) path to model in the hierarchy of the top model
var_name – (string) name of the to-be-injected variable
value – value of the to-be-injected variable
- setup()¶
Sets up the top-level Simulink model to prepare simulation of the model. It creates an sldd and calls the setups for all attached modules. For wrappers, it only calls the bus definition scripts to prevent parameter clashes.
syntax: obj.setup
- Parameters:
none
- sim()¶
Simulates the top model, assuming all input data is self-contained in the model. Simulation data injection is not yet supported
syntax: simout = obj.sim
- Parameters:
none