Ticket #4905: TestProtectedConnector.mo

File TestProtectedConnector.mo, 550 bytes (added by Francesco Casella, 7 years ago)
Line 
1package TestProtectedConnector
2 model M
3 Modelica.Blocks.Interfaces.RealInput u if use_u;
4 parameter Boolean use_u;
5 // protected
6 Modelica.Blocks.Interfaces.RealInput u_internal;
7 equation
8 if not use_u then
9 u_internal = 1;
10 end if;
11 connect(u, u_internal);
12 end M;
13
14 model P
15 TestProtectedConnector.M m1(use_u = true);
16 TestProtectedConnector.M m2(use_u = false);
17 Modelica.Blocks.Sources.RealExpression source;
18 equation
19 connect(source.y, m1.u);
20 end P;
21end TestProtectedConnector;