root/pmsm/pmsm_ui.h @ 312

Revision 280, 1.9 kB (checked in by smidl, 15 years ago)

progress...

Line 
1/*!
2  \file
3  \brief UserInfo for pmsm related objects
4  \author Vaclav Smidl.
5
6  -----------------------------------
7  BDM++ - C++ library for Bayesian Decision Making under Uncertainty
8
9  Using IT++ for numerical operations
10  -----------------------------------
11*/
12
13#include "pmsmDS.h"
14#include <uibuilder.h>
15
16class UIpmsmIM: public UIbuilder {
17        protected:
18        static void tmp_set ( Setting &S, IMpmsm* IM ) {
19                //set_parameters( Rs0, Ls0, dt0, Ypm0, kp0, p0, J0, Mz0 )
20                IM->set_parameters ( S["Rs"], S["Ls"], 125e-6, S["Fmag"], S["kp"],  S["p"], \
21                                S["J"], 0.0 );
22        };
23        public:
24        UIpmsmIM():UIbuilder("pmsmIM"){};
25        bdmroot* build ( Setting &S ) const {
26                IMpmsm* tmp;
27                //Switch to variants
28                if (S.exists("variant")){
29                        string var=S["variant"];
30                        if (var=="Stat"){tmp=new IMpmsmStat;}
31                        if (var=="Mf"){tmp=new IMpmsmStat;}
32                } else {
33                        tmp= new IMpmsm;
34                }
35                //Set parameters (recursively)
36                UIcall<IMpmsm*> ( S["params"], &tmp_set , tmp );
37                return tmp;
38        }       
39};
40UIREGISTER ( UIpmsmIM );
41
42//! UI for pmsm observation model
43class UIpmsmOM: public UIbuilder {
44        public:
45                UIpmsmOM():UIbuilder("pmsmOM"){};
46                bdmroot* build ( Setting &S ) const {
47                        return new OMpmsm;
48                }       
49};
50UIREGISTER ( UIpmsmOM );
51
52
53
54//!UI for pmsmDS,
55class UIpmsmDS: public UIbuilder {
56        static void tmp_set ( Setting &S, pmsmDS* DS ) {
57                //pmsmsim_set_parameters (( Rs0,  Ls0, Fmag0, Bf0, p0, kp0,  J0, Uc0, DT0,  dt0);
58                DS->set_parameters ( S["Rs"], S["Ls"], S["Fmag"], S["Bf"], S["p"], S["kp"], \
59                                     S["J"], S["Uc"], S["DT"], 1.0e-6 );
60        };
61public:
62        UIpmsmDS() :UIbuilder ( "pmsmDS" ) {};
63        bdmroot* build ( Setting &S ) const {
64                pmsmDS* tmp = new pmsmDS ( );
65                //Calling function tmp->tmp_set
66                UIcall<pmsmDS*> ( S["params"], &tmp_set , tmp );
67                //
68                if ( S.exists ( "profile" ) ) {
69                        tmp->set_profile ( S["tstep"],getvec ( S["profile"] ) );
70                }
71                else {
72                        tmp->set_profile ( 1.0, vec ( "1" ) );
73                }
74                return tmp;
75        };
76
77};
78UIREGISTER ( UIpmsmDS );
Note: See TracBrowser for help on using the browser.