Index: doc/html/pmsm_8h-source.html
===================================================================
--- doc/html/pmsm_8h-source.html (revision 234)
+++ doc/html/pmsm_8h-source.html (revision 255)
@@ -21,214 +21,214 @@
 <a name="l00004"></a>00004 <span class="preprocessor">#include &lt;stat/libFN.h&gt;</span>
 <a name="l00005"></a>00005 
-<a name="l00010"></a>00010 <span class="comment">//TODO hardcoded RVs!!!</span>
-<a name="l00011"></a>00011 <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> rx ( <span class="stringliteral">"{ia ib om th }"</span>);
-<a name="l00012"></a>00012 <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> ru ( <span class="stringliteral">"{ua ub }"</span>);
-<a name="l00013"></a>00013 <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> ry ( <span class="stringliteral">"{oia oib }"</span>);
-<a name="l00014"></a>00014 <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> rU = <a class="code" href="group__core.html#g33c114e83980d883c5b211c47d5322a4" title="Concat two random variables.">concat</a>(ru, <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a>(<span class="stringliteral">"{dua dub }"</span>));
-<a name="l00015"></a>00015 
-<a name="l00016"></a>00016 <span class="comment">// class uipmsm : public uibase{</span>
-<a name="l00017"></a>00017 <span class="comment">//      double Rs, Ls, dt, Ypm, kp, p,  J, Mz;</span>
-<a name="l00018"></a>00018 <span class="comment">// };</span>
-<a name="l00019"></a>00019 
-<a name="l00020"></a>00020 vec x2o_dbg(4);
-<a name="l00021"></a>00021 
-<a name="l00023"></a><a class="code" href="classIMpmsm.html">00023</a> <span class="keyword">class </span><a class="code" href="classIMpmsm.html" title="State evolution model for a PMSM drive and its derivative with respect to .">IMpmsm</a> : <span class="keyword">public</span> <a class="code" href="classdiffbifn.html" title="Class representing a differentiable function of two variables .">diffbifn</a> {
-<a name="l00024"></a>00024 <span class="keyword">protected</span>:
-<a name="l00025"></a>00025         <span class="keywordtype">double</span> Rs, Ls, dt, Ypm, kp, p,  J, Mz;
-<a name="l00026"></a>00026 
-<a name="l00027"></a>00027 <span class="keyword">public</span>:
-<a name="l00028"></a>00028         <a class="code" href="classIMpmsm.html" title="State evolution model for a PMSM drive and its derivative with respect to .">IMpmsm</a>() :<a class="code" href="classdiffbifn.html#797772c0d5aab8ddccec19dfe4bb2d77" title="Default constructor (dimy is not set!).">diffbifn</a> (rx.<a class="code" href="classRV.html#f5c7b8bd589eef09ccdf3329a0addea0" title="Return number of scalars in the RV.">count</a>(), rx, ru ) {};
-<a name="l00030"></a><a class="code" href="classIMpmsm.html#42818f3426d99fecb7e97be8ffe2e228">00030</a>         <span class="keywordtype">void</span> <a class="code" href="classIMpmsm.html#42818f3426d99fecb7e97be8ffe2e228" title="Set mechanical and electrical variables.">set_parameters</a> ( <span class="keywordtype">double</span> Rs0, <span class="keywordtype">double</span> Ls0, <span class="keywordtype">double</span> dt0, <span class="keywordtype">double</span> Ypm0, <span class="keywordtype">double</span> kp0, <span class="keywordtype">double</span> p0, <span class="keywordtype">double</span> J0, <span class="keywordtype">double</span> Mz0 ) {Rs=Rs0; Ls=Ls0; dt=dt0; Ypm=Ypm0; kp=kp0; p=p0; J=J0; Mz=Mz0;}
-<a name="l00031"></a>00031 
-<a name="l00032"></a><a class="code" href="classIMpmsm.html#45785869d978dda42828a072ec2caebe">00032</a>         vec <a class="code" href="classIMpmsm.html#45785869d978dda42828a072ec2caebe" title="Evaluates .">eval</a> ( <span class="keyword">const</span> vec &amp;x0, <span class="keyword">const</span> vec &amp;u0 ) {
-<a name="l00033"></a>00033                 <span class="comment">// last state</span>
-<a name="l00034"></a>00034                 <span class="keywordtype">double</span> iam = x0 ( 0 );
-<a name="l00035"></a>00035                 <span class="keywordtype">double</span> ibm = x0 ( 1 );
-<a name="l00036"></a>00036                 <span class="keywordtype">double</span> omm = x0 ( 2 );
-<a name="l00037"></a>00037                 <span class="keywordtype">double</span> thm = x0 ( 3 );
-<a name="l00038"></a>00038                 <span class="keywordtype">double</span> uam = u0 ( 0 );
-<a name="l00039"></a>00039                 <span class="keywordtype">double</span> ubm = u0 ( 1 );
-<a name="l00040"></a>00040 
-<a name="l00041"></a>00041                 vec xk=zeros ( 4 );
-<a name="l00042"></a>00042                 <span class="comment">//ia</span>
-<a name="l00043"></a>00043                 xk ( 0 ) = ( 1.0- Rs/Ls*dt ) * iam + Ypm/Ls*dt*omm * sin ( thm ) + uam*dt/Ls;
-<a name="l00044"></a>00044                 <span class="comment">//ib</span>
-<a name="l00045"></a>00045                 xk ( 1 ) = ( 1.0- Rs/Ls*dt ) * ibm - Ypm/Ls*dt*omm * cos ( thm ) + ubm*dt/Ls;
-<a name="l00046"></a>00046                 <span class="comment">//om</span>
-<a name="l00047"></a>00047                 xk ( 2 ) = omm + kp*p*p * Ypm/J*dt* ( ibm * cos ( thm )-iam * sin ( thm ) ) - p/J*dt*Mz;
-<a name="l00048"></a>00048                 <span class="comment">//th</span>
-<a name="l00049"></a>00049                 xk ( 3 ) = thm + omm*dt; <span class="comment">// &lt;0..2pi&gt;</span>
-<a name="l00050"></a>00050                 <span class="keywordflow">if</span> ( xk ( 3 ) &gt;pi ) xk ( 3 )-=2*pi;
-<a name="l00051"></a>00051                 <span class="keywordflow">if</span> ( xk ( 3 ) &lt;-pi ) xk ( 3 ) +=2*pi;
-<a name="l00052"></a>00052                 <span class="keywordflow">return</span> xk;
-<a name="l00053"></a>00053         }
-<a name="l00054"></a>00054 
-<a name="l00055"></a><a class="code" href="classIMpmsm.html#b4378b5d3bf64c683e4cf5c5f1cd56f1">00055</a>         <span class="keywordtype">void</span> <a class="code" href="classIMpmsm.html#b4378b5d3bf64c683e4cf5c5f1cd56f1" title="Evaluates  and writes result into A .">dfdx_cond</a> ( <span class="keyword">const</span> vec &amp;x0, <span class="keyword">const</span> vec &amp;u0, mat &amp;A, <span class="keywordtype">bool</span> full=<span class="keyword">true</span> ) {
-<a name="l00056"></a>00056                 <span class="keywordtype">double</span> iam = x0 ( 0 );
-<a name="l00057"></a>00057                 <span class="keywordtype">double</span> ibm = x0 ( 1 );
-<a name="l00058"></a>00058                 <span class="keywordtype">double</span> omm = x0 ( 2 );
-<a name="l00059"></a>00059                 <span class="keywordtype">double</span> thm = x0 ( 3 );
-<a name="l00060"></a>00060                 <span class="comment">// d ia</span>
-<a name="l00061"></a>00061                 A ( 0,0 ) = ( 1.0- Rs/Ls*dt ); A ( 0,1 ) = 0.0;
-<a name="l00062"></a>00062                 A ( 0,2 ) = Ypm/Ls*dt* sin ( thm ); A ( 0,3 ) = Ypm/Ls*dt*omm * ( cos ( thm ) );
-<a name="l00063"></a>00063                 <span class="comment">// d ib</span>
-<a name="l00064"></a>00064                 A ( 1,0 ) = 0.0 ; A ( 1,1 ) = ( 1.0- Rs/Ls*dt );
-<a name="l00065"></a>00065                 A ( 1,2 ) = -Ypm/Ls*dt* cos ( thm ); A ( 1,3 ) = Ypm/Ls*dt*omm * ( sin ( thm ) );
-<a name="l00066"></a>00066                 <span class="comment">// d om</span>
-<a name="l00067"></a>00067                 A ( 2,0 ) = kp*p*p * Ypm/J*dt* ( - sin ( thm ) );
-<a name="l00068"></a>00068                 A ( 2,1 ) = kp*p*p * Ypm/J*dt* ( cos ( thm ) );
-<a name="l00069"></a>00069                 A ( 2,2 ) = 1.0;
-<a name="l00070"></a>00070                 A ( 2,3 ) = kp*p*p * Ypm/J*dt* ( -ibm * sin ( thm )-iam * cos ( thm ) );
-<a name="l00071"></a>00071                 <span class="comment">// d th</span>
-<a name="l00072"></a>00072                 A ( 3,0 ) = 0.0; A ( 3,1 ) = 0.0; A ( 3,2 ) = dt; A ( 3,3 ) = 1.0;
-<a name="l00073"></a>00073         }
-<a name="l00074"></a>00074 
-<a name="l00075"></a><a class="code" href="classIMpmsm.html#c3f8dad22ae9855c04a1d593b45c99b5">00075</a>         <span class="keywordtype">void</span> <a class="code" href="classIMpmsm.html#c3f8dad22ae9855c04a1d593b45c99b5" title="Evaluates  and writes result into A .">dfdu_cond</a> ( <span class="keyword">const</span> vec &amp;x0, <span class="keyword">const</span> vec &amp;u0, mat &amp;A, <span class="keywordtype">bool</span> full=<span class="keyword">true</span> ) {it_error ( <span class="stringliteral">"not needed"</span> );};
-<a name="l00076"></a>00076 
-<a name="l00077"></a>00077 };
-<a name="l00078"></a>00078 
-<a name="l00080"></a><a class="code" href="classIMpmsm2o.html">00080</a> <span class="keyword">class </span><a class="code" href="classIMpmsm2o.html" title="State evolution model for a PMSM drive and its derivative with respect to .">IMpmsm2o</a> : <span class="keyword">public</span> <a class="code" href="classdiffbifn.html" title="Class representing a differentiable function of two variables .">diffbifn</a> {
-<a name="l00081"></a>00081         <span class="keyword">protected</span>:
-<a name="l00082"></a>00082                 <span class="keywordtype">double</span> Rs, Ls, dt, Ypm, kp, p,  J, Mz;
-<a name="l00083"></a>00083 
-<a name="l00084"></a>00084         <span class="keyword">public</span>:
-<a name="l00085"></a>00085                 <a class="code" href="classIMpmsm2o.html" title="State evolution model for a PMSM drive and its derivative with respect to .">IMpmsm2o</a>() :<a class="code" href="classdiffbifn.html#797772c0d5aab8ddccec19dfe4bb2d77" title="Default constructor (dimy is not set!).">diffbifn</a> (rx.<a class="code" href="classRV.html#f5c7b8bd589eef09ccdf3329a0addea0" title="Return number of scalars in the RV.">count</a>(), rx, rU ) {};
-<a name="l00087"></a><a class="code" href="classIMpmsm2o.html#abdefc0467678a05abf12f5c77eaf49d">00087</a>                 <span class="keywordtype">void</span> <a class="code" href="classIMpmsm2o.html#abdefc0467678a05abf12f5c77eaf49d" title="Set mechanical and electrical variables.">set_parameters</a> ( <span class="keywordtype">double</span> Rs0, <span class="keywordtype">double</span> Ls0, <span class="keywordtype">double</span> dt0, <span class="keywordtype">double</span> Ypm0, <span class="keywordtype">double</span> kp0, <span class="keywordtype">double</span> p0, <span class="keywordtype">double</span> J0, <span class="keywordtype">double</span> Mz0 ) {Rs=Rs0; Ls=Ls0; dt=dt0; Ypm=Ypm0; kp=kp0; p=p0; J=J0; Mz=Mz0;}
-<a name="l00088"></a>00088 
-<a name="l00089"></a><a class="code" href="classIMpmsm2o.html#86e04b5118e567ea7a2540059f553f41">00089</a>                 vec <a class="code" href="classIMpmsm2o.html#86e04b5118e567ea7a2540059f553f41" title="Evaluates .">eval</a> ( <span class="keyword">const</span> vec &amp;x0, <span class="keyword">const</span> vec &amp;u0 ) {
-<a name="l00090"></a>00090                 <span class="comment">// last state</span>
-<a name="l00091"></a>00091                         <span class="keywordtype">double</span> iam = x0 ( 0 );
-<a name="l00092"></a>00092                         <span class="keywordtype">double</span> ibm = x0 ( 1 );
-<a name="l00093"></a>00093                         <span class="keywordtype">double</span> omm = x0 ( 2 );
-<a name="l00094"></a>00094                         <span class="keywordtype">double</span> thm = x0 ( 3 );
-<a name="l00095"></a>00095                         <span class="keywordtype">double</span> uam = u0 ( 0 );
-<a name="l00096"></a>00096                         <span class="keywordtype">double</span> ubm = u0 ( 1 );
-<a name="l00097"></a>00097                         <span class="keywordtype">double</span> dua = u0 ( 2 )/dt;
-<a name="l00098"></a>00098                         <span class="keywordtype">double</span> dub = u0 ( 3 )/dt;
-<a name="l00099"></a>00099 
-<a name="l00100"></a>00100                         <span class="keywordtype">double</span> cth = cos(thm);
-<a name="l00101"></a>00101                         <span class="keywordtype">double</span> sth = sin(thm);
-<a name="l00102"></a>00102                         <span class="keywordtype">double</span> d2t = dt*dt/2;
+<a name="l00010"></a>00010 <span class="keyword">using namespace </span>bdm;
+<a name="l00011"></a>00011 
+<a name="l00012"></a>00012 <span class="comment">//TODO hardcoded RVs!!!</span>
+<a name="l00013"></a>00013 <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> rx ( <span class="stringliteral">"{ia ib om th }"</span>);
+<a name="l00014"></a>00014 <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> ru ( <span class="stringliteral">"{ua ub }"</span>);
+<a name="l00015"></a>00015 <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> ry ( <span class="stringliteral">"{oia oib }"</span>);
+<a name="l00016"></a>00016 
+<a name="l00017"></a>00017 <span class="comment">// class uipmsm : public uibase{</span>
+<a name="l00018"></a>00018 <span class="comment">//      double Rs, Ls, dt, Ypm, kp, p,  J, Mz;</span>
+<a name="l00019"></a>00019 <span class="comment">// };</span>
+<a name="l00020"></a>00020 
+<a name="l00022"></a><a class="code" href="classIMpmsm.html">00022</a> <span class="keyword">class </span><a class="code" href="classIMpmsm.html" title="State evolution model for a PMSM drive and its derivative with respect to .">IMpmsm</a> : <span class="keyword">public</span> <a class="code" href="classbdm_1_1diffbifn.html" title="Class representing a differentiable function of two variables .">diffbifn</a> {
+<a name="l00023"></a>00023 <span class="keyword">protected</span>:
+<a name="l00024"></a>00024         <span class="keywordtype">double</span> Rs, Ls, dt, Ypm, kp, p,  J, Mz;
+<a name="l00025"></a>00025 
+<a name="l00026"></a>00026 <span class="keyword">public</span>:
+<a name="l00027"></a>00027         <a class="code" href="classIMpmsm.html" title="State evolution model for a PMSM drive and its derivative with respect to .">IMpmsm</a>() :<a class="code" href="classbdm_1_1diffbifn.html#6ecfa9bf42b2421bd56c260a8b2c51e1" title="Default constructor (dimy is not set!).">diffbifn</a> (rx.<a class="code" href="classbdm_1_1RV.html#2174751a00ce19f941edd2c1a861be67" title="Return number of scalars in the RV.">count</a>(), rx, ru ) {};
+<a name="l00029"></a><a class="code" href="classIMpmsm.html#42818f3426d99fecb7e97be8ffe2e228">00029</a>         <span class="keywordtype">void</span> <a class="code" href="classIMpmsm.html#42818f3426d99fecb7e97be8ffe2e228" title="Set mechanical and electrical variables.">set_parameters</a> ( <span class="keywordtype">double</span> Rs0, <span class="keywordtype">double</span> Ls0, <span class="keywordtype">double</span> dt0, <span class="keywordtype">double</span> Ypm0, <span class="keywordtype">double</span> kp0, <span class="keywordtype">double</span> p0, <span class="keywordtype">double</span> J0, <span class="keywordtype">double</span> Mz0 ) {Rs=Rs0; Ls=Ls0; dt=dt0; Ypm=Ypm0; kp=kp0; p=p0; J=J0; Mz=Mz0;}
+<a name="l00030"></a>00030 
+<a name="l00031"></a><a class="code" href="classIMpmsm.html#45785869d978dda42828a072ec2caebe">00031</a>         vec <a class="code" href="classIMpmsm.html#45785869d978dda42828a072ec2caebe" title="Evaluates .">eval</a> ( <span class="keyword">const</span> vec &amp;x0, <span class="keyword">const</span> vec &amp;u0 ) {
+<a name="l00032"></a>00032                 <span class="comment">// last state</span>
+<a name="l00033"></a>00033                 <span class="keywordtype">double</span> iam = x0 ( 0 );
+<a name="l00034"></a>00034                 <span class="keywordtype">double</span> ibm = x0 ( 1 );
+<a name="l00035"></a>00035                 <span class="keywordtype">double</span> omm = x0 ( 2 );
+<a name="l00036"></a>00036                 <span class="keywordtype">double</span> thm = x0 ( 3 );
+<a name="l00037"></a>00037                 <span class="keywordtype">double</span> uam = u0 ( 0 );
+<a name="l00038"></a>00038                 <span class="keywordtype">double</span> ubm = u0 ( 1 );
+<a name="l00039"></a>00039 
+<a name="l00040"></a>00040                 vec xk=zeros ( 4 );
+<a name="l00041"></a>00041                 <span class="comment">//ia</span>
+<a name="l00042"></a>00042                 xk ( 0 ) = ( 1.0- Rs/Ls*dt ) * iam + Ypm/Ls*dt*omm * sin ( thm ) + uam*dt/Ls;
+<a name="l00043"></a>00043                 <span class="comment">//ib</span>
+<a name="l00044"></a>00044                 xk ( 1 ) = ( 1.0- Rs/Ls*dt ) * ibm - Ypm/Ls*dt*omm * cos ( thm ) + ubm*dt/Ls;
+<a name="l00045"></a>00045                 <span class="comment">//om</span>
+<a name="l00046"></a>00046                 xk ( 2 ) = omm + kp*p*p * Ypm/J*dt* ( ibm * cos ( thm )-iam * sin ( thm ) ) - p/J*dt*Mz;
+<a name="l00047"></a>00047                 <span class="comment">//th</span>
+<a name="l00048"></a>00048                 xk ( 3 ) = thm + omm*dt; <span class="comment">// &lt;0..2pi&gt;</span>
+<a name="l00049"></a>00049                 <span class="keywordflow">if</span> ( xk ( 3 ) &gt;pi ) xk ( 3 )-=2*pi;
+<a name="l00050"></a>00050                 <span class="keywordflow">if</span> ( xk ( 3 ) &lt;-pi ) xk ( 3 ) +=2*pi;
+<a name="l00051"></a>00051                 <span class="keywordflow">return</span> xk;
+<a name="l00052"></a>00052         }
+<a name="l00053"></a>00053 
+<a name="l00054"></a><a class="code" href="classIMpmsm.html#b4378b5d3bf64c683e4cf5c5f1cd56f1">00054</a>         <span class="keywordtype">void</span> <a class="code" href="classIMpmsm.html#b4378b5d3bf64c683e4cf5c5f1cd56f1" title="Evaluates  and writes result into A .">dfdx_cond</a> ( <span class="keyword">const</span> vec &amp;x0, <span class="keyword">const</span> vec &amp;u0, mat &amp;A, <span class="keywordtype">bool</span> full=<span class="keyword">true</span> ) {
+<a name="l00055"></a>00055                 <span class="keywordtype">double</span> iam = x0 ( 0 );
+<a name="l00056"></a>00056                 <span class="keywordtype">double</span> ibm = x0 ( 1 );
+<a name="l00057"></a>00057                 <span class="keywordtype">double</span> omm = x0 ( 2 );
+<a name="l00058"></a>00058                 <span class="keywordtype">double</span> thm = x0 ( 3 );
+<a name="l00059"></a>00059                 <span class="comment">// d ia</span>
+<a name="l00060"></a>00060                 A ( 0,0 ) = ( 1.0- Rs/Ls*dt ); A ( 0,1 ) = 0.0;
+<a name="l00061"></a>00061                 A ( 0,2 ) = Ypm/Ls*dt* sin ( thm ); A ( 0,3 ) = Ypm/Ls*dt*omm * ( cos ( thm ) );
+<a name="l00062"></a>00062                 <span class="comment">// d ib</span>
+<a name="l00063"></a>00063                 A ( 1,0 ) = 0.0 ; A ( 1,1 ) = ( 1.0- Rs/Ls*dt );
+<a name="l00064"></a>00064                 A ( 1,2 ) = -Ypm/Ls*dt* cos ( thm ); A ( 1,3 ) = Ypm/Ls*dt*omm * ( sin ( thm ) );
+<a name="l00065"></a>00065                 <span class="comment">// d om</span>
+<a name="l00066"></a>00066                 A ( 2,0 ) = kp*p*p * Ypm/J*dt* ( - sin ( thm ) );
+<a name="l00067"></a>00067                 A ( 2,1 ) = kp*p*p * Ypm/J*dt* ( cos ( thm ) );
+<a name="l00068"></a>00068                 A ( 2,2 ) = 1.0;
+<a name="l00069"></a>00069                 A ( 2,3 ) = kp*p*p * Ypm/J*dt* ( -ibm * sin ( thm )-iam * cos ( thm ) );
+<a name="l00070"></a>00070                 <span class="comment">// d th</span>
+<a name="l00071"></a>00071                 A ( 3,0 ) = 0.0; A ( 3,1 ) = 0.0; A ( 3,2 ) = dt; A ( 3,3 ) = 1.0;
+<a name="l00072"></a>00072         }
+<a name="l00073"></a>00073 
+<a name="l00074"></a><a class="code" href="classIMpmsm.html#c3f8dad22ae9855c04a1d593b45c99b5">00074</a>         <span class="keywordtype">void</span> <a class="code" href="classIMpmsm.html#c3f8dad22ae9855c04a1d593b45c99b5" title="Evaluates  and writes result into A .">dfdu_cond</a> ( <span class="keyword">const</span> vec &amp;x0, <span class="keyword">const</span> vec &amp;u0, mat &amp;A, <span class="keywordtype">bool</span> full=<span class="keyword">true</span> ) {it_error ( <span class="stringliteral">"not needed"</span> );};
+<a name="l00075"></a>00075 
+<a name="l00076"></a>00076 };
+<a name="l00077"></a>00077 
+<a name="l00079"></a><a class="code" href="classIMpmsm2o.html">00079</a> <span class="keyword">class </span><a class="code" href="classIMpmsm2o.html" title="State evolution model for a PMSM drive and its derivative with respect to .">IMpmsm2o</a> : <span class="keyword">public</span> <a class="code" href="classbdm_1_1diffbifn.html" title="Class representing a differentiable function of two variables .">diffbifn</a> {
+<a name="l00080"></a>00080         <span class="keyword">protected</span>:
+<a name="l00081"></a>00081                 <span class="keywordtype">double</span> Rs, Ls, dt, Ypm, kp, p,  J, Mz;
+<a name="l00083"></a><a class="code" href="classIMpmsm2o.html#5b668744a1e5189f324897a62b9c3ea6">00083</a>                 <span class="keywordtype">double</span> <a class="code" href="classIMpmsm2o.html#5b668744a1e5189f324897a62b9c3ea6" title="store first derivatives for the use in second derivatives">dia</a>, dib, dom, dth;
+<a name="l00085"></a><a class="code" href="classIMpmsm2o.html#74954dedce055db9ee50d53790e8341c">00085</a>                 <span class="keywordtype">double</span> <a class="code" href="classIMpmsm2o.html#74954dedce055db9ee50d53790e8341c" title="d2t = dt^2/2, cth = cos(th), sth=sin(th)">d2t</a>, cth, sth;
+<a name="l00086"></a>00086                 <span class="keywordtype">double</span> iam, ibm, omm, thm, uam, ubm;
+<a name="l00087"></a>00087         <span class="keyword">public</span>:
+<a name="l00088"></a>00088                 <a class="code" href="classIMpmsm2o.html" title="State evolution model for a PMSM drive and its derivative with respect to .">IMpmsm2o</a>() :<a class="code" href="classbdm_1_1diffbifn.html" title="Class representing a differentiable function of two variables .">diffbifn</a> (rx.count(), rx, ru ) {};
+<a name="l00090"></a><a class="code" href="classIMpmsm2o.html#abdefc0467678a05abf12f5c77eaf49d">00090</a>                 <span class="keywordtype">void</span> <a class="code" href="classIMpmsm2o.html#abdefc0467678a05abf12f5c77eaf49d" title="Set mechanical and electrical variables.">set_parameters</a> ( <span class="keywordtype">double</span> Rs0, <span class="keywordtype">double</span> Ls0, <span class="keywordtype">double</span> dt0, <span class="keywordtype">double</span> Ypm0, <span class="keywordtype">double</span> kp0, <span class="keywordtype">double</span> p0, <span class="keywordtype">double</span> J0, <span class="keywordtype">double</span> Mz0 ) {Rs=Rs0; Ls=Ls0; dt=dt0; Ypm=Ypm0; kp=kp0; p=p0; J=J0; Mz=Mz0; <a class="code" href="classIMpmsm2o.html#74954dedce055db9ee50d53790e8341c" title="d2t = dt^2/2, cth = cos(th), sth=sin(th)">d2t</a>=dt*dt/2;}
+<a name="l00091"></a>00091 
+<a name="l00092"></a><a class="code" href="classIMpmsm2o.html#86e04b5118e567ea7a2540059f553f41">00092</a>                 vec <a class="code" href="classIMpmsm2o.html#86e04b5118e567ea7a2540059f553f41" title="Evaluates .">eval</a> ( <span class="keyword">const</span> vec &amp;x0, <span class="keyword">const</span> vec &amp;u0 ) {
+<a name="l00093"></a>00093                 <span class="comment">// last state</span>
+<a name="l00094"></a>00094                         iam = x0 ( 0 );
+<a name="l00095"></a>00095                         ibm = x0 ( 1 );
+<a name="l00096"></a>00096                         omm = x0 ( 2 );
+<a name="l00097"></a>00097                         thm = x0 ( 3 );
+<a name="l00098"></a>00098                         uam = u0 ( 0 );
+<a name="l00099"></a>00099                         ubm = u0 ( 1 );
+<a name="l00100"></a>00100 
+<a name="l00101"></a>00101                         cth = cos(thm);
+<a name="l00102"></a>00102                         sth = sin(thm);
 <a name="l00103"></a>00103                         
-<a name="l00104"></a>00104                         <span class="keywordtype">double</span> dia = (- Rs/Ls*iam +  Ypm/Ls*omm * sth + uam/Ls);
-<a name="l00105"></a>00105                         <span class="keywordtype">double</span> dib = (- Rs/Ls*ibm -  Ypm/Ls*omm * cth + ubm/Ls);
-<a name="l00106"></a>00106                         <span class="keywordtype">double</span> dom = kp*p*p * Ypm/J *( ibm * cth-iam * sth ) - p/J*Mz;
-<a name="l00107"></a>00107                         <span class="keywordtype">double</span> dth = omm;
-<a name="l00108"></a>00108                         
-<a name="l00109"></a>00109                         <span class="keywordtype">double</span> d2ia = (- Rs/Ls*dia +  Ypm/Ls*(dom * sth + omm*cth) + dua/Ls);
-<a name="l00110"></a>00110                         <span class="keywordtype">double</span> d2ib = (- Rs/Ls*dib -  Ypm/Ls*(dom * cth - omm*sth) + dub/Ls);
-<a name="l00111"></a>00111                         <span class="keywordtype">double</span> d2om = kp*p*p * Ypm/J *( dib * cth-ibm*sth - (dia * sth + iam *cth));
-<a name="l00112"></a>00112                         <span class="keywordtype">double</span> d2th = dom;
-<a name="l00113"></a>00113                         
-<a name="l00114"></a>00114                         vec xk=zeros ( 4 );
-<a name="l00115"></a>00115                         xk ( 0 ) =  iam + dt*dia;<span class="comment">// +d2t*d2ia;</span>
-<a name="l00116"></a>00116                         xk ( 1 ) = ibm + dt*dib;<span class="comment">// +d2t*d2ib;</span>
-<a name="l00117"></a>00117                         xk ( 2 ) = omm +dt*dom;<span class="comment">// +d2t*d2om;</span>
-<a name="l00118"></a>00118                         xk ( 3 ) = thm + dt*dth;<span class="comment">// +d2t*d2th; // &lt;0..2pi&gt;</span>
-<a name="l00119"></a>00119                         
-<a name="l00120"></a>00120                         x2o_dbg(0)=d2t*d2ia;
-<a name="l00121"></a>00121                         x2o_dbg(1)=d2t*d2ib;
-<a name="l00122"></a>00122                         x2o_dbg(2)=d2t*d2om;
-<a name="l00123"></a>00123                         x2o_dbg(3)=d2t*d2th;
+<a name="l00104"></a>00104                         <a class="code" href="classIMpmsm2o.html#5b668744a1e5189f324897a62b9c3ea6" title="store first derivatives for the use in second derivatives">dia</a> = (- Rs/Ls*iam +  Ypm/Ls*omm * sth + uam/Ls);
+<a name="l00105"></a>00105                         dib = (- Rs/Ls*ibm -  Ypm/Ls*omm * cth + ubm/Ls);
+<a name="l00106"></a>00106                         dom = kp*p*p * Ypm/J *( ibm * cth-iam * sth ) - p/J*Mz;
+<a name="l00107"></a>00107                         dth = omm;
+<a name="l00108"></a>00108                                                 
+<a name="l00109"></a>00109                         vec xk=zeros ( 4 );
+<a name="l00110"></a>00110                         xk ( 0 ) =  iam + dt*<a class="code" href="classIMpmsm2o.html#5b668744a1e5189f324897a62b9c3ea6" title="store first derivatives for the use in second derivatives">dia</a>;<span class="comment">// +d2t*d2ia;</span>
+<a name="l00111"></a>00111                         xk ( 1 ) = ibm + dt*dib;<span class="comment">// +d2t*d2ib;</span>
+<a name="l00112"></a>00112                         xk ( 2 ) = omm +dt*dom;<span class="comment">// +d2t*d2om;</span>
+<a name="l00113"></a>00113                         xk ( 3 ) = thm + dt*dth;<span class="comment">// +d2t*d2th; // &lt;0..2pi&gt;</span>
+<a name="l00114"></a>00114                         
+<a name="l00115"></a>00115                         <span class="keywordflow">if</span> ( xk ( 3 ) &gt;pi ) xk ( 3 )-=2*pi;
+<a name="l00116"></a>00116                         <span class="keywordflow">if</span> ( xk ( 3 ) &lt;-pi ) xk ( 3 ) +=2*pi;
+<a name="l00117"></a>00117                         <span class="keywordflow">return</span> xk;
+<a name="l00118"></a>00118                 }
+<a name="l00119"></a>00119 
+<a name="l00121"></a><a class="code" href="classIMpmsm2o.html#cf66e75d9e532b0a1c2135b34ac57c89">00121</a>                 vec <a class="code" href="classIMpmsm2o.html#cf66e75d9e532b0a1c2135b34ac57c89" title="eval 2nd order Taylor expansion, MUST be used only as a follow up AFTER eval()!!">eval2o</a>(<span class="keyword">const</span> vec &amp;du){
+<a name="l00122"></a>00122                         <span class="keywordtype">double</span> dua = du ( 0 )/dt;
+<a name="l00123"></a>00123                         <span class="keywordtype">double</span> dub = du ( 1 )/dt;
 <a name="l00124"></a>00124                         
-<a name="l00125"></a>00125                         <span class="keywordflow">if</span> ( xk ( 3 ) &gt;pi ) xk ( 3 )-=2*pi;
-<a name="l00126"></a>00126                         <span class="keywordflow">if</span> ( xk ( 3 ) &lt;-pi ) xk ( 3 ) +=2*pi;
-<a name="l00127"></a>00127                         <span class="keywordflow">return</span> xk;
-<a name="l00128"></a>00128                 }
-<a name="l00129"></a>00129 
-<a name="l00130"></a><a class="code" href="classIMpmsm2o.html#0a3e125df1e53821e08accbd4960d713">00130</a>                 <span class="keywordtype">void</span> <a class="code" href="classIMpmsm2o.html#0a3e125df1e53821e08accbd4960d713" title="Evaluates  and writes result into A .">dfdx_cond</a> ( <span class="keyword">const</span> vec &amp;x0, <span class="keyword">const</span> vec &amp;u0, mat &amp;A, <span class="keywordtype">bool</span> full=<span class="keyword">true</span> ) {
-<a name="l00131"></a>00131                         <span class="keywordtype">double</span> iam = x0 ( 0 );
-<a name="l00132"></a>00132                         <span class="keywordtype">double</span> ibm = x0 ( 1 );
-<a name="l00133"></a>00133                         <span class="keywordtype">double</span> omm = x0 ( 2 );
-<a name="l00134"></a>00134                         <span class="keywordtype">double</span> thm = x0 ( 3 );
-<a name="l00135"></a>00135                 <span class="comment">// d ia</span>
-<a name="l00136"></a>00136                         A ( 0,0 ) = ( 1.0- Rs/Ls*dt ); A ( 0,1 ) = 0.0;
-<a name="l00137"></a>00137                         A ( 0,2 ) = Ypm/Ls*dt* sin ( thm ); A ( 0,3 ) = Ypm/Ls*dt*omm * ( cos ( thm ) );
-<a name="l00138"></a>00138                 <span class="comment">// d ib</span>
-<a name="l00139"></a>00139                         A ( 1,0 ) = 0.0 ; A ( 1,1 ) = ( 1.0- Rs/Ls*dt );
-<a name="l00140"></a>00140                         A ( 1,2 ) = -Ypm/Ls*dt* cos ( thm ); A ( 1,3 ) = Ypm/Ls*dt*omm * ( sin ( thm ) );
-<a name="l00141"></a>00141                 <span class="comment">// d om</span>
-<a name="l00142"></a>00142                         A ( 2,0 ) = kp*p*p * Ypm/J*dt* ( - sin ( thm ) );
-<a name="l00143"></a>00143                         A ( 2,1 ) = kp*p*p * Ypm/J*dt* ( cos ( thm ) );
-<a name="l00144"></a>00144                         A ( 2,2 ) = 1.0;
-<a name="l00145"></a>00145                         A ( 2,3 ) = kp*p*p * Ypm/J*dt* ( -ibm * sin ( thm )-iam * cos ( thm ) );
-<a name="l00146"></a>00146                 <span class="comment">// d th</span>
-<a name="l00147"></a>00147                         A ( 3,0 ) = 0.0; A ( 3,1 ) = 0.0; A ( 3,2 ) = dt; A ( 3,3 ) = 1.0;
-<a name="l00148"></a>00148                 }
-<a name="l00149"></a>00149 
-<a name="l00150"></a><a class="code" href="classIMpmsm2o.html#27f9d89bce832056f747d985df77a726">00150</a>                 <span class="keywordtype">void</span> <a class="code" href="classIMpmsm2o.html#27f9d89bce832056f747d985df77a726" title="Evaluates  and writes result into A .">dfdu_cond</a> ( <span class="keyword">const</span> vec &amp;x0, <span class="keyword">const</span> vec &amp;u0, mat &amp;A, <span class="keywordtype">bool</span> full=<span class="keyword">true</span> ) {it_error ( <span class="stringliteral">"not needed"</span> );};
+<a name="l00125"></a>00125                         vec xth2o(4);
+<a name="l00126"></a>00126                         xth2o(0) = (- Rs/Ls*<a class="code" href="classIMpmsm2o.html#5b668744a1e5189f324897a62b9c3ea6" title="store first derivatives for the use in second derivatives">dia</a> +  Ypm/Ls*(dom * sth + omm*cth) + dua/Ls);
+<a name="l00127"></a>00127                         xth2o(1) = (- Rs/Ls*dib -  Ypm/Ls*(dom * cth - omm*sth) + dub/Ls);
+<a name="l00128"></a>00128                         xth2o(2) = kp*p*p * Ypm/J *( dib * cth-ibm*sth - (<a class="code" href="classIMpmsm2o.html#5b668744a1e5189f324897a62b9c3ea6" title="store first derivatives for the use in second derivatives">dia</a> * sth + iam *cth));
+<a name="l00129"></a>00129                         xth2o(3) = dom;
+<a name="l00130"></a>00130                         <span class="keywordflow">return</span> xth2o;
+<a name="l00131"></a>00131                 }
+<a name="l00132"></a><a class="code" href="classIMpmsm2o.html#0a3e125df1e53821e08accbd4960d713">00132</a>                 <span class="keywordtype">void</span> <a class="code" href="classIMpmsm2o.html#0a3e125df1e53821e08accbd4960d713" title="Evaluates  and writes result into A .">dfdx_cond</a> ( <span class="keyword">const</span> vec &amp;x0, <span class="keyword">const</span> vec &amp;u0, mat &amp;A, <span class="keywordtype">bool</span> full=<span class="keyword">true</span> ) {
+<a name="l00133"></a>00133                          iam = x0 ( 0 );
+<a name="l00134"></a>00134                          ibm = x0 ( 1 );
+<a name="l00135"></a>00135                          omm = x0 ( 2 );
+<a name="l00136"></a>00136                          thm = x0 ( 3 );
+<a name="l00137"></a>00137                 <span class="comment">// d ia</span>
+<a name="l00138"></a>00138                         A ( 0,0 ) = ( 1.0- Rs/Ls*dt ); A ( 0,1 ) = 0.0;
+<a name="l00139"></a>00139                         A ( 0,2 ) = Ypm/Ls*dt* sin ( thm ); A ( 0,3 ) = Ypm/Ls*dt*omm * ( cos ( thm ) );
+<a name="l00140"></a>00140                 <span class="comment">// d ib</span>
+<a name="l00141"></a>00141                         A ( 1,0 ) = 0.0 ; A ( 1,1 ) = ( 1.0- Rs/Ls*dt );
+<a name="l00142"></a>00142                         A ( 1,2 ) = -Ypm/Ls*dt* cos ( thm ); A ( 1,3 ) = Ypm/Ls*dt*omm * ( sin ( thm ) );
+<a name="l00143"></a>00143                 <span class="comment">// d om</span>
+<a name="l00144"></a>00144                         A ( 2,0 ) = kp*p*p * Ypm/J*dt* ( - sin ( thm ) );
+<a name="l00145"></a>00145                         A ( 2,1 ) = kp*p*p * Ypm/J*dt* ( cos ( thm ) );
+<a name="l00146"></a>00146                         A ( 2,2 ) = 1.0;
+<a name="l00147"></a>00147                         A ( 2,3 ) = kp*p*p * Ypm/J*dt* ( -ibm * sin ( thm )-iam * cos ( thm ) );
+<a name="l00148"></a>00148                 <span class="comment">// d th</span>
+<a name="l00149"></a>00149                         A ( 3,0 ) = 0.0; A ( 3,1 ) = 0.0; A ( 3,2 ) = dt; A ( 3,3 ) = 1.0;
+<a name="l00150"></a>00150                 }
 <a name="l00151"></a>00151 
-<a name="l00152"></a>00152 };
+<a name="l00152"></a><a class="code" href="classIMpmsm2o.html#27f9d89bce832056f747d985df77a726">00152</a>                 <span class="keywordtype">void</span> <a class="code" href="classIMpmsm2o.html#27f9d89bce832056f747d985df77a726" title="Evaluates  and writes result into A .">dfdu_cond</a> ( <span class="keyword">const</span> vec &amp;x0, <span class="keyword">const</span> vec &amp;u0, mat &amp;A, <span class="keywordtype">bool</span> full=<span class="keyword">true</span> ) {it_error ( <span class="stringliteral">"not needed"</span> );};
 <a name="l00153"></a>00153 
-<a name="l00155"></a><a class="code" href="classIMpmsmStat.html">00155</a> <span class="keyword">class </span><a class="code" href="classIMpmsmStat.html" title="State evolution model for a PMSM drive and its derivative with respect to , equation...">IMpmsmStat</a> : <span class="keyword">public</span> <a class="code" href="classIMpmsm.html" title="State evolution model for a PMSM drive and its derivative with respect to .">IMpmsm</a> {
-<a name="l00156"></a>00156         <a class="code" href="classIMpmsmStat.html" title="State evolution model for a PMSM drive and its derivative with respect to , equation...">IMpmsmStat</a>() :<a class="code" href="classIMpmsm.html" title="State evolution model for a PMSM drive and its derivative with respect to .">IMpmsm</a>() {};
-<a name="l00158"></a>00158         <span class="keywordtype">void</span> set_parameters ( <span class="keywordtype">double</span> Rs0, <span class="keywordtype">double</span> Ls0, <span class="keywordtype">double</span> dt0, <span class="keywordtype">double</span> Ypm0, <span class="keywordtype">double</span> kp0, <span class="keywordtype">double</span> p0, <span class="keywordtype">double</span> J0, <span class="keywordtype">double</span> Mz0 ) {Rs=Rs0; Ls=Ls0; dt=dt0; Ypm=Ypm0; kp=kp0; p=p0; J=J0; Mz=Mz0;}
-<a name="l00159"></a>00159 
-<a name="l00160"></a>00160         vec eval ( <span class="keyword">const</span> vec &amp;x0, <span class="keyword">const</span> vec &amp;u0 ) {
-<a name="l00161"></a>00161                 <span class="comment">// last state</span>
-<a name="l00162"></a>00162                 <span class="keywordtype">double</span> iam = x0 ( 0 );
-<a name="l00163"></a>00163                 <span class="keywordtype">double</span> ibm = x0 ( 1 );
-<a name="l00164"></a>00164                 <span class="keywordtype">double</span> omm = x0 ( 2 );
-<a name="l00165"></a>00165                 <span class="keywordtype">double</span> thm = x0 ( 3 );
-<a name="l00166"></a>00166                 <span class="keywordtype">double</span> uam = u0 ( 0 );
-<a name="l00167"></a>00167                 <span class="keywordtype">double</span> ubm = u0 ( 1 );
-<a name="l00168"></a>00168 
-<a name="l00169"></a>00169                 vec xk=zeros ( 4 );
-<a name="l00170"></a>00170                 <span class="comment">//ia</span>
-<a name="l00171"></a>00171                 xk ( 0 ) = ( 1.0- Rs/Ls*dt ) * iam + Ypm/Ls*dt*omm * sin ( thm ) + uam*dt/Ls;
-<a name="l00172"></a>00172                 <span class="comment">//ib</span>
-<a name="l00173"></a>00173                 xk ( 1 ) = ( 1.0- Rs/Ls*dt ) * ibm - Ypm/Ls*dt*omm * cos ( thm ) + ubm*dt/Ls;
-<a name="l00174"></a>00174                 <span class="comment">//om</span>
-<a name="l00175"></a>00175                 xk ( 2 ) = omm;<span class="comment">// + kp*p*p * Ypm/J*dt* ( ibm * cos ( thm )-iam * sin ( thm ) ) - p/J*dt*Mz;</span>
-<a name="l00176"></a>00176                 <span class="comment">//th</span>
-<a name="l00177"></a>00177                 xk ( 3 ) = rem(thm + omm*dt,2*pi); <span class="comment">// &lt;0..2pi&gt;</span>
-<a name="l00178"></a>00178                 <span class="keywordflow">return</span> xk;
-<a name="l00179"></a>00179         }
-<a name="l00180"></a>00180 
-<a name="l00181"></a>00181         <span class="keywordtype">void</span> dfdx_cond ( <span class="keyword">const</span> vec &amp;x0, <span class="keyword">const</span> vec &amp;u0, mat &amp;A, <span class="keywordtype">bool</span> full=<span class="keyword">true</span> ) {
-<a name="l00182"></a>00182 <span class="comment">//              double iam = x0 ( 0 );</span>
-<a name="l00183"></a>00183 <span class="comment">//              double ibm = x0 ( 1 );</span>
-<a name="l00184"></a>00184                 <span class="keywordtype">double</span> omm = x0 ( 2 );
-<a name="l00185"></a>00185                 <span class="keywordtype">double</span> thm = x0 ( 3 );
-<a name="l00186"></a>00186                 <span class="comment">// d ia</span>
-<a name="l00187"></a>00187                 A ( 0,0 ) = ( 1.0- Rs/Ls*dt ); A ( 0,1 ) = 0.0;
-<a name="l00188"></a>00188                 A ( 0,2 ) = Ypm/Ls*dt* sin ( thm ); A ( 0,3 ) = Ypm/Ls*dt*omm * ( cos ( thm ) );
-<a name="l00189"></a>00189                 <span class="comment">// d ib</span>
-<a name="l00190"></a>00190                 A ( 1,0 ) = 0.0 ; A ( 1,1 ) = ( 1.0- Rs/Ls*dt );
-<a name="l00191"></a>00191                 A ( 1,2 ) = -Ypm/Ls*dt* cos ( thm ); A ( 1,3 ) = Ypm/Ls*dt*omm * ( sin ( thm ) );
-<a name="l00192"></a>00192                 <span class="comment">// d om</span>
-<a name="l00193"></a>00193                 A ( 2,0 ) = 0.0;<span class="comment">//kp*p*p * Ypm/J*dt* ( - sin ( thm ) );</span>
-<a name="l00194"></a>00194                 A ( 2,1 ) = 0.0;<span class="comment">//kp*p*p * Ypm/J*dt* ( cos ( thm ) );</span>
-<a name="l00195"></a>00195                 A ( 2,2 ) = 1.0;
-<a name="l00196"></a>00196                 A ( 2,3 ) = 0.0;<span class="comment">//kp*p*p * Ypm/J*dt* ( -ibm * sin ( thm )-iam * cos ( thm ) );</span>
-<a name="l00197"></a>00197                 <span class="comment">// d th</span>
-<a name="l00198"></a>00198                 A ( 3,0 ) = 0.0; A ( 3,1 ) = 0.0; A ( 3,2 ) = dt; A ( 3,3 ) = 1.0;
-<a name="l00199"></a>00199         }
-<a name="l00200"></a>00200 
-<a name="l00201"></a>00201         <span class="keywordtype">void</span> dfdu_cond ( <span class="keyword">const</span> vec &amp;x0, <span class="keyword">const</span> vec &amp;u0, mat &amp;A, <span class="keywordtype">bool</span> full=<span class="keyword">true</span> ) {it_error ( <span class="stringliteral">"not needed"</span> );};
-<a name="l00202"></a>00202 
-<a name="l00203"></a>00203 };
-<a name="l00204"></a>00204 
-<a name="l00206"></a><a class="code" href="classOMpmsm.html">00206</a> <span class="keyword">class </span><a class="code" href="classOMpmsm.html" title="Observation model for PMSM drive and its derivative with respect to .">OMpmsm</a>: <span class="keyword">public</span> <a class="code" href="classdiffbifn.html" title="Class representing a differentiable function of two variables .">diffbifn</a> {
-<a name="l00207"></a>00207 <span class="keyword">public</span>:
-<a name="l00208"></a>00208         <a class="code" href="classOMpmsm.html" title="Observation model for PMSM drive and its derivative with respect to .">OMpmsm</a>() :<a class="code" href="classdiffbifn.html#797772c0d5aab8ddccec19dfe4bb2d77" title="Default constructor (dimy is not set!).">diffbifn</a> (2, rx,ru ) {};
-<a name="l00209"></a>00209 
-<a name="l00210"></a><a class="code" href="classOMpmsm.html#8e32392c9c635584606287b8c0e8c9da">00210</a>         vec <a class="code" href="classOMpmsm.html#8e32392c9c635584606287b8c0e8c9da" title="Evaluates .">eval</a> ( <span class="keyword">const</span> vec &amp;x0, <span class="keyword">const</span> vec &amp;u0 ) {
-<a name="l00211"></a>00211                 vec y ( 2 );
-<a name="l00212"></a>00212                 y ( 0 ) = x0 ( 0 );
-<a name="l00213"></a>00213                 y ( 1 ) = x0 ( 1 );
-<a name="l00214"></a>00214                 <span class="keywordflow">return</span> y;
-<a name="l00215"></a>00215         }
-<a name="l00216"></a>00216 
-<a name="l00217"></a><a class="code" href="classOMpmsm.html#b75b5fd55b2ac5ed74b5b953af122821">00217</a>         <span class="keywordtype">void</span> <a class="code" href="classOMpmsm.html#b75b5fd55b2ac5ed74b5b953af122821" title="Evaluates  and writes result into A .">dfdx_cond</a> ( <span class="keyword">const</span> vec &amp;x0, <span class="keyword">const</span> vec &amp;u0, mat &amp;A, <span class="keywordtype">bool</span> full=<span class="keyword">true</span> ) {
-<a name="l00218"></a>00218                 A.clear();
-<a name="l00219"></a>00219                 A ( 0,0 ) = 1.0;
-<a name="l00220"></a>00220                 A ( 1,1 ) = 1.0;
-<a name="l00221"></a>00221         }
-<a name="l00222"></a>00222 };
-<a name="l00223"></a>00223 
-<a name="l00225"></a>00225 <span class="preprocessor">#endif //PMSM_H</span>
+<a name="l00154"></a>00154 };
+<a name="l00155"></a>00155 
+<a name="l00157"></a><a class="code" href="classIMpmsmStat.html">00157</a> <span class="keyword">class </span><a class="code" href="classIMpmsmStat.html" title="State evolution model for a PMSM drive and its derivative with respect to , equation...">IMpmsmStat</a> : <span class="keyword">public</span> <a class="code" href="classIMpmsm.html" title="State evolution model for a PMSM drive and its derivative with respect to .">IMpmsm</a> {
+<a name="l00158"></a>00158         <span class="keyword">public</span>:
+<a name="l00159"></a>00159         <a class="code" href="classIMpmsmStat.html" title="State evolution model for a PMSM drive and its derivative with respect to , equation...">IMpmsmStat</a>() :<a class="code" href="classIMpmsm.html" title="State evolution model for a PMSM drive and its derivative with respect to .">IMpmsm</a>() {};
+<a name="l00161"></a><a class="code" href="classIMpmsmStat.html#6379210623a2d353d42bfc87ccbd4384">00161</a>         <span class="keywordtype">void</span> <a class="code" href="classIMpmsmStat.html#6379210623a2d353d42bfc87ccbd4384" title="Set mechanical and electrical variables.">set_parameters</a> ( <span class="keywordtype">double</span> Rs0, <span class="keywordtype">double</span> Ls0, <span class="keywordtype">double</span> dt0, <span class="keywordtype">double</span> Ypm0, <span class="keywordtype">double</span> kp0, <span class="keywordtype">double</span> p0, <span class="keywordtype">double</span> J0, <span class="keywordtype">double</span> Mz0 ) {Rs=Rs0; Ls=Ls0; dt=dt0; Ypm=Ypm0; kp=kp0; p=p0; J=J0; Mz=Mz0;}
+<a name="l00162"></a>00162 
+<a name="l00163"></a><a class="code" href="classIMpmsmStat.html#5ed3582c2c0edb0753387a82598f8d21">00163</a>         vec <a class="code" href="classIMpmsmStat.html#5ed3582c2c0edb0753387a82598f8d21" title="Evaluates .">eval</a> ( <span class="keyword">const</span> vec &amp;x0, <span class="keyword">const</span> vec &amp;u0 ) {
+<a name="l00164"></a>00164                 <span class="comment">// last state</span>
+<a name="l00165"></a>00165                 <span class="keywordtype">double</span> iam = x0 ( 0 );
+<a name="l00166"></a>00166                 <span class="keywordtype">double</span> ibm = x0 ( 1 );
+<a name="l00167"></a>00167                 <span class="keywordtype">double</span> omm = x0 ( 2 );
+<a name="l00168"></a>00168                 <span class="keywordtype">double</span> thm = x0 ( 3 );
+<a name="l00169"></a>00169                 <span class="keywordtype">double</span> uam = u0 ( 0 );
+<a name="l00170"></a>00170                 <span class="keywordtype">double</span> ubm = u0 ( 1 );
+<a name="l00171"></a>00171 
+<a name="l00172"></a>00172                 vec xk=zeros ( 4 );
+<a name="l00173"></a>00173                 <span class="comment">//ia</span>
+<a name="l00174"></a>00174                 xk ( 0 ) = ( 1.0- Rs/Ls*dt ) * iam + Ypm/Ls*dt*omm * sin ( thm ) + uam*dt/Ls;
+<a name="l00175"></a>00175                 <span class="comment">//ib</span>
+<a name="l00176"></a>00176                 xk ( 1 ) = ( 1.0- Rs/Ls*dt ) * ibm - Ypm/Ls*dt*omm * cos ( thm ) + ubm*dt/Ls;
+<a name="l00177"></a>00177                 <span class="comment">//om</span>
+<a name="l00178"></a>00178                 xk ( 2 ) = omm;<span class="comment">// + kp*p*p * Ypm/J*dt* ( ibm * cos ( thm )-iam * sin ( thm ) ) - p/J*dt*Mz;</span>
+<a name="l00179"></a>00179                 <span class="comment">//th</span>
+<a name="l00180"></a>00180                 xk ( 3 ) = rem(thm + omm*dt,2*pi); <span class="comment">// &lt;0..2pi&gt;</span>
+<a name="l00181"></a>00181                 <span class="keywordflow">return</span> xk;
+<a name="l00182"></a>00182         }
+<a name="l00183"></a>00183 
+<a name="l00184"></a><a class="code" href="classIMpmsmStat.html#29a9c09fd328e89748d9be0801e84831">00184</a>         <span class="keywordtype">void</span> <a class="code" href="classIMpmsmStat.html#29a9c09fd328e89748d9be0801e84831" title="Evaluates  and writes result into A .">dfdx_cond</a> ( <span class="keyword">const</span> vec &amp;x0, <span class="keyword">const</span> vec &amp;u0, mat &amp;A, <span class="keywordtype">bool</span> full=<span class="keyword">true</span> ) {
+<a name="l00185"></a>00185 <span class="comment">//              double iam = x0 ( 0 );</span>
+<a name="l00186"></a>00186 <span class="comment">//              double ibm = x0 ( 1 );</span>
+<a name="l00187"></a>00187                 <span class="keywordtype">double</span> omm = x0 ( 2 );
+<a name="l00188"></a>00188                 <span class="keywordtype">double</span> thm = x0 ( 3 );
+<a name="l00189"></a>00189                 <span class="comment">// d ia</span>
+<a name="l00190"></a>00190                 A ( 0,0 ) = ( 1.0- Rs/Ls*dt ); A ( 0,1 ) = 0.0;
+<a name="l00191"></a>00191                 A ( 0,2 ) = Ypm/Ls*dt* sin ( thm ); A ( 0,3 ) = Ypm/Ls*dt*omm * ( cos ( thm ) );
+<a name="l00192"></a>00192                 <span class="comment">// d ib</span>
+<a name="l00193"></a>00193                 A ( 1,0 ) = 0.0 ; A ( 1,1 ) = ( 1.0- Rs/Ls*dt );
+<a name="l00194"></a>00194                 A ( 1,2 ) = -Ypm/Ls*dt* cos ( thm ); A ( 1,3 ) = Ypm/Ls*dt*omm * ( sin ( thm ) );
+<a name="l00195"></a>00195                 <span class="comment">// d om</span>
+<a name="l00196"></a>00196                 A ( 2,0 ) = 0.0;<span class="comment">//kp*p*p * Ypm/J*dt* ( - sin ( thm ) );</span>
+<a name="l00197"></a>00197                 A ( 2,1 ) = 0.0;<span class="comment">//kp*p*p * Ypm/J*dt* ( cos ( thm ) );</span>
+<a name="l00198"></a>00198                 A ( 2,2 ) = 1.0;
+<a name="l00199"></a>00199                 A ( 2,3 ) = 0.0;<span class="comment">//kp*p*p * Ypm/J*dt* ( -ibm * sin ( thm )-iam * cos ( thm ) );</span>
+<a name="l00200"></a>00200                 <span class="comment">// d th</span>
+<a name="l00201"></a>00201                 A ( 3,0 ) = 0.0; A ( 3,1 ) = 0.0; A ( 3,2 ) = dt; A ( 3,3 ) = 1.0;
+<a name="l00202"></a>00202         }
+<a name="l00203"></a>00203 
+<a name="l00204"></a><a class="code" href="classIMpmsmStat.html#ff740ee20100ae2a2d03a2538638f8e8">00204</a>         <span class="keywordtype">void</span> <a class="code" href="classIMpmsmStat.html#ff740ee20100ae2a2d03a2538638f8e8" title="Evaluates  and writes result into A .">dfdu_cond</a> ( <span class="keyword">const</span> vec &amp;x0, <span class="keyword">const</span> vec &amp;u0, mat &amp;A, <span class="keywordtype">bool</span> full=<span class="keyword">true</span> ) {it_error ( <span class="stringliteral">"not needed"</span> );};
+<a name="l00205"></a>00205 
+<a name="l00206"></a>00206 };
+<a name="l00207"></a>00207 
+<a name="l00209"></a><a class="code" href="classOMpmsm.html">00209</a> <span class="keyword">class </span><a class="code" href="classOMpmsm.html" title="Observation model for PMSM drive and its derivative with respect to .">OMpmsm</a>: <span class="keyword">public</span> <a class="code" href="classbdm_1_1diffbifn.html" title="Class representing a differentiable function of two variables .">diffbifn</a> {
+<a name="l00210"></a>00210 <span class="keyword">public</span>:
+<a name="l00211"></a>00211         <a class="code" href="classOMpmsm.html" title="Observation model for PMSM drive and its derivative with respect to .">OMpmsm</a>() :<a class="code" href="classbdm_1_1diffbifn.html#6ecfa9bf42b2421bd56c260a8b2c51e1" title="Default constructor (dimy is not set!).">diffbifn</a> (2, rx,ru ) {};
+<a name="l00212"></a>00212 
+<a name="l00213"></a><a class="code" href="classOMpmsm.html#8e32392c9c635584606287b8c0e8c9da">00213</a>         vec <a class="code" href="classOMpmsm.html#8e32392c9c635584606287b8c0e8c9da" title="Evaluates .">eval</a> ( <span class="keyword">const</span> vec &amp;x0, <span class="keyword">const</span> vec &amp;u0 ) {
+<a name="l00214"></a>00214                 vec y ( 2 );
+<a name="l00215"></a>00215                 y ( 0 ) = x0 ( 0 );
+<a name="l00216"></a>00216                 y ( 1 ) = x0 ( 1 );
+<a name="l00217"></a>00217                 <span class="keywordflow">return</span> y;
+<a name="l00218"></a>00218         }
+<a name="l00219"></a>00219 
+<a name="l00220"></a><a class="code" href="classOMpmsm.html#b75b5fd55b2ac5ed74b5b953af122821">00220</a>         <span class="keywordtype">void</span> <a class="code" href="classOMpmsm.html#b75b5fd55b2ac5ed74b5b953af122821" title="Evaluates  and writes result into A .">dfdx_cond</a> ( <span class="keyword">const</span> vec &amp;x0, <span class="keyword">const</span> vec &amp;u0, mat &amp;A, <span class="keywordtype">bool</span> full=<span class="keyword">true</span> ) {
+<a name="l00221"></a>00221                 A.clear();
+<a name="l00222"></a>00222                 A ( 0,0 ) = 1.0;
+<a name="l00223"></a>00223                 A ( 1,1 ) = 1.0;
+<a name="l00224"></a>00224         }
+<a name="l00225"></a>00225 };
+<a name="l00226"></a>00226 
+<a name="l00228"></a>00228 <span class="preprocessor">#endif //PMSM_H</span>
 </pre></div></div>
-<hr size="1"><address style="text-align: right;"><small>Generated on Thu Jan 15 10:50:26 2009 for mixpp by&nbsp;
+<hr size="1"><address style="text-align: right;"><small>Generated on Tue Jan 27 16:29:53 2009 for mixpp by&nbsp;
 <a href="http://www.doxygen.org/index.html">
 <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.6 </small></address>
