(* Problem from Hines/Maddox - Mass Transfer, Page 62, Example 3.2 *) REQUIRE "ivpsystem.a4l"; REQUIRE "atoms.a4l"; MODEL tank; (* List of Variables *) dM_dt IS_A mass_rate; M IS_A mass; input IS_A mass_rate; input_flow IS_A volume_rate; output IS_A mass_rate; output_flow IS_A volume_rate; Volume IS_A volume; U IS_A volume_rate; conc_tank, conc_input IS_A mass_density; dynamic IS_A boolean; t IS_A time; (* Equations *) dM_dt = input - output; M = Volume * conc_tank; input = input_flow*conc_input; output = output_flow*conc_tank; METHODS METHOD all; dM_dt.fixed := FALSE; M.fixed := TRUE; M := 89.6 {kg}; Volume.fixed :=TRUE; Volume := 2.8 {m^3}; input.fixed := FALSE; input_flow.fixed := TRUE; input_flow := 1.0 {m^3/hr}; output.fixed :=FALSE; output_flow.fixed := TRUE; output_flow := 1.0 {m^3/hr}; U.fixed := TRUE; U := 1.0 {m^3/hr}; conc_tank.fixed := FALSE; conc_input.fixed := TRUE; conc_input := 0.0 {kg/m^3}; dynamic := TRUE; t := 0 {sec}; dM_dt := 0 {kg/sec}; dM_dt.lower_bound := -1e49 {kg/sec}; END all; METHOD set_ode; (* set ODE_TYPE -1=independent variable, 0=algebraic variable, 1=state variable, 2=derivative *) t.ode_type :=-1; input_flow.ode_type := 1; output_flow.ode_type := 1; output.ode_type := 1; M.ode_type := 1; dM_dt.ode_type :=2; (* Set ODE_ID *) dM_dt.ode_id :=1; M.ode_id :=1; END set_ode; METHOD set_obs; (* Set OBS_ID to any integer value greater than 0, the variable will be recorded (i.e., observed) *) M.obs_id :=1; Volume.obs_id :=2; input.obs_id :=3; output.obs_id :=4; conc_tank.obs_id := 5; END set_obs; METHOD values; Volume :=5 {m^3}; input :=100 {mole/s}; END values; END tank; (* This is written in the ASCEND Language ... ASCEND is an environment to pose modeling problems and solve the resulting equations in an object oriented fashion ... ASCEND is copyrighted by Carnegie Mellon University ... the project has been directed by Prof. Art Westerberg in the Chemical Engineering Department ...*) (* ASCEND is free software, released under GNU ... and you can get it from http://www.cs.cmu.edu/~ascend ... The software has been released WITH source code ... it compiles under Solaris, Linux and IRIX (SGI) ... thanks to the excellent job in putting the software together by the folks at CMU! ... and autoconf ... I have no idea of how people compiled things before ./configure ! *) (* This example written by Krishnan Chittur (chitturk@uah.edu) Chemical Engineering Department, University of Alabama in Huntsville, Huntsville, AL 35899 (256) 890 6850 (V), (256) 890 6839 (FAX) *)