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
.
Attribute | Values | Default | Model Classes | Description |
---|---|---|---|---|
|
|
|
| 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 Using the |
|
|
|
| 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.
Attribute | Values | Default | Member Classes | Description |
---|---|---|---|---|
|
|
| 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. |
|
| Depends on the value of | all | Sets the visibility of the member in the user interface, that is, in block dialog boxes, simulation logs, variable viewer, and so on:
|
|
|
|
| If set to |
|
|
|
| If set to |
|
|
|
| Defines how the parameter or variable units are converted for use in equations, intermediates, and other sections. See Parameter Units. |
|
|
|
| If a member declaration contains a declaration function that does not
support code generation, set this attribute to |
|
|
|
| If set to |
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.
Access | Default ExternalAccess |
---|---|
public | modify |
protected | observe |
private | observe |
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 haveExternalAccess=none
, to avoid potential collision of names between the base class and the derived class.When
Access
is explicitly set toprivate
orprotected
, it does not make sense to explicitly setExternalAccess=modify
. In this situation, the compiler issues a warning and remapsExternalAccess
toobserve
.