Skip to content

Commit

Permalink
Add example for 'protected' annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
henrikt-ma committed May 11, 2022
1 parent 84f4be0 commit 8404255
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions RationaleMCP/0031/annotations.md
Expand Up @@ -59,6 +59,24 @@ A component coming from a public section must not have the `protected = true` an

When the Flat Modelica is not generated from a full Modelica model, the `protected` annotation needs to be understood by comparison to the case of full Modelica origin.

For example, consider the following full Modelica model:
```
model M
protected
parameter Real p = 1.0;
end M;
```

Note that `p` can only be modified when extending the model, and that the `protected = true` annotation does not enforce this constraint in Flat Modelica.
Hence, the correct conversion to Flat Modelica needs to combine `protected = true` with treatment similar to a parameter declared `final`:
```
model 'M'
parameter Real 'p' annotation(protected = true);
initial equation
'p' = 1.0; /* From full Modelica protected declaration equation. */
end 'M';
```


## Vendor annotations

Expand Down

0 comments on commit 8404255

Please sign in to comment.