1 | #* |
---|

2 | * EMSO template file for new equation flowsheets. |
---|

3 | * |
---|

4 | * The user should edit the contents of this file in order |
---|

5 | * to develop a new flowsheet. |
---|

6 | * |
---|

7 | * $Id: flowsheet_eqs.mso 14 2006-08-26 20:15:39Z rafael $ |
---|

8 | *# |
---|

9 | |
---|

10 | |
---|

11 | #* |
---|

12 | * The using command makes available entities declared in another files. |
---|

13 | * |
---|

14 | * With this command the user can make use of the EML types |
---|

15 | *# |
---|

16 | using "types"; |
---|

17 | |
---|

18 | #* |
---|

19 | * A new model is declared with the Model keyword and a name. |
---|

20 | * A model can have several sections presented above: |
---|

21 | *# |
---|

22 | FlowSheet BB_react |
---|

23 | |
---|

24 | #* |
---|

25 | * In the PARAMETERS section we can define the constants of the |
---|

26 | * model. |
---|

27 | * A parameter will never be the result of the simulation its value |
---|

28 | * need to be specified by the user. |
---|

29 | *# |
---|

30 | PARAMETERS |
---|

31 | nz as Integer(Brief="Nnmber of differential component", Default=2); |
---|

32 | ny as Integer(Brief="Number of algebraic", Default=1); |
---|

33 | nu as Integer(Brief="number of control", Default=1); |
---|

34 | ak01 as Real(Brief="reaction rate constant",Default=65.5 ); |
---|

35 | ak02 as Real(Brief="reaction rate constant",Default=1970 ); |
---|

36 | e1 as Real(Brief="reaction rate constant",Default=5027.7 ); |
---|

37 | e2 as Real(Brief="reaction rate constant",Default=8044.31 ); |
---|

38 | #* |
---|

39 | * In the VARIABLE section we declare the variables of the model. |
---|

40 | * The values of the variables will be calculated by the system |
---|

41 | * in order to respect the model equations. |
---|

42 | *# |
---|

43 | VARIABLES |
---|

44 | z as Real(Brief="concentration of component"); |
---|

45 | y as Real(Brief="Algebraic, the third component"); |
---|

46 | u as Real(Brief="Control", Default=700); |
---|

47 | k as Real(Brief="reaction rate"); |
---|

48 | f as Real(Brief="residuals of constraint"); |
---|

49 | |
---|

50 | #* |
---|

51 | * In the EQUATIONS section we declare equality expressions involving |
---|

52 | * the any previously declared parameter or variable. |
---|

53 | * The equations will be used to determine the value of the variables. |
---|

54 | *# |
---|

55 | EQUATIONS |
---|

56 | k(1) = ak01*exp(-e1/u(1)); |
---|

57 | k(2) = ak02*exp(-e2/u(1)); |
---|

58 | f(1) = -k(1)*z(1) - diff(z(1)); |
---|

59 | f(2) = (k(1)*z(1)-k(2)*z(2)) - diff(z(2)); |
---|

60 | f(3) = z(1) + z(2) + y(1) - 1; |
---|

61 | |
---|

62 | |
---|

63 | |
---|

64 | |
---|

65 | #* |
---|

66 | * Additionally, in the case of dynamic models we can declare initial |
---|

67 | * conditions exactly as in the EQUATIONS section. |
---|

68 | * Equations declared on the INITIAL section will be used to determine |
---|

69 | * the initial condition of dynamic models. |
---|

70 | *# |
---|

71 | INITIAL |
---|

72 | z=[1,0]; |
---|

73 | |
---|

74 | OPTIONS |
---|

75 | |
---|

76 | time = [0:100:180*60]; |
---|

77 | |
---|

78 | end |
---|