Parent Directory | Revision Log

Revision **1** -
(**show annotations**)
(**download**)

*Fri Oct 29 20:54:12 2004 UTC*
(19 years, 7 months ago)
by *aw0a*

File size: 3522 byte(s)

File size: 3522 byte(s)

Setting up web subdirectory in repository

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 vessel.a4c |

5 | |

6 | DELETE TYPES; |

7 | READ FILE "vessel.a4c"; |

8 | |

9 | COMPILE v OF vessel; |

10 | BROWSE {v}; |

11 | RUN {v.values}; |

12 | RUN {v.reset}; |

13 | SOLVE {v} WITH QRSlv; |

14 | |

15 | REFINE {v} TO vessel_optimize; |

16 | RUN {v.min_cost}; |

17 | SOLVE {v} WITH CONOPT; |

18 | |

19 | ASSIGN {v.H_to_D_ratio.fixed} TRUE; |

20 | ASSIGN {v.H.fixed} FALSE; |

21 | |

22 | STUDY {cost} IN {v} \ |

23 | VARYING {H_to_D_ratio 1 2 3 5 10 20} \ |

24 | USING QRSlv \ |

25 | OUTFILE vessel.dat \ |

26 | ERROR STOP; |

27 | ASCPLOT vessel.dat; |

28 | # before you run another study, close the ASCPLOT window. |

29 | ASCPLOT CLOSE; |

30 | |

31 | # GAMS optimization conversion example. |

32 | # GAMS does not tolerate poor scaling nearly as well as ASCEND. |

33 | # Therefore, you should set good values for the variable.nominals: |

34 | # values near the expected solution (within a factor of 1-100). |

35 | |

36 | RUN v.scale; |

37 | |

38 | # Note that this scale method, which scales the variables, is missing. |

39 | # Fortunately, 'vessel' is so nearly linear that you can get away |

40 | # with not scaling it's variables beyond the default nominal value. |

41 | |

42 | # Once you have scaled the variables, ASCEND will |

43 | # scale the equations based on the scaled variables. |

44 | # Do this even though vessel does not have a scale method. |

45 | |

46 | dbg_calc_relnoms; |

47 | |

48 | # Now you tell ASCEND to generate a generic equation file |

49 | # in ASCEND notation. |

50 | |

51 | dbg_write_slv0_sys vessel.a2g; |

52 | |

53 | # But we have to convert it to GAMS notation because GAMS |

54 | # cannot tolerate long, descriptive, and otherwise user-friendly |

55 | # variable names. A PERL 5 script, ascend2gms.pl, does this. |

56 | # set ATOG to be the path to the PERL converter. |

57 | |

58 | set ATOG $ascGlobalVect(ascend2gms); |

59 | |

60 | # call the GAMS converter |

61 | |

62 | exec $ATOG vessel.a2g; |

63 | |

64 | # Call GAMS. ASCEND will freeze while GAMS runs. |

65 | # You should peek at the error messages or output |

66 | # in vessel.a2g.lst that GAMS will create. |

67 | |

68 | exec gams vessel.a2g.gms; |

69 | |

70 | # Load the results, or try to at least. This may fail if gams did. |

71 | # GAMS solvers (e.g. CONOPT set very tight default bounds |

72 | # for equation residuals and Jacobian elements in order to |

73 | # trap user input errors of a class that simply do not exist |

74 | # in ASCEND generated GAMS code. You may need a file |

75 | # like 'conopt.opt' to reset these bounds. |

76 | # For example in conopt.opt we typically have: |

77 | # SET RTMAXJ 9.E22 |

78 | # SET RTMAXV 1.E20 |

79 | |

80 | set GTOA $ascGlobalVect(gms2ascend) |

81 | exec $GTOA vessel.a2g.lst; |

82 | |

83 | ########## vessel.a4s ends here ########## |

84 | # |

85 | # vessel.a4s |

86 | # by Arthur W. Westerberg |

87 | # Part of the ASCEND Library |

88 | # $Date: 1998/06/17 20:08:46 $ |

89 | # $Revision: 1.4 $ |

90 | # $Author: mthomas $ |

91 | # $Source: /afs/cs.cmu.edu/project/ascend/Repository/models/vessel.a4s,v $ |

92 | # |

93 | # This file is part of the ASCEND Modeling Library. |

94 | # |

95 | # Copyright (C) 1994 - 1998 Carnegie Mellon University |

96 | # |

97 | # The ASCEND Modeling Library is free software. You can redistribute |

98 | # it and/or modify it under the terms of the GNU General Public |

99 | # License as published by the Free Software Foundation---either |

100 | # version 2 of the License, or (at your option) any later version. |

101 | # |

102 | # The ASCEND Modeling Library is distributed in hope that it |

103 | # will be useful, but WITHOUT ANY WARRANTY--without even the implied |

104 | # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |

105 | # See the GNU General Public License for more details. |

106 | # |

107 | # You should have received a copy of the GNU General Public License |

108 | # along with the program. If not, write to the Free Software |

109 | # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139 USA. Check |

110 | # the file named COPYING. |

john.pye@anu.edu.au | ViewVC Help |

Powered by ViewVC 1.1.22 |