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__sim2_8cpp" kind="file"> |
---|
4 | <compoundname>pmsm_sim2.cpp</compoundname> |
---|
5 | <includes local="no">itpp/itbase.h</includes> |
---|
6 | <includes refid="libKF_8h" local="no">estim/libKF.h</includes> |
---|
7 | <includes refid="libPF_8h" local="no">estim/libPF.h</includes> |
---|
8 | <includes refid="libFN_8h" local="no">stat/libFN.h</includes> |
---|
9 | <includes refid="loggers_8h" local="no">stat/loggers.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 | <incdepgraph> |
---|
14 | <node id="610"> |
---|
15 | <label>sim_profiles.h</label> |
---|
16 | <link refid="sim__profiles_8h-source"/> |
---|
17 | </node> |
---|
18 | <node id="607"> |
---|
19 | <label>stat/loggers.h</label> |
---|
20 | <link refid="loggers_8h"/> |
---|
21 | <childnode refid="598" relation="include"> |
---|
22 | </childnode> |
---|
23 | <childnode refid="601" relation="include"> |
---|
24 | </childnode> |
---|
25 | <childnode refid="604" relation="include"> |
---|
26 | </childnode> |
---|
27 | </node> |
---|
28 | <node id="601"> |
---|
29 | <label>libBM.h</label> |
---|
30 | <link refid="libBM_8h"/> |
---|
31 | <childnode refid="598" relation="include"> |
---|
32 | </childnode> |
---|
33 | </node> |
---|
34 | <node id="609"> |
---|
35 | <label>simulator.h</label> |
---|
36 | <link refid="simulator_8h-source"/> |
---|
37 | </node> |
---|
38 | <node id="608"> |
---|
39 | <label>pmsm.h</label> |
---|
40 | <link refid="pmsm_8h-source"/> |
---|
41 | <childnode refid="600" relation="include"> |
---|
42 | </childnode> |
---|
43 | </node> |
---|
44 | <node id="604"> |
---|
45 | <label>../itpp_ext.h</label> |
---|
46 | <link refid="itpp__ext_8h-source"/> |
---|
47 | <childnode refid="598" relation="include"> |
---|
48 | </childnode> |
---|
49 | </node> |
---|
50 | <node id="602"> |
---|
51 | <label>../stat/libEF.h</label> |
---|
52 | <link refid="libEF_8h"/> |
---|
53 | <childnode refid="598" relation="include"> |
---|
54 | </childnode> |
---|
55 | <childnode refid="603" relation="include"> |
---|
56 | </childnode> |
---|
57 | <childnode refid="601" relation="include"> |
---|
58 | </childnode> |
---|
59 | <childnode refid="604" relation="include"> |
---|
60 | </childnode> |
---|
61 | </node> |
---|
62 | <node id="606"> |
---|
63 | <label>estim/libPF.h</label> |
---|
64 | <link refid="libPF_8h"/> |
---|
65 | <childnode refid="598" relation="include"> |
---|
66 | </childnode> |
---|
67 | <childnode refid="602" relation="include"> |
---|
68 | </childnode> |
---|
69 | <childnode refid="603" relation="include"> |
---|
70 | </childnode> |
---|
71 | </node> |
---|
72 | <node id="600"> |
---|
73 | <label>../stat/libFN.h</label> |
---|
74 | <link refid="libFN_8h-source"/> |
---|
75 | <childnode refid="598" relation="include"> |
---|
76 | </childnode> |
---|
77 | <childnode refid="601" relation="include"> |
---|
78 | </childnode> |
---|
79 | </node> |
---|
80 | <node id="598"> |
---|
81 | <label>itpp/itbase.h</label> |
---|
82 | </node> |
---|
83 | <node id="605"> |
---|
84 | <label>../math/chmat.h</label> |
---|
85 | <link refid="chmat_8h"/> |
---|
86 | <childnode refid="598" relation="include"> |
---|
87 | </childnode> |
---|
88 | <childnode refid="603" relation="include"> |
---|
89 | </childnode> |
---|
90 | <childnode refid="604" relation="include"> |
---|
91 | </childnode> |
---|
92 | </node> |
---|
93 | <node id="597"> |
---|
94 | <label>work/git/mixpp/pmsm/pmsm_sim2.cpp</label> |
---|
95 | <link refid="pmsm_sim2.cpp"/> |
---|
96 | <childnode refid="598" relation="include"> |
---|
97 | </childnode> |
---|
98 | <childnode refid="599" relation="include"> |
---|
99 | </childnode> |
---|
100 | <childnode refid="606" relation="include"> |
---|
101 | </childnode> |
---|
102 | <childnode refid="600" relation="include"> |
---|
103 | </childnode> |
---|
104 | <childnode refid="607" relation="include"> |
---|
105 | </childnode> |
---|
106 | <childnode refid="608" relation="include"> |
---|
107 | </childnode> |
---|
108 | <childnode refid="609" relation="include"> |
---|
109 | </childnode> |
---|
110 | <childnode refid="610" relation="include"> |
---|
111 | </childnode> |
---|
112 | </node> |
---|
113 | <node id="599"> |
---|
114 | <label>estim/libKF.h</label> |
---|
115 | <link refid="libKF_8h"/> |
---|
116 | <childnode refid="598" relation="include"> |
---|
117 | </childnode> |
---|
118 | <childnode refid="600" relation="include"> |
---|
119 | </childnode> |
---|
120 | <childnode refid="602" relation="include"> |
---|
121 | </childnode> |
---|
122 | <childnode refid="605" relation="include"> |
---|
123 | </childnode> |
---|
124 | </node> |
---|
125 | <node id="603"> |
---|
126 | <label>../math/libDC.h</label> |
---|
127 | <link refid="libDC_8h"/> |
---|
128 | <childnode refid="598" relation="include"> |
---|
129 | </childnode> |
---|
130 | </node> |
---|
131 | </incdepgraph> |
---|
132 | <innerclass refid="classEKF__unQ" prot="public">EKF_unQ</innerclass> |
---|
133 | <innerclass refid="classEKF__unQful" prot="public">EKF_unQful</innerclass> |
---|
134 | <sectiondef kind="func"> |
---|
135 | <memberdef kind="function" id="pmsm__sim2_8cpp_1e66f6b31b5ad750f1fe042a706a4e3d4" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual"> |
---|
136 | <type>int</type> |
---|
137 | <definition>int main</definition> |
---|
138 | <argsstring>()</argsstring> |
---|
139 | <name>main</name> |
---|
140 | <briefdescription> |
---|
141 | </briefdescription> |
---|
142 | <detaileddescription> |
---|
143 | </detaileddescription> |
---|
144 | <inbodydescription> |
---|
145 | </inbodydescription> |
---|
146 | <location file="/home/smidl/work/git/mixpp/pmsm/pmsm_sim2.cpp" line="69" bodyfile="/home/smidl/work/git/mixpp/pmsm/pmsm_sim2.cpp" bodystart="69" bodyend="151"/> |
---|
147 | </memberdef> |
---|
148 | </sectiondef> |
---|
149 | <briefdescription> |
---|
150 | </briefdescription> |
---|
151 | <detaileddescription> |
---|
152 | </detaileddescription> |
---|
153 | <programlisting> |
---|
154 | <codeline lineno="1"><highlight class="comment">/*</highlight></codeline> |
---|
155 | <codeline lineno="2"><highlight class="comment"><sp/><sp/>\file</highlight></codeline> |
---|
156 | <codeline lineno="3"><highlight class="comment"><sp/><sp/>\brief<sp/>Models<sp/>for<sp/>synchronous<sp/>electric<sp/>drive<sp/>using<sp/>IT++<sp/>and<sp/>BDM</highlight></codeline> |
---|
157 | <codeline lineno="4"><highlight class="comment"><sp/><sp/>\author<sp/>Vaclav<sp/>Smidl.</highlight></codeline> |
---|
158 | <codeline lineno="5"><highlight class="comment"></highlight></codeline> |
---|
159 | <codeline lineno="6"><highlight class="comment"><sp/><sp/>-----------------------------------</highlight></codeline> |
---|
160 | <codeline lineno="7"><highlight class="comment"><sp/><sp/>BDM++<sp/>-<sp/>C++<sp/>library<sp/>for<sp/>Bayesian<sp/>Decision<sp/>Making<sp/>under<sp/>Uncertainty</highlight></codeline> |
---|
161 | <codeline lineno="8"><highlight class="comment"></highlight></codeline> |
---|
162 | <codeline lineno="9"><highlight class="comment"><sp/><sp/>Using<sp/>IT++<sp/>for<sp/>numerical<sp/>operations</highlight></codeline> |
---|
163 | <codeline lineno="10"><highlight class="comment"><sp/><sp/>-----------------------------------</highlight></codeline> |
---|
164 | <codeline lineno="11"><highlight class="comment">*/</highlight><highlight class="normal"></highlight></codeline> |
---|
165 | <codeline lineno="12"><highlight class="normal"></highlight></codeline> |
---|
166 | <codeline lineno="13"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/><itpp/itbase.h></highlight><highlight class="normal"></highlight></codeline> |
---|
167 | <codeline lineno="14"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/><<ref refid="libKF_8h" kindref="compound" tooltip="Bayesian Filtering for linear Gaussian models (Kalman Filter) and extensions.">estim/libKF.h</ref>></highlight><highlight class="normal"></highlight></codeline> |
---|
168 | <codeline lineno="15"><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> |
---|
169 | <codeline lineno="16"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/><stat/libFN.h></highlight><highlight class="normal"></highlight></codeline> |
---|
170 | <codeline lineno="17"><highlight class="normal"></highlight></codeline> |
---|
171 | <codeline lineno="18"><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> |
---|
172 | <codeline lineno="19"><highlight class="normal"></highlight></codeline> |
---|
173 | <codeline lineno="20"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>"pmsm.h"</highlight><highlight class="normal"></highlight></codeline> |
---|
174 | <codeline lineno="21"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>"simulator.h"</highlight><highlight class="normal"></highlight></codeline> |
---|
175 | <codeline lineno="22"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>"sim_profiles.h"</highlight><highlight class="normal"></highlight></codeline> |
---|
176 | <codeline lineno="23"><highlight class="normal"></highlight></codeline> |
---|
177 | <codeline lineno="24"><highlight class="normal"></highlight><highlight class="keyword">using<sp/>namespace<sp/></highlight><highlight class="normal">itpp;</highlight></codeline> |
---|
178 | <codeline lineno="26"><highlight class="keyword">class<sp/></highlight><highlight class="normal"><ref refid="classEKF__unQ" kindref="compound" tooltip="Extended Kalman filter with unknown Q.">EKF_unQ</ref><sp/>:<sp/></highlight><highlight class="keyword">public</highlight><highlight class="normal"><sp/><ref refid="classEKFCh" kindref="compound" tooltip="Extended Kalman Filter in Square root.">EKFCh</ref><sp/>,<sp/></highlight><highlight class="keyword">public</highlight><highlight class="normal"><sp/><ref refid="classBMcond" kindref="compound" tooltip="Conditional Bayesian Filter.">BMcond</ref><sp/>{</highlight></codeline> |
---|
179 | <codeline lineno="27"><highlight class="normal"></highlight><highlight class="keyword">public</highlight><highlight class="normal">:</highlight></codeline> |
---|
180 | <codeline lineno="29" refid="classEKF__unQ_1159eaaa5a05c5ceecdaa20956a307244" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classEKF__unQ_1159eaaa5a05c5ceecdaa20956a307244" kindref="member" tooltip="Default constructor.">EKF_unQ</ref><sp/>(<sp/><ref refid="classRV" kindref="compound" tooltip="Class representing variables, most often random variables.">RV</ref><sp/>rx,<sp/><ref refid="classRV" kindref="compound" tooltip="Class representing variables, most often random variables.">RV</ref><sp/>ry,<ref refid="classRV" kindref="compound" tooltip="Class representing variables, most often random variables.">RV</ref><sp/>ru,<ref refid="classRV" kindref="compound" tooltip="Class representing variables, most often random variables.">RV</ref><sp/>rQ<sp/>)<sp/>:<ref refid="classEKFCh" kindref="compound" tooltip="Extended Kalman Filter in Square root.">EKFCh</ref><sp/>(<sp/>rx,ry,ru<sp/>),<ref refid="classBMcond" kindref="compound" tooltip="Conditional Bayesian Filter.">BMcond</ref><sp/>(<sp/>rQ<sp/>)<sp/>{};</highlight></codeline> |
---|
181 | <codeline lineno="30" refid="classEKF__unQ_1cd06a8c662da244cf61bb5bd39688c99" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classEKF__unQ_1cd06a8c662da244cf61bb5bd39688c99" kindref="member" tooltip="Substitute val for rvc.">condition</ref><sp/>(<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>vec<sp/>&Q0<sp/>)<sp/>{</highlight></codeline> |
---|
182 | <codeline lineno="31"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classKalman_19b69015c800eb93f3ee49da23a6f55d9" kindref="member" tooltip="Matrix Q in square-root form.">Q</ref>.<ref refid="classchmat_1a4fc7f9b0539b97c414442a22f3db6e8" kindref="member" tooltip="Access functions.">setD</ref><sp/>(<sp/>Q0,0<sp/>);</highlight></codeline> |
---|
183 | <codeline lineno="32"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//from<sp/>EKF</highlight><highlight class="normal"></highlight></codeline> |
---|
184 | <codeline lineno="33"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classKalmanCh_194ee9da75b0e0f632e4a354988ca3798" kindref="member" tooltip="pre array (triangular matrix)">preA</ref>.set_submatrix<sp/>(<sp/><ref refid="classKalman_1ba17b956df1e38b31fbbc299c8213b6a" kindref="member" tooltip="cache of rvy.count()">dimy</ref>+<ref refid="classKalman_139c8c403b46fa3b8c7da77cb2e3729eb" kindref="member" tooltip="cache of rv.count()">dimx</ref>,<ref refid="classKalman_1ba17b956df1e38b31fbbc299c8213b6a" kindref="member" tooltip="cache of rvy.count()">dimy</ref>,<ref refid="classKalman_19b69015c800eb93f3ee49da23a6f55d9" kindref="member" tooltip="Matrix Q in square-root form.">Q</ref>.<ref refid="classchmat_19c50d31c999d85d8e9d8cf2b69b6ac8c" kindref="member" tooltip="Access function.">_Ch</ref>()<sp/>);</highlight></codeline> |
---|
185 | <codeline lineno="34"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>};</highlight></codeline> |
---|
186 | <codeline lineno="35"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>bayes(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>vec<sp/>dt){</highlight></codeline> |
---|
187 | <codeline lineno="36"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classEKFCh_196f6edda324a0b7ef8b4e86cc7af60c1" kindref="member" tooltip="Here dt = [yt;ut] of appropriate dimensions.">EKFCh::bayes</ref>(dt);</highlight></codeline> |
---|
188 | <codeline lineno="37"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight></codeline> |
---|
189 | <codeline lineno="38"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>vec<sp/>xtrue(4);</highlight></codeline> |
---|
190 | <codeline lineno="39"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//UGLY<sp/>HACK!!!<sp/>reliance<sp/>on<sp/>a<sp/>predictor!!</highlight><highlight class="normal"></highlight></codeline> |
---|
191 | <codeline lineno="40"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>xtrue(0)=x[0];</highlight></codeline> |
---|
192 | <codeline lineno="41"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>xtrue(1)=x[1];</highlight></codeline> |
---|
193 | <codeline lineno="42"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>xtrue(2)=x[2];</highlight></codeline> |
---|
194 | <codeline lineno="43"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>xtrue(3)=x[3];</highlight></codeline> |
---|
195 | <codeline lineno="44"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight></codeline> |
---|
196 | <codeline lineno="45"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classBM_15623fef6572a08c2b53b8c87b82dc979" kindref="member" tooltip="Logarithm of marginalized data likelihood.">ll</ref><sp/>=<sp/>-0.5*<sp/>(<sp/>4<sp/>*<sp/>1.83787706640935<sp/>+<ref refid="classKalman_19fb808cc94a4c2652e1fb93be9bb7dcf" kindref="member" tooltip="cache of est.R">_P</ref>.<ref refid="classchmat_1b504ca818203b13e667cb3c503980382" kindref="member" tooltip="Logarithm of a determinant.">logdet</ref>()<sp/>+<ref refid="classKalman_19fb808cc94a4c2652e1fb93be9bb7dcf" kindref="member" tooltip="cache of est.R">_P</ref>.<ref refid="classchmat_1b49427cff186c62f5df3724e5d2c34b4" kindref="member" tooltip="Evaluates quadratic form ;.">invqform</ref>(xtrue));</highlight></codeline> |
---|
197 | <codeline lineno="46"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> |
---|
198 | <codeline lineno="47"><highlight class="normal">};</highlight></codeline> |
---|
199 | <codeline lineno="48"><highlight class="normal"></highlight><highlight class="keyword">class<sp/></highlight><highlight class="normal">EKF_unQful<sp/>:<sp/></highlight><highlight class="keyword">public</highlight><highlight class="normal"><sp/><ref refid="classEKFfull" kindref="compound" tooltip="Extended Kalman Filter in full matrices.">EKFfull</ref><sp/>,<sp/></highlight><highlight class="keyword">public</highlight><highlight class="normal"><sp/><ref refid="classBMcond" kindref="compound" tooltip="Conditional Bayesian Filter.">BMcond</ref><sp/>{</highlight></codeline> |
---|
200 | <codeline lineno="49"><highlight class="normal"></highlight><highlight class="keyword">public</highlight><highlight class="normal">:</highlight></codeline> |
---|
201 | <codeline lineno="51"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>EKF_unQful<sp/>(<sp/><ref refid="classRV" kindref="compound" tooltip="Class representing variables, most often random variables.">RV</ref><sp/>rx,<sp/><ref refid="classRV" kindref="compound" tooltip="Class representing variables, most often random variables.">RV</ref><sp/>ry,<ref refid="classRV" kindref="compound" tooltip="Class representing variables, most often random variables.">RV</ref><sp/>ru,<ref refid="classRV" kindref="compound" tooltip="Class representing variables, most often random variables.">RV</ref><sp/>rQ<sp/>)<sp/>:<ref refid="classEKFfull" kindref="compound" tooltip="Extended Kalman Filter in full matrices.">EKFfull</ref><sp/>(<sp/>rx,ry,ru<sp/>),<ref refid="classBMcond" kindref="compound" tooltip="Conditional Bayesian Filter.">BMcond</ref><sp/>(<sp/>rQ<sp/>)<sp/>{};</highlight></codeline> |
---|
202 | <codeline lineno="52"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classBMcond_13543cfe274c35f9033c24d8036a96c4d" kindref="member" tooltip="Substitute val for rvc.">condition</ref><sp/>(<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>vec<sp/>&Q0<sp/>)<sp/>{</highlight></codeline> |
---|
203 | <codeline lineno="53"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Q=diag(Q0);</highlight></codeline> |
---|
204 | <codeline lineno="54"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>};</highlight></codeline> |
---|
205 | <codeline lineno="55"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classEKFfull_18ca46f177e395fa714bbd8bd29ea43e0" kindref="member" tooltip="Here dt = [yt;ut] of appropriate dimensions.">bayes</ref>(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>vec<sp/>dt){</highlight></codeline> |
---|
206 | <codeline lineno="56"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classEKFfull_18ca46f177e395fa714bbd8bd29ea43e0" kindref="member" tooltip="Here dt = [yt;ut] of appropriate dimensions.">EKFfull::bayes</ref>(dt);</highlight></codeline> |
---|
207 | <codeline lineno="57"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight></codeline> |
---|
208 | <codeline lineno="58"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>vec<sp/>xtrue(4);</highlight></codeline> |
---|
209 | <codeline lineno="59"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//UGLY<sp/>HACK!!!<sp/>reliance<sp/>on<sp/>a<sp/>predictor!!</highlight><highlight class="normal"></highlight></codeline> |
---|
210 | <codeline lineno="60"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>xtrue(0)=x[0];</highlight></codeline> |
---|
211 | <codeline lineno="61"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>xtrue(1)=x[1];</highlight></codeline> |
---|
212 | <codeline lineno="62"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>xtrue(2)=x[2];</highlight></codeline> |
---|
213 | <codeline lineno="63"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>xtrue(3)=x[3];</highlight></codeline> |
---|
214 | <codeline lineno="64"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight></codeline> |
---|
215 | <codeline lineno="65"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classBM_15623fef6572a08c2b53b8c87b82dc979" kindref="member" tooltip="Logarithm of marginalized data likelihood.">BM::ll</ref><sp/>=<sp/>-0.5*<sp/>(<sp/>4<sp/>*<sp/>1.83787706640935<sp/>+log(det(P))<sp/>+xtrue*<sp/>(<sp/>inv(P)*xtrue<sp/>)<sp/>);</highlight></codeline> |
---|
216 | <codeline lineno="66"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> |
---|
217 | <codeline lineno="67"><highlight class="normal">};</highlight></codeline> |
---|
218 | <codeline lineno="68"><highlight class="normal"></highlight></codeline> |
---|
219 | <codeline lineno="69"><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> |
---|
220 | <codeline lineno="70"><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> |
---|
221 | <codeline lineno="71"><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> |
---|
222 | <codeline lineno="72"><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> |
---|
223 | <codeline lineno="73"><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> |
---|
224 | <codeline lineno="74"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>Npart<sp/>=<sp/>50;</highlight></codeline> |
---|
225 | <codeline lineno="75"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight></codeline> |
---|
226 | <codeline lineno="76"><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_sim2"</highlight><highlight class="normal">,1000);</highlight></codeline> |
---|
227 | <codeline lineno="77"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight></codeline> |
---|
228 | <codeline lineno="78"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>internal<sp/>model</highlight><highlight class="normal"></highlight></codeline> |
---|
229 | <codeline lineno="79"><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> |
---|
230 | <codeline lineno="80"><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> |
---|
231 | <codeline lineno="81"><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> |
---|
232 | <codeline lineno="82"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>observation<sp/>model</highlight><highlight class="normal"></highlight></codeline> |
---|
233 | <codeline lineno="83"><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> |
---|
234 | <codeline lineno="84"><highlight class="normal"></highlight></codeline> |
---|
235 | <codeline lineno="85"><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> |
---|
236 | <codeline lineno="86"><highlight class="normal"></highlight><highlight class="comment">//<sp/><sp/><sp/><sp/><sp/><sp/>vec<sp/>Qdiag<sp/>(<sp/>"0.01<sp/>0.01<sp/>0.01<sp/>0.0001"<sp/>);<sp/>//zdenek:<sp/>0.01<sp/>0.01<sp/>0.0001<sp/>0.0001</highlight><highlight class="normal"></highlight></codeline> |
---|
237 | <codeline lineno="87"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>vec<sp/>Qdiag<sp/>(<sp/></highlight><highlight class="stringliteral">"10<sp/>10<sp/>10<sp/>0.001"</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> |
---|
238 | <codeline lineno="88"><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> |
---|
239 | <codeline lineno="89"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classchmat" kindref="compound" tooltip="Symmetric matrix stored in square root decomposition using upper cholesky.">chmat</ref><sp/>Q<sp/>(<sp/>Qdiag<sp/>);</highlight></codeline> |
---|
240 | <codeline lineno="90"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classchmat" kindref="compound" tooltip="Symmetric matrix stored in square root decomposition using upper cholesky.">chmat</ref><sp/>R<sp/>(<sp/>Rdiag<sp/>);</highlight></codeline> |
---|
241 | <codeline lineno="91"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classEKFCh" kindref="compound" tooltip="Extended Kalman Filter in Square root.">EKFCh</ref><sp/>KFE<sp/>(<sp/>rx,ry,ru<sp/>);</highlight></codeline> |
---|
242 | <codeline lineno="92"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>KFE.set_est<sp/>(<sp/>mu0,<sp/><ref refid="classchmat" kindref="compound" tooltip="Symmetric matrix stored in square root decomposition using upper cholesky.">chmat</ref>(<sp/>1*eye<sp/>(<sp/>4<sp/>)<sp/>)<sp/>);</highlight></codeline> |
---|
243 | <codeline lineno="93"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>KFE.set_parameters<sp/>(<sp/>&fxu,&hxu,Q,R);</highlight></codeline> |
---|
244 | <codeline lineno="94"><highlight class="normal"></highlight></codeline> |
---|
245 | <codeline lineno="95"><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/>rQ<sp/>(<sp/></highlight><highlight class="stringliteral">"{Q}"</highlight><highlight class="normal">,</highlight><highlight class="stringliteral">"4"</highlight><highlight class="normal"><sp/>);</highlight></codeline> |
---|
246 | <codeline lineno="96"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>EKF_unQful<sp/>KFEp<sp/>(<sp/>rx,ry,ru,rQ<sp/>);</highlight></codeline> |
---|
247 | <codeline lineno="97"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>KFEp.set_est<sp/>(<sp/>mu0,<sp/><sp/>1*ones<sp/>(<sp/>4<sp/>)<sp/>);</highlight></codeline> |
---|
248 | <codeline lineno="98"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>KFEp.set_parameters<sp/>(<sp/>&fxu,&hxu,diag(Qdiag),diag(Rdiag)<sp/>);</highlight></codeline> |
---|
249 | <codeline lineno="99"><highlight class="normal"></highlight></codeline> |
---|
250 | <codeline lineno="100"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classmgamma__fix" kindref="compound" tooltip="Gamma random walk around a fixed point.">mgamma_fix</ref><sp/>evolQ<sp/>(<sp/>rQ,rQ<sp/>);</highlight></codeline> |
---|
251 | <codeline lineno="101"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classMPF" kindref="compound" tooltip="Marginalized Particle filter.">MPF<EKF_unQful></ref><sp/>M<sp/>(<sp/>rx,rQ,evolQ,evolQ,Npart,KFEp<sp/>);</highlight></codeline> |
---|
252 | <codeline lineno="102"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>initialize</highlight><highlight class="normal"></highlight></codeline> |
---|
253 | <codeline lineno="103"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>evolQ.set_parameters<sp/>(<sp/>1000.0<sp/>,Qdiag,<sp/>0.5);<sp/></highlight><highlight class="comment">//sigma<sp/>=<sp/>1/10<sp/>mu</highlight><highlight class="normal"></highlight></codeline> |
---|
254 | <codeline lineno="104"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>evolQ.condition<sp/>(<sp/>Qdiag<sp/>);<sp/></highlight><highlight class="comment">//Zdenek<sp/>default</highlight><highlight class="normal"></highlight></codeline> |
---|
255 | <codeline lineno="105"><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/>pfinit=evolQ._epdf();</highlight></codeline> |
---|
256 | <codeline lineno="106"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>M.set_est<sp/>(<sp/>pfinit<sp/>);</highlight></codeline> |
---|
257 | <codeline lineno="107"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>evolQ.set_parameters<sp/>(<sp/>100000.0,<sp/>Qdiag,<sp/>0.9999<sp/>);</highlight></codeline> |
---|
258 | <codeline lineno="108"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//</highlight><highlight class="normal"></highlight></codeline> |
---|
259 | <codeline lineno="109"><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/>KFEep<sp/>=<sp/>KFE._epdf();</highlight></codeline> |
---|
260 | <codeline lineno="110"><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/>Mep<sp/>=<sp/>M._epdf();</highlight></codeline> |
---|
261 | <codeline lineno="111"><highlight class="normal"></highlight></codeline> |
---|
262 | <codeline lineno="112"><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> |
---|
263 | <codeline lineno="113"><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> |
---|
264 | <codeline lineno="114"><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(rQ,rx);</highlight></codeline> |
---|
265 | <codeline lineno="115"><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> |
---|
266 | <codeline lineno="116"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>L.init();</highlight></codeline> |
---|
267 | <codeline lineno="117"><highlight class="normal"></highlight></codeline> |
---|
268 | <codeline lineno="118"><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> |
---|
269 | <codeline lineno="119"><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> |
---|
270 | <codeline lineno="120"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>Ww=0.0;</highlight></codeline> |
---|
271 | <codeline lineno="121"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>vec<sp/>dt<sp/>(<sp/>2<sp/>);</highlight></codeline> |
---|
272 | <codeline lineno="122"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>vec<sp/>ut<sp/>(<sp/>2<sp/>);</highlight></codeline> |
---|
273 | <codeline lineno="123"><highlight class="normal"></highlight></codeline> |
---|
274 | <codeline lineno="124"><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> |
---|
275 | <codeline lineno="125"><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> |
---|
276 | <codeline lineno="126"><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> |
---|
277 | <codeline lineno="127"><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/></highlight><highlight class="comment">//simulator</highlight><highlight class="normal"></highlight></codeline> |
---|
278 | <codeline lineno="128"><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(Ww);</highlight></codeline> |
---|
279 | <codeline lineno="129"><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> |
---|
280 | <codeline lineno="130"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>};</highlight></codeline> |
---|
281 | <codeline lineno="131"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>collect<sp/>data</highlight><highlight class="normal"></highlight></codeline> |
---|
282 | <codeline lineno="132"><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> |
---|
283 | <codeline lineno="133"><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> |
---|
284 | <codeline lineno="134"><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> |
---|
285 | <codeline lineno="135"><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> |
---|
286 | <codeline lineno="136"><highlight class="normal"></highlight></codeline> |
---|
287 | <codeline lineno="137"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//estimator</highlight><highlight class="normal"></highlight></codeline> |
---|
288 | <codeline lineno="138"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>KFE.bayes<sp/>(<sp/>concat<sp/>(<sp/>dt,ut<sp/>)<sp/>);</highlight></codeline> |
---|
289 | <codeline lineno="139"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>M.bayes<sp/>(<sp/>concat<sp/>(<sp/>dt,ut<sp/>)<sp/>);</highlight></codeline> |
---|
290 | <codeline lineno="140"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight></codeline> |
---|
291 | <codeline lineno="141"><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> |
---|
292 | <codeline lineno="142"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>L.logit(Efix_log,<sp/>KFEep.<ref refid="classepdf_1bf0a070a8f3e67a93604ca724638b870" kindref="member" tooltip="return expected value">mean</ref>()<sp/>);<sp/></highlight></codeline> |
---|
293 | <codeline lineno="143"><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/>Mep.<ref refid="classepdf_1bf0a070a8f3e67a93604ca724638b870" kindref="member" tooltip="return expected value">mean</ref>()<sp/>);<sp/></highlight></codeline> |
---|
294 | <codeline lineno="144"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight></codeline> |
---|
295 | <codeline lineno="145"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>L.step();</highlight></codeline> |
---|
296 | <codeline lineno="146"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> |
---|
297 | <codeline lineno="147"><highlight class="normal"></highlight></codeline> |
---|
298 | <codeline lineno="148"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>L.finalize();<sp/></highlight></codeline> |
---|
299 | <codeline lineno="149"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight></codeline> |
---|
300 | <codeline lineno="150"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0;</highlight></codeline> |
---|
301 | <codeline lineno="151"><highlight class="normal">}</highlight></codeline> |
---|
302 | <codeline lineno="152"><highlight class="normal"></highlight></codeline> |
---|
303 | </programlisting> |
---|
304 | <location file="/home/smidl/work/git/mixpp/pmsm/pmsm_sim2.cpp"/> |
---|
305 | </compounddef> |
---|
306 | </doxygen> |
---|