[187] | 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="sim__var_8cpp" kind="file"> |
---|
| 4 | <compoundname>sim_var.cpp</compoundname> |
---|
| 5 | <includes local="no">itpp/itbase.h</includes> |
---|
| 6 | <includes refid="libFN_8h" local="no">stat/libFN.h</includes> |
---|
| 7 | <includes refid="libKF_8h" local="no">estim/libKF.h</includes> |
---|
| 8 | <includes refid="chmat_8h" local="no">math/chmat.h</includes> |
---|
| 9 | <includes refid="pmsm_8h" local="yes">pmsm.h</includes> |
---|
| 10 | <includes refid="simulator_8h" local="yes">simulator.h</includes> |
---|
| 11 | <includes refid="sim__profiles_8h" local="yes">sim_profiles.h</includes> |
---|
| 12 | <includes refid="loggers_8h" local="no">stat/loggers.h</includes> |
---|
| 13 | <incdepgraph> |
---|
| 14 | <node id="666"> |
---|
| 15 | <label>sim_profiles.h</label> |
---|
| 16 | <link refid="sim__profiles_8h-source"/> |
---|
| 17 | </node> |
---|
| 18 | <node id="667"> |
---|
| 19 | <label>stat/loggers.h</label> |
---|
| 20 | <link refid="loggers_8h"/> |
---|
| 21 | <childnode refid="656" relation="include"> |
---|
| 22 | </childnode> |
---|
| 23 | <childnode refid="658" relation="include"> |
---|
| 24 | </childnode> |
---|
| 25 | <childnode refid="662" relation="include"> |
---|
| 26 | </childnode> |
---|
| 27 | </node> |
---|
| 28 | <node id="658"> |
---|
| 29 | <label>libBM.h</label> |
---|
| 30 | <link refid="libBM_8h"/> |
---|
| 31 | <childnode refid="656" relation="include"> |
---|
| 32 | </childnode> |
---|
| 33 | </node> |
---|
| 34 | <node id="665"> |
---|
| 35 | <label>simulator.h</label> |
---|
| 36 | <link refid="simulator_8h-source"/> |
---|
| 37 | </node> |
---|
| 38 | <node id="664"> |
---|
| 39 | <label>pmsm.h</label> |
---|
| 40 | <link refid="pmsm_8h-source"/> |
---|
| 41 | <childnode refid="657" relation="include"> |
---|
| 42 | </childnode> |
---|
| 43 | </node> |
---|
| 44 | <node id="662"> |
---|
| 45 | <label>../itpp_ext.h</label> |
---|
| 46 | <link refid="itpp__ext_8h-source"/> |
---|
| 47 | <childnode refid="656" relation="include"> |
---|
| 48 | </childnode> |
---|
| 49 | </node> |
---|
| 50 | <node id="660"> |
---|
| 51 | <label>../stat/libEF.h</label> |
---|
| 52 | <link refid="libEF_8h"/> |
---|
| 53 | <childnode refid="656" relation="include"> |
---|
| 54 | </childnode> |
---|
| 55 | <childnode refid="661" relation="include"> |
---|
| 56 | </childnode> |
---|
| 57 | <childnode refid="658" relation="include"> |
---|
| 58 | </childnode> |
---|
| 59 | <childnode refid="662" relation="include"> |
---|
| 60 | </childnode> |
---|
| 61 | </node> |
---|
| 62 | <node id="657"> |
---|
| 63 | <label>stat/libFN.h</label> |
---|
| 64 | <link refid="libFN_8h-source"/> |
---|
| 65 | <childnode refid="656" relation="include"> |
---|
| 66 | </childnode> |
---|
| 67 | <childnode refid="658" relation="include"> |
---|
| 68 | </childnode> |
---|
| 69 | </node> |
---|
| 70 | <node id="655"> |
---|
| 71 | <label>work/git/mixpp/pmsm/sim_var.cpp</label> |
---|
| 72 | <link refid="sim_var.cpp"/> |
---|
| 73 | <childnode refid="656" relation="include"> |
---|
| 74 | </childnode> |
---|
| 75 | <childnode refid="657" relation="include"> |
---|
| 76 | </childnode> |
---|
| 77 | <childnode refid="659" relation="include"> |
---|
| 78 | </childnode> |
---|
| 79 | <childnode refid="663" relation="include"> |
---|
| 80 | </childnode> |
---|
| 81 | <childnode refid="664" relation="include"> |
---|
| 82 | </childnode> |
---|
| 83 | <childnode refid="665" relation="include"> |
---|
| 84 | </childnode> |
---|
| 85 | <childnode refid="666" relation="include"> |
---|
| 86 | </childnode> |
---|
| 87 | <childnode refid="667" relation="include"> |
---|
| 88 | </childnode> |
---|
| 89 | </node> |
---|
| 90 | <node id="656"> |
---|
| 91 | <label>itpp/itbase.h</label> |
---|
| 92 | </node> |
---|
| 93 | <node id="663"> |
---|
| 94 | <label>../math/chmat.h</label> |
---|
| 95 | <link refid="chmat_8h"/> |
---|
| 96 | <childnode refid="656" relation="include"> |
---|
| 97 | </childnode> |
---|
| 98 | <childnode refid="661" relation="include"> |
---|
| 99 | </childnode> |
---|
| 100 | <childnode refid="662" relation="include"> |
---|
| 101 | </childnode> |
---|
| 102 | </node> |
---|
| 103 | <node id="659"> |
---|
| 104 | <label>estim/libKF.h</label> |
---|
| 105 | <link refid="libKF_8h"/> |
---|
| 106 | <childnode refid="656" relation="include"> |
---|
| 107 | </childnode> |
---|
| 108 | <childnode refid="657" relation="include"> |
---|
| 109 | </childnode> |
---|
| 110 | <childnode refid="660" relation="include"> |
---|
| 111 | </childnode> |
---|
| 112 | <childnode refid="663" relation="include"> |
---|
| 113 | </childnode> |
---|
| 114 | </node> |
---|
| 115 | <node id="661"> |
---|
| 116 | <label>../math/libDC.h</label> |
---|
| 117 | <link refid="libDC_8h"/> |
---|
| 118 | <childnode refid="656" relation="include"> |
---|
| 119 | </childnode> |
---|
| 120 | </node> |
---|
| 121 | </incdepgraph> |
---|
| 122 | <sectiondef kind="func"> |
---|
| 123 | <memberdef kind="function" id="sim__var_8cpp_1e66f6b31b5ad750f1fe042a706a4e3d4" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual"> |
---|
| 124 | <type>int</type> |
---|
| 125 | <definition>int main</definition> |
---|
| 126 | <argsstring>()</argsstring> |
---|
| 127 | <name>main</name> |
---|
| 128 | <briefdescription> |
---|
| 129 | <para>Extended <ref refid="classKalman" kindref="compound">Kalman</ref> filter with unknown <computeroutput>Q</computeroutput>. </para> </briefdescription> |
---|
| 130 | <detaileddescription> |
---|
| 131 | </detaileddescription> |
---|
| 132 | <inbodydescription> |
---|
| 133 | </inbodydescription> |
---|
| 134 | <location file="/home/smidl/work/git/mixpp/pmsm/sim_var.cpp" line="28" bodyfile="/home/smidl/work/git/mixpp/pmsm/sim_var.cpp" bodystart="28" bodyend="166"/> |
---|
| 135 | <references refid="classEKFfull_14080d68f79dade36ccf547d57e64bdc2" compoundref="libKF_8h" startline="188" endline="188">EKFfull::_epdf</references> |
---|
| 136 | <references refid="classlogger_1cfb250a559b71e07a1a6aa92f2185c1b" compoundref="loggers_8h" startline="39" endline="45">logger::add</references> |
---|
| 137 | <references refid="classEKFfull_18ca46f177e395fa714bbd8bd29ea43e0" compoundref="libKF_8cpp" startline="86" endline="114">EKFfull::bayes</references> |
---|
| 138 | <references refid="classOMpmsm_18e32392c9c635584606287b8c0e8c9da" compoundref="pmsm_8h" startline="128" endline="133">OMpmsm::eval</references> |
---|
| 139 | <references refid="classIMpmsm_145785869d978dda42828a072ec2caebe" compoundref="pmsm_8h" startline="25" endline="46">IMpmsm::eval</references> |
---|
| 140 | <references refid="classdirfilelog_14d671baf6f88444d7fe25a5b8a80834a" compoundref="loggers_8cpp" startline="128" endline="131">dirfilelog::finalize</references> |
---|
| 141 | <references refid="classdirfilelog_1afeaebe003110f9db1ac43edf8e53a92" compoundref="loggers_8cpp" startline="25" endline="74">dirfilelog::init</references> |
---|
| 142 | <references refid="classmemlog_18d2feeb826f7249e9104d616b5a67144" compoundref="loggers_8h" startline="88" endline="90">memlog::logit</references> |
---|
| 143 | <references refid="classepdf_1bf0a070a8f3e67a93604ca724638b870">epdf::mean</references> |
---|
| 144 | <references refid="classEKFfull_17bb76ea74c144ea0b36db99f94750b7b" compoundref="libKF_8h" startline="186" endline="186">EKFfull::set_est</references> |
---|
| 145 | <references refid="classEKFfull_1fc753106e0d4cf68e4f2160fd54458c0" compoundref="libKF_8cpp" startline="66" endline="84">EKFfull::set_parameters</references> |
---|
| 146 | <references refid="classIMpmsm_142818f3426d99fecb7e97be8ffe2e228" compoundref="pmsm_8h" startline="23" endline="23">IMpmsm::set_parameters</references> |
---|
| 147 | <references refid="classdirfilelog_1f5fe9483a041591bfe6f3d6393b02aa7" compoundref="loggers_8cpp" startline="117" endline="126">dirfilelog::step</references> |
---|
| 148 | </memberdef> |
---|
| 149 | </sectiondef> |
---|
| 150 | <briefdescription> |
---|
| 151 | <para>Models for synchronous electric drive using IT++ and BDM. </para> </briefdescription> |
---|
| 152 | <detaileddescription> |
---|
| 153 | <para><simplesect kind="author"><para>Vaclav Smidl.</para></simplesect> |
---|
| 154 | ----------------------------------- BDM++ - C++ library for Bayesian Decision Making under Uncertainty</para><para>Using IT++ for numerical operations ----------------------------------- </para> </detaileddescription> |
---|
| 155 | <programlisting> |
---|
| 156 | <codeline lineno="1"></codeline> |
---|
| 157 | <codeline lineno="13"><highlight class="preprocessor">#include<sp/><itpp/itbase.h></highlight><highlight class="normal"></highlight></codeline> |
---|
| 158 | <codeline lineno="14"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/><stat/libFN.h></highlight><highlight class="normal"></highlight></codeline> |
---|
| 159 | <codeline lineno="15"><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> |
---|
| 160 | <codeline lineno="16"><highlight class="normal"></highlight><highlight class="comment">//#include<sp/><estim/libPF.h></highlight><highlight class="normal"></highlight></codeline> |
---|
| 161 | <codeline lineno="17"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/><<ref refid="chmat_8h" kindref="compound" tooltip="Matrices in decomposed forms (LDL&#39;, LU, UDU&#39;, etc).">math/chmat.h</ref>></highlight><highlight class="normal"></highlight></codeline> |
---|
| 162 | <codeline lineno="18"><highlight class="normal"></highlight></codeline> |
---|
| 163 | <codeline lineno="19"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>"pmsm.h"</highlight><highlight class="normal"></highlight></codeline> |
---|
| 164 | <codeline lineno="20"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>"simulator.h"</highlight><highlight class="normal"></highlight></codeline> |
---|
| 165 | <codeline lineno="21"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>"sim_profiles.h"</highlight><highlight class="normal"></highlight></codeline> |
---|
| 166 | <codeline lineno="22"><highlight class="normal"></highlight></codeline> |
---|
| 167 | <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> |
---|
| 168 | <codeline lineno="24"><highlight class="normal"></highlight></codeline> |
---|
| 169 | <codeline lineno="25"><highlight class="normal"></highlight><highlight class="keyword">using<sp/>namespace<sp/></highlight><highlight class="normal">itpp;</highlight></codeline> |
---|
| 170 | <codeline lineno="27"><highlight class="normal"></highlight></codeline> |
---|
| 171 | <codeline lineno="28" refid="sim__var_8cpp_1e66f6b31b5ad750f1fe042a706a4e3d4" refkind="member"><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> |
---|
| 172 | <codeline lineno="29"><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> |
---|
| 173 | <codeline lineno="30"><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> |
---|
| 174 | <codeline lineno="31"><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> |
---|
| 175 | <codeline lineno="32"><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> |
---|
| 176 | <codeline lineno="33"><highlight class="normal"></highlight></codeline> |
---|
| 177 | <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/sim_var"</highlight><highlight class="normal">,1000);</highlight></codeline> |
---|
| 178 | <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> |
---|
| 179 | <codeline lineno="36"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight></codeline> |
---|
| 180 | <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> |
---|
| 181 | <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> |
---|
| 182 | <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> |
---|
| 183 | <codeline lineno="40"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>vec<sp/>dt<sp/>(<sp/>2<sp/>);</highlight></codeline> |
---|
| 184 | <codeline lineno="41"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>vec<sp/>ut<sp/>(<sp/>2<sp/>);</highlight></codeline> |
---|
| 185 | <codeline lineno="42"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>vec<sp/>dut<sp/>(<sp/>2<sp/>);</highlight></codeline> |
---|
| 186 | <codeline lineno="43"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>vec<sp/>dit<sp/>(2);</highlight></codeline> |
---|
| 187 | <codeline lineno="44"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>vec<sp/>xtm=zeros<sp/>(<sp/>4<sp/>);</highlight></codeline> |
---|
| 188 | <codeline lineno="45"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>vec<sp/>xte=zeros<sp/>(<sp/>4<sp/>);</highlight></codeline> |
---|
| 189 | <codeline lineno="46"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>vec<sp/>xdif=zeros<sp/>(<sp/>4<sp/>);</highlight></codeline> |
---|
| 190 | <codeline lineno="47"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>vec<sp/>xt<sp/>(<sp/>4<sp/>);</highlight></codeline> |
---|
| 191 | <codeline lineno="48"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>vec<sp/>ddif=zeros(2);</highlight></codeline> |
---|
| 192 | <codeline lineno="49"><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> |
---|
| 193 | <codeline lineno="50"><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> |
---|
| 194 | <codeline lineno="51"><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> |
---|
| 195 | <codeline lineno="52"><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> |
---|
| 196 | <codeline lineno="53"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>mat<sp/>Qt=zeros<sp/>(<sp/>4,4<sp/>);</highlight></codeline> |
---|
| 197 | <codeline lineno="54"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>mat<sp/>Rt=zeros<sp/>(<sp/>2,2<sp/>);</highlight></codeline> |
---|
| 198 | <codeline lineno="55"><highlight class="normal"></highlight></codeline> |
---|
| 199 | <codeline lineno="56"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>ESTIMATORS</highlight><highlight class="normal"></highlight></codeline> |
---|
| 200 | <codeline lineno="57"><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> |
---|
| 201 | <codeline lineno="58"><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> |
---|
| 202 | <codeline lineno="59"><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> |
---|
| 203 | <codeline lineno="60"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>mat<sp/>Q<sp/>=diag(<sp/>Qdiag<sp/>);</highlight></codeline> |
---|
| 204 | <codeline lineno="61"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>mat<sp/>R<sp/>=diag<sp/>(<sp/>Rdiag<sp/>);</highlight></codeline> |
---|
| 205 | <codeline lineno="62"><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> |
---|
| 206 | <codeline lineno="63"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Efix.<ref refid="classEKFfull_17bb76ea74c144ea0b36db99f94750b7b" kindref="member" tooltip="set estimates">set_est</ref><sp/>(<sp/>mu0,<sp/>1*eye<sp/>(<sp/>4<sp/>)<sp/><sp/>);</highlight></codeline> |
---|
| 207 | <codeline lineno="64"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Efix.<ref refid="classEKFfull_1fc753106e0d4cf68e4f2160fd54458c0" kindref="member" tooltip="Set nonlinear functions for mean values and covariance matrices.">set_parameters</ref><sp/>(<sp/>&fxu,&hxu,Q,R);</highlight></codeline> |
---|
| 208 | <codeline lineno="65"><highlight class="normal"></highlight></codeline> |
---|
| 209 | <codeline lineno="66"><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/>Eop<sp/>(<sp/>rx,ry,ru<sp/>);</highlight></codeline> |
---|
| 210 | <codeline lineno="67"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Eop.<ref refid="classEKFfull_17bb76ea74c144ea0b36db99f94750b7b" kindref="member" tooltip="set estimates">set_est</ref><sp/>(<sp/>mu0,<sp/>1*eye<sp/>(<sp/>4<sp/>)<sp/>);</highlight></codeline> |
---|
| 211 | <codeline lineno="68"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Eop.<ref refid="classEKFfull_1fc753106e0d4cf68e4f2160fd54458c0" kindref="member" tooltip="Set nonlinear functions for mean values and covariance matrices.">set_parameters</ref><sp/>(<sp/>&fxu,&hxu,Q,R);</highlight></codeline> |
---|
| 212 | <codeline lineno="69"><highlight class="normal"></highlight></codeline> |
---|
| 213 | <codeline lineno="70"><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/>Edi<sp/>(<sp/>rx,ry,ru<sp/>);</highlight></codeline> |
---|
| 214 | <codeline lineno="71"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Edi.<ref refid="classEKFfull_17bb76ea74c144ea0b36db99f94750b7b" kindref="member" tooltip="set estimates">set_est</ref><sp/>(<sp/>mu0,<sp/>1*eye<sp/>(<sp/>4<sp/>)<sp/>);</highlight></codeline> |
---|
| 215 | <codeline lineno="72"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Edi.<ref refid="classEKFfull_1fc753106e0d4cf68e4f2160fd54458c0" kindref="member" tooltip="Set nonlinear functions for mean values and covariance matrices.">set_parameters</ref><sp/>(<sp/>&fxu,&hxu,Q,R);</highlight></codeline> |
---|
| 216 | <codeline lineno="73"><highlight class="normal"></highlight></codeline> |
---|
| 217 | <codeline lineno="74"><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.<ref refid="classEKFfull_14080d68f79dade36ccf547d57e64bdc2" kindref="member" tooltip="dummy!">_epdf</ref>();</highlight></codeline> |
---|
| 218 | <codeline lineno="75"><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/>Eop_ep<sp/>=<sp/>Eop.<ref refid="classEKFfull_14080d68f79dade36ccf547d57e64bdc2" kindref="member" tooltip="dummy!">_epdf</ref>();</highlight></codeline> |
---|
| 219 | <codeline lineno="76"><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/>Edi_ep<sp/>=<sp/>Edi.<ref refid="classEKFfull_14080d68f79dade36ccf547d57e64bdc2" kindref="member" tooltip="dummy!">_epdf</ref>();</highlight></codeline> |
---|
| 220 | <codeline lineno="77"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight></codeline> |
---|
| 221 | <codeline lineno="78"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//LOG</highlight><highlight class="normal"></highlight></codeline> |
---|
| 222 | <codeline lineno="79"><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/></highlight><highlight class="stringliteral">"{Q<sp/>}"</highlight><highlight class="normal">,<sp/></highlight><highlight class="stringliteral">"16"</highlight><highlight class="normal">);</highlight></codeline> |
---|
| 223 | <codeline lineno="80"><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/>rR(<sp/></highlight><highlight class="stringliteral">"{R<sp/>}"</highlight><highlight class="normal">,<sp/></highlight><highlight class="stringliteral">"4"</highlight><highlight class="normal">);</highlight></codeline> |
---|
| 224 | <codeline lineno="81"><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">,<sp/>ones_i(4));</highlight></codeline> |
---|
| 225 | <codeline lineno="82"><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/>rDu(</highlight><highlight class="stringliteral">"{dux<sp/>duy<sp/>duxf<sp/>duyf<sp/>}"</highlight><highlight class="normal">,ones_i(4));</highlight></codeline> |
---|
| 226 | <codeline lineno="83"><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/>rDi(</highlight><highlight class="stringliteral">"{disa<sp/>disb<sp/>}"</highlight><highlight class="normal">,ones_i(2));</highlight></codeline> |
---|
| 227 | <codeline lineno="84"><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.<ref refid="classlogger_1cfb250a559b71e07a1a6aa92f2185c1b" kindref="member" tooltip="returns an identifier which will be later needed for calling the log() function">add</ref>(rx,</highlight><highlight class="stringliteral">"X"</highlight><highlight class="normal">);</highlight></codeline> |
---|
| 228 | <codeline lineno="85"><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.<ref refid="classlogger_1cfb250a559b71e07a1a6aa92f2185c1b" kindref="member" tooltip="returns an identifier which will be later needed for calling the log() function">add</ref>(rx,</highlight><highlight class="stringliteral">"XF"</highlight><highlight class="normal">);</highlight></codeline> |
---|
| 229 | <codeline lineno="86"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>Eop_log<sp/>=<sp/>L.<ref refid="classlogger_1cfb250a559b71e07a1a6aa92f2185c1b" kindref="member" tooltip="returns an identifier which will be later needed for calling the log() function">add</ref>(rx,</highlight><highlight class="stringliteral">"XO"</highlight><highlight class="normal">);</highlight></codeline> |
---|
| 230 | <codeline lineno="87"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>Edi_log<sp/>=<sp/>L.<ref refid="classlogger_1cfb250a559b71e07a1a6aa92f2185c1b" kindref="member" tooltip="returns an identifier which will be later needed for calling the log() function">add</ref>(rx,</highlight><highlight class="stringliteral">"XD"</highlight><highlight class="normal">);</highlight></codeline> |
---|
| 231 | <codeline lineno="88"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>Q_log<sp/>=<sp/>L.<ref refid="classlogger_1cfb250a559b71e07a1a6aa92f2185c1b" kindref="member" tooltip="returns an identifier which will be later needed for calling the log() function">add</ref>(rQ,</highlight><highlight class="stringliteral">"Q"</highlight><highlight class="normal">);</highlight></codeline> |
---|
| 232 | <codeline lineno="89"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>R_log<sp/>=<sp/>L.<ref refid="classlogger_1cfb250a559b71e07a1a6aa92f2185c1b" kindref="member" tooltip="returns an identifier which will be later needed for calling the log() function">add</ref>(rR,</highlight><highlight class="stringliteral">"R"</highlight><highlight class="normal">);</highlight></codeline> |
---|
| 233 | <codeline lineno="90"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>D_log<sp/>=<sp/>L.<ref refid="classlogger_1cfb250a559b71e07a1a6aa92f2185c1b" kindref="member" tooltip="returns an identifier which will be later needed for calling the log() function">add</ref>(rUD,</highlight><highlight class="stringliteral">"D"</highlight><highlight class="normal">);</highlight></codeline> |
---|
| 234 | <codeline lineno="91"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>Du_log<sp/>=<sp/>L.<ref refid="classlogger_1cfb250a559b71e07a1a6aa92f2185c1b" kindref="member" tooltip="returns an identifier which will be later needed for calling the log() function">add</ref>(rDu,</highlight><highlight class="stringliteral">"Du"</highlight><highlight class="normal">);</highlight></codeline> |
---|
| 235 | <codeline lineno="92"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>Di_log<sp/>=<sp/>L.<ref refid="classlogger_1cfb250a559b71e07a1a6aa92f2185c1b" kindref="member" tooltip="returns an identifier which will be later needed for calling the log() function">add</ref>(rDi,</highlight><highlight class="stringliteral">"Di"</highlight><highlight class="normal">);</highlight></codeline> |
---|
| 236 | <codeline lineno="93"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>L.<ref refid="classdirfilelog_1afeaebe003110f9db1ac43edf8e53a92" kindref="member" tooltip="Initialize storage.">init</ref>();</highlight></codeline> |
---|
| 237 | <codeline lineno="94"><highlight class="normal"></highlight></codeline> |
---|
| 238 | <codeline lineno="95"><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> |
---|
| 239 | <codeline lineno="96"><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> |
---|
| 240 | <codeline lineno="97"><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> |
---|
| 241 | <codeline lineno="98"><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/>,<sp/></highlight><highlight class="keyword">false</highlight><highlight class="normal">);</highlight></codeline> |
---|
| 242 | <codeline lineno="99"><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> |
---|
| 243 | <codeline lineno="100"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>};</highlight></codeline> |
---|
| 244 | <codeline lineno="101"><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> |
---|
| 245 | <codeline lineno="102"><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> |
---|
| 246 | <codeline lineno="103"><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> |
---|
| 247 | <codeline lineno="104"><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> |
---|
| 248 | <codeline lineno="105"><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> |
---|
| 249 | <codeline lineno="106"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>dut<sp/>(<sp/>0<sp/>)<sp/>=<sp/>KalmanObs[4];</highlight></codeline> |
---|
| 250 | <codeline lineno="107"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>dut<sp/>(<sp/>1<sp/>)<sp/>=<sp/>KalmanObs[5];</highlight></codeline> |
---|
| 251 | <codeline lineno="108"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>dit<sp/>(<sp/>0<sp/>)<sp/>=<sp/>KalmanObs[8];</highlight></codeline> |
---|
| 252 | <codeline lineno="109"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>dit<sp/>(<sp/>1<sp/>)<sp/>=<sp/>KalmanObs[9];</highlight></codeline> |
---|
| 253 | <codeline lineno="110"><highlight class="normal"></highlight></codeline> |
---|
| 254 | <codeline lineno="111"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>xte<sp/>=<sp/>fxu.<ref refid="classIMpmsm_145785869d978dda42828a072ec2caebe" kindref="member" tooltip="Evaluates .">eval</ref><sp/>(<sp/>xtm,ut<sp/>);</highlight></codeline> |
---|
| 255 | <codeline lineno="112"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//Results:</highlight><highlight class="normal"></highlight></codeline> |
---|
| 256 | <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">//<sp/>in<sp/>xt<sp/>we<sp/>have<sp/>simulation<sp/>according<sp/>to<sp/>the<sp/>model</highlight><highlight class="normal"></highlight></codeline> |
---|
| 257 | <codeline lineno="114"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>in<sp/>x<sp/>we<sp/>have<sp/>"reality"</highlight><highlight class="normal"></highlight></codeline> |
---|
| 258 | <codeline lineno="115"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>xt<sp/>(<sp/>0<sp/>)<sp/>=x[0];xt<sp/>(<sp/>1<sp/>)<sp/>=x[1];xt<sp/>(<sp/>2<sp/>)<sp/>=x[2];xt<sp/>(<sp/>3<sp/>)<sp/>=x[3];</highlight></codeline> |
---|
| 259 | <codeline lineno="116"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>xdif<sp/>=<sp/>xt-xte;<sp/></highlight><highlight class="comment">//xtm<sp/>is<sp/>a<sp/>copy<sp/>of<sp/>x[]</highlight><highlight class="normal"></highlight></codeline> |
---|
| 260 | <codeline lineno="117"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(xdif(0)>3.0){</highlight></codeline> |
---|
| 261 | <codeline lineno="118"><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/>cout<sp/><<<sp/></highlight><highlight class="stringliteral">"here"</highlight><highlight class="normal"><sp/><<endl;</highlight></codeline> |
---|
| 262 | <codeline lineno="119"><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></codeline> |
---|
| 263 | <codeline lineno="120"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<sp/>xdif<sp/>(<sp/>3<sp/>)<sp/>>pi<sp/>)<sp/>xdif<sp/>(<sp/>3<sp/>)-=2*pi;</highlight></codeline> |
---|
| 264 | <codeline lineno="121"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<sp/>xdif<sp/>(<sp/>3<sp/>)<sp/><-pi<sp/>)<sp/>xdif<sp/>(<sp/>3<sp/>)<sp/>+=2*pi;</highlight></codeline> |
---|
| 265 | <codeline lineno="122"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight></codeline> |
---|
| 266 | <codeline lineno="123"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ddif<sp/>=<sp/>hxu.<ref refid="classOMpmsm_18e32392c9c635584606287b8c0e8c9da" kindref="member" tooltip="Evaluates .">eval</ref>(xt,ut)<sp/>-<sp/>dit;</highlight></codeline> |
---|
| 267 | <codeline lineno="124"><highlight class="normal"></highlight></codeline> |
---|
| 268 | <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">//Rt<sp/>=<sp/>0.9*Rt<sp/>+<sp/>xdif^2</highlight><highlight class="normal"></highlight></codeline> |
---|
| 269 | <codeline lineno="126"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Qt*=0.1;</highlight></codeline> |
---|
| 270 | <codeline lineno="127"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Qt<sp/>+=<sp/>10*outer_product<sp/>(<sp/>xdif,xdif<sp/>);<sp/></highlight><highlight class="comment">//(x-xt)^2</highlight><highlight class="normal"></highlight></codeline> |
---|
| 271 | <codeline lineno="128"><highlight class="normal"></highlight></codeline> |
---|
| 272 | <codeline lineno="129"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(Qt(0,0)>3.0){</highlight></codeline> |
---|
| 273 | <codeline lineno="130"><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/>cout<sp/><<<sp/></highlight><highlight class="stringliteral">"here"</highlight><highlight class="normal"><sp/><<endl;</highlight></codeline> |
---|
| 274 | <codeline lineno="131"><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></codeline> |
---|
| 275 | <codeline lineno="132"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>For<sp/>future<sp/>ref.</highlight><highlight class="normal"></highlight></codeline> |
---|
| 276 | <codeline lineno="133"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>xtm<sp/>=<sp/>xt;</highlight></codeline> |
---|
| 277 | <codeline lineno="134"><highlight class="normal"></highlight></codeline> |
---|
| 278 | <codeline lineno="135"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Rt*=0.1;</highlight></codeline> |
---|
| 279 | <codeline lineno="136"><highlight class="normal"></highlight><highlight class="comment">//<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Rt<sp/>+=<sp/>10*outer_product<sp/>(<sp/>ddif,ddif<sp/>);<sp/>//(x-xt)^2</highlight><highlight class="normal"></highlight></codeline> |
---|
| 280 | <codeline lineno="137"><highlight class="normal"></highlight></codeline> |
---|
| 281 | <codeline lineno="138"><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> |
---|
| 282 | <codeline lineno="139"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Efix.<ref refid="classEKFfull_18ca46f177e395fa714bbd8bd29ea43e0" kindref="member" tooltip="Here dt = [yt;ut] of appropriate dimensions.">bayes</ref>(concat(dt,ut));</highlight></codeline> |
---|
| 283 | <codeline lineno="140"><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> |
---|
| 284 | <codeline lineno="141"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Eop.<ref refid="classEKFfull_1fc753106e0d4cf68e4f2160fd54458c0" kindref="member" tooltip="Set nonlinear functions for mean values and covariance matrices.">set_parameters</ref><sp/>(<sp/>&fxu,&hxu,(Qt+1e-8*eye(4)),(Rt+1e-6*eye(2)));</highlight></codeline> |
---|
| 285 | <codeline lineno="142"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Eop.<ref refid="classEKFfull_18ca46f177e395fa714bbd8bd29ea43e0" kindref="member" tooltip="Here dt = [yt;ut] of appropriate dimensions.">bayes</ref>(concat(dt,ut));</highlight></codeline> |
---|
| 286 | <codeline lineno="143"><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> |
---|
| 287 | <codeline lineno="144"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Edi.<ref refid="classEKFfull_1fc753106e0d4cf68e4f2160fd54458c0" kindref="member" tooltip="Set nonlinear functions for mean values and covariance matrices.">set_parameters</ref><sp/>(<sp/>&fxu,&hxu,(diag(diag(Qt))+1e-16*eye(4)),<sp/>(diag(diag(Rt))+1e-3*eye(2)));</highlight></codeline> |
---|
| 288 | <codeline lineno="145"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Edi.<ref refid="classEKFfull_18ca46f177e395fa714bbd8bd29ea43e0" kindref="member" tooltip="Here dt = [yt;ut] of appropriate dimensions.">bayes</ref>(concat(dt,ut));</highlight></codeline> |
---|
| 289 | <codeline lineno="146"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight></codeline> |
---|
| 290 | <codeline lineno="147"><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> |
---|
| 291 | <codeline lineno="148"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>L.<ref refid="classmemlog_18d2feeb826f7249e9104d616b5a67144" kindref="member" tooltip="log this vector">logit</ref>(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="149"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>L.<ref refid="classmemlog_18d2feeb826f7249e9104d616b5a67144" kindref="member" tooltip="log this vector">logit</ref>(Efix_log,<sp/>Efix_ep.<ref refid="classepdf_1bf0a070a8f3e67a93604ca724638b870" kindref="member" tooltip="return expected value">mean</ref>()<sp/>);<sp/></highlight></codeline> |
---|
| 293 | <codeline lineno="150"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>L.<ref refid="classmemlog_18d2feeb826f7249e9104d616b5a67144" kindref="member" tooltip="log this vector">logit</ref>(Eop_log,<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Eop_ep.<ref refid="classepdf_1bf0a070a8f3e67a93604ca724638b870" kindref="member" tooltip="return expected value">mean</ref>()<sp/>);<sp/></highlight></codeline> |
---|
| 294 | <codeline lineno="151"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>L.<ref refid="classmemlog_18d2feeb826f7249e9104d616b5a67144" kindref="member" tooltip="log this vector">logit</ref>(Edi_log,<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Edi_ep.<ref refid="classepdf_1bf0a070a8f3e67a93604ca724638b870" kindref="member" tooltip="return expected value">mean</ref>()<sp/>);<sp/></highlight></codeline> |
---|
| 295 | <codeline lineno="152"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>L.<ref refid="classmemlog_18d2feeb826f7249e9104d616b5a67144" kindref="member" tooltip="log this vector">logit</ref>(Q_log,<sp/><sp/>vec(Qt._data(),16)<sp/>);<sp/></highlight></codeline> |
---|
| 296 | <codeline lineno="153"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>L.<ref refid="classmemlog_18d2feeb826f7249e9104d616b5a67144" kindref="member" tooltip="log this vector">logit</ref>(R_log,<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>vec(Rt._data(),4)<sp/>);<sp/></highlight></codeline> |
---|
| 297 | <codeline lineno="154"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>L.<ref refid="classmemlog_18d2feeb826f7249e9104d616b5a67144" kindref="member" tooltip="log this vector">logit</ref>(D_log,<sp/><sp/>vec(KalmanObs,4)<sp/>);<sp/></highlight></codeline> |
---|
| 298 | <codeline lineno="155"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>L.<ref refid="classmemlog_18d2feeb826f7249e9104d616b5a67144" kindref="member" tooltip="log this vector">logit</ref>(Du_log,<sp/>dut<sp/>);<sp/></highlight></codeline> |
---|
| 299 | <codeline lineno="156"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>L.<ref refid="classmemlog_18d2feeb826f7249e9104d616b5a67144" kindref="member" tooltip="log this vector">logit</ref>(Di_log,<sp/>dit<sp/>);<sp/></highlight></codeline> |
---|
| 300 | <codeline lineno="157"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight></codeline> |
---|
| 301 | <codeline lineno="158"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>L.<ref refid="classdirfilelog_1f5fe9483a041591bfe6f3d6393b02aa7" kindref="member" tooltip="Shifts storage position for another time step.">step</ref>();</highlight></codeline> |
---|
| 302 | <codeline lineno="159"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> |
---|
| 303 | <codeline lineno="160"><highlight class="normal"></highlight></codeline> |
---|
| 304 | <codeline lineno="161"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>L.<ref refid="classdirfilelog_14d671baf6f88444d7fe25a5b8a80834a" kindref="member" tooltip="Finalize storing information.">finalize</ref>();</highlight></codeline> |
---|
| 305 | <codeline lineno="162"><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> |
---|
| 306 | <codeline lineno="163"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight></codeline> |
---|
| 307 | <codeline lineno="164"><highlight class="normal"></highlight></codeline> |
---|
| 308 | <codeline lineno="165"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0;</highlight></codeline> |
---|
| 309 | <codeline lineno="166"><highlight class="normal">}</highlight></codeline> |
---|
| 310 | <codeline lineno="167"><highlight class="normal"></highlight></codeline> |
---|
| 311 | </programlisting> |
---|
| 312 | <location file="/home/smidl/work/git/mixpp/pmsm/sim_var.cpp"/> |
---|
| 313 | </compounddef> |
---|
| 314 | </doxygen> |
---|