|
Revision 1292, 0.7 kB
(checked in by smidl, 15 years ago)
|
|
model in DQ + test
|
-
Property svn:eol-style set to
native
|
| Line | |
|---|
| 1 | |
|---|
| 2 | #include <base/bdmbase.h> |
|---|
| 3 | |
|---|
| 4 | #include "pmsm.h" |
|---|
| 5 | |
|---|
| 6 | using namespace bdm; |
|---|
| 7 | |
|---|
| 8 | //These lines are needed for use of cout and endl |
|---|
| 9 | using std::cout; |
|---|
| 10 | using std::endl; |
|---|
| 11 | |
|---|
| 12 | int main() |
|---|
| 13 | { |
|---|
| 14 | vec x0 = "1 2 10 0"; |
|---|
| 15 | vec u0 = "1 1"; |
|---|
| 16 | double h=1e-6; |
|---|
| 17 | |
|---|
| 18 | IMpmsmDQ I; |
|---|
| 19 | I.set_parameters ( 0.28, 0.003465, 0.003, h, 0.1989, 1.5 ,4.0, 0.04, 0.0 ); |
|---|
| 20 | |
|---|
| 21 | vec x(x0); x(0) += h; |
|---|
| 22 | cout << I.eval(x,u0) << ", " << I.eval(x0,u0) <<endl<<endl; |
|---|
| 23 | |
|---|
| 24 | cout << (I.eval(x,u0)-I.eval(x0,u0))/h <<endl; |
|---|
| 25 | x=x0; x(1) += h; |
|---|
| 26 | cout << (I.eval(x,u0)-I.eval(x0,u0))/h <<endl; |
|---|
| 27 | x=x0; x(2) += h; |
|---|
| 28 | cout << (I.eval(x,u0)-I.eval(x0,u0))/h <<endl; |
|---|
| 29 | x=x0; x(3) += h; |
|---|
| 30 | cout << (I.eval(x,u0)-I.eval(x0,u0))/h <<endl; |
|---|
| 31 | cout << endl; |
|---|
| 32 | mat A(4,4); |
|---|
| 33 | I.dfdx_cond(x0,u0,A); |
|---|
| 34 | |
|---|
| 35 | cout <<A.T() << endl; |
|---|
| 36 | //Exit program: |
|---|
| 37 | return 0; |
|---|
| 38 | |
|---|
| 39 | } |
|---|