Changeset 654

Show
Ignore:
Timestamp:
10/12/09 19:38:57 (15 years ago)
Author:
smidl
Message:

PMSM compiles again

Location:
applications/pmsm
Files:
1 added
7 modified

Legend:

Unmodified
Added
Removed
  • applications/pmsm/CMakeLists.txt

    r357 r654  
    1 # Make sure the compiler can find include files from our Bdm library. 
     1# Matlab toolbox of functions from BDM 
     2 
     3cmake_minimum_required(VERSION 2.6) 
     4PROJECT(bdmtoolbox) 
     5 
     6# Link it to BDM 
     7SET(BDM_SOURCE_DIR "${CMAKE_SOURCE_DIR}/../../library") 
     8SET(CMAKE_MODULE_PATH "${BDM_SOURCE_DIR}/system") 
     9 
     10# Load BDM environment 
     11INCLUDE(SetBdmEnv) 
     12 
    213include_directories (${BDM_SOURCE_DIR}/bdm) 
    3  
    4 # Make sure the linker can find the bdm library once it is built. 
    5 link_directories (${BDM_BINARY_DIR}/bdm) 
     14link_directories (${BDM_SOURCE_DIR}/bdm) 
    615 
    716# no simulator needed... 
     
    2433#EXEC (sim_var pmsmsim) 
    2534 
    26 add_subdirectory (TR2245) 
     35#add_subdirectory (TR2245) 
  • applications/pmsm/cfg/mpf_test.cfg

    r295 r654  
    22 
    33experiment={ 
    4         ndat = 9000; 
     4        ndat = 90000; 
    55}; 
    66 
    7 system= { 
    8         type = "stateDS"; 
    9         IM = {type="mprod"; 
    10         mpdfs=( 
    11                    {type="mgnorm";  
    12                    g={type="pmsmIM";  
    13                            params : {type = "external";filename = "cfg/zcu.cfg";path = "pmsm107";}; 
    14                    }; 
    15                    dR= 
    16                    }}  
    17                   ); 
     7system= "system@cfg/sim.cfg"; 
     8 
     9estimator = (  
     10        {class="MPFpmsm";  
     11        params = "pmsm107@cfg/zcu.cfg"; 
     12        dQ=[0.17, 0.17, 0.00004, 1e-9]; 
     13        dR=[0.06, 0.06]; 
     14        prior={class="euni";high=[4];low=[-4];}; 
     15        //connect 
     16        drv = {class="RV"; names=("o_ia","o_ib","o_ua","o_ub");}; 
     17        rv = {class="RV"; names=("e_ia","e_ib","e_om","e_th");}; 
     18        options = "logbounds"; 
     19        n=20; 
    1820        } 
    19         tstep = 1.0; // steps for profile in [s] 
    20         profile = [1, 5, 0, -3, 8]; 
    21         opt = "u"; 
    22 }; 
    23  
    24 estimator = ( 
    25                          {type="EKF"; 
    26                          IM = {type="pmsmIM"; 
    27                                 params : {type = "external";filename = "cfg/zcu.cfg";path = "pmsm107";}; 
    28                          }; 
    29                          OM = {type="pmsmOM";}; 
    30                          dQ=[62., 66., 44., 0.03]; 
    31                          dR=[100, 100]; 
    32                          //connect 
    33                          drv = {type="rv"; names=["o_ia","o_ib","t_ua","t_ub"];}; 
    34                          rv = {type="rv"; names=["EKF"]; sizes=[4];}; 
    35                          } 
    3621); 
    3722         
    3823logger= { 
    39         type="dirfilelog"; 
     24        class="dirfilelog"; 
    4025        maxlen = 1000; 
    41         dirname = "exp/sim"; 
     26        dirname = "kst/mpf_test"; 
    4227}; 
  • applications/pmsm/cfg/sim.cfg

    r295 r654  
    66 
    77system= { 
    8         type = "pmsmDS"; 
    9         params : {type = "external";filename = "cfg/zcu.cfg";path = "pmsm107";}; 
     8        class = "pmsmDS"; 
     9        params = "pmsm107@zcu.cfg"; 
    1010        tstep = 1.0; // steps for profile in [s] 
    11         profile = [1, 5, 0, -3, 8]; 
     11        profileW = [1, 5, 0, -3, 0, 0, 0, 1, 0, 0 ]; 
    1212        opt = "u"; 
    1313}; 
    1414 
    1515estimator = ( 
    16                          {type="EKF"; 
    17                          IM = {type="pmsmIM"; 
    18                                 params : {type = "external";filename = "cfg/zcu.cfg";path = "pmsm107";}; 
    19                          }; 
    20                          OM = {type="pmsmOM";}; 
    21                          dQ=[62., 66., 44., 0.03]; 
    22                          dR=[100, 100]; 
    23                          //connect 
    24                          drv = {type="rv"; names=["o_ia","o_ib","o_ua","o_ub"];};  // observed u 
    25                          //drv = {type="rv"; names=["o_ia","o_ib","t_ua","t_ub"];}; // true u 
    26                          rv = {type="rv"; names=["EKF"]; sizes=[4];}; 
    27                          } 
     16         {class="EKFfull"; 
     17                IM = {class="IMpmsm"; 
     18                        params = "pmsm107@cfg/zcu.cfg"; 
     19                }; 
     20                OM = {class="OMpmsm";}; 
     21                dQ=[0.17, 0.17, 0.0000004, 1e-11]; 
     22                dR=[0.0006, 0.0006]; 
     23                //connect 
     24                drv = {class="RV"; names=("o_ia","o_ib","o_ua","o_ub");};  // observed u 
     25                //drv = {type="rv"; names=["o_ia","o_ib","t_ua","t_ub"];}; // true u 
     26                rv = {class="RV"; names=("EKF"); sizes=[4];}; 
     27                options = "logbounds"; 
     28         }                                        
    2829); 
    2930         
    3031logger= { 
    31         type="dirfilelog"; 
     32        class="dirfilelog"; 
    3233        maxlen = 1000; 
    33         dirname = "exp/sim"; 
     34        dirname = "kst/sim"; 
    3435}; 
  • applications/pmsm/pmsm.h

    r384 r654  
    22#define PMSM_H 
    33 
    4 #include <stat/functions.h> 
    5 #include "user_info.h" 
     4#include <math/functions.h> 
     5#include "base/user_info.h" 
    66 
    77/*! \defgroup PMSM  
     
    9898        void from_setting( const Setting &root ) 
    9999        {        
    100                 UI::SettingResolver params_exp(root["params"]); 
    101                 const Setting& params=params_exp.result; 
    102  
    103                 set_parameters ( params["Rs"], params["Ls"], 125e-6, params["Fmag"], \ 
     100 
     101                const SettingResolver& params_b=root["params"]; 
     102                const Setting& params=params_b.result; 
     103                 
     104                set_parameters ( params["Rs"], params["Ls"], 125e-6, params["Fmag"], \ 
    104105                         params["kp"], params["p"], params["J"], 0.0); 
    105  
    106 /*              set_parameters ( root["params"]["Rs"], root["params"]["Ls"], 125e-6, root["params"]["Fmag"], \ 
    107                         root["params"]["kp"],  root["params"]["p"], root["params"]["J"], 0.0 );*/ 
    108106        }; 
    109107 
  • applications/pmsm/pmsmDS.h

    r384 r654  
    1111*/ 
    1212 
    13 #include <stat/loggers.h> 
     13#include <base/loggers.h> 
    1414#include <estim/kalman.h> 
    1515#include "simulator_zdenek/simulator.h" 
     
    7171            ind++; 
    7272            // check omega profile and set dW 
    73             if ( ind<profileWw.length() ) 
     73                        if ( ind <2 && profileWw.length() ==1 ) 
     74                        { 
     75                                Ww=profileWw ( 0 ); 
     76                                dW=0.0; 
     77                        } 
     78                        if ( ind<profileWw.length() ) 
    7479            { 
    75                 //linear increase 
    76                 if ( profileWw.length() ==1 ) 
    77                 { 
    78                     Ww=profileWw ( 0 ); 
    79                     dW=0.0; 
    80                 } 
    81                 else 
    82                 { 
    8380                    dW = profileWw ( ind )-profileWw ( ind-1 ); 
    8481                    dW *=125e-6/dt_prof; 
    85                 } 
    8682            } 
    8783            else 
     
    167163    void from_setting( const Setting &root ) 
    168164    { 
    169                 UI::SettingResolver params_exp(root["params"]); 
    170                 const Setting& params=params_exp.result; 
    171  
     165                const SettingResolver& params_l(root["params"]); 
     166                const Setting &params = params_l.result; 
    172167        set_parameters ( params["Rs"], params["Ls"], params["Fmag"], \ 
    173168                         params["Bf"], params["p"], params["kp"], \ 
     
    214209    { 
    215210        static vec umin(2); 
    216         vec u(2); 
    217         //assume we know state exactly: 
     211                vec u(2); 
     212                vec &mu = est->_mu(); 
     213                //assume we know state exactly: 
    218214        vec true_state=vec(x,4); // read from pmsm 
    219         E.set_mu(true_state); 
    220215        mu=true_state; 
    221216 
     
    228223 
    229224        //second derivative 
    230         IMpmsm2o* pf = dynamic_cast<IMpmsm2o*>(pfxu); 
     225        IMpmsm2o* pf = dynamic_cast<IMpmsm2o*>(pfxu.get()); 
    231226        if (pf) 
    232227        { 
     
    254249    void from_setting( const Setting &root ) 
    255250    { 
    256         diffbifn* IM = UI::build<diffbifn>(root, "IM"); 
    257         diffbifn* OM = UI::build<diffbifn>(root, "OM"); 
     251        shared_ptr<diffbifn> IM = UI::build<diffbifn>(root, "IM"); 
     252        shared_ptr<diffbifn> OM = UI::build<diffbifn>(root, "OM"); 
    258253 
    259254        //parameters 
     
    289284 
    290285        //connect 
    291         RV* drv = UI::build<RV>(root, "drv"); 
     286        shared_ptr<RV> drv = UI::build<RV>(root, "drv"); 
    292287        set_drv(*drv); 
    293         RV* rv = UI::build<RV>(root, "rv"); 
     288        shared_ptr<RV> rv = UI::build<RV>(root, "rv"); 
    294289        set_rv(*rv); 
    295290    } 
     
    317312        true_state(4)=x[8]; 
    318313 
    319         E.set_mu(true_state); 
     314        vec &mu = est->_mu(); 
    320315        mu = true_state; 
    321316        //hack for ut 
     
    334329    void from_setting( const Setting &root ) 
    335330    { 
    336         diffbifn* IM = UI::build<diffbifn>(root,"IM"); 
    337         diffbifn* OM = UI::build<diffbifn>(root,"OM"); 
     331        shared_ptr<diffbifn> IM = UI::build<diffbifn>(root,"IM"); 
     332                shared_ptr<diffbifn> OM = UI::build<diffbifn>(root,"OM"); 
    338333 
    339334        //statistics 
     
    367362 
    368363        //connect 
    369         RV* drv = UI::build<RV>(root, "drv"); 
     364                shared_ptr<RV> drv = UI::build<RV>(root, "drv"); 
    370365        set_drv(*drv); 
    371         RV* rv = UI::build<RV>(root, "rv"); 
     366                shared_ptr<RV> rv = UI::build<RV>(root, "rv"); 
    372367        set_rv(*rv); 
    373368    } 
  • applications/pmsm/pmsm_estim.cpp

    r394 r654  
    77 */ 
    88 
    9 #include "user_info.h" 
    10 #include "stat/loggers.h" 
     9#include "base/user_info.h" 
     10#include "base/loggers.h" 
    1111#include "estim/kalman.h" 
    1212#include "pmsmDS.h" 
     13#include "filters.h" 
    1314 
    1415 
     
    2021        UIFile F ( fname ); 
    2122 
    22         logger* L = UI::build <logger>( F, "logger" ); 
    23         DS * pDS = UI::build<DS> ( F, "system" ); 
    24         Array<BM*> Es;                  // array of estimators 
     23        shared_ptr<logger> L = UI::build <logger>( F, "logger" ); 
     24        shared_ptr<DS> pDS = UI::build<DS> ( F, "system" ); 
     25        Array<shared_ptr<BM> > Es;                      // array of estimators 
    2526        UI::get( Es, F, "estimator" ); 
    2627        int nE = Es.length();   //number of estimators 
     
    6061        L->finalize(); 
    6162 
    62         delete L; 
    63         delete pDS; 
    6463        for (int i=0; i<nE; i++){ 
    6564                delete Dls(i); 
    66                 delete Es(i); 
    6765        } 
    6866        return 0; 
  • applications/pmsm/testbidiff.cpp

    r262 r654  
    11 
    2 #include "../bdm/stat/libBM.h" 
     2#include <base/bdmbase.h> 
    33 
    44#include "pmsm.h"