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