- Main Page
- Related Pages
- Modules
- Classes
- Files

- File List
- File Members

# pmsm_ui.h

Go to the documentation of this file.

    00001
    00013 #include "pmsmDS.h"
    00014 #include <uibuilder.h>
    00015
    00016 class UIpmsmIM: public UIbuilder {
    00017         protected:
    00018         static void tmp_set ( Setting &S, IMpmsm* IM ) {
    00019                 //set_parameters( Rs0, Ls0, dt0, Ypm0, kp0, p0, J0, Mz0 )
    00020                 IM->set_parameters ( S["Rs"], S["Ls"], 125e-6, S["Fmag"], S["kp"],  S["p"], \
    00021                                 S["J"], 0.0 );
    00022         };
    00023         public:
    00024         UIpmsmIM():UIbuilder("pmsmIM"){};
    00025         bdmroot* build ( Setting &S ) const {
    00026                 IMpmsm* tmp;
    00027                 //Switch to variants
    00028                 if (S.exists("variant")){
    00029                         string var=S["variant"];
    00030                         if (var=="Stat"){tmp=new IMpmsmStat;}
    00031                         if (var=="Mf"){tmp=new IMpmsmStat;}
    00032                 } else {
    00033                         tmp= new IMpmsm;
    00034                 }
    00035                 //Set parameters (recursively)
    00036                 UIcall<IMpmsm*> ( S["params"], &tmp_set , tmp );
    00037                 return tmp;
    00038         }
    00039 };
    00040 UIREGISTER ( UIpmsmIM );
    00041
    00043 class UIpmsmOM: public UIbuilder {
    00044         public:
    00045                 UIpmsmOM():UIbuilder("pmsmOM"){};
    00046                 bdmroot* build ( Setting &S ) const {
    00047                         return new OMpmsm;
    00048                 }
    00049 };
    00050 UIREGISTER ( UIpmsmOM );
    00051
    00052
    00053
    00055 class UIpmsmDS: public UIbuilder {
    00056         static void tmp_set ( Setting &S, pmsmDS* DS ) {
    00057                 //pmsmsim_set_parameters (( Rs0,  Ls0, Fmag0, Bf0, p0, kp0,  J0, Uc0, DT0,  dt0);
    00058                 DS->set_parameters ( S["Rs"], S["Ls"], S["Fmag"], S["Bf"], S["p"], S["kp"], \
    00059                                      S["J"], S["Uc"], S["DT"], 1.0e-6 );
    00060         };
    00061 public:
    00062         UIpmsmDS() :UIbuilder ( "pmsmDS" ) {};
    00063         bdmroot* build ( Setting &S ) const {
    00064                 pmsmDS* tmp = new pmsmDS ( );
    00065                 //Calling function tmp->tmp_set
    00066                 UIcall<pmsmDS*> ( S["params"], &tmp_set , tmp );
    00067                 //
    00068                 if ( S.exists ( "profile" ) ) {
    00069                         tmp->set_profile ( S["tstep"],getvec ( S["profile"] ) );
    00070                 }
    00071                 else {
    00072                         tmp->set_profile ( 1.0, vec ( "1" ) );
    00073                 }
    00074                 return tmp;
    00075         };
    00076
    00077 };
    00078 UIREGISTER ( UIpmsmDS );