Differences From Artifact [8d882eb23f]:

To Artifact [12ca25468f]:


1
2
3
4
5
6
7
8
9

10
11

12
13
14
15
16
17
18


19
20
21

22
23
24
25


26
27
28
29
30



31
1
2
3
4
5
6
7
8

9
10

11
12
13
14
15
16


17
18
19
20

21
22
23


24
25
26
27



28
29
30
31








-
+

-
+





-
-
+
+


-
+


-
-
+
+


-
-
-
+
+
+

%% CR file for the sR component. - 2 port.
%% Special version just for this example.

%% CR for non-linear pipe discharge
%% Just do for flow input causality.

in "discharge.cr";

PROCEDURE l_discharge(alpha,beta,P);
PROCEDURE l_discharge(COMP, alpha,beta,P);
BEGIN
  result := sub({x=P},df(discharge(alpha,beta,flow,1,x,effort,1), x));
  result := sub({x=P},df(discharge(COMP, alpha,beta,flow,1,x,effort,1), x));
  return result;
END;

OPERATOR sdischarge;
%% The actual port (1) -- Pressure input
FOR ALL alpha,beta,alpha_s,beta_s,P,sP LET
    sdischarge(alpha,beta,alpha_s,beta_s,flow,1,
FOR ALL COMP, alpha,beta,alpha_s,beta_s,P,sP LET
    sdischarge(COMP, alpha,beta,alpha_s,beta_s,flow,1,
               P,effort,1,
               sP,effort,2)
    = discharge(alpha,beta,flow,1,P,effort,1);
    = discharge(COMP, alpha,beta,flow,1,P,effort,1);

%% The sensitivity port (2) -- Pressure input
FOR ALL alpha,beta,alpha_s,beta_s,P,sP LET
    sdischarge(alpha,beta,alpha_s,beta_s,flow,2,
FOR ALL COMP, alpha,beta,alpha_s,beta_s,P,sP LET
    sdischarge(COMP, alpha,beta,alpha_s,beta_s,flow,2,
               P,effort,1,
               sP,effort,2)
    =  l_discharge(alpha,beta,P) * sP
    + df(discharge(alpha,beta,flow,1,P,effort,1), alpha)* alpha_s
    + df(discharge(alpha,beta,flow,1,P,effort,1), beta) * beta_s;
    =  l_discharge(COMP, alpha,beta,P) * sP
    + df(discharge(COMP, alpha,beta,flow,1,P,effort,1), alpha)* alpha_s
    + df(discharge(COMP, alpha,beta,flow,1,P,effort,1), beta) * beta_s;
END;;

MTT: Model Transformation Tools
GitHub | SourceHut | Sourceforge | Fossil RSS ]