wrapper

[SCDDS - Simulink Control Development & Deployment Suite] Copyright SPC-EPFL Lausanne 2022. Distributed under the terms of the GNU Lesser General Public License, LGPL-3.0-only.

Class hierarchy: component

Class hierarchy: component

class SCDDSclass_wrapper

Bases: SCDDSclass_component

Wrapper class containing algos

Constructor Summary
SCDDSclass_wrapper(name, dt)

Constructor for SCDDSclass_wrapper. Initializes a wrapper object for a Simulink component by setting its name, model file, timing, and folder path. Verifies the .slx model exists and, if enabled, initializes the associated data dictionary.

Syntax:

obj = SCDDSclass_wrapper(name) obj = SCDDSclass_wrapper(name, dt)

Parameters:
  • name – string - Component name (must match an .slx model on path)

  • dt – double - Optional sample time (default = 1e-3)

Property Summary
buildable

can be build

Type:

boolean

createdd

automatically create fresh dd during wrapper init

Type:

boolean

Method Summary
addbus(name, source)

Registers a bus to be added to the wrapper’s data dictionary. The bus is defined by a name and a source file. The source file and bus name must not be identical.

Syntax:

obj = obj.addbus(name, source)

Parameters:
  • name – string - Name of the bus

  • source – string - File or source defining the bus

Example

obj = obj.addbus(‘MyBus’,’MyBusDefinition’)

build()

Generates C/C++ code for the wrapper Simulink model. This method can only be called for wrappers whose ‘buildable’ property is set to true. It delegates the actual build process to the superclass method.

Syntax:

obj.build

Parameters:

none

Example

obj.build

getbuildargs()

grabs build arguments from the attached algo objects in this wrapper syntax build_args = obj.getbuildargs

init()

Initializes this wrapper object. During initialization, the following steps are performed:

  • Places a Simulink configuration set in the base workspace for use in the linked model (.slx)

  • Creates a fresh Simulink Data Dictionary (SLDD) if obj.createdd is true

  • Initializes all algorithm objects attached to this wrapper

  • Stores their nominal parameter values in the newly created SLDD

  • Adds required buses to the wrapper’s SLDD

Syntax:

obj.init

Parameters:

none

Example

obj.init

printinfo()

Prints basic information about this wrapper object, including its name, sample time, and the list of algorithms contained in obj.algos.

Syntax:

obj.printinfo

Parameters:

none

Example

obj.printinfo

setup()

Sets up the wrapper object by calling the setup methods of all underlying algorithm objects attached to this wrapper. If a fresh data dictionary was created during initialization, algorithm parameters are added as data sources to it. After init + setup, the wrapper model should update successfully in Simulink (Ctrl+D).

Syntax:

obj.setup

Parameters:

none

Example

obj.setup

updatetemplatetp()

Updates linked tunable parameters in all algorithms of this wrapper. Iterates over each element in obj.algos and calls its updatetemplatetp method if available.

Syntax:

obj.updatetemplatetp

Parameters:

none