Ticket #3628: TransformationSorted.mo

File TransformationSorted.mo, 3.3 KB (added by anonymous, 9 years ago)
Line 
1class Transformation
2 constant Real d_P_LO = 4.5;
3 parameter Real alv_long = 2.5;
4 parameter Real alv_T = 310.0;
5 parameter Real alv_V_0 = 0.0;
6 parameter Real bAC_c = -0.654054054054054;
7 parameter Real bAC_m = 0.123502703;
8 parameter Real bRC_aFD(nominal = 15.0) = 0.5 * (bRC_b_max - bRC_b_min);
9 parameter Real bRC_b_max(nominal = 15.0) = 70.0;
10 parameter Real bRC_b_min(nominal = 15.0) = 10.0;
11 parameter Real bRC_pC3_ref(min = 0.0) = 36.0;
12 parameter Real bRC_slp = 3.0;
13 parameter Real d_dM_b_sd = 0.0;
14 parameter Real d_dM_k_sc = 2.5;
15 parameter Real h(min = 0.0) = 1.78;
16 parameter Real stoma_c_co2 = 0.0;
17 parameter Real wear_R = 1.0;
18 parameter Real wear_V = 7.585e-07 * (100.0 * h) ^ 2.363;
19 Real alv_C3_mnt(min = 0.0, stateSelect = StateSelect.prefer);
20 Real alv_C3_skon(min = 0.0);
21 Real alv_C3_skon(min = 0.0);
22 Real alv_convMtL;
23 Real alv_mF_2;
24 Real alv_P;
25 Real alv_P;
26 Real alv_pC3(min = 0.0);
27 Real alv_pC3(min = 0.0);
28 Real alv_q;
29 Real alv_q;
30 Real alv_V;
31 Real bAC_pam;
32 Real bAC_pam;
33 Real bRC_buency(nominal = 15.0);
34 Real bRC_buency(nominal = 15.0);
35 Real bRC_da(min = -100.0);
36 Real bRC_pC3_bean(min = 0.0);
37 Real d_bO_a_P;
38 Real d_bO_x;
39 Real d_bO_xm;
40 Real d_bO_y;
41 Real d_dM_a_P;
42 Real d_dM_a_P;
43 Real d_dM_b_P;
44 Real d_dM_D;
45 Real d_dW_P;
46 Real d_P_xm;
47 Real P_stoma;
48 Real P_stoma;
49 Real ruralP;
50 Real ruralP;
51 Real stoma_aP_q;
52 Real wear_C3_mnt(min = 0.0, stateSelect = StateSelect.prefer);
53 Real wear_C3_skon(min = 0.0);
54 Real wear_C3_skon(min = 0.0);
55 Real wear_C3_skon(min = 0.0);
56 Real wear_i_q;
57 Real wear_mFIn_2;
58 Real wear_mFOut_2;
59 Real wear_o_q;
60initial equation
61 bRC_pC3_bean = 30.9228008845;
62 wear_C3_mnt = 0.000173999146152;
63 alv_C3_mnt = 0.00238983232409;
64 alv_P = 759.725958311;
65 d_bO_x = 0.885821623007;
66 d_bO_y = -0.459753330157;
67equation
68 der(bRC_pC3_bean) = (if noEvent(alv_pC3 - bRC_pC3_bean > 0.0) then 0.9 else 0.05) * (alv_pC3 - bRC_pC3_bean);
69 bRC_da = bRC_pC3_bean - bRC_pC3_ref;
70 bRC_buency = bRC_aFD * (1.0 + tanh(bRC_slp * bRC_da / 6.283185307179586)) + bRC_b_min;
71 bAC_pam = bAC_m * bRC_buency + bAC_c;
72 d_dM_a_P = (-d_dM_k_sc) * d_dM_D - d_dM_b_sd * der(d_dM_D);
73 d_dM_a_P + d_dM_b_P = 0.0;
74 d_dM_D = d_bO_xm - 0.0;
75 der(d_bO_x) = -0.1047197551196598 * bRC_buency * d_bO_y;
76 der(d_bO_y) = 0.1047197551196598 * bRC_buency * d_bO_x;
77 d_bO_xm = 0.5 * d_bO_y * bAC_pam;
78 d_P_xm = -d_dW_P;
79 ruralP = -4.5 + P_stoma - d_P_xm;
80 wear_mFIn_2 = smooth(0, smooth(0, if wear_i_q > 0.0 then stoma_c_co2 else wear_C3_skon) * wear_i_q);
81 wear_mFOut_2 = smooth(0, smooth(0, if wear_o_q > 0.0 then alv_C3_skon else wear_C3_skon) * wear_o_q);
82 wear_C3_skon = wear_C3_mnt / wear_V;
83 der(wear_C3_mnt) = wear_mFIn_2 + wear_mFOut_2;
84 wear_i_q = (P_stoma - alv_P) / wear_R;
85 wear_i_q + wear_o_q = 0.0;
86 alv_mF_2 = smooth(0, smooth(0, if alv_q > 0.0 then wear_C3_skon else alv_C3_skon) * alv_q);
87 alv_C3_skon = alv_C3_mnt / alv_V;
88 der(alv_C3_mnt) = alv_mF_2;
89 alv_convMtL = 62.36367 * alv_T / alv_P;
90 alv_V = (alv_P - ruralP) / alv_long + alv_V_0;
91 der(alv_P) = P_stoma * alv_long * alv_q / alv_P + der(ruralP);
92 alv_pC3 = 62.36367 * alv_C3_mnt * alv_T / alv_V;
93 d_dM_a_P + d_bO_a_P = 0.0;
94 d_dM_b_P + d_dW_P = 0.0;
95 stoma_aP_q + wear_i_q = 0.0;
96 alv_q + wear_o_q = 0.0;
97 P_stoma = 760.0;
98end Transformation;