Main Content

Attribute Lists

Attribute Types

The attributes appear in an AttributeList, which is a comma separated list of pairs, as defined in the MATLAB® class system grammar. Simscape™ language distinguishes between two types of attributes: model attributes and member attributes.

Model Attributes

Model attributes are applicable only to model type component.

AttributeValuesDefaultModel ClassesDescription

Propagation

propagates
blocks
source (not recommended)

propagates

component

Defines the domain data propagation of the component. By default, components propagate domain data, such as domain parameter values. If your model requires different values of a domain parameter in different segments of the same circuit, use blocks to designate a blocking component.

Using the source value, along with the setup function, is no longer recommended; instead, use direct assignment to a domain parameter in the component node declaration. See Working with Domain Parameters.

Hidden

true
false

false

component

Defines the visibility of the entire component. This dictates whether the component shows up in a generated library or report.

Component model attributes apply to the entire model. For example:

component (Propagation = blocks) Separator
  % component model goes here
end

Here, Propagation is a model attribute.

Member Attributes

Member attributes apply to a whole declaration block.

AttributeValuesDefaultMember ClassesDescription

Access

public
private
protected

public

all

Defines the read and write access of members. Public (the default) is the most permissive access level. There are no restrictions on accessing public members. Private members are only accessible to the instance of the component model and not to external clients. Protected members of a base class are accessible only to subclasses.

ExternalAccess

modify
observe
none

Depends on the value of Access attribute: for public, the default is modify, for private and protected, the default is observe

all

Sets the visibility of the member in the user interface, that is, in block dialog boxes, simulation logs, variable viewer, and so on:

  • modify — The member is modifiable in the block dialogs and visible in the logs and viewer.

  • observe — The member is visible in the logs and viewer, but not modifiable, and therefore not visible, in block dialogs.

  • none — The member is visible nowhere outside the language.

Balancing

true
false

false

variables

If set to true, declares Through variables for a domain. You can set this attribute to true only for model type domain. See Declare Through and Across Variables for a Domain.

Event

true
false

false

variables

If set to true, declares event variables for a component. You can set this attribute to true only for model type component. See Event Variables.

Conversion

absolute
relative

absolute

parameters
variables

Defines how the parameter or variable units are converted for use in equations, intermediates, and other sections. See Parameter Units.

MATLABEvaluation

default
compiletime

default

parameters
variables

If a member declaration contains a declaration function that does not support code generation, set this attribute to compiletime. The declaration function is then evaluated only at compile time, and all the function input parameters are marked as compile-time only. See Declaration Functions.

CompileReuse

true
false

false

components

If set to true, the compilation artifacts for these components are reusable during scalable compilation. See About Scalable Compilation.

The attribute list for the declaration block appears after MemberClass keyword. For example:

parameters (Access = public,ExternalAccess = observe)
  % parameters go here
end

Here, all parameters in the declaration block are externally writable in language, but they will not appear in the block dialog box.

Specifying Member Accessibility

The two attributes defining member accessibility act in conjunction. The default value of the ExternalAccess attribute for a member depends on the value of the Access attribute for that member.

AccessDefault ExternalAccess
publicmodify
protectedobserve
privateobserve

You can modify the values of the two attributes independently from each other. However, certain combinations are prohibited. The compiler enforces the following rules:

  • Members in the base class with Access=private are forced to have ExternalAccess=none, to avoid potential collision of names between the base class and the derived class.

  • When Access is explicitly set to private or protected, it does not make sense to explicitly set ExternalAccess=modify. In this situation, the compiler issues a warning and remaps ExternalAccess to observe.