1 |
aw0a |
1 |
# This file is part of the ASCEND Modeling Library and is released |
2 |
|
|
# under the GNU Public License as described at the end of this file. |
3 |
|
|
# |
4 |
|
|
# This file demonstrates the use of dyn_tank.a4c |
5 |
|
|
|
6 |
|
|
DELETE TYPES; |
7 |
|
|
READ FILE "dyn_tank.a4c"; |
8 |
|
|
source "$env(ASCENDDIST)/models/set_intervals.tcl"; |
9 |
|
|
|
10 |
|
|
COMPILE ex OF tank; |
11 |
|
|
BROWSE {ex}; |
12 |
|
|
RUN {ex.default_self}; |
13 |
|
|
RUN {ex.reset}; |
14 |
|
|
RUN {ex.values}; |
15 |
|
|
SOLVE ex WITH QRSlv; |
16 |
|
|
RUN {ex.check_all}; |
17 |
|
|
ASSIGN {ex.dynamic} TRUE; |
18 |
|
|
RUN {ex.reset}; |
19 |
|
|
RUN {ex.set_ode}; |
20 |
|
|
RUN {ex.set_obs}; |
21 |
|
|
set_int 500 10 {s}; |
22 |
|
|
INTEGRATE ex FROM 0 TO 50 WITH BLSODE; |
23 |
|
|
|
24 |
|
|
ASSIGN {ex.input} 101 {mole/s}; |
25 |
|
|
INTEGRATE ex FROM 50 TO 499 WITH BLSODE; |
26 |
|
|
|
27 |
|
|
# In order to view integration results from both the integrations |
28 |
|
|
# the user will have to goto the solver window, select options general |
29 |
|
|
# and turn off the overwrite integrator logs toggle on the second page. |
30 |
|
|
# (NOTE: If you were then to run a different model or this same simulation |
31 |
|
|
# again it would still write to the same files) |
32 |
|
|
|
33 |
|
|
# In order to see both sets of data at the same time on one plot |
34 |
|
|
# you will have to merge the two sets of data in the file. This |
35 |
|
|
# is done with following command. |
36 |
|
|
|
37 |
|
|
asc_merge_data_file ascend new_obs.dat obs.dat; |
38 |
|
|
ASCPLOT new_obs.dat; |
39 |
|
|
|
40 |
|
|
# This command can also be used to convert data into a format |
41 |
|
|
# that can be loaded into matlab for further work. |
42 |
|
|
|
43 |
|
|
asc_merge_data_file matlab matlab_obs.m obs.dat; |
44 |
|
|
|
45 |
|
|
# This command can also be used to convert data into a format |
46 |
|
|
# that can be loaded into excel as a tab delimited text file. |
47 |
|
|
|
48 |
|
|
asc_merge_data_file excel excel_obs.txt obs.dat; |
49 |
|
|
|
50 |
|
|
########## dyn_tank.a4s ends here ########## |
51 |
|
|
# |
52 |
|
|
# dyn_tank.a4s |
53 |
|
|
# by Duncan Coffey |
54 |
|
|
# June, 1998 |
55 |
|
|
# Part of the ASCEND Library |
56 |
|
|
# $Date: 1998/06/17 20:08:31 $ |
57 |
|
|
# $Revision: 1.2 $ |
58 |
|
|
# $Author: mthomas $ |
59 |
|
|
# $Source: /afs/cs.cmu.edu/project/ascend/Repository/models/dyn_tank.a4s,v $ |
60 |
|
|
# |
61 |
|
|
# This file is part of the ASCEND Modeling Library. |
62 |
|
|
# |
63 |
|
|
# Copyright (C) 1998 Carnegie Mellon University |
64 |
|
|
# |
65 |
|
|
# The ASCEND Modeling Library is free software. You can redistribute |
66 |
|
|
# it and/or modify it under the terms of the GNU General Public |
67 |
|
|
# License as published by the Free Software Foundation---either |
68 |
|
|
# version 2 of the License, or (at your option) any later version. |
69 |
|
|
# |
70 |
|
|
# The ASCEND Modeling Library is distributed in hope that it |
71 |
|
|
# will be useful, but WITHOUT ANY WARRANTY--without even the implied |
72 |
|
|
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
73 |
|
|
# See the GNU General Public License for more details. |
74 |
|
|
# |
75 |
|
|
# You should have received a copy of the GNU General Public License |
76 |
|
|
# along with the program. If not, write to the Free Software |
77 |
|
|
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139 USA. Check |
78 |
|
|
# the file named COPYING. |