liebouds_system.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of ACADO Toolkit.
3  *
4  * ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization.
5  * Copyright (C) 2008-2009 by Boris Houska and Hans Joachim Ferreau, K.U.Leuven.
6  * Developed within the Optimization in Engineering Center (OPTEC) under
7  * supervision of Moritz Diehl. All rights reserved.
8  *
9  * ACADO Toolkit is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 3 of the License, or (at your option) any later version.
13  *
14  * ACADO Toolkit is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with ACADO Toolkit; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22  *
23  */
24 
25 
26 
35 
36  DifferentialState x("x",10,1);
37 
38  Control u1, u2;
39 
40  DMatrix A0(10,10);
41  A0.setZero();
42 
43  DMatrix A1(10,10);
44  A1.setZero();
45 
46  DMatrix A2(10,10);
47  A2.setZero();
48 
49  DMatrix A3(10,10);
50  A3.setZero();
51 
52  DMatrix A4(10,10);
53  A4.setZero();
54 
55  DVector b1(10), b2(10);
56  b1.setZero();
57  b2.setZero();
58 
59  // DEFINE THE MATRICES AND VECTORS:
60  // --------------------------------
61 
62  A0(0,1) = 1.0;
63  A0(1,1) = -1.0;
64 
65  A0(2,3) = 6.3;
66  A0(3,3) = -71.4;
67  A0(4,3) = 62.6;
68  A0(5,3) = -91.1;
69  A0(6,3) = 54.4;
70  A0(7,3) = -126.5;
71  A0(8,3) = 82.6;
72  A0(9,3) = -228.4;
73 
74  A0(4,4) = -2000.0;
75  A0(5,4) = 2000.0;
76 
77  A0(2,5) = 6.3;
78  A0(3,5) = 0.0 ;
79  A0(4,5) = -1882.6;
80  A0(5,5) = 1662.3;
81  A0(6,5) = 54.4;
82  A0(7,5) = -126.5;
83  A0(8,5) = 82.6;
84  A0(9,5) = -228.4;
85 
86  A0(6,6) = -2000.0;
87  A0(7,6) = 2000.0;
88 
89  A0(2,7) = 6.3;
90  A0(3,7) = 0.0 ;
91  A0(4,7) = 0.0 ;
92  A0(5,7) = 0.0 ;
93  A0(6,7) = -1888.9;
94  A0(7,7) = 1589.4;
95  A0(8,7) = 82.6;
96  A0(9,7) = -228.4;
97 
98  A0(8,8) = -2000.0;
99  A0(9,8) = 2000.0;
100 
101  A0(2,7) = 6.3;
102  A0(3,7) = 0.0 ;
103  A0(4,7) = 0.0 ;
104  A0(5,7) = 0.0 ;
105  A0(6,7) = 0.0 ;
106  A0(7,7) = 0.0 ;
107  A0(8,7) = -1834.4;
108  A0(9,7) = 1303.4;
109 
110  A1(4,3) = -1.4597;
111  A1(5,3) = 2.2015;
112  A1(6,3) = -0.0238;
113  A1(7,3) = 0.0306;
114  A1(8,3) = -0.0072;
115  A1(9,3) = 0.0106;
116 
117  A1(4,5) = -2.9068;
118  A1(5,5) = 5.7267;
119  A1(6,5) = -0.0238;
120  A1(7,5) = 0.0306;
121  A1(8,5) = -0.0072;
122  A1(9,5) = 0.0106;
123 
124  A1(8,7) = -0.0072;
125  A1(9,7) = 0.0106;
126 
127 
128  A2(4,3) = 0.0129;
129  A2(5,3) = -0.0206;
130  A2(6,3) = 0.0002;
131  A2(7,3) = -0.0003;
132  A2(8,3) = 0.0001;
133  A2(9,3) = -0.0001;
134 
135  A2(4,5) = 0.0284;
136  A2(5,5) = -0.0448;
137  A2(6,5) = 0.0002;
138  A2(7,5) = -0.0003;
139  A2(8,5) = 0.0001;
140  A2(9,5) = -0.0001;
141 
142  A2(8,7) = 0.0001;
143  A2(9,7) = -0.0001;
144 
145 
146  A3(4,3) = -0.0497e-03;
147  A3(5,3) = 0.0835e-03;
148  A3(6,3) = -0.0009e-03;
149  A3(7,3) = 0.0012e-03;
150  A3(8,3) = -0.0003e-03;
151  A3(9,3) = 0.0004e-03;
152 
153  A3(4,5) = -0.1225e-03;
154  A3(5,5) = 0.1688e-03;
155  A3(6,5) = -0.0009e-03;
156  A3(7,5) = 0.0012e-03;
157  A3(8,5) = -0.0003e-03;
158  A3(9,5) = 0.0004e-03;
159 
160  A3(8,7) = -0.0003e-03;
161  A3(9,7) = 0.0004e-03;
162 
163 
164  A4(4,3) = 0.0691e-06;
165  A4(5,3) = -0.1238e-06;
166  A4(6,3) = 0.0014e-06;
167  A4(7,3) = -0.0019e-06;
168  A4(8,3) = 0.0004e-06;
169  A4(9,3) = -0.0006e-06;
170 
171  A4(4,5) = 0.1936e-06;
172  A4(5,5) = -0.2445e-06;
173  A4(6,5) = 0.0014e-06;
174  A4(7,5) = -0.0019e-06;
175  A4(8,5) = 0.0004e-06;
176  A4(9,5) = -0.0006e-06;
177 
178  A4(8,7) = 0.0004e-06;
179  A4(9,7) = -0.0006e-06;
180 
181 
182 
183  b1(1) = 10.0 ;
184  b2(3) = 2000.0;
185 
186  IntermediateState rho = x(0) ;
187  IntermediateState rho2 = rho*rho ;
188  IntermediateState rho3 = rho2*rho;
189  IntermediateState rho4 = rho3*rho;
190 
191 
192  // Define the Right-Hand-Side:
193  // ---------------------------
194 
195  *f << dot(x) == ( A0 + A1*rho + A2*rho2 + A3*rho3 + A4*rho4 )*x - b1*u1 - b2*u2;
196 }
197 
198 
199 
void liebouds_system(DifferentialEquation *f)
#define A1
#define A2
Derived & setZero(Index size)
Expression dot(const Expression &arg)
Allows to setup and evaluate differential equations (ODEs and DAEs) based on SymbolicExpressions.


acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Mon Jun 10 2019 12:34:48