IMPORT KValues_Init FROM libkvalues; ATOM comp_atom REFINES generic_real; component IS_A symbol; END comp_atom; MODEL component_data; ncomps IS_A integer; ncomps := 3; components[1..ncomps] IS_A symbol; components[1] := 'benzene'; components[2] := 'hexane'; components[3] := 'chloro'; END component_data; MODEL test1; liq, feed, vap IS_A generic_real; T, P IS_A generic_real; x[1..5] IS_A generic_real; y[1..3] IS_A generic_real; data IS_A component_data; (* given T,x, compute P,y. *) gnew: bubblepnt( T,x[1..3],P : INPUT, y[1..3] : OUTPUT, data : DATA); h4: x[1] + x[2] + x[3] = 1.0; h5: x[2] * 0.1805 = y[3]; INITIALIZATION PROCEDURE mytest; END mytest; PROCEDURE specify; x[1].fixed := TRUE; x[2].fixed := TRUE; x[1] := 0.3; x[2] := 0.5; x[3] := 1.0 - (x[1] + x[2]); y[1].fixed := FALSE; y[2].fixed := FALSE; y[3].fixed := FALSE; T.fixed := TRUE; T := 300.0; P.fixed := TRUE; P := 760.0; END specify; END test1; MODEL test2; t1 IS_A test1; END test2; MODEL test1_normal; comp IS_A set OF integer; a[comp],b[comp],c[comp] IS_A real; comp := [1..3]; a[1] := 15.5381; b[1] := 2032.73; c[1] := -33.15; a[2] := 15.8333; b[2] := 2477.07; c[2] := -39.94; a[3] := 15.8737; b[3] := 2911.32; c[3] := -56.51; T, P IS_A generic_real; psat[1..3] IS_A generic_real; x[1..3] IS_A comp_atom; x[1].component := 'benzene'; x[2].component := 'hexane'; x[3].component := 'chloro'; y[1..3] IS_A generic_real; FOR i IN comp CREATE pres[i]: ln(psat[i]) = a[i] - b[i]/(T + c[i]); END; FOR i IN comp CREATE raoult[i]: P*y[i] = psat[i]*x[i]; END; h4: x[1] + x[2] + x[3] = 1.0; h5: x[2] * 0.1805 = y[3]; INITIALIZATION PROCEDURE specify; x[1].fixed := TRUE; x[3].fixed := TRUE; x[1] := 0.3; x[2] := 0.5; x[3] := 1.0 - (x[1] + x[2]); y[1].fixed := FALSE; y[2].fixed := FALSE; y[3].fixed := FALSE; T.fixed := TRUE; T := 300.0; P.fixed := TRUE; P := 760.0; END specify; END test1_normal; MODEL test2_normal; t1 IS_A test1_normal; END test2_normal;