22 | | <a name="l00016"></a>00016 <span class="preprocessor">#include "simulator.h"</span> |
23 | | <a name="l00017"></a>00017 <span class="preprocessor">#include <uibuilder.h></span> |
24 | | <a name="l00018"></a>00018 |
25 | | <a name="l00020"></a><a class="code" href="classpmsmDS.html">00020</a> <span class="keyword">class </span><a class="code" href="classpmsmDS.html" title="Simulator of PMSM machine with predefined profile on omega.">pmsmDS</a> : <span class="keyword">public</span> <a class="code" href="classbdm_1_1DS.html" title="Abstract class for discrete-time sources of data.">DS</a> { |
26 | | <a name="l00021"></a>00021 |
27 | | <a name="l00022"></a>00022 <span class="keyword">protected</span>: |
28 | | <a name="l00024"></a><a class="code" href="classpmsmDS.html#3975e648cc981a550997df8120e176f7">00024</a> <span class="keywordtype">int</span> <a class="code" href="classpmsmDS.html#3975e648cc981a550997df8120e176f7" title="indeces of logged variables">L_x</a>, L_ou, L_oy, L_iu; |
29 | | <a name="l00026"></a><a class="code" href="classpmsmDS.html#ba6fbc63e4353135857bbba8f30e3012">00026</a> vec <a class="code" href="classpmsmDS.html#ba6fbc63e4353135857bbba8f30e3012" title="Setpoints of omega in timespans given by dt_prof.">profileWw</a>; |
30 | | <a name="l00028"></a><a class="code" href="classpmsmDS.html#01d9d15490d336b6613368557608f4fe">00028</a> <span class="keywordtype">double</span> <a class="code" href="classpmsmDS.html#01d9d15490d336b6613368557608f4fe" title="time-step for profiles">dt_prof</a>; |
31 | | <a name="l00030"></a><a class="code" href="classpmsmDS.html#c27956dc82ede2e8dbeb34e6cfa15a40">00030</a> <span class="keywordtype">int</span> <a class="code" href="classpmsmDS.html#c27956dc82ede2e8dbeb34e6cfa15a40" title="Number of miliseconds per discrete time step.">Dt</a>; |
32 | | <a name="l00031"></a>00031 <span class="keyword">public</span>: |
33 | | <a name="l00032"></a>00032 <a class="code" href="classpmsmDS.html" title="Simulator of PMSM machine with predefined profile on omega.">pmsmDS</a> ( <span class="keywordtype">int</span> Dt0 ) : <a class="code" href="classpmsmDS.html#c27956dc82ede2e8dbeb34e6cfa15a40" title="Number of miliseconds per discrete time step.">Dt</a> ( Dt0 ) {} |
34 | | <a name="l00033"></a>00033 <span class="keywordtype">void</span> set_parameters ( <span class="keywordtype">double</span> Rs0, <span class="keywordtype">double</span> Ls0, <span class="keywordtype">double</span> Fmag0, <span class="keywordtype">double</span> Bf0, <span class="keywordtype">double</span> p0, <span class="keywordtype">double</span> kp0, <span class="keywordtype">double</span> J0, <span class="keywordtype">double</span> Uc0, <span class="keywordtype">double</span> DT0, <span class="keywordtype">double</span> dt0 ) { |
35 | | <a name="l00034"></a>00034 pmsmsim_set_parameters ( Rs0, Ls0, Fmag0, Bf0, p0, kp0, J0, Uc0, DT0, dt0 ); |
36 | | <a name="l00035"></a>00035 } |
37 | | <a name="l00036"></a><a class="code" href="classpmsmDS.html#4e47e678eb56e0b3bd47d801d0995e46">00036</a> <span class="keywordtype">void</span> <a class="code" href="classpmsmDS.html#4e47e678eb56e0b3bd47d801d0995e46" title="Returns full vector of observed data.">getdata</a> ( vec &dt ) {dt=vec ( KalmanObs,6 );} |
38 | | <a name="l00037"></a><a class="code" href="classpmsmDS.html#35e9a2b9d82bd1b71d66778021d1e8b4">00037</a> <span class="keywordtype">void</span> <a class="code" href="classpmsmDS.html#35e9a2b9d82bd1b71d66778021d1e8b4" title="Accepts action variable and schedule it for application.">write</a> ( vec &ut ) {} |
39 | | <a name="l00038"></a>00038 |
40 | | <a name="l00039"></a><a class="code" href="classpmsmDS.html#664fc8deff7c141ee7ab826a9abb387b">00039</a> <span class="keywordtype">void</span> <a class="code" href="classpmsmDS.html#664fc8deff7c141ee7ab826a9abb387b" title="Moves from to , i.e. perfroms the actions and reads response of the system.">step</a>() { |
41 | | <a name="l00040"></a>00040 <span class="keyword">static</span> <span class="keywordtype">int</span> ind=0; |
42 | | <a name="l00041"></a>00041 <span class="keyword">static</span> <span class="keywordtype">double</span> dW; <span class="comment">// increase of W</span> |
43 | | <a name="l00042"></a>00042 <span class="keyword">static</span> <span class="keywordtype">double</span> Ww; <span class="comment">// W</span> |
44 | | <a name="l00043"></a>00043 <span class="keywordflow">if</span> ( t>=<a class="code" href="classpmsmDS.html#01d9d15490d336b6613368557608f4fe" title="time-step for profiles">dt_prof</a>*ind ) { |
45 | | <a name="l00044"></a>00044 <span class="keywordflow">if</span> ( ind<<a class="code" href="classpmsmDS.html#ba6fbc63e4353135857bbba8f30e3012" title="Setpoints of omega in timespans given by dt_prof.">profileWw</a>.length() ) { |
46 | | <a name="l00045"></a>00045 ind++; |
47 | | <a name="l00046"></a>00046 <span class="comment">//linear increase</span> |
48 | | <a name="l00047"></a>00047 dW = <a class="code" href="classpmsmDS.html#ba6fbc63e4353135857bbba8f30e3012" title="Setpoints of omega in timespans given by dt_prof.">profileWw</a> ( ind )-<a class="code" href="classpmsmDS.html#ba6fbc63e4353135857bbba8f30e3012" title="Setpoints of omega in timespans given by dt_prof.">profileWw</a> ( ind-1 ); |
49 | | <a name="l00048"></a>00048 } |
50 | | <a name="l00049"></a>00049 <span class="keywordflow">else</span> { |
51 | | <a name="l00050"></a>00050 dW = 0; |
52 | | <a name="l00051"></a>00051 } |
53 | | <a name="l00052"></a>00052 } |
54 | | <a name="l00053"></a>00053 Ww += dW; |
55 | | <a name="l00054"></a>00054 <span class="comment">//Simulate Dt seconds!</span> |
56 | | <a name="l00055"></a>00055 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=0;i<<a class="code" href="classpmsmDS.html#c27956dc82ede2e8dbeb34e6cfa15a40" title="Number of miliseconds per discrete time step.">Dt</a>;i++ ) { pmsmsim_step ( Ww );} |
57 | | <a name="l00056"></a>00056 }; |
58 | | <a name="l00057"></a>00057 |
59 | | <a name="l00058"></a>00058 <span class="keywordtype">void</span> log_add ( <a class="code" href="classbdm_1_1logger.html" title="Class for storing results (and semi-results) of an experiment.">logger</a> &L ) { |
60 | | <a name="l00059"></a>00059 <a class="code" href="classpmsmDS.html#3975e648cc981a550997df8120e176f7" title="indeces of logged variables">L_x</a> = L.<a class="code" href="classbdm_1_1logger.html#cfb4807e20b3d00f3d33e55ada528dc1" title="returns an identifier which will be later needed for calling the log() function">add</a> ( rx, <span class="stringliteral">"x"</span> ); |
61 | | <a name="l00060"></a>00060 L_oy = L.<a class="code" href="classbdm_1_1logger.html#cfb4807e20b3d00f3d33e55ada528dc1" title="returns an identifier which will be later needed for calling the log() function">add</a> ( ry, <span class="stringliteral">"oi"</span> ); |
62 | | <a name="l00061"></a>00061 L_ou = L.<a class="code" href="classbdm_1_1logger.html#cfb4807e20b3d00f3d33e55ada528dc1" title="returns an identifier which will be later needed for calling the log() function">add</a> ( ru, <span class="stringliteral">"ou"</span> ); |
63 | | <a name="l00062"></a>00062 L_iu = L.<a class="code" href="classbdm_1_1logger.html#cfb4807e20b3d00f3d33e55ada528dc1" title="returns an identifier which will be later needed for calling the log() function">add</a> ( ru, <span class="stringliteral">"iu"</span> ); |
64 | | <a name="l00063"></a>00063 } |
| 23 | <a name="l00016"></a>00016 |
| 24 | <a name="l00018"></a><a class="code" href="classpmsmDS.html">00018</a> <span class="keyword">class </span><a class="code" href="classpmsmDS.html" title="Simulator of PMSM machine with predefined profile on omega.">pmsmDS</a> : <span class="keyword">public</span> <a class="code" href="classbdm_1_1DS.html" title="Abstract class for discrete-time sources of data.">DS</a> { |
| 25 | <a name="l00019"></a>00019 |
| 26 | <a name="l00020"></a>00020 <span class="keyword">protected</span>: |
| 27 | <a name="l00022"></a><a class="code" href="classpmsmDS.html#3975e648cc981a550997df8120e176f7">00022</a> <span class="keywordtype">int</span> <a class="code" href="classpmsmDS.html#3975e648cc981a550997df8120e176f7" title="indeces of logged variables">L_x</a>, L_ou, L_oy, L_iu, L_optu; |
| 28 | <a name="l00024"></a><a class="code" href="classpmsmDS.html#ba6fbc63e4353135857bbba8f30e3012">00024</a> vec <a class="code" href="classpmsmDS.html#ba6fbc63e4353135857bbba8f30e3012" title="Setpoints of omega in timespans given by dt_prof.">profileWw</a>; |
| 29 | <a name="l00026"></a><a class="code" href="classpmsmDS.html#01d9d15490d336b6613368557608f4fe">00026</a> <span class="keywordtype">double</span> <a class="code" href="classpmsmDS.html#01d9d15490d336b6613368557608f4fe" title="time-step for profiles">dt_prof</a>; |
| 30 | <a name="l00028"></a><a class="code" href="classpmsmDS.html#c27956dc82ede2e8dbeb34e6cfa15a40">00028</a> <span class="keywordtype">int</span> <a class="code" href="classpmsmDS.html#c27956dc82ede2e8dbeb34e6cfa15a40" title="Number of miliseconds per discrete time step.">Dt</a>; |
| 31 | <a name="l00031"></a><a class="code" href="classpmsmDS.html#d410b9ca1a362e50a0833ae67803b7ee">00031</a> <span class="keywordtype">string</span> <a class="code" href="classpmsmDS.html#d410b9ca1a362e50a0833ae67803b7ee">opt</a>; |
| 32 | <a name="l00032"></a>00032 <span class="keyword">public</span>: |
| 33 | <a name="l00034"></a><a class="code" href="classpmsmDS.html#38803dee6cc0bf261d277a225bca48cf">00034</a> <a class="code" href="classpmsmDS.html#38803dee6cc0bf261d277a225bca48cf" title="Constructor with fixed sampling period.">pmsmDS</a> (<span class="keywordtype">string</span> opt0=<span class="stringliteral">""</span> ) : <a class="code" href="classpmsmDS.html#c27956dc82ede2e8dbeb34e6cfa15a40" title="Number of miliseconds per discrete time step.">Dt</a> ( 125 ), <a class="code" href="classpmsmDS.html#d410b9ca1a362e50a0833ae67803b7ee">opt</a>(opt0) {} |
| 34 | <a name="l00035"></a>00035 <span class="keywordtype">void</span> set_parameters ( <span class="keywordtype">double</span> Rs0, <span class="keywordtype">double</span> Ls0, <span class="keywordtype">double</span> Fmag0, <span class="keywordtype">double</span> Bf0, <span class="keywordtype">double</span> p0, <span class="keywordtype">double</span> kp0, <span class="keywordtype">double</span> J0, <span class="keywordtype">double</span> Uc0, <span class="keywordtype">double</span> DT0, <span class="keywordtype">double</span> dt0 ) { |
| 35 | <a name="l00036"></a>00036 pmsmsim_set_parameters ( Rs0, Ls0, Fmag0, Bf0, p0, kp0, J0, Uc0, DT0, dt0 ); |
| 36 | <a name="l00037"></a>00037 } |
| 37 | <a name="l00038"></a><a class="code" href="classpmsmDS.html#4e47e678eb56e0b3bd47d801d0995e46">00038</a> <span class="keywordtype">void</span> <a class="code" href="classpmsmDS.html#4e47e678eb56e0b3bd47d801d0995e46" title="Returns full vector of observed data.">getdata</a> ( vec &dt ) {dt=vec ( KalmanObs,6 );} |
| 38 | <a name="l00039"></a><a class="code" href="classpmsmDS.html#35e9a2b9d82bd1b71d66778021d1e8b4">00039</a> <span class="keywordtype">void</span> <a class="code" href="classpmsmDS.html#35e9a2b9d82bd1b71d66778021d1e8b4" title="Accepts action variable and schedule it for application.">write</a> ( vec &ut ) {} |
| 39 | <a name="l00040"></a>00040 |
| 40 | <a name="l00041"></a><a class="code" href="classpmsmDS.html#664fc8deff7c141ee7ab826a9abb387b">00041</a> <span class="keywordtype">void</span> <a class="code" href="classpmsmDS.html#664fc8deff7c141ee7ab826a9abb387b" title="Moves from to , i.e. perfroms the actions and reads response of the system.">step</a>() { |
| 41 | <a name="l00042"></a>00042 <span class="keyword">static</span> <span class="keywordtype">int</span> ind=0; |
| 42 | <a name="l00043"></a>00043 <span class="keyword">static</span> <span class="keywordtype">double</span> dW; <span class="comment">// increase of W</span> |
| 43 | <a name="l00044"></a>00044 <span class="keyword">static</span> <span class="keywordtype">double</span> Ww; <span class="comment">// W</span> |
| 44 | <a name="l00045"></a>00045 <span class="keywordflow">if</span> ( t>=<a class="code" href="classpmsmDS.html#01d9d15490d336b6613368557608f4fe" title="time-step for profiles">dt_prof</a>*ind ) { |
| 45 | <a name="l00046"></a>00046 ind++; |
| 46 | <a name="l00047"></a>00047 <span class="keywordflow">if</span> ( ind<<a class="code" href="classpmsmDS.html#ba6fbc63e4353135857bbba8f30e3012" title="Setpoints of omega in timespans given by dt_prof.">profileWw</a>.length() ) { |
| 47 | <a name="l00048"></a>00048 <span class="comment">//linear increase</span> |
| 48 | <a name="l00049"></a>00049 <span class="keywordflow">if</span> ( <a class="code" href="classpmsmDS.html#ba6fbc63e4353135857bbba8f30e3012" title="Setpoints of omega in timespans given by dt_prof.">profileWw</a>.length() ==1 ) { |
| 49 | <a name="l00050"></a>00050 Ww=<a class="code" href="classpmsmDS.html#ba6fbc63e4353135857bbba8f30e3012" title="Setpoints of omega in timespans given by dt_prof.">profileWw</a> ( 0 ); dW=0.0;} |
| 50 | <a name="l00051"></a>00051 <span class="keywordflow">else</span> { |
| 51 | <a name="l00052"></a>00052 dW = <a class="code" href="classpmsmDS.html#ba6fbc63e4353135857bbba8f30e3012" title="Setpoints of omega in timespans given by dt_prof.">profileWw</a> ( ind )-<a class="code" href="classpmsmDS.html#ba6fbc63e4353135857bbba8f30e3012" title="Setpoints of omega in timespans given by dt_prof.">profileWw</a> ( ind-1 ); |
| 52 | <a name="l00053"></a>00053 dW *=125e-6/<a class="code" href="classpmsmDS.html#01d9d15490d336b6613368557608f4fe" title="time-step for profiles">dt_prof</a>; |
| 53 | <a name="l00054"></a>00054 } |
| 54 | <a name="l00055"></a>00055 } |
| 55 | <a name="l00056"></a>00056 <span class="keywordflow">else</span> { |
| 56 | <a name="l00057"></a>00057 dW = 0; |
| 57 | <a name="l00058"></a>00058 } |
| 58 | <a name="l00059"></a>00059 } |
| 59 | <a name="l00060"></a>00060 Ww += dW; |
| 60 | <a name="l00061"></a>00061 <span class="comment">//Simulate Dt seconds!</span> |
| 61 | <a name="l00062"></a>00062 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=0;i<<a class="code" href="classpmsmDS.html#c27956dc82ede2e8dbeb34e6cfa15a40" title="Number of miliseconds per discrete time step.">Dt</a>;i++ ) { pmsmsim_step ( Ww );} |
| 62 | <a name="l00063"></a>00063 }; |
66 | | <a name="l00065"></a>00065 <span class="keywordtype">void</span> logit ( <a class="code" href="classbdm_1_1logger.html" title="Class for storing results (and semi-results) of an experiment.">logger</a> &L ) { |
67 | | <a name="l00066"></a>00066 L.<a class="code" href="classbdm_1_1logger.html#397c014b0aaf3581516e2a105d26a5c9" title="log this vector">logit</a> ( <a class="code" href="classpmsmDS.html#3975e648cc981a550997df8120e176f7" title="indeces of logged variables">L_x</a>, vec ( x,4 ) ); |
68 | | <a name="l00067"></a>00067 L.<a class="code" href="classbdm_1_1logger.html#397c014b0aaf3581516e2a105d26a5c9" title="log this vector">logit</a> ( L_oy, vec_2 ( KalmanObs[2],KalmanObs[3] ) ); |
69 | | <a name="l00068"></a>00068 L.<a class="code" href="classbdm_1_1logger.html#397c014b0aaf3581516e2a105d26a5c9" title="log this vector">logit</a> ( L_ou, vec_2 ( KalmanObs[0],KalmanObs[1] ) ); |
70 | | <a name="l00069"></a>00069 L.<a class="code" href="classbdm_1_1logger.html#397c014b0aaf3581516e2a105d26a5c9" title="log this vector">logit</a> ( L_iu, vec_2 ( KalmanObs[4],KalmanObs[5] ) ); |
71 | | <a name="l00070"></a>00070 } |
72 | | <a name="l00071"></a>00071 |
73 | | <a name="l00072"></a>00072 <span class="keywordtype">void</span> set_profile ( <span class="keywordtype">double</span> dt, <span class="keyword">const</span> vec &Ww ) {<a class="code" href="classpmsmDS.html#01d9d15490d336b6613368557608f4fe" title="time-step for profiles">dt_prof</a>=dt; <a class="code" href="classpmsmDS.html#ba6fbc63e4353135857bbba8f30e3012" title="Setpoints of omega in timespans given by dt_prof.">profileWw</a>=Ww;} |
74 | | <a name="l00073"></a>00073 }; |
75 | | <a name="l00074"></a>00074 |
76 | | <a name="l00075"></a>00075 <span class="keyword">class </span>UIpmsm: <span class="keyword">public</span> <a class="code" href="classbdm_1_1UIbuilder.html" title="Builds computational object from a UserInfo structure.">UIbuilder</a>{ |
77 | | <a name="l00076"></a>00076 <span class="keyword">public</span>: |
78 | | <a name="l00077"></a>00077 UIpmsm():<a class="code" href="classbdm_1_1UIbuilder.html" title="Builds computational object from a UserInfo structure.">UIbuilder</a>(<span class="stringliteral">"pmsm"</span>){} |
79 | | <a name="l00078"></a>00078 <span class="comment">//Non-standard BUILD!! Does not create </span> |
80 | | <a name="l00079"></a>00079 <span class="keywordtype">void</span> build(Setting &S, <span class="keywordtype">void</span>** result)<span class="keyword"> const</span>{ |
81 | | <a name="l00080"></a>00080 |
82 | | <a name="l00081"></a>00081 }; |
83 | | <a name="l00082"></a>00082 }; |
84 | | <a name="l00083"></a>00083 |
85 | | <a name="l00084"></a>00084 <span class="keyword">class </span>UIpmsmDS: <span class="keyword">public</span> <a class="code" href="classbdm_1_1UIbuilder.html" title="Builds computational object from a UserInfo structure.">UIbuilder</a> { |
86 | | <a name="l00085"></a>00085 <span class="keyword">public</span>: |
87 | | <a name="l00086"></a>00086 UIpmsmDS():<a class="code" href="classbdm_1_1UIbuilder.html" title="Builds computational object from a UserInfo structure.">UIbuilder</a>(<span class="stringliteral">"pmsmDS"</span>){} |
88 | | <a name="l00087"></a>00087 <span class="keywordtype">void</span> build(Setting &S, <span class="keywordtype">void</span>** result)<span class="keyword"> const</span>{ |
89 | | <a name="l00088"></a>00088 <span class="keywordtype">double</span> DT=S[<span class="stringliteral">"Dt"</span>]; |
90 | | <a name="l00089"></a>00089 <a class="code" href="classpmsmDS.html" title="Simulator of PMSM machine with predefined profile on omega.">pmsmDS</a>* tmp = <span class="keyword">new</span> <a class="code" href="classpmsmDS.html" title="Simulator of PMSM machine with predefined profile on omega.">pmsmDS</a>(DT); |
91 | | <a name="l00090"></a>00090 <span class="keywordflow">try</span>{ |
92 | | <a name="l00091"></a>00091 Setting& Sp=S[<span class="stringliteral">"param"</span>]; |
93 | | <a name="l00092"></a>00092 tmp-><a class="code" href="classpmsmDS.html#73073ee4f905af3f9f96a6130e9a9e22">set_parameters</a>(S[<span class="stringliteral">"Rs"</span>], S[<span class="stringliteral">"Ls"</span>], S[<span class="stringliteral">"Fmag"</span>], S[<span class="stringliteral">"Bf"</span>], S[<span class="stringliteral">"p"</span>], S[<span class="stringliteral">"kp"</span>], ... |
94 | | <a name="l00093"></a>00093 S[<span class="stringliteral">"J"</span>], S[<span class="stringliteral">"Uc"</span>], DT, ) |
95 | | <a name="l00094"></a>00094 } |
96 | | <a name="l00095"></a>00095 } |
97 | | <a name="l00096"></a>00096 } |
| 64 | <a name="l00065"></a>00065 <span class="keywordtype">void</span> log_add ( <a class="code" href="classbdm_1_1logger.html" title="Class for storing results (and semi-results) of an experiment.">logger</a> &L ) { |
| 65 | <a name="l00066"></a>00066 <a class="code" href="classpmsmDS.html#3975e648cc981a550997df8120e176f7" title="indeces of logged variables">L_x</a> = L.<a class="code" href="classbdm_1_1logger.html#cfb4807e20b3d00f3d33e55ada528dc1" title="returns an identifier which will be later needed for calling the log() function">add</a> ( rx, <span class="stringliteral">"x"</span> ); |
| 66 | <a name="l00067"></a>00067 L_oy = L.<a class="code" href="classbdm_1_1logger.html#cfb4807e20b3d00f3d33e55ada528dc1" title="returns an identifier which will be later needed for calling the log() function">add</a> ( ry, <span class="stringliteral">"obs"</span> ); |
| 67 | <a name="l00068"></a>00068 L_ou = L.<a class="code" href="classbdm_1_1logger.html#cfb4807e20b3d00f3d33e55ada528dc1" title="returns an identifier which will be later needed for calling the log() function">add</a> ( ru, <span class="stringliteral">"obs"</span> ); |
| 68 | <a name="l00069"></a>00069 L_iu = L.<a class="code" href="classbdm_1_1logger.html#cfb4807e20b3d00f3d33e55ada528dc1" title="returns an identifier which will be later needed for calling the log() function">add</a> ( ru, <span class="stringliteral">"true"</span> ); |
| 69 | <a name="l00070"></a>00070 <span class="comment">// log differences</span> |
| 70 | <a name="l00071"></a>00071 <span class="keywordflow">if</span> (<a class="code" href="classpmsmDS.html#d410b9ca1a362e50a0833ae67803b7ee">opt</a>.find(<span class="stringliteral">"u"</span>)==string::npos){ |
| 71 | <a name="l00072"></a>00072 L_optu = L.<a class="code" href="classbdm_1_1logger.html#cfb4807e20b3d00f3d33e55ada528dc1" title="returns an identifier which will be later needed for calling the log() function">add</a>(ru, <span class="stringliteral">"model"</span>); |
| 72 | <a name="l00073"></a>00073 } |
| 73 | <a name="l00074"></a>00074 } |
| 74 | <a name="l00075"></a>00075 |
| 75 | <a name="l00076"></a>00076 <span class="keywordtype">void</span> logit ( <a class="code" href="classbdm_1_1logger.html" title="Class for storing results (and semi-results) of an experiment.">logger</a> &L ) { |
| 76 | <a name="l00077"></a>00077 L.<a class="code" href="classbdm_1_1logger.html#397c014b0aaf3581516e2a105d26a5c9" title="log this vector">logit</a> ( <a class="code" href="classpmsmDS.html#3975e648cc981a550997df8120e176f7" title="indeces of logged variables">L_x</a>, vec ( x,4 ) ); |
| 77 | <a name="l00078"></a>00078 L.<a class="code" href="classbdm_1_1logger.html#397c014b0aaf3581516e2a105d26a5c9" title="log this vector">logit</a> ( L_oy, vec_2 ( KalmanObs[2],KalmanObs[3] ) ); |
| 78 | <a name="l00079"></a>00079 L.<a class="code" href="classbdm_1_1logger.html#397c014b0aaf3581516e2a105d26a5c9" title="log this vector">logit</a> ( L_ou, vec_2 ( KalmanObs[0],KalmanObs[1] ) ); |
| 79 | <a name="l00080"></a>00080 L.<a class="code" href="classbdm_1_1logger.html#397c014b0aaf3581516e2a105d26a5c9" title="log this vector">logit</a> ( L_iu, vec_2 ( KalmanObs[4],KalmanObs[5] ) ); |
| 80 | <a name="l00081"></a>00081 <span class="keywordflow">if</span> (<a class="code" href="classpmsmDS.html#d410b9ca1a362e50a0833ae67803b7ee">opt</a>.find(<span class="stringliteral">"u"</span>)==string::npos){ |
| 81 | <a name="l00082"></a>00082 <span class="keywordtype">double</span> sq3=sqrt(3.0); |
| 82 | <a name="l00083"></a>00083 <span class="keywordtype">double</span> ua,ub; |
| 83 | <a name="l00084"></a>00084 <span class="keywordtype">double</span> i1=x[0]; |
| 84 | <a name="l00085"></a>00085 <span class="keywordtype">double</span> i2=0.5*(-i1+sq3*x[1]); |
| 85 | <a name="l00086"></a>00086 <span class="keywordtype">double</span> i3=0.5*(-i1-sq3*x[1]); |
| 86 | <a name="l00087"></a>00087 <span class="keywordtype">double</span> u1=KalmanObs[0]; |
| 87 | <a name="l00088"></a>00088 <span class="keywordtype">double</span> u2=0.5*(-u1+sq3*KalmanObs[1]); |
| 88 | <a name="l00089"></a>00089 <span class="keywordtype">double</span> u3=0.5*(-u1-sq3*KalmanObs[1]); |
| 89 | <a name="l00090"></a>00090 |
| 90 | <a name="l00091"></a>00091 <span class="keywordtype">double</span> du1=0.7*(double(i1>0.1) - double(i1<-0.1))+0.05*i1; |
| 91 | <a name="l00092"></a>00092 <span class="keywordtype">double</span> du2=0.7*(double(i2>0.1) - double(i2<-0.1))+0.05*i2; |
| 92 | <a name="l00093"></a>00093 <span class="keywordtype">double</span> du3=0.7*(double(i3>0.1) - double(i3<-0.1))+0.05*i3; |
| 93 | <a name="l00094"></a>00094 ua = (2.0*(u1-du1)-(u2-du2)-(u3-du3))/3.0; |
| 94 | <a name="l00095"></a>00095 ub = ((u2-du2)-(u3-du3))/sq3; |
| 95 | <a name="l00096"></a>00096 L.<a class="code" href="classbdm_1_1logger.html#397c014b0aaf3581516e2a105d26a5c9" title="log this vector">logit</a>( L_optu , vec_2 (ua,ub)); |
| 96 | <a name="l00097"></a>00097 } |
| 97 | <a name="l00098"></a>00098 } |
| 98 | <a name="l00099"></a>00099 |
| 99 | <a name="l00100"></a>00100 <span class="keywordtype">void</span> set_profile ( <span class="keywordtype">double</span> dt, <span class="keyword">const</span> vec &Ww ) {<a class="code" href="classpmsmDS.html#01d9d15490d336b6613368557608f4fe" title="time-step for profiles">dt_prof</a>=dt; <a class="code" href="classpmsmDS.html#ba6fbc63e4353135857bbba8f30e3012" title="Setpoints of omega in timespans given by dt_prof.">profileWw</a>=Ww;} |
| 100 | <a name="l00101"></a>00101 }; |