Show
Ignore:
Timestamp:
08/18/08 14:27:50 (16 years ago)
Author:
smidl
Message:

Documentation update

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • doc/html/pmsm_8h-source.html

    r106 r139  
    55<link href="tabs.css" rel="stylesheet" type="text/css"> 
    66</head><body> 
    7 <!-- Generated by Doxygen 1.5.5 --> 
     7<!-- Generated by Doxygen 1.5.6 --> 
    88<div class="navigation" id="top"> 
    99  <div class="tabs"> 
     
    1919<a name="l00003"></a>00003 <span class="preprocessor"></span> 
    2020<a name="l00004"></a>00004 <span class="preprocessor">#include &lt;stat/libFN.h&gt;</span> 
    21 <a name="l00005"></a>00005 <span class="preprocessor">#include &lt;userinfo.h&gt;</span> 
    22 <a name="l00006"></a>00006  
    23 <a name="l00007"></a>00007  
    24 <a name="l00008"></a>00008 <span class="comment">//TODO hardcoded RVs!!!</span> 
    25 <a name="l00009"></a>00009 <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> rx ( <span class="stringliteral">"1 2 3 4"</span>, <span class="stringliteral">"{ia ib om th }"</span>, ones_i ( 4 ), zeros_i ( 4 )); 
    26 <a name="l00010"></a>00010 <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> ru ( <span class="stringliteral">"5 6"</span>, <span class="stringliteral">"{ua ub }"</span>, ones_i ( 2 ) ,zeros_i ( 2 )); 
    27 <a name="l00011"></a>00011 <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> ry ( <span class="stringliteral">"7 8"</span>, <span class="stringliteral">"{oia oib }"</span>, ones_i ( 2 ) ,zeros_i ( 2 )); 
    28 <a name="l00012"></a>00012  
    29 <a name="l00013"></a>00013 <span class="keyword">class </span>uipmsm : <span class="keyword">public</span> <a class="code" href="classuibase.html" title="User Info base class.">uibase</a>{ 
    30 <a name="l00014"></a>00014         <span class="keywordtype">double</span> Rs, Ls, dt, Ypm, kp, p,  J, Mz; 
    31 <a name="l00015"></a>00015 }; 
    32 <a name="l00016"></a>00016  
    33 <a name="l00018"></a><a class="code" href="classIMpmsm.html">00018</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 $x$.">IMpmsm</a> : <span class="keyword">public</span> <a class="code" href="classdiffbifn.html" title="Class representing a differentiable function of two variables .">diffbifn</a> { 
    34 <a name="l00019"></a>00019 <span class="keyword">protected</span>: 
    35 <a name="l00020"></a>00020         <span class="keywordtype">double</span> Rs, Ls, dt, Ypm, kp, p,  J, Mz; 
    36 <a name="l00021"></a>00021  
    37 <a name="l00022"></a>00022 <span class="keyword">public</span>: 
    38 <a name="l00023"></a>00023         <a class="code" href="classIMpmsm.html" title="State evolution model for a PMSM drive and its derivative with respect to $x$.">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 ) {}; 
    39 <a name="l00025"></a><a class="code" href="classIMpmsm.html#42818f3426d99fecb7e97be8ffe2e228">00025</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;} 
    40 <a name="l00026"></a>00026  
    41 <a name="l00027"></a><a class="code" href="classIMpmsm.html#45785869d978dda42828a072ec2caebe">00027</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 ) { 
    42 <a name="l00028"></a>00028                 <span class="comment">// last state</span> 
    43 <a name="l00029"></a>00029                 <span class="keywordtype">double</span> iam = x0 ( 0 ); 
    44 <a name="l00030"></a>00030                 <span class="keywordtype">double</span> ibm = x0 ( 1 ); 
    45 <a name="l00031"></a>00031                 <span class="keywordtype">double</span> omm = x0 ( 2 ); 
    46 <a name="l00032"></a>00032                 <span class="keywordtype">double</span> thm = x0 ( 3 ); 
    47 <a name="l00033"></a>00033                 <span class="keywordtype">double</span> uam = u0 ( 0 ); 
    48 <a name="l00034"></a>00034                 <span class="keywordtype">double</span> ubm = u0 ( 1 ); 
    49 <a name="l00035"></a>00035  
    50 <a name="l00036"></a>00036                 vec xk=zeros ( 4 ); 
    51 <a name="l00037"></a>00037                 <span class="comment">//ia</span> 
    52 <a name="l00038"></a>00038                 xk ( 0 ) = ( 1.0- Rs/Ls*dt ) * iam + Ypm/Ls*dt*omm * sin ( thm ) + uam*dt/Ls; 
    53 <a name="l00039"></a>00039                 <span class="comment">//ib</span> 
    54 <a name="l00040"></a>00040                 xk ( 1 ) = ( 1.0- Rs/Ls*dt ) * ibm - Ypm/Ls*dt*omm * cos ( thm ) + ubm*dt/Ls; 
    55 <a name="l00041"></a>00041                 <span class="comment">//om</span> 
    56 <a name="l00042"></a>00042                 xk ( 2 ) = omm + kp*p*p * Ypm/J*dt* ( ibm * cos ( thm )-iam * sin ( thm ) ) - p/J*dt*Mz; 
    57 <a name="l00043"></a>00043                 <span class="comment">//th</span> 
    58 <a name="l00044"></a>00044                 xk ( 3 ) = thm + omm*dt; <span class="comment">// &lt;0..2pi&gt;</span> 
    59 <a name="l00045"></a>00045                 <span class="keywordflow">if</span> ( xk ( 3 ) &gt;pi ) xk ( 3 )-=2*pi; 
    60 <a name="l00046"></a>00046                 <span class="keywordflow">if</span> ( xk ( 3 ) &lt;-pi ) xk ( 3 ) +=2*pi; 
    61 <a name="l00047"></a>00047                 <span class="keywordflow">return</span> xk; 
    62 <a name="l00048"></a>00048         } 
    63 <a name="l00049"></a>00049  
    64 <a name="l00050"></a><a class="code" href="classIMpmsm.html#b4378b5d3bf64c683e4cf5c5f1cd56f1">00050</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> ) { 
    65 <a name="l00051"></a>00051                 <span class="keywordtype">double</span> iam = x0 ( 0 ); 
    66 <a name="l00052"></a>00052                 <span class="keywordtype">double</span> ibm = x0 ( 1 ); 
    67 <a name="l00053"></a>00053                 <span class="keywordtype">double</span> omm = x0 ( 2 ); 
    68 <a name="l00054"></a>00054                 <span class="keywordtype">double</span> thm = x0 ( 3 ); 
    69 <a name="l00055"></a>00055                 <span class="comment">// d ia</span> 
    70 <a name="l00056"></a>00056                 A ( 0,0 ) = ( 1.0- Rs/Ls*dt ); A ( 0,1 ) = 0.0; 
    71 <a name="l00057"></a>00057                 A ( 0,2 ) = Ypm/Ls*dt* sin ( thm ); A ( 0,3 ) = Ypm/Ls*dt*omm * ( cos ( thm ) ); 
    72 <a name="l00058"></a>00058                 <span class="comment">// d ib</span> 
    73 <a name="l00059"></a>00059                 A ( 1,0 ) = 0.0 ; A ( 1,1 ) = ( 1.0- Rs/Ls*dt ); 
    74 <a name="l00060"></a>00060                 A ( 1,2 ) = -Ypm/Ls*dt* cos ( thm ); A ( 1,3 ) = Ypm/Ls*dt*omm * ( sin ( thm ) ); 
    75 <a name="l00061"></a>00061                 <span class="comment">// d om</span> 
    76 <a name="l00062"></a>00062                 A ( 2,0 ) = kp*p*p * Ypm/J*dt* ( - sin ( thm ) ); 
    77 <a name="l00063"></a>00063                 A ( 2,1 ) = kp*p*p * Ypm/J*dt* ( cos ( thm ) ); 
    78 <a name="l00064"></a>00064                 A ( 2,2 ) = 1.0; 
    79 <a name="l00065"></a>00065                 A ( 2,3 ) = kp*p*p * Ypm/J*dt* ( -ibm * sin ( thm )-iam * cos ( thm ) ); 
    80 <a name="l00066"></a>00066                 <span class="comment">// d th</span> 
    81 <a name="l00067"></a>00067                 A ( 3,0 ) = 0.0; A ( 3,1 ) = 0.0; A ( 3,2 ) = dt; A ( 3,3 ) = 1.0; 
    82 <a name="l00068"></a>00068         } 
     21<a name="l00005"></a>00005  
     22<a name="l00006"></a>00006 <span class="comment">//TODO hardcoded RVs!!!</span> 
     23<a name="l00007"></a>00007 <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> rx ( <span class="stringliteral">"1 2 3 4"</span>, <span class="stringliteral">"{ia ib om th }"</span>, ones_i ( 4 ), zeros_i ( 4 )); 
     24<a name="l00008"></a>00008 <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> ru ( <span class="stringliteral">"5 6"</span>, <span class="stringliteral">"{ua ub }"</span>, ones_i ( 2 ) ,zeros_i ( 2 )); 
     25<a name="l00009"></a>00009 <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> ry ( <span class="stringliteral">"7 8"</span>, <span class="stringliteral">"{oia oib }"</span>, ones_i ( 2 ) ,zeros_i ( 2 )); 
     26<a name="l00010"></a>00010  
     27<a name="l00011"></a>00011 <span class="comment">// class uipmsm : public uibase{</span> 
     28<a name="l00012"></a>00012 <span class="comment">//      double Rs, Ls, dt, Ypm, kp, p,  J, Mz;</span> 
     29<a name="l00013"></a>00013 <span class="comment">// };</span> 
     30<a name="l00014"></a>00014  
     31<a name="l00016"></a><a class="code" href="classIMpmsm.html">00016</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 $x$.">IMpmsm</a> : <span class="keyword">public</span> <a class="code" href="classdiffbifn.html" title="Class representing a differentiable function of two variables .">diffbifn</a> { 
     32<a name="l00017"></a>00017 <span class="keyword">protected</span>: 
     33<a name="l00018"></a>00018         <span class="keywordtype">double</span> Rs, Ls, dt, Ypm, kp, p,  J, Mz; 
     34<a name="l00019"></a>00019  
     35<a name="l00020"></a>00020 <span class="keyword">public</span>: 
     36<a name="l00021"></a>00021         <a class="code" href="classIMpmsm.html" title="State evolution model for a PMSM drive and its derivative with respect to $x$.">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 ) {}; 
     37<a name="l00023"></a><a class="code" href="classIMpmsm.html#42818f3426d99fecb7e97be8ffe2e228">00023</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;} 
     38<a name="l00024"></a>00024  
     39<a name="l00025"></a><a class="code" href="classIMpmsm.html#45785869d978dda42828a072ec2caebe">00025</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 ) { 
     40<a name="l00026"></a>00026                 <span class="comment">// last state</span> 
     41<a name="l00027"></a>00027                 <span class="keywordtype">double</span> iam = x0 ( 0 ); 
     42<a name="l00028"></a>00028                 <span class="keywordtype">double</span> ibm = x0 ( 1 ); 
     43<a name="l00029"></a>00029                 <span class="keywordtype">double</span> omm = x0 ( 2 ); 
     44<a name="l00030"></a>00030                 <span class="keywordtype">double</span> thm = x0 ( 3 ); 
     45<a name="l00031"></a>00031                 <span class="keywordtype">double</span> uam = u0 ( 0 ); 
     46<a name="l00032"></a>00032                 <span class="keywordtype">double</span> ubm = u0 ( 1 ); 
     47<a name="l00033"></a>00033  
     48<a name="l00034"></a>00034                 vec xk=zeros ( 4 ); 
     49<a name="l00035"></a>00035                 <span class="comment">//ia</span> 
     50<a name="l00036"></a>00036                 xk ( 0 ) = ( 1.0- Rs/Ls*dt ) * iam + Ypm/Ls*dt*omm * sin ( thm ) + uam*dt/Ls; 
     51<a name="l00037"></a>00037                 <span class="comment">//ib</span> 
     52<a name="l00038"></a>00038                 xk ( 1 ) = ( 1.0- Rs/Ls*dt ) * ibm - Ypm/Ls*dt*omm * cos ( thm ) + ubm*dt/Ls; 
     53<a name="l00039"></a>00039                 <span class="comment">//om</span> 
     54<a name="l00040"></a>00040                 xk ( 2 ) = omm + kp*p*p * Ypm/J*dt* ( ibm * cos ( thm )-iam * sin ( thm ) ) - p/J*dt*Mz; 
     55<a name="l00041"></a>00041                 <span class="comment">//th</span> 
     56<a name="l00042"></a>00042                 xk ( 3 ) = thm + omm*dt; <span class="comment">// &lt;0..2pi&gt;</span> 
     57<a name="l00043"></a>00043                 <span class="keywordflow">if</span> ( xk ( 3 ) &gt;pi ) xk ( 3 )-=2*pi; 
     58<a name="l00044"></a>00044                 <span class="keywordflow">if</span> ( xk ( 3 ) &lt;-pi ) xk ( 3 ) +=2*pi; 
     59<a name="l00045"></a>00045                 <span class="keywordflow">return</span> xk; 
     60<a name="l00046"></a>00046         } 
     61<a name="l00047"></a>00047  
     62<a name="l00048"></a><a class="code" href="classIMpmsm.html#b4378b5d3bf64c683e4cf5c5f1cd56f1">00048</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> ) { 
     63<a name="l00049"></a>00049                 <span class="keywordtype">double</span> iam = x0 ( 0 ); 
     64<a name="l00050"></a>00050                 <span class="keywordtype">double</span> ibm = x0 ( 1 ); 
     65<a name="l00051"></a>00051                 <span class="keywordtype">double</span> omm = x0 ( 2 ); 
     66<a name="l00052"></a>00052                 <span class="keywordtype">double</span> thm = x0 ( 3 ); 
     67<a name="l00053"></a>00053                 <span class="comment">// d ia</span> 
     68<a name="l00054"></a>00054                 A ( 0,0 ) = ( 1.0- Rs/Ls*dt ); A ( 0,1 ) = 0.0; 
     69<a name="l00055"></a>00055                 A ( 0,2 ) = Ypm/Ls*dt* sin ( thm ); A ( 0,3 ) = Ypm/Ls*dt*omm * ( cos ( thm ) ); 
     70<a name="l00056"></a>00056                 <span class="comment">// d ib</span> 
     71<a name="l00057"></a>00057                 A ( 1,0 ) = 0.0 ; A ( 1,1 ) = ( 1.0- Rs/Ls*dt ); 
     72<a name="l00058"></a>00058                 A ( 1,2 ) = -Ypm/Ls*dt* cos ( thm ); A ( 1,3 ) = Ypm/Ls*dt*omm * ( sin ( thm ) ); 
     73<a name="l00059"></a>00059                 <span class="comment">// d om</span> 
     74<a name="l00060"></a>00060                 A ( 2,0 ) = kp*p*p * Ypm/J*dt* ( - sin ( thm ) ); 
     75<a name="l00061"></a>00061                 A ( 2,1 ) = kp*p*p * Ypm/J*dt* ( cos ( thm ) ); 
     76<a name="l00062"></a>00062                 A ( 2,2 ) = 1.0; 
     77<a name="l00063"></a>00063                 A ( 2,3 ) = kp*p*p * Ypm/J*dt* ( -ibm * sin ( thm )-iam * cos ( thm ) ); 
     78<a name="l00064"></a>00064                 <span class="comment">// d th</span> 
     79<a name="l00065"></a>00065                 A ( 3,0 ) = 0.0; A ( 3,1 ) = 0.0; A ( 3,2 ) = dt; A ( 3,3 ) = 1.0; 
     80<a name="l00066"></a>00066         } 
     81<a name="l00067"></a>00067  
     82<a name="l00068"></a><a class="code" href="classIMpmsm.html#c3f8dad22ae9855c04a1d593b45c99b5">00068</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> );}; 
    8383<a name="l00069"></a>00069  
    84 <a name="l00070"></a><a class="code" href="classIMpmsm.html#c3f8dad22ae9855c04a1d593b45c99b5">00070</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> );}; 
     84<a name="l00070"></a>00070 }; 
    8585<a name="l00071"></a>00071  
    86 <a name="l00072"></a>00072 }; 
    87 <a name="l00073"></a>00073  
    88 <a name="l00074"></a>00074 <span class="keyword">class </span>IMpmsmStat : <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 $x$.">IMpmsm</a> { 
    89 <a name="l00075"></a>00075         IMpmsmStat() :<a class="code" href="classIMpmsm.html" title="State evolution model for a PMSM drive and its derivative with respect to $x$.">IMpmsm</a>() {}; 
    90 <a name="l00077"></a>00077         <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;} 
    91 <a name="l00078"></a>00078  
    92 <a name="l00079"></a>00079         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 ) { 
    93 <a name="l00080"></a>00080                 <span class="comment">// last state</span> 
    94 <a name="l00081"></a>00081                 <span class="keywordtype">double</span> iam = x0 ( 0 ); 
    95 <a name="l00082"></a>00082                 <span class="keywordtype">double</span> ibm = x0 ( 1 ); 
    96 <a name="l00083"></a>00083                 <span class="keywordtype">double</span> omm = x0 ( 2 ); 
    97 <a name="l00084"></a>00084                 <span class="keywordtype">double</span> thm = x0 ( 3 ); 
    98 <a name="l00085"></a>00085                 <span class="keywordtype">double</span> uam = u0 ( 0 ); 
    99 <a name="l00086"></a>00086                 <span class="keywordtype">double</span> ubm = u0 ( 1 ); 
    100 <a name="l00087"></a>00087  
    101 <a name="l00088"></a>00088                 vec xk=zeros ( 4 ); 
    102 <a name="l00089"></a>00089                 <span class="comment">//ia</span> 
    103 <a name="l00090"></a>00090                 xk ( 0 ) = ( 1.0- Rs/Ls*dt ) * iam + Ypm/Ls*dt*omm * sin ( thm ) + uam*dt/Ls; 
    104 <a name="l00091"></a>00091                 <span class="comment">//ib</span> 
    105 <a name="l00092"></a>00092                 xk ( 1 ) = ( 1.0- Rs/Ls*dt ) * ibm - Ypm/Ls*dt*omm * cos ( thm ) + ubm*dt/Ls; 
    106 <a name="l00093"></a>00093                 <span class="comment">//om</span> 
    107 <a name="l00094"></a>00094                 xk ( 2 ) = omm;<span class="comment">// + kp*p*p * Ypm/J*dt* ( ibm * cos ( thm )-iam * sin ( thm ) ) - p/J*dt*Mz;</span> 
    108 <a name="l00095"></a>00095                 <span class="comment">//th</span> 
    109 <a name="l00096"></a>00096                 xk ( 3 ) = rem(thm + omm*dt,2*pi); <span class="comment">// &lt;0..2pi&gt;</span> 
    110 <a name="l00097"></a>00097                 <span class="keywordflow">return</span> xk; 
    111 <a name="l00098"></a>00098         } 
    112 <a name="l00099"></a>00099  
    113 <a name="l00100"></a>00100         <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> ) { 
    114 <a name="l00101"></a>00101 <span class="comment">//              double iam = x0 ( 0 );</span> 
    115 <a name="l00102"></a>00102 <span class="comment">//              double ibm = x0 ( 1 );</span> 
    116 <a name="l00103"></a>00103                 <span class="keywordtype">double</span> omm = x0 ( 2 ); 
    117 <a name="l00104"></a>00104                 <span class="keywordtype">double</span> thm = x0 ( 3 ); 
    118 <a name="l00105"></a>00105                 <span class="comment">// d ia</span> 
    119 <a name="l00106"></a>00106                 A ( 0,0 ) = ( 1.0- Rs/Ls*dt ); A ( 0,1 ) = 0.0; 
    120 <a name="l00107"></a>00107                 A ( 0,2 ) = Ypm/Ls*dt* sin ( thm ); A ( 0,3 ) = Ypm/Ls*dt*omm * ( cos ( thm ) ); 
    121 <a name="l00108"></a>00108                 <span class="comment">// d ib</span> 
    122 <a name="l00109"></a>00109                 A ( 1,0 ) = 0.0 ; A ( 1,1 ) = ( 1.0- Rs/Ls*dt ); 
    123 <a name="l00110"></a>00110                 A ( 1,2 ) = -Ypm/Ls*dt* cos ( thm ); A ( 1,3 ) = Ypm/Ls*dt*omm * ( sin ( thm ) ); 
    124 <a name="l00111"></a>00111                 <span class="comment">// d om</span> 
    125 <a name="l00112"></a>00112                 A ( 2,0 ) = 0.0;<span class="comment">//kp*p*p * Ypm/J*dt* ( - sin ( thm ) );</span> 
    126 <a name="l00113"></a>00113                 A ( 2,1 ) = 0.0;<span class="comment">//kp*p*p * Ypm/J*dt* ( cos ( thm ) );</span> 
    127 <a name="l00114"></a>00114                 A ( 2,2 ) = 1.0; 
    128 <a name="l00115"></a>00115                 A ( 2,3 ) = 0.0;<span class="comment">//kp*p*p * Ypm/J*dt* ( -ibm * sin ( thm )-iam * cos ( thm ) );</span> 
    129 <a name="l00116"></a>00116                 <span class="comment">// d th</span> 
    130 <a name="l00117"></a>00117                 A ( 3,0 ) = 0.0; A ( 3,1 ) = 0.0; A ( 3,2 ) = dt; A ( 3,3 ) = 1.0; 
    131 <a name="l00118"></a>00118         } 
     86<a name="l00072"></a>00072 <span class="keyword">class </span>IMpmsmStat : <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 $x$.">IMpmsm</a> { 
     87<a name="l00073"></a>00073         IMpmsmStat() :<a class="code" href="classIMpmsm.html" title="State evolution model for a PMSM drive and its derivative with respect to $x$.">IMpmsm</a>() {}; 
     88<a name="l00075"></a>00075         <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;} 
     89<a name="l00076"></a>00076  
     90<a name="l00077"></a>00077         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 ) { 
     91<a name="l00078"></a>00078                 <span class="comment">// last state</span> 
     92<a name="l00079"></a>00079                 <span class="keywordtype">double</span> iam = x0 ( 0 ); 
     93<a name="l00080"></a>00080                 <span class="keywordtype">double</span> ibm = x0 ( 1 ); 
     94<a name="l00081"></a>00081                 <span class="keywordtype">double</span> omm = x0 ( 2 ); 
     95<a name="l00082"></a>00082                 <span class="keywordtype">double</span> thm = x0 ( 3 ); 
     96<a name="l00083"></a>00083                 <span class="keywordtype">double</span> uam = u0 ( 0 ); 
     97<a name="l00084"></a>00084                 <span class="keywordtype">double</span> ubm = u0 ( 1 ); 
     98<a name="l00085"></a>00085  
     99<a name="l00086"></a>00086                 vec xk=zeros ( 4 ); 
     100<a name="l00087"></a>00087                 <span class="comment">//ia</span> 
     101<a name="l00088"></a>00088                 xk ( 0 ) = ( 1.0- Rs/Ls*dt ) * iam + Ypm/Ls*dt*omm * sin ( thm ) + uam*dt/Ls; 
     102<a name="l00089"></a>00089                 <span class="comment">//ib</span> 
     103<a name="l00090"></a>00090                 xk ( 1 ) = ( 1.0- Rs/Ls*dt ) * ibm - Ypm/Ls*dt*omm * cos ( thm ) + ubm*dt/Ls; 
     104<a name="l00091"></a>00091                 <span class="comment">//om</span> 
     105<a name="l00092"></a>00092                 xk ( 2 ) = omm;<span class="comment">// + kp*p*p * Ypm/J*dt* ( ibm * cos ( thm )-iam * sin ( thm ) ) - p/J*dt*Mz;</span> 
     106<a name="l00093"></a>00093                 <span class="comment">//th</span> 
     107<a name="l00094"></a>00094                 xk ( 3 ) = rem(thm + omm*dt,2*pi); <span class="comment">// &lt;0..2pi&gt;</span> 
     108<a name="l00095"></a>00095                 <span class="keywordflow">return</span> xk; 
     109<a name="l00096"></a>00096         } 
     110<a name="l00097"></a>00097  
     111<a name="l00098"></a>00098         <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> ) { 
     112<a name="l00099"></a>00099 <span class="comment">//              double iam = x0 ( 0 );</span> 
     113<a name="l00100"></a>00100 <span class="comment">//              double ibm = x0 ( 1 );</span> 
     114<a name="l00101"></a>00101                 <span class="keywordtype">double</span> omm = x0 ( 2 ); 
     115<a name="l00102"></a>00102                 <span class="keywordtype">double</span> thm = x0 ( 3 ); 
     116<a name="l00103"></a>00103                 <span class="comment">// d ia</span> 
     117<a name="l00104"></a>00104                 A ( 0,0 ) = ( 1.0- Rs/Ls*dt ); A ( 0,1 ) = 0.0; 
     118<a name="l00105"></a>00105                 A ( 0,2 ) = Ypm/Ls*dt* sin ( thm ); A ( 0,3 ) = Ypm/Ls*dt*omm * ( cos ( thm ) ); 
     119<a name="l00106"></a>00106                 <span class="comment">// d ib</span> 
     120<a name="l00107"></a>00107                 A ( 1,0 ) = 0.0 ; A ( 1,1 ) = ( 1.0- Rs/Ls*dt ); 
     121<a name="l00108"></a>00108                 A ( 1,2 ) = -Ypm/Ls*dt* cos ( thm ); A ( 1,3 ) = Ypm/Ls*dt*omm * ( sin ( thm ) ); 
     122<a name="l00109"></a>00109                 <span class="comment">// d om</span> 
     123<a name="l00110"></a>00110                 A ( 2,0 ) = 0.0;<span class="comment">//kp*p*p * Ypm/J*dt* ( - sin ( thm ) );</span> 
     124<a name="l00111"></a>00111                 A ( 2,1 ) = 0.0;<span class="comment">//kp*p*p * Ypm/J*dt* ( cos ( thm ) );</span> 
     125<a name="l00112"></a>00112                 A ( 2,2 ) = 1.0; 
     126<a name="l00113"></a>00113                 A ( 2,3 ) = 0.0;<span class="comment">//kp*p*p * Ypm/J*dt* ( -ibm * sin ( thm )-iam * cos ( thm ) );</span> 
     127<a name="l00114"></a>00114                 <span class="comment">// d th</span> 
     128<a name="l00115"></a>00115                 A ( 3,0 ) = 0.0; A ( 3,1 ) = 0.0; A ( 3,2 ) = dt; A ( 3,3 ) = 1.0; 
     129<a name="l00116"></a>00116         } 
     130<a name="l00117"></a>00117  
     131<a name="l00118"></a>00118         <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> );}; 
    132132<a name="l00119"></a>00119  
    133 <a name="l00120"></a>00120         <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> );}; 
     133<a name="l00120"></a>00120 }; 
    134134<a name="l00121"></a>00121  
    135 <a name="l00122"></a>00122 }; 
    136 <a name="l00123"></a>00123  
    137 <a name="l00125"></a><a class="code" href="classOMpmsm.html">00125</a> <span class="keyword">class </span><a class="code" href="classOMpmsm.html" title="Observation model for PMSM drive and its derivative with respect to $x$.">OMpmsm</a>: <span class="keyword">public</span> <a class="code" href="classdiffbifn.html" title="Class representing a differentiable function of two variables .">diffbifn</a> { 
    138 <a name="l00126"></a>00126 <span class="keyword">public</span>: 
    139 <a name="l00127"></a>00127         <a class="code" href="classOMpmsm.html" title="Observation model for PMSM drive and its derivative with respect to $x$.">OMpmsm</a>() :<a class="code" href="classdiffbifn.html#797772c0d5aab8ddccec19dfe4bb2d77" title="Default constructor (dimy is not set!).">diffbifn</a> (2, rx,ru ) {}; 
    140 <a name="l00128"></a>00128  
    141 <a name="l00129"></a><a class="code" href="classOMpmsm.html#8e32392c9c635584606287b8c0e8c9da">00129</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 ) { 
    142 <a name="l00130"></a>00130                 vec y ( 2 ); 
    143 <a name="l00131"></a>00131                 y ( 0 ) = x0 ( 0 ); 
    144 <a name="l00132"></a>00132                 y ( 1 ) = x0 ( 1 ); 
    145 <a name="l00133"></a>00133                 <span class="keywordflow">return</span> y; 
    146 <a name="l00134"></a>00134         } 
    147 <a name="l00135"></a>00135  
    148 <a name="l00136"></a><a class="code" href="classOMpmsm.html#b75b5fd55b2ac5ed74b5b953af122821">00136</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> ) { 
    149 <a name="l00137"></a>00137                 A.clear(); 
    150 <a name="l00138"></a>00138                 A ( 0,0 ) = 1.0; 
    151 <a name="l00139"></a>00139                 A ( 1,1 ) = 1.0; 
    152 <a name="l00140"></a>00140         } 
    153 <a name="l00141"></a>00141 }; 
    154 <a name="l00142"></a>00142  
    155 <a name="l00143"></a>00143 <span class="preprocessor">#endif //PMSM_H</span> 
     135<a name="l00123"></a><a class="code" href="classOMpmsm.html">00123</a> <span class="keyword">class </span><a class="code" href="classOMpmsm.html" title="Observation model for PMSM drive and its derivative with respect to $x$.">OMpmsm</a>: <span class="keyword">public</span> <a class="code" href="classdiffbifn.html" title="Class representing a differentiable function of two variables .">diffbifn</a> { 
     136<a name="l00124"></a>00124 <span class="keyword">public</span>: 
     137<a name="l00125"></a>00125         <a class="code" href="classOMpmsm.html" title="Observation model for PMSM drive and its derivative with respect to $x$.">OMpmsm</a>() :<a class="code" href="classdiffbifn.html#797772c0d5aab8ddccec19dfe4bb2d77" title="Default constructor (dimy is not set!).">diffbifn</a> (2, rx,ru ) {}; 
     138<a name="l00126"></a>00126  
     139<a name="l00127"></a><a class="code" href="classOMpmsm.html#8e32392c9c635584606287b8c0e8c9da">00127</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 ) { 
     140<a name="l00128"></a>00128                 vec y ( 2 ); 
     141<a name="l00129"></a>00129                 y ( 0 ) = x0 ( 0 ); 
     142<a name="l00130"></a>00130                 y ( 1 ) = x0 ( 1 ); 
     143<a name="l00131"></a>00131                 <span class="keywordflow">return</span> y; 
     144<a name="l00132"></a>00132         } 
     145<a name="l00133"></a>00133  
     146<a name="l00134"></a><a class="code" href="classOMpmsm.html#b75b5fd55b2ac5ed74b5b953af122821">00134</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> ) { 
     147<a name="l00135"></a>00135                 A.clear(); 
     148<a name="l00136"></a>00136                 A ( 0,0 ) = 1.0; 
     149<a name="l00137"></a>00137                 A ( 1,1 ) = 1.0; 
     150<a name="l00138"></a>00138         } 
     151<a name="l00139"></a>00139 }; 
     152<a name="l00140"></a>00140  
     153<a name="l00141"></a>00141 <span class="preprocessor">#endif //PMSM_H</span> 
    156154</pre></div></div> 
    157 <hr size="1"><address style="text-align: right;"><small>Generated on Fri May 9 23:06:28 2008 for mixpp by&nbsp; 
     155<hr size="1"><address style="text-align: right;"><small>Generated on Sat Aug 16 11:58:41 2008 for mixpp by&nbsp; 
    158156<a href="http://www.doxygen.org/index.html"> 
    159 <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.5 </small></address> 
     157<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.6 </small></address> 
    160158</body> 
    161159</html>