1 | <?xml version='1.0' encoding='UTF-8' standalone='no'?> |
---|
2 | <doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="1.5.6"> |
---|
3 | <compounddef id="pmsm__mix_8cpp" kind="file"> |
---|
4 | <compoundname>pmsm_mix.cpp</compoundname> |
---|
5 | <includes local="no">itpp/itbase.h</includes> |
---|
6 | <includes refid="libFN_8h" local="no">stat/libFN.h</includes> |
---|
7 | <includes refid="emix_8h" local="no">stat/emix.h</includes> |
---|
8 | <includes refid="ekf__templ_8h" local="no">estim/ekf_templ.h</includes> |
---|
9 | <includes refid="libPF_8h" local="no">estim/libPF.h</includes> |
---|
10 | <includes refid="pmsm_8h" local="yes">pmsm.h</includes> |
---|
11 | <includes refid="simulator_8h" local="yes">simulator.h</includes> |
---|
12 | <includes refid="sim__profiles_8h" local="yes">sim_profiles.h</includes> |
---|
13 | <includes refid="loggers_8h" local="no">stat/loggers.h</includes> |
---|
14 | <incdepgraph> |
---|
15 | <node id="581"> |
---|
16 | <label>sim_profiles.h</label> |
---|
17 | <link refid="sim__profiles_8h-source"/> |
---|
18 | </node> |
---|
19 | <node id="582"> |
---|
20 | <label>stat/loggers.h</label> |
---|
21 | <link refid="loggers_8h"/> |
---|
22 | <childnode refid="568" relation="include"> |
---|
23 | </childnode> |
---|
24 | <childnode refid="570" relation="include"> |
---|
25 | </childnode> |
---|
26 | <childnode refid="574" relation="include"> |
---|
27 | </childnode> |
---|
28 | </node> |
---|
29 | <node id="570"> |
---|
30 | <label>libBM.h</label> |
---|
31 | <link refid="libBM_8h"/> |
---|
32 | <childnode refid="568" relation="include"> |
---|
33 | </childnode> |
---|
34 | </node> |
---|
35 | <node id="580"> |
---|
36 | <label>simulator.h</label> |
---|
37 | <link refid="simulator_8h-source"/> |
---|
38 | </node> |
---|
39 | <node id="571"> |
---|
40 | <label>stat/emix.h</label> |
---|
41 | <link refid="emix_8h"/> |
---|
42 | <childnode refid="570" relation="include"> |
---|
43 | </childnode> |
---|
44 | <childnode refid="572" relation="include"> |
---|
45 | </childnode> |
---|
46 | </node> |
---|
47 | <node id="579"> |
---|
48 | <label>pmsm.h</label> |
---|
49 | <link refid="pmsm_8h-source"/> |
---|
50 | <childnode refid="569" relation="include"> |
---|
51 | </childnode> |
---|
52 | </node> |
---|
53 | <node id="575"> |
---|
54 | <label>estim/ekf_templ.h</label> |
---|
55 | <link refid="ekf__templ_8h"/> |
---|
56 | <childnode refid="576" relation="include"> |
---|
57 | </childnode> |
---|
58 | </node> |
---|
59 | <node id="574"> |
---|
60 | <label>../itpp_ext.h</label> |
---|
61 | <link refid="itpp__ext_8h-source"/> |
---|
62 | <childnode refid="568" relation="include"> |
---|
63 | </childnode> |
---|
64 | </node> |
---|
65 | <node id="572"> |
---|
66 | <label>libEF.h</label> |
---|
67 | <link refid="libEF_8h"/> |
---|
68 | <childnode refid="568" relation="include"> |
---|
69 | </childnode> |
---|
70 | <childnode refid="573" relation="include"> |
---|
71 | </childnode> |
---|
72 | <childnode refid="570" relation="include"> |
---|
73 | </childnode> |
---|
74 | <childnode refid="574" relation="include"> |
---|
75 | </childnode> |
---|
76 | </node> |
---|
77 | <node id="578"> |
---|
78 | <label>estim/libPF.h</label> |
---|
79 | <link refid="libPF_8h"/> |
---|
80 | <childnode refid="568" relation="include"> |
---|
81 | </childnode> |
---|
82 | <childnode refid="572" relation="include"> |
---|
83 | </childnode> |
---|
84 | <childnode refid="573" relation="include"> |
---|
85 | </childnode> |
---|
86 | </node> |
---|
87 | <node id="569"> |
---|
88 | <label>stat/libFN.h</label> |
---|
89 | <link refid="libFN_8h-source"/> |
---|
90 | <childnode refid="568" relation="include"> |
---|
91 | </childnode> |
---|
92 | <childnode refid="570" relation="include"> |
---|
93 | </childnode> |
---|
94 | </node> |
---|
95 | <node id="568"> |
---|
96 | <label>itpp/itbase.h</label> |
---|
97 | </node> |
---|
98 | <node id="577"> |
---|
99 | <label>../math/chmat.h</label> |
---|
100 | <link refid="chmat_8h"/> |
---|
101 | <childnode refid="568" relation="include"> |
---|
102 | </childnode> |
---|
103 | <childnode refid="573" relation="include"> |
---|
104 | </childnode> |
---|
105 | <childnode refid="574" relation="include"> |
---|
106 | </childnode> |
---|
107 | </node> |
---|
108 | <node id="576"> |
---|
109 | <label>libKF.h</label> |
---|
110 | <link refid="libKF_8h"/> |
---|
111 | <childnode refid="568" relation="include"> |
---|
112 | </childnode> |
---|
113 | <childnode refid="569" relation="include"> |
---|
114 | </childnode> |
---|
115 | <childnode refid="572" relation="include"> |
---|
116 | </childnode> |
---|
117 | <childnode refid="577" relation="include"> |
---|
118 | </childnode> |
---|
119 | </node> |
---|
120 | <node id="573"> |
---|
121 | <label>../math/libDC.h</label> |
---|
122 | <link refid="libDC_8h"/> |
---|
123 | <childnode refid="568" relation="include"> |
---|
124 | </childnode> |
---|
125 | </node> |
---|
126 | <node id="567"> |
---|
127 | <label>work/git/mixpp/pmsm/pmsm_mix.cpp</label> |
---|
128 | <link refid="pmsm_mix.cpp"/> |
---|
129 | <childnode refid="568" relation="include"> |
---|
130 | </childnode> |
---|
131 | <childnode refid="569" relation="include"> |
---|
132 | </childnode> |
---|
133 | <childnode refid="571" relation="include"> |
---|
134 | </childnode> |
---|
135 | <childnode refid="575" relation="include"> |
---|
136 | </childnode> |
---|
137 | <childnode refid="578" relation="include"> |
---|
138 | </childnode> |
---|
139 | <childnode refid="579" relation="include"> |
---|
140 | </childnode> |
---|
141 | <childnode refid="580" relation="include"> |
---|
142 | </childnode> |
---|
143 | <childnode refid="581" relation="include"> |
---|
144 | </childnode> |
---|
145 | <childnode refid="582" relation="include"> |
---|
146 | </childnode> |
---|
147 | </node> |
---|
148 | </incdepgraph> |
---|
149 | <sectiondef kind="func"> |
---|
150 | <memberdef kind="function" id="pmsm__mix_8cpp_1e66f6b31b5ad750f1fe042a706a4e3d4" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual"> |
---|
151 | <type>int</type> |
---|
152 | <definition>int main</definition> |
---|
153 | <argsstring>()</argsstring> |
---|
154 | <name>main</name> |
---|
155 | <briefdescription> |
---|
156 | </briefdescription> |
---|
157 | <detaileddescription> |
---|
158 | </detaileddescription> |
---|
159 | <inbodydescription> |
---|
160 | </inbodydescription> |
---|
161 | <location file="/home/smidl/work/git/mixpp/pmsm/pmsm_mix.cpp" line="27" bodyfile="/home/smidl/work/git/mixpp/pmsm/pmsm_mix.cpp" bodystart="27" bodyend="131"/> |
---|
162 | </memberdef> |
---|
163 | </sectiondef> |
---|
164 | <briefdescription> |
---|
165 | <para>Models for synchronous electric drive using IT++ and BDM. </para> </briefdescription> |
---|
166 | <detaileddescription> |
---|
167 | <para><simplesect kind="author"><para>Vaclav Smidl.</para></simplesect> |
---|
168 | ----------------------------------- BDM++ - C++ library for Bayesian Decision Making under Uncertainty</para><para>Using IT++ for numerical operations ----------------------------------- </para> </detaileddescription> |
---|
169 | <programlisting> |
---|
170 | <codeline lineno="1"></codeline> |
---|
171 | <codeline lineno="13"><highlight class="preprocessor">#include<sp/><itpp/itbase.h></highlight><highlight class="normal"></highlight></codeline> |
---|
172 | <codeline lineno="14"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/><stat/libFN.h></highlight><highlight class="normal"></highlight></codeline> |
---|
173 | <codeline lineno="15"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/><<ref refid="emix_8h" kindref="compound" tooltip="Probability distributions for Mixtures of pdfs.">stat/emix.h</ref>></highlight><highlight class="normal"></highlight></codeline> |
---|
174 | <codeline lineno="16"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/><<ref refid="ekf__templ_8h" kindref="compound" tooltip="Bayesian Filtering for linear Gaussian models (Kalman Filter) and extensions.">estim/ekf_templ.h</ref>></highlight><highlight class="normal"></highlight></codeline> |
---|
175 | <codeline lineno="17"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/><<ref refid="libPF_8h" kindref="compound" tooltip="Bayesian Filtering using stochastic sampling (Particle Filters).">estim/libPF.h</ref>></highlight><highlight class="normal"></highlight></codeline> |
---|
176 | <codeline lineno="18"><highlight class="normal"></highlight></codeline> |
---|
177 | <codeline lineno="19"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>"pmsm.h"</highlight><highlight class="normal"></highlight></codeline> |
---|
178 | <codeline lineno="20"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>"simulator.h"</highlight><highlight class="normal"></highlight></codeline> |
---|
179 | <codeline lineno="21"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>"sim_profiles.h"</highlight><highlight class="normal"></highlight></codeline> |
---|
180 | <codeline lineno="22"><highlight class="normal"></highlight></codeline> |
---|
181 | <codeline lineno="23"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/><<ref refid="loggers_8h" kindref="compound" tooltip="Loggers for storing results of experiments.">stat/loggers.h</ref>></highlight><highlight class="normal"></highlight></codeline> |
---|
182 | <codeline lineno="24"><highlight class="normal"></highlight></codeline> |
---|
183 | <codeline lineno="25"><highlight class="normal"></highlight><highlight class="keyword">using<sp/>namespace<sp/></highlight><highlight class="normal">itpp;</highlight></codeline> |
---|
184 | <codeline lineno="26"><highlight class="normal"></highlight></codeline> |
---|
185 | <codeline lineno="27"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/><ref refid="sim__var_8cpp_1e66f6b31b5ad750f1fe042a706a4e3d4" kindref="member" tooltip="Extended Kalman filter with unknown Q.">main</ref>()<sp/>{</highlight></codeline> |
---|
186 | <codeline lineno="28"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Kalman<sp/>filter</highlight><highlight class="normal"></highlight></codeline> |
---|
187 | <codeline lineno="29"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>Ndat<sp/>=<sp/>90000;</highlight></codeline> |
---|
188 | <codeline lineno="30"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>h<sp/>=<sp/>1e-6;</highlight></codeline> |
---|
189 | <codeline lineno="31"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>Nsimstep<sp/>=<sp/>125;</highlight></codeline> |
---|
190 | <codeline lineno="32"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>Npar<sp/>=<sp/>10;</highlight></codeline> |
---|
191 | <codeline lineno="33"><highlight class="normal"></highlight></codeline> |
---|
192 | <codeline lineno="34"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classdirfilelog" kindref="compound" tooltip="Logging into dirfile with buffer in memory.">dirfilelog</ref><sp/>L(</highlight><highlight class="stringliteral">"exp/pmsm_mix"</highlight><highlight class="normal">,1000);</highlight></codeline> |
---|
193 | <codeline lineno="35"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//memlog<sp/>L(Ndat);</highlight><highlight class="normal"></highlight></codeline> |
---|
194 | <codeline lineno="36"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight></codeline> |
---|
195 | <codeline lineno="37"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>SET<sp/>SIMULATOR</highlight><highlight class="normal"></highlight></codeline> |
---|
196 | <codeline lineno="38"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>pmsmsim_set_parameters<sp/>(<sp/>0.28,0.003465,0.1989,0.0,4,1.5,0.04,<sp/>200.,<sp/>3e-6,<sp/>h<sp/>);</highlight></codeline> |
---|
197 | <codeline lineno="39"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>Ww<sp/>=<sp/>0.0;</highlight></codeline> |
---|
198 | <codeline lineno="40"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>vec<sp/>dt<sp/>(<sp/>2<sp/>);</highlight></codeline> |
---|
199 | <codeline lineno="41"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>vec<sp/>ut<sp/>(<sp/>2<sp/>);</highlight></codeline> |
---|
200 | <codeline lineno="42"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>vec<sp/>xtm=zeros<sp/>(<sp/>4<sp/>);</highlight></codeline> |
---|
201 | <codeline lineno="43"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>vec<sp/>xdif=zeros<sp/>(<sp/>4<sp/>);</highlight></codeline> |
---|
202 | <codeline lineno="44"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>vec<sp/>xt<sp/>(<sp/>4<sp/>);</highlight></codeline> |
---|
203 | <codeline lineno="45"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>vec<sp/>ddif=zeros(2);</highlight></codeline> |
---|
204 | <codeline lineno="46"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classIMpmsm" kindref="compound" tooltip="State evolution model for a PMSM drive and its derivative with respect to $.">IMpmsm</ref><sp/>fxu;</highlight></codeline> |
---|
205 | <codeline lineno="47"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Rs<sp/><sp/><sp/><sp/>Ls<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>dt<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Fmag(Ypm)<sp/>kp<sp/><sp/><sp/>p<sp/><sp/><sp/><sp/>J<sp/><sp/><sp/><sp/><sp/>Bf(Mz)</highlight><highlight class="normal"></highlight></codeline> |
---|
206 | <codeline lineno="48"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>fxu.<ref refid="classIMpmsm_142818f3426d99fecb7e97be8ffe2e228" kindref="member" tooltip="Set mechanical and electrical variables.">set_parameters</ref><sp/>(<sp/>0.28,<sp/>0.003465,<sp/>Nsimstep*h,<sp/>0.1989,<sp/><sp/><sp/>1.5<sp/>,4.0,<sp/>0.04,<sp/>0.0<sp/>);</highlight></codeline> |
---|
207 | <codeline lineno="49"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classOMpmsm" kindref="compound" tooltip="Observation model for PMSM drive and its derivative with respect to .">OMpmsm</ref><sp/>hxu;</highlight></codeline> |
---|
208 | <codeline lineno="50"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>mat<sp/>Qt=zeros<sp/>(<sp/>4,4<sp/>);</highlight></codeline> |
---|
209 | <codeline lineno="51"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>mat<sp/>Rt=zeros<sp/>(<sp/>2,2<sp/>);</highlight></codeline> |
---|
210 | <codeline lineno="52"><highlight class="normal"></highlight></codeline> |
---|
211 | <codeline lineno="53"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>ESTIMATORS</highlight><highlight class="normal"></highlight></codeline> |
---|
212 | <codeline lineno="54"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>vec<sp/>mu0=<sp/></highlight><highlight class="stringliteral">"0.0<sp/>0.0<sp/>0.0<sp/>0.0"</highlight><highlight class="normal">;</highlight></codeline> |
---|
213 | <codeline lineno="55"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>vec<sp/>Qdiag<sp/>(<sp/></highlight><highlight class="stringliteral">"62<sp/>66<sp/>454<sp/>0.03"</highlight><highlight class="normal"><sp/>);<sp/></highlight><highlight class="comment">//zdenek:<sp/>0.01<sp/>0.01<sp/>0.0001<sp/>0.0001</highlight><highlight class="normal"></highlight></codeline> |
---|
214 | <codeline lineno="56"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>vec<sp/>Rdiag<sp/>(<sp/></highlight><highlight class="stringliteral">"100<sp/>100"</highlight><highlight class="normal"><sp/>);<sp/></highlight><highlight class="comment">//var(diff(xth))<sp/>=<sp/>"0.034<sp/>0.034"</highlight><highlight class="normal"></highlight></codeline> |
---|
215 | <codeline lineno="57"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>mat<sp/>Q<sp/>=diag(<sp/>Qdiag<sp/>);</highlight></codeline> |
---|
216 | <codeline lineno="58"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>mat<sp/>R<sp/>=diag<sp/>(<sp/>Rdiag<sp/>);</highlight></codeline> |
---|
217 | <codeline lineno="59"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classEKFfull" kindref="compound" tooltip="Extended Kalman Filter in full matrices.">EKFfull</ref><sp/>Efix<sp/>(<sp/>rx,ry,ru<sp/>);</highlight></codeline> |
---|
218 | <codeline lineno="60"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Efix.set_est<sp/>(<sp/>mu0,<sp/>1*eye<sp/>(<sp/>4<sp/>)<sp/><sp/>);</highlight></codeline> |
---|
219 | <codeline lineno="61"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Efix.set_parameters<sp/>(<sp/>&fxu,&hxu,Q,R);</highlight></codeline> |
---|
220 | <codeline lineno="62"><highlight class="normal"></highlight></codeline> |
---|
221 | <codeline lineno="63"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classRV" kindref="compound" tooltip="Class representing variables, most often random variables.">RV</ref><sp/>rQR(<sp/></highlight><highlight class="stringliteral">"{Q<sp/>R<sp/>}"</highlight><highlight class="normal">,<sp/></highlight><highlight class="stringliteral">"4<sp/>2<sp/>"</highlight><highlight class="normal">);</highlight></codeline> |
---|
222 | <codeline lineno="64"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classEKFful__unQR" kindref="compound" tooltip="Extended Kalman filter with unknown Q and R.">EKFful_unQR</ref><sp/>EKU<sp/>(rx,ry,ru,rQR);</highlight></codeline> |
---|
223 | <codeline lineno="65"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>EKU.set_est<sp/>(<sp/>mu0,<sp/><sp/>1*ones<sp/>(<sp/>4<sp/>)<sp/>);</highlight></codeline> |
---|
224 | <codeline lineno="66"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>EKU.set_parameters<sp/>(<sp/>&fxu,&hxu,diag(Qdiag),diag(Rdiag)<sp/>);</highlight></codeline> |
---|
225 | <codeline lineno="67"><highlight class="normal"></highlight></codeline> |
---|
226 | <codeline lineno="68"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//QU<sp/>model</highlight><highlight class="normal"></highlight></codeline> |
---|
227 | <codeline lineno="69"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classegamma" kindref="compound" tooltip="Gamma posterior density.">egamma</ref><sp/>Gcom(rQR);Gcom.set_parameters(ones(6),vec(</highlight><highlight class="stringliteral">"1<sp/>1<sp/>1e4<sp/>1e10<sp/>1<sp/>1"</highlight><highlight class="normal">));</highlight></codeline> |
---|
228 | <codeline lineno="70"><highlight class="normal"></highlight><highlight class="comment">/*<sp/><sp/><sp/><sp/><sp/><sp/>cout<sp/><<<sp/>Gcom.mean()<sp/><<endl;</highlight></codeline> |
---|
229 | <codeline lineno="71"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>cout<sp/><<<sp/>Gcom.sample()<sp/><<endl;*/</highlight><highlight class="normal"></highlight></codeline> |
---|
230 | <codeline lineno="72"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classeuni" kindref="compound" tooltip="Uniform distributed density on a rectangular support.">euni</ref><sp/>Ucom(rQR);<sp/>Ucom.set_parameters(zeros(6),vec(</highlight><highlight class="stringliteral">"60<sp/>60<sp/>453<sp/>0.03<sp/>100<sp/>100"</highlight><highlight class="normal">));</highlight></codeline> |
---|
231 | <codeline lineno="73"><highlight class="normal"></highlight><highlight class="comment">/*<sp/><sp/><sp/><sp/><sp/><sp/>cout<sp/><<<sp/>Ucom.mean()<sp/><<endl;</highlight></codeline> |
---|
232 | <codeline lineno="74"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>cout<sp/><<<sp/>Ucom.sample()<sp/><<endl;*/</highlight><highlight class="normal"></highlight></codeline> |
---|
233 | <codeline lineno="75"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Array<epdf*><sp/>Coms(2);</highlight></codeline> |
---|
234 | <codeline lineno="76"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Coms(0)<sp/>=<sp/>&Gcom;</highlight></codeline> |
---|
235 | <codeline lineno="77"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Coms(1)<sp/>=<sp/>&Ucom;</highlight></codeline> |
---|
236 | <codeline lineno="78"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classemix" kindref="compound" tooltip="Mixture of epdfs.">emix</ref><sp/>Eevol(rQR);<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Eevol.set_parameters(</highlight><highlight class="stringliteral">"0.1<sp/>0.9"</highlight><highlight class="normal">,<sp/>Coms);</highlight></codeline> |
---|
237 | <codeline lineno="79"><highlight class="normal"></highlight><highlight class="comment">//<sp/><sp/><sp/><sp/><sp/><sp/>cout<sp/><<<sp/>Eevol.sample()<sp/><<endl;</highlight><highlight class="normal"></highlight></codeline> |
---|
238 | <codeline lineno="80"><highlight class="normal"></highlight></codeline> |
---|
239 | <codeline lineno="81"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classmepdf" kindref="compound" tooltip="Unconditional mpdf, allows using epdf in the role of mpdf.">mepdf</ref><sp/>evolQR(Eevol);</highlight></codeline> |
---|
240 | <codeline lineno="82"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classMPF" kindref="compound" tooltip="Marginalized Particle filter.">MPF<EKFful_unQR></ref><sp/>M<sp/>(<sp/>rx,rQR,<sp/>evolQR,<sp/>evolQR,<sp/>Npar,<sp/>EKU<sp/>);</highlight></codeline> |
---|
241 | <codeline lineno="83"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>M.set_est<sp/>(<sp/>evolQR._epdf()<sp/>);</highlight></codeline> |
---|
242 | <codeline lineno="84"><highlight class="normal"></highlight></codeline> |
---|
243 | <codeline lineno="85"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classepdf" kindref="compound" tooltip="Probability density function with numerical statistics, e.g. posterior density.">epdf</ref>&<sp/>Efix_ep<sp/>=<sp/>Efix._epdf();</highlight></codeline> |
---|
244 | <codeline lineno="86"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classepdf" kindref="compound" tooltip="Probability density function with numerical statistics, e.g. posterior density.">epdf</ref>&<sp/>M_ep<sp/>=<sp/>M._epdf();</highlight></codeline> |
---|
245 | <codeline lineno="87"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight></codeline> |
---|
246 | <codeline lineno="88"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//LOG</highlight><highlight class="normal"></highlight></codeline> |
---|
247 | <codeline lineno="89"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classRV" kindref="compound" tooltip="Class representing variables, most often random variables.">RV</ref><sp/>rUD(<sp/></highlight><highlight class="stringliteral">"{u_isa<sp/>u_isb<sp/>i_isa<sp/>i_isb<sp/>}"</highlight><highlight class="normal">);</highlight></codeline> |
---|
248 | <codeline lineno="90"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>X_log<sp/>=<sp/>L.add(rx,</highlight><highlight class="stringliteral">"X"</highlight><highlight class="normal">);</highlight></codeline> |
---|
249 | <codeline lineno="91"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>Efix_log<sp/>=<sp/>L.add(rx,</highlight><highlight class="stringliteral">"XF"</highlight><highlight class="normal">);</highlight></codeline> |
---|
250 | <codeline lineno="92"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classRV" kindref="compound" tooltip="Class representing variables, most often random variables.">RV</ref><sp/>tmp=concat(rQR,rx);</highlight></codeline> |
---|
251 | <codeline lineno="93"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>M_log<sp/>=<sp/>L.add(tmp,</highlight><highlight class="stringliteral">"M"</highlight><highlight class="normal">);</highlight></codeline> |
---|
252 | <codeline lineno="94"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>L.init();</highlight></codeline> |
---|
253 | <codeline lineno="95"><highlight class="normal"></highlight></codeline> |
---|
254 | <codeline lineno="96"><highlight class="normal"></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>dum=0.0;</highlight></codeline> |
---|
255 | <codeline lineno="97"><highlight class="normal">vec<sp/>dumvec<sp/>=<sp/>vec_1(1.0);</highlight></codeline> |
---|
256 | <codeline lineno="98"><highlight class="normal">vec<sp/>z=<sp/><sp/>evolQR.samplecond(dumvec,dum)<sp/>;</highlight></codeline> |
---|
257 | <codeline lineno="99"><highlight class="normal">cout<sp/><<<sp/>z<sp/><<<sp/>endl;</highlight></codeline> |
---|
258 | <codeline lineno="100"><highlight class="normal"></highlight></codeline> |
---|
259 | <codeline lineno="101"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>tK=1;tK<Ndat;tK++<sp/>)<sp/>{</highlight></codeline> |
---|
260 | <codeline lineno="102"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//Number<sp/>of<sp/>steps<sp/>of<sp/>a<sp/>simulator<sp/>for<sp/>one<sp/>step<sp/>of<sp/>Kalman</highlight><highlight class="normal"></highlight></codeline> |
---|
261 | <codeline lineno="103"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>ii=0;<sp/>ii<Nsimstep;ii++<sp/>)<sp/>{</highlight></codeline> |
---|
262 | <codeline lineno="104"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>sim_profile_steps1<sp/>(<sp/>Ww,<sp/></highlight><highlight class="keyword">true</highlight><highlight class="normal"><sp/>);</highlight></codeline> |
---|
263 | <codeline lineno="105"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>pmsmsim_step<sp/>(<sp/>Ww<sp/>);</highlight></codeline> |
---|
264 | <codeline lineno="106"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>};</highlight></codeline> |
---|
265 | <codeline lineno="107"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>simulation<sp/>via<sp/>deterministic<sp/>model</highlight><highlight class="normal"></highlight></codeline> |
---|
266 | <codeline lineno="108"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ut<sp/>(<sp/>0<sp/>)<sp/>=<sp/>KalmanObs[0];</highlight></codeline> |
---|
267 | <codeline lineno="109"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ut<sp/>(<sp/>1<sp/>)<sp/>=<sp/>KalmanObs[1];</highlight></codeline> |
---|
268 | <codeline lineno="110"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>dt<sp/>(<sp/>0<sp/>)<sp/>=<sp/>KalmanObs[2];</highlight></codeline> |
---|
269 | <codeline lineno="111"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>dt<sp/>(<sp/>1<sp/>)<sp/>=<sp/>KalmanObs[3];</highlight></codeline> |
---|
270 | <codeline lineno="112"><highlight class="normal"></highlight></codeline> |
---|
271 | <codeline lineno="113"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//ESTIMATE</highlight><highlight class="normal"></highlight></codeline> |
---|
272 | <codeline lineno="114"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Efix.bayes(concat(dt,ut));</highlight></codeline> |
---|
273 | <codeline lineno="115"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//</highlight><highlight class="normal"></highlight></codeline> |
---|
274 | <codeline lineno="116"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>M.bayes(concat(dt,ut));</highlight></codeline> |
---|
275 | <codeline lineno="117"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight></codeline> |
---|
276 | <codeline lineno="118"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//LOG</highlight><highlight class="normal"></highlight></codeline> |
---|
277 | <codeline lineno="119"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>L.logit(X_log,<sp/><sp/>vec(x,4));<sp/></highlight><highlight class="comment">//vec<sp/>from<sp/>C-array</highlight><highlight class="normal"></highlight></codeline> |
---|
278 | <codeline lineno="120"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>L.logit(Efix_log,<sp/>Efix_ep.<ref refid="classepdf_1bf0a070a8f3e67a93604ca724638b870" kindref="member" tooltip="return expected value">mean</ref>()<sp/>);<sp/></highlight></codeline> |
---|
279 | <codeline lineno="121"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>L.logit(M_log,<sp/><sp/>M_ep.<ref refid="classepdf_1bf0a070a8f3e67a93604ca724638b870" kindref="member" tooltip="return expected value">mean</ref>()<sp/>);<sp/></highlight></codeline> |
---|
280 | <codeline lineno="122"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight></codeline> |
---|
281 | <codeline lineno="123"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>L.step();</highlight></codeline> |
---|
282 | <codeline lineno="124"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> |
---|
283 | <codeline lineno="125"><highlight class="normal"></highlight></codeline> |
---|
284 | <codeline lineno="126"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>L.finalize();</highlight></codeline> |
---|
285 | <codeline lineno="127"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//L.itsave("sim_var.it");<sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="normal"></highlight></codeline> |
---|
286 | <codeline lineno="128"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight></codeline> |
---|
287 | <codeline lineno="129"><highlight class="normal"></highlight></codeline> |
---|
288 | <codeline lineno="130"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0;</highlight></codeline> |
---|
289 | <codeline lineno="131"><highlight class="normal">}</highlight></codeline> |
---|
290 | <codeline lineno="132"><highlight class="normal"></highlight></codeline> |
---|
291 | </programlisting> |
---|
292 | <location file="/home/smidl/work/git/mixpp/pmsm/pmsm_mix.cpp"/> |
---|
293 | </compounddef> |
---|
294 | </doxygen> |
---|