Last change
on this file since 582 was
539,
checked in by Rafael de Pelegrini Soares, 14 years ago

Updated simple linear sample


Property svn:eolstyle set to
native

Property svn:keywords set to
Id

File size:
1.6 KB

Line  

1  #* 

2  * EMSO Model Library (EML) Copyright (C) 2004  2007 ALSOC. 

3  * 

4  * This LIBRARY is free software; you can distribute it and/or modify 

5  * it under the therms of the ALSOC FREE LICENSE as available at 

6  * http://www.enq.ufrgs.br/alsoc. 

7  * 

8  * EMSO Copyright (C) 2004  2007 ALSOC, original code 

9  * from http://www.rps.eng.br Copyright (C) 20022004. 

10  * All rights reserved. 

11  * 

12  * EMSO is distributed under the therms of the ALSOC LICENSE as 

13  * available at http://www.enq.ufrgs.br/alsoc. 

14  * 

15  * 

16  * FlowSheet with simple linear system 

17  * 

18  * Author: Rafael de Pelegrini Soares 

19  * $Id: sample_linear.mso 539 20080616 16:59:56Z rafael $ 

20  **# 

21  

22  using "types"; 

23  

24  FlowSheet linear 

25  PARAMETERS 

26  nx as Integer(Default=2); 

27  ny as Integer(Default=2); 

28  nu as Integer(Default=2); 

29  

30  A(nx,nx) as Real; 

31  B(nx,nu) as Real; 

32  C(ny,nx) as Real; 

33  D(ny,nu) as Real; 

34  

35  VARIABLES 

36  x(nx) as Real (Brief="State Variables"); 

37  y(ny) as Real (Brief="Output Variables"); 

38  u(nu) as Real (Brief="Control Variables"); 

39  

40  EQUATIONS 

41  

42  diff(x)*'s' = sumt(A*x) + sumt(B*u); 

43  y = sumt(C*x) + sumt(D*u); 

44  

45  SPECIFY 

46  u(1:nu) = sin((time/'s' + [1:nu])*'rad'); 

47  

48  SET 

49  

50  nx = 7; 

51  ny = 3; 

52  nu = 5; 

53  

54  A = 0; 

55  B = 0; 

56  C = 0; 

57  D = 0; 

58  

59  A(1,1) = 0.5; 

60  A(2,2) = 0.5; 

61  A(3,3) = 0.5; 

62  

63  B(1,1) = 0.75; 

64  B(2,2) = 0.75; 

65  B(3,3) = 0.75; 

66  

67  C(2,1) = 0.85; 

68  D = 0.95; 

69  

70  INITIAL 

71  x = 0; 

72  

73  OPTIONS 

74  TimeStep = 0.1; 

75  TimeEnd = 2; 

76  TimeUnit = 's'; 

77  SparseAlgebra = true; 

78  Linearize = true; 

79  end 

Note: See
TracBrowser
for help on using the repository browser.