/[ascend]/trunk/doc/howto-model1.lyx
ViewVC logotype

Diff of /trunk/doc/howto-model1.lyx

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 826 by johnpye, Tue Aug 22 01:34:33 2006 UTC revision 1385 by jpye, Sat Apr 7 09:13:41 2007 UTC
# Line 1  Line 1 
1  #LyX 1.4.1 created this file. For more info see http://www.lyx.org/  #LyX 1.4.3 created this file. For more info see http://www.lyx.org/
2  \lyxformat 245  \lyxformat 245
3  \begin_document  \begin_document
4  \begin_header  \begin_header
5  \textclass book  \textclass book
6    \begin_preamble
7    \usepackage[bookmarks,bookmarksnumbered=true]{hyperref}
8    \usepackage{lmodern}
9    \usepackage{color}
10    \definecolor{darkred}{rgb}{0.55,0,0}
11    
12    \usepackage{listings}
13    
14    \lstdefinelanguage{ascend}{
15      morekeywords=[1]{
16         REQUIRE,IMPORT,
17         ATOM,MODEL,METHOD,METHODS,
18         UNIVERSAL,CONSTANT,DIMENSION,DEFAULT,
19         END,FOR,CREATE,DO,EXTERNAL,  
20         CONDITIONAL,SATISFIED,WHEN,CASE,OTHERWISE,TRUE,
21         FALSE,SELF,
22      },
23      morekeywords=[2]{
24         REFINES,IS_A,WILL_BE,ALIASES,INPUT,OUTPUT,DATA,
25         FIX,FREE,RUN,ARE_THE_SAME
26      },
27      morekeywords=[3]{
28         solver_var,integer_constant
29      },
30      sensitive=true,
31      morecomment=[s]{(*}{*)},
32      morestring=[b]',
33      morestring=[b]",
34    }
35    
36    \lstset{
37      basicstyle=\ttfamily,
38      commentstyle=\color{blue},
39      keywordstyle=\color{darkred},
40    }
41    \end_preamble
42  \language english  \language english
43  \inputencoding auto  \inputencoding auto
44  \fontscheme default  \fontscheme default
# Line 1151  wide false Line 1187  wide false
1187  sideways false  sideways false
1188  status open  status open
1189    
1190  \begin_layout LyX-Code  \begin_layout Standard
 ATOM  
1191  \begin_inset LatexCommand \index{ATOM}  \begin_inset LatexCommand \index{ATOM}
1192    
1193  \end_inset  \end_inset
1194    
1195   volume REFINES solver_var  
1196    \begin_inset ERT
1197    status open
1198    
1199    \begin_layout Standard
1200    
1201    
1202    \backslash
1203    lstset{language=ASCEND}
1204  \end_layout  \end_layout
1205    
1206  \begin_layout LyX-Code  \begin_layout Standard
1207  DIMENSION L^3  
1208    
1209    \backslash
1210    begin{lstlisting}
1211  \end_layout  \end_layout
1212    
1213  \begin_layout LyX-Code  \begin_layout Standard
1214  DEFAULT 100.0{ft^3};  
1215    ATOM volume REFINES solver_var
1216  \end_layout  \end_layout
1217    
1218  \begin_layout LyX-Code  \begin_layout Standard
1219  lower_bound := 0.0{ft^3};  
1220        DIMENSION L^3
1221  \end_layout  \end_layout
1222    
1223  \begin_layout LyX-Code  \begin_layout Standard
1224  upper_bound := 1e50{ft^3};  
1225        DEFAULT 100.0{ft^3};
1226  \end_layout  \end_layout
1227    
1228  \begin_layout LyX-Code  \begin_layout Standard
1229  nominal := 100.0{ft^3};    
1230      lower_bound := 0.0{ft^3};
1231  \end_layout  \end_layout
1232    
1233  \begin_layout LyX-Code  \begin_layout Standard
1234    
1235      upper_bound := 1e50{ft^3};
1236    \end_layout
1237    
1238    \begin_layout Standard
1239    
1240      nominal := 100.0{ft^3};
1241    \end_layout
1242    
1243    \begin_layout Standard
1244    
1245  END volume;  END volume;
1246  \end_layout  \end_layout
1247    
1248    \begin_layout Standard
1249    
1250    
1251    \backslash
1252    end{lstlisting}
1253    \end_layout
1254    
1255    \begin_layout Standard
1256    
1257    \end_layout
1258    
1259    \end_inset
1260    
1261    
1262    \end_layout
1263    
1264  \begin_layout Caption  \begin_layout Caption
1265  A typical type definition, called an atom, used to define variable and constant  A typical type definition, called an atom, used to define variable and constant
1266   types   types
# Line 1290  L^3 Line 1367  L^3
1367   says volume must be a nonnegative number.   says volume must be a nonnegative number.
1368   ASCEND used the nominal value for scaling a variable of type volume when   ASCEND used the nominal value for scaling a variable of type volume when
1369   solving, here   solving, here
1370  \begin_inset Formula $100\,{\mathrm{ft}}^{3}$  \begin_inset Formula $100\,\mathrm{ft}^{3}$
1371  \end_inset  \end_inset
1372    
1373  .  .
# Line 1439  sideways false Line 1516  sideways false
1516  status open  status open
1517    
1518  \begin_layout LyX-Code  \begin_layout LyX-Code
1519    \begin_inset ERT
1520    status open
1521    
1522    \begin_layout Standard
1523    
1524    
1525    \backslash
1526    begin{ascend}
1527    \end_layout
1528    
1529    \begin_layout Standard
1530    
1531  UNIVERSAL CONSTANT circle_constant  UNIVERSAL CONSTANT circle_constant
1532  \end_layout  \end_layout
1533    
1534  \begin_layout LyX-Code  \begin_layout Standard
1535    
1536      REFINES real_constant :== 1{PI};      REFINES real_constant :== 1{PI};
1537  \end_layout  \end_layout
1538    
1539    \begin_layout Standard
1540    
1541    
1542    \backslash
1543    end{ascend}
1544    \end_layout
1545    
1546    \end_inset
1547    
1548    
1549    \end_layout
1550    
1551  \begin_layout Caption  \begin_layout Caption
1552  \begin_inset LatexCommand \label{fig:model1.universalConstant}  \begin_inset LatexCommand \label{fig:model1.universalConstant}
1553    
# Line 1578  sideways false Line 1680  sideways false
1680  status open  status open
1681    
1682  \begin_layout LyX-Code  \begin_layout LyX-Code
1683    \begin_inset ERT
1684    status open
1685    
1686    \begin_layout Standard
1687    
1688    
1689    \backslash
1690    begin{ascend}
1691    \end_layout
1692    
1693    \begin_layout Standard
1694    
1695  REQUIRE "atoms.a4l";  REQUIRE "atoms.a4l";
1696  \end_layout  \end_layout
1697    
1698  \begin_layout LyX-Code  \begin_layout Standard
1699    
1700  MODEL vessel;  MODEL vessel;
1701  \end_layout  \end_layout
1702    
1703  \begin_layout LyX-Code  \begin_layout Standard
1704  (* variables *)  
1705      (* variables *)
1706  \end_layout  \end_layout
1707    
1708  \begin_layout LyX-Code  \begin_layout Standard
1709  side_area, end_areaIS_Aarea;  
1710      side_area, end_area     IS_A area;
1711  \end_layout  \end_layout
1712    
1713  \begin_layout LyX-Code  \begin_layout Standard
1714  vessel_vol, wall_vol    IS_Avolume;  
1715      vessel_vol, wall_vol    IS_A volume;
1716  \end_layout  \end_layout
1717    
1718  \begin_layout LyX-Code  \begin_layout Standard
1719  wall_thickness, H, D    IS_Adistance;  
1720      wall_thickness, H, D    IS_A distance;
1721  \end_layout  \end_layout
1722    
1723  \begin_layout LyX-Code  \begin_layout Standard
1724  H_to_D_ratio            IS_A    factor;  
1725      H_to_D_ratio            IS_A factor;
1726  \end_layout  \end_layout
1727    
1728  \begin_layout LyX-Code  \begin_layout Standard
1729  metal_density           IS_A    mass_density;  
1730      metal_density           IS_A mass_density;
1731  \end_layout  \end_layout
1732    
1733  \begin_layout LyX-Code  \begin_layout Standard
1734  metal_mass              IS_A    mass;  
1735      metal_mass              IS_A mass;
1736  \end_layout  \end_layout
1737    
1738  \begin_layout LyX-Code  \begin_layout Standard
1739    
1740  \end_layout  \end_layout
1741    
1742  \begin_layout LyX-Code  \begin_layout Standard
1743  (* equations *)  
1744      (* equations *)
1745  \end_layout  \end_layout
1746    
1747  \begin_layout LyX-Code  \begin_layout Standard
1748  FlatEnds:end_area = 1{PI} * D^2 / 4;  
1749      FlatEnds:end_area = 1{PI} * D^2 / 4;
1750  \end_layout  \end_layout
1751    
1752  \begin_layout LyX-Code  \begin_layout Standard
1753  Sides:side_area = 1{PI} * D * H;  
1754      Sides:side_area = 1{PI} * D * H;
1755  \end_layout  \end_layout
1756    
1757  \begin_layout LyX-Code  \begin_layout Standard
1758  Cylinder:vessel_vol = end_area * H;  
1759      Cylinder:vessel_vol = end_area * H;
1760  \end_layout  \end_layout
1761    
1762  \begin_layout LyX-Code  \begin_layout Standard
1763  Metal_volume:(side_area + 2 * end_area) *  
1764      Metal_volume:(side_area + 2 * end_area) *
1765  \end_layout  \end_layout
1766    
1767  \begin_layout LyX-Code  \begin_layout Standard
1768  wall_thickness = wall_vol;  
1769      wall_thickness = wall_vol;
1770  \end_layout  \end_layout
1771    
1772  \begin_layout LyX-Code  \begin_layout Standard
1773  HD_definition:D * H_to_D_ratio = H;  
1774      HD_definition:D * H_to_D_ratio = H;
1775  \end_layout  \end_layout
1776    
1777  \begin_layout LyX-Code  \begin_layout Standard
1778  VesselMass:metal_mass = metal_density * wall_vol;  
1779      VesselMass:metal_mass = metal_density * wall_vol;
1780  \end_layout  \end_layout
1781    
1782  \begin_layout LyX-Code  \begin_layout Standard
1783    
1784  END vessel;  END vessel;
1785  \end_layout  \end_layout
1786    
1787    \begin_layout Standard
1788    
1789    
1790    \backslash
1791    end{ascend}
1792    \end_layout
1793    
1794    \end_inset
1795    
1796    
1797    \end_layout
1798    
1799  \begin_layout Caption  \begin_layout Caption
1800  \begin_inset LatexCommand \label{fig:model1.modelVessel}  \begin_inset LatexCommand \label{fig:model1.modelVessel}
1801    
# Line 3459  You can now solve this model. Line 3602  You can now solve this model.
3602  \end_layout  \end_layout
3603    
3604  \begin_layout LyX-Code  \begin_layout LyX-Code
3605    \begin_inset ERT
3606    status open
3607    
3608    \begin_layout Standard
3609    
3610    
3611    \backslash
3612    begin{ascend}
3613    \end_layout
3614    
3615    \begin_layout Standard
3616    
3617  D = 1.21922 meter  D = 1.21922 meter
3618  \end_layout  \end_layout
3619    
3620  \begin_layout LyX-Code  \begin_layout Standard
3621    
3622  H = 3.65765 meter  H = 3.65765 meter
3623  \end_layout  \end_layout
3624    
3625  \begin_layout LyX-Code  \begin_layout Standard
3626    
3627  H_to_D_ratio = 3  H_to_D_ratio = 3
3628  \end_layout  \end_layout
3629    
3630  \begin_layout LyX-Code  \begin_layout Standard
3631    
3632  end_area = 1.16748 meter^2  end_area = 1.16748 meter^2
3633  \end_layout  \end_layout
3634    
3635  \begin_layout LyX-Code  \begin_layout Standard
3636    
3637  metal_density = 5000 kilogram/meter^3  metal_density = 5000 kilogram/meter^3
3638  \end_layout  \end_layout
3639    
3640  \begin_layout LyX-Code  \begin_layout Standard
3641    
3642  metal_mass = 408.62 kilogram  metal_mass = 408.62 kilogram
3643  \end_layout  \end_layout
3644    
3645  \begin_layout LyX-Code  \begin_layout Standard
3646    
3647  side_area = 14.0098 meter^2  side_area = 14.0098 meter^2
3648  \end_layout  \end_layout
3649    
3650  \begin_layout LyX-Code  \begin_layout Standard
3651    
3652  vessel_vol = 4.27025 meter^3  vessel_vol = 4.27025 meter^3
3653  \end_layout  \end_layout
3654    
3655  \begin_layout LyX-Code  \begin_layout Standard
3656    
3657  wall_thickness = 0.005 meter  wall_thickness = 0.005 meter
3658  \end_layout  \end_layout
3659    
3660  \begin_layout LyX-Code  \begin_layout Standard
3661    
3662  wall_vol = 0.0817239 meter^3  wall_vol = 0.0817239 meter^3
3663  \end_layout  \end_layout
3664    
3665  \begin_layout Standard  \begin_layout Standard
3666    
3667    
3668    \backslash
3669    end{ascend}
3670    \end_layout
3671    
3672    \end_inset
3673    
3674    
3675    \end_layout
3676    
3677    \begin_layout LyX-Code
3678    
3679    \end_layout
3680    
3681    \begin_layout Standard
3682  \begin_inset Note Note  \begin_inset Note Note
3683  status collapsed  status collapsed
3684    

Legend:
Removed from v.826  
changed lines
  Added in v.1385

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22