<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="1.5.6">
  <compounddef id="pwm_8cpp" kind="file">
    <compoundname>pwm.cpp</compoundname>
    <includes local="no">math.h</includes>
    <includes local="no">stdlib.h</includes>
    <includes refid="pwm_8h" local="yes">pwm.h</includes>
    <incdepgraph>
      <node id="775">
        <label>pwm.h</label>
        <link refid="pwm_8h-source"/>
      </node>
      <node id="774">
        <label>stdlib.h</label>
      </node>
      <node id="772">
        <label>work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp</label>
        <link refid="pwm.cpp"/>
        <childnode refid="773" relation="include">
        </childnode>
        <childnode refid="774" relation="include">
        </childnode>
        <childnode refid="775" relation="include">
        </childnode>
      </node>
      <node id="773">
        <label>math.h</label>
      </node>
    </incdepgraph>
      <sectiondef kind="define">
      <memberdef kind="define" id="pwm_8cpp_1525335710b53cb064ca56b936120431e" prot="public" static="no">
        <name>_USE_MATH_DEFINES</name>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp" line="12" bodyfile="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp" bodystart="12" bodyend="-1"/>
      </memberdef>
      </sectiondef>
      <sectiondef kind="var">
      <memberdef kind="variable" id="pwm_8cpp_1daf2100f703a9431b674c5210eeb65a3" prot="public" static="yes" mutable="no">
        <type>double</type>
        <definition>double up</definition>
        <argsstring></argsstring>
        <name>up</name>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp" line="29" bodyfile="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp" bodystart="29" bodyend="-1"/>
      </memberdef>
      <memberdef kind="variable" id="pwm_8cpp_12f875ebe908810d9666a2dcb4a28bd8e" prot="public" static="yes" mutable="no">
        <type>double</type>
        <definition>double up2</definition>
        <argsstring></argsstring>
        <name>up2</name>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp" line="29" bodyfile="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp" bodystart="29" bodyend="-1"/>
      </memberdef>
      <memberdef kind="variable" id="pwm_8cpp_13d0e10d2a152c348be161be18c1deb5a" prot="public" static="yes" mutable="no">
        <type>double</type>
        <definition>double dup</definition>
        <argsstring></argsstring>
        <name>dup</name>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp" line="29" bodyfile="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp" bodystart="29" bodyend="-1"/>
      </memberdef>
      <memberdef kind="variable" id="pwm_8cpp_1a25c32c8e1605293535ff9baa435b758" prot="public" static="yes" mutable="no">
        <type>int</type>
        <definition>int smer</definition>
        <argsstring></argsstring>
        <name>smer</name>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp" line="30" bodyfile="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp" bodystart="30" bodyend="-1"/>
      </memberdef>
      <memberdef kind="variable" id="pwm_8cpp_1e2040e9b4693cfc54938a3b2d062591c" prot="public" static="yes" mutable="no">
        <type>int</type>
        <definition>int smer2</definition>
        <argsstring></argsstring>
        <name>smer2</name>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp" line="30" bodyfile="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp" bodystart="30" bodyend="-1"/>
      </memberdef>
      <memberdef kind="variable" id="pwm_8cpp_1911020f0c2ee7248d3575189b06398c2" prot="public" static="yes" mutable="no">
        <type>int</type>
        <definition>int citac</definition>
        <argsstring></argsstring>
        <name>citac</name>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp" line="32" bodyfile="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp" bodystart="32" bodyend="-1"/>
      </memberdef>
      <memberdef kind="variable" id="pwm_8cpp_1abf693f6b07594a20f4aa8d02a875399" prot="public" static="yes" mutable="no">
        <type>int</type>
        <definition>int citac2</definition>
        <argsstring></argsstring>
        <name>citac2</name>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp" line="32" bodyfile="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp" bodystart="32" bodyend="-1"/>
      </memberdef>
      <memberdef kind="variable" id="pwm_8cpp_1278b61cc75f0dcbf7685ad230b12b1a4" prot="public" static="yes" mutable="no">
        <type>int</type>
        <definition>int citac_PR</definition>
        <argsstring></argsstring>
        <name>citac_PR</name>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp" line="32" bodyfile="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp" bodystart="32" bodyend="-1"/>
      </memberdef>
      <memberdef kind="variable" id="pwm_8cpp_17a680e4d7a5e9346e499145d368b3425" prot="public" static="no" mutable="no">
        <type>double</type>
        <definition>double ladeni_pila</definition>
        <argsstring></argsstring>
        <name>ladeni_pila</name>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp" line="34" bodyfile="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp" bodystart="34" bodyend="-1"/>
      </memberdef>
      <memberdef kind="variable" id="pwm_8cpp_10395b9b0cf279728c73762ea8b38752d" prot="public" static="no" mutable="no">
        <type>double</type>
        <definition>double ladeni_ur</definition>
        <argsstring></argsstring>
        <name>ladeni_ur</name>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp" line="34" bodyfile="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp" bodystart="34" bodyend="-1"/>
      </memberdef>
      </sectiondef>
      <sectiondef kind="func">
      <memberdef kind="function" id="pwm_8cpp_17513b869bbedd804e88eacb29ce7ce65" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>void</type>
        <definition>void pwm_full_init</definition>
        <argsstring>(double Ucn, double fc, double DT)</argsstring>
        <name>pwm_full_init</name>
        <param>
          <type>double</type>
          <declname>Ucn</declname>
        </param>
        <param>
          <type>double</type>
          <declname>fc</declname>
        </param>
        <param>
          <type>double</type>
          <declname>DT</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp" line="17" bodyfile="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp" bodystart="36" bodyend="48"/>
      </memberdef>
      <memberdef kind="function" id="pwm_8cpp_11f94887ac28aad48fbc0a58158d1bfc9" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>void</type>
        <definition>void pwm_full</definition>
        <argsstring>(double *us, double *u, double *Iz, double Ucn, double Uc, double *i, double fc, double *va_char, unsigned int pocet, double h)</argsstring>
        <name>pwm_full</name>
        <param>
          <type>double *</type>
          <declname>us</declname>
        </param>
        <param>
          <type>double *</type>
          <declname>u</declname>
        </param>
        <param>
          <type>double *</type>
          <declname>Iz</declname>
        </param>
        <param>
          <type>double</type>
          <declname>Ucn</declname>
        </param>
        <param>
          <type>double</type>
          <declname>Uc</declname>
        </param>
        <param>
          <type>double *</type>
          <declname>i</declname>
        </param>
        <param>
          <type>double</type>
          <declname>fc</declname>
        </param>
        <param>
          <type>double *</type>
          <declname>va_char</declname>
        </param>
        <param>
          <type>unsigned int</type>
          <declname>pocet</declname>
        </param>
        <param>
          <type>double</type>
          <declname>h</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp" line="18" bodyfile="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp" bodystart="50" bodyend="127"/>
      </memberdef>
      <memberdef kind="function" id="pwm_8cpp_1e1c2432789266f899d9b76a1116671ab" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>void</type>
        <definition>void pwm_full_new_init</definition>
        <argsstring>(double h, double fc, double DT, int citac_init, int D_smer, int D_smer2)</argsstring>
        <name>pwm_full_new_init</name>
        <param>
          <type>double</type>
          <declname>h</declname>
        </param>
        <param>
          <type>double</type>
          <declname>fc</declname>
        </param>
        <param>
          <type>double</type>
          <declname>DT</declname>
        </param>
        <param>
          <type>int</type>
          <declname>citac_init</declname>
        </param>
        <param>
          <type>int</type>
          <declname>D_smer</declname>
        </param>
        <param>
          <type>int</type>
          <declname>D_smer2</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp" line="20" bodyfile="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp" bodystart="217" bodyend="230"/>
      </memberdef>
      <memberdef kind="function" id="pwm_8cpp_1c56bd9c40bf614797dcf24aaa772cb13" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>void</type>
        <definition>void pwm_full_new</definition>
        <argsstring>(double *us, double *u, double *Iz, double Ucn, double Uc, double *is, double *va_char, unsigned int pocet)</argsstring>
        <name>pwm_full_new</name>
        <param>
          <type>double *</type>
          <declname>us</declname>
        </param>
        <param>
          <type>double *</type>
          <declname>u</declname>
        </param>
        <param>
          <type>double *</type>
          <declname>Iz</declname>
        </param>
        <param>
          <type>double</type>
          <declname>Ucn</declname>
        </param>
        <param>
          <type>double</type>
          <declname>Uc</declname>
        </param>
        <param>
          <type>double *</type>
          <declname>is</declname>
        </param>
        <param>
          <type>double *</type>
          <declname>va_char</declname>
        </param>
        <param>
          <type>unsigned int</type>
          <declname>pocet</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp" line="21" bodyfile="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp" bodystart="150" bodyend="215"/>
      </memberdef>
      <memberdef kind="function" id="pwm_8cpp_190a472aec25336c72743a4b078251e3d" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>void</type>
        <definition>void pwm_full_new_init_3h</definition>
        <argsstring>(double h, double fc, double DT, int citac_init, int D_smer, int D_smer2)</argsstring>
        <name>pwm_full_new_init_3h</name>
        <param>
          <type>double</type>
          <declname>h</declname>
        </param>
        <param>
          <type>double</type>
          <declname>fc</declname>
        </param>
        <param>
          <type>double</type>
          <declname>DT</declname>
        </param>
        <param>
          <type>int</type>
          <declname>citac_init</declname>
        </param>
        <param>
          <type>int</type>
          <declname>D_smer</declname>
        </param>
        <param>
          <type>int</type>
          <declname>D_smer2</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp" line="24" bodyfile="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp" bodystart="233" bodyend="246"/>
      </memberdef>
      <memberdef kind="function" id="pwm_8cpp_18dd985080259d21d1c0505551e3d187e" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>void</type>
        <definition>void pwm_full_new_3h</definition>
        <argsstring>(double *us, double *u, double *Iz, double Ucn, double Uc, double *is, double *va_char, unsigned int pocet, unsigned int mod)</argsstring>
        <name>pwm_full_new_3h</name>
        <param>
          <type>double *</type>
          <declname>us</declname>
        </param>
        <param>
          <type>double *</type>
          <declname>u</declname>
        </param>
        <param>
          <type>double *</type>
          <declname>Iz</declname>
        </param>
        <param>
          <type>double</type>
          <declname>Ucn</declname>
        </param>
        <param>
          <type>double</type>
          <declname>Uc</declname>
        </param>
        <param>
          <type>double *</type>
          <declname>is</declname>
        </param>
        <param>
          <type>double *</type>
          <declname>va_char</declname>
        </param>
        <param>
          <type>unsigned int</type>
          <declname>pocet</declname>
        </param>
        <param>
          <type>unsigned int</type>
          <declname>mod</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp" line="25" bodyfile="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp" bodystart="249" bodyend="341"/>
      </memberdef>
      <memberdef kind="function" id="pwm_8cpp_1868d0eed8fe05ebbce87ae4297619983" prot="public" static="yes" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>double</type>
        <definition>static double ubytek</definition>
        <argsstring>(double *va_char, double I, unsigned int pocet)</argsstring>
        <name>ubytek</name>
        <param>
          <type>double *</type>
          <declname>va_char</declname>
        </param>
        <param>
          <type>double</type>
          <declname>I</declname>
        </param>
        <param>
          <type>unsigned int</type>
          <declname>pocet</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp" line="27" bodyfile="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp" bodystart="129" bodyend="147"/>
      </memberdef>
      </sectiondef>
    <briefdescription>
    </briefdescription>
    <detaileddescription>
    </detaileddescription>
    <programlisting>
<codeline lineno="1"><highlight class="comment">/*<sp/>modul<sp/>PWM<sp/>modulace</highlight></codeline>
<codeline lineno="2"><highlight class="comment"><sp/><sp/><sp/>ubytky<sp/>a<sp/>mrtve<sp/>casy</highlight></codeline>
<codeline lineno="3"><highlight class="comment"></highlight></codeline>
<codeline lineno="4"><highlight class="comment"><sp/><sp/><sp/>shodna<sp/>verze<sp/>s<sp/>PWM_FULL_LC</highlight></codeline>
<codeline lineno="5"><highlight class="comment"></highlight></codeline>
<codeline lineno="6"><highlight class="comment"><sp/><sp/><sp/>31.5.<sp/>2007</highlight></codeline>
<codeline lineno="7"><highlight class="comment"></highlight></codeline>
<codeline lineno="8"><highlight class="comment"><sp/><sp/><sp/>VER.<sp/>zmenena<sp/>metoda<sp/>vypoctu<sp/>pily<sp/>(nove<sp/>funkce)</highlight></codeline>
<codeline lineno="9"><highlight class="comment"><sp/><sp/><sp/>31.5.2007<sp/><sp/><sp/><sp/>Doplnena<sp/>PWM<sp/>se<sp/>treti<sp/>harmonickou<sp/>-<sp/>fce<sp/>pwm_full_new_3h(...)<sp/>-<sp/>prepinani<sp/>mezi<sp/>sinusovou<sp/>PWM<sp/>a<sp/>3.<sp/>harmonickou<sp/>pomoci<sp/>priznaku<sp/>mod!</highlight></codeline>
<codeline lineno="10"><highlight class="comment">*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="11"><highlight class="normal"></highlight></codeline>
<codeline lineno="12"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>_USE_MATH_DEFINES</highlight></codeline>
<codeline lineno="13"><highlight class="preprocessor"></highlight><highlight class="preprocessor">#include<sp/>&lt;math.h&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="14"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;stdlib.h&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="15"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;pwm.h&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="16"><highlight class="normal"></highlight></codeline>
<codeline lineno="17"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>pwm_full_init(</highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>Ucn,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>fc,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>DT);</highlight></codeline>
<codeline lineno="18"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>pwm_full(</highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*us,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*u,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*Iz,</highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>Ucn,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>Uc,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*i,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>fc,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*va_char,</highlight><highlight class="keywordtype">unsigned</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>pocet,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>h);</highlight></codeline>
<codeline lineno="19"><highlight class="normal"></highlight></codeline>
<codeline lineno="20"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>pwm_full_new_init(</highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>h,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>fc,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>DT,<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>citac_init,<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>D_smer,<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>D_smer2);</highlight></codeline>
<codeline lineno="21"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>pwm_full_new(</highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*us,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*u,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*Iz,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>Ucn,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>Uc,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*is,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*va_char,<sp/></highlight><highlight class="keywordtype">unsigned</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>pocet);</highlight></codeline>
<codeline lineno="22"><highlight class="normal"></highlight></codeline>
<codeline lineno="23"><highlight class="normal"></highlight><highlight class="comment">//<sp/>PWM<sp/>se<sp/>treti<sp/>harmonickou</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="24"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>pwm_full_new_init_3h(</highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>h,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>fc,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>DT,<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>citac_init,<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>D_smer,<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>D_smer2);</highlight></codeline>
<codeline lineno="25"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>pwm_full_new_3h(</highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*us,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*u,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*Iz,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>Ucn,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>Uc,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*is,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*va_char,<sp/></highlight><highlight class="keywordtype">unsigned</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>pocet,<sp/></highlight><highlight class="keywordtype">unsigned</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>mod);</highlight></codeline>
<codeline lineno="26"><highlight class="normal"></highlight></codeline>
<codeline lineno="27"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>ubytek(</highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*va_char,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>I,<sp/></highlight><highlight class="keywordtype">unsigned</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>pocet);</highlight></codeline>
<codeline lineno="28"><highlight class="normal"></highlight></codeline>
<codeline lineno="29"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>up,<sp/>up2,<sp/>dup;</highlight></codeline>
<codeline lineno="30"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>smer,<sp/>smer2;</highlight></codeline>
<codeline lineno="31"><highlight class="normal"></highlight></codeline>
<codeline lineno="32"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>citac,<sp/>citac2,<sp/>citac_PR;</highlight></codeline>
<codeline lineno="33"><highlight class="normal"></highlight></codeline>
<codeline lineno="34"><highlight class="normal"></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>ladeni_pila,<sp/>ladeni_ur;</highlight></codeline>
<codeline lineno="35"><highlight class="normal"></highlight></codeline>
<codeline lineno="36"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>pwm_full_init(</highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>Ucn,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>fc,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>DT)</highlight></codeline>
<codeline lineno="37"><highlight class="normal"></highlight><highlight class="comment">/*</highlight></codeline>
<codeline lineno="38"><highlight class="comment">Ucn<sp/>...<sp/>jmenovite<sp/>napeti<sp/>kondenzatoru<sp/>v<sp/>ss<sp/>obvodu</highlight></codeline>
<codeline lineno="39"><highlight class="comment">fc<sp/><sp/>...<sp/>spinaci<sp/>frekvence</highlight></codeline>
<codeline lineno="40"><highlight class="comment">h<sp/><sp/><sp/>...<sp/>krok<sp/>simulace</highlight></codeline>
<codeline lineno="41"><highlight class="comment">DT<sp/><sp/>...<sp/>velikost<sp/>mrtveho<sp/>casu</highlight></codeline>
<codeline lineno="42"><highlight class="comment">*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="43"><highlight class="normal">{</highlight></codeline>
<codeline lineno="44"><highlight class="normal"><sp/><sp/>smer=-1;<sp/>smer2=1;</highlight></codeline>
<codeline lineno="45"><highlight class="normal"><sp/><sp/>up=Ucn/2;</highlight></codeline>
<codeline lineno="46"><highlight class="normal"></highlight><highlight class="comment">//<sp/><sp/>up=0.;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="47"><highlight class="normal"><sp/><sp/>up2=up-2*Ucn*fc*DT;</highlight></codeline>
<codeline lineno="48"><highlight class="normal">}</highlight></codeline>
<codeline lineno="49"><highlight class="normal"></highlight></codeline>
<codeline lineno="50"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>pwm_full(</highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*us,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*u,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*Iz,</highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>Ucn,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>Uc,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*is,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>fc,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*va_char,</highlight><highlight class="keywordtype">unsigned</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>pocet,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>h)</highlight></codeline>
<codeline lineno="51"><highlight class="normal"></highlight><highlight class="comment">/*</highlight></codeline>
<codeline lineno="52"><highlight class="comment">u<sp/><sp/><sp/><sp/>...<sp/>pozadovane<sp/>napeti</highlight></codeline>
<codeline lineno="53"><highlight class="comment">us<sp/><sp/><sp/>...<sp/>[usx,<sp/>usy]...vystupni<sp/>napeti<sp/>stridace<sp/>v<sp/>(x,y)</highlight></codeline>
<codeline lineno="54"><highlight class="comment">Iz<sp/><sp/><sp/>...<sp/>proud<sp/>v<sp/>ss<sp/>obvodu</highlight></codeline>
<codeline lineno="55"><highlight class="comment">Ucn<sp/><sp/>...<sp/>jmenovite<sp/>nap.<sp/>v<sp/>ss<sp/>obvodu</highlight></codeline>
<codeline lineno="56"><highlight class="comment">Uc<sp/><sp/><sp/>...<sp/>skutecne<sp/>napeti<sp/>na<sp/>C</highlight></codeline>
<codeline lineno="57"><highlight class="comment">is<sp/><sp/><sp/>...<sp/>[isx,<sp/>isy]...proud<sp/>motorem</highlight></codeline>
<codeline lineno="58"><highlight class="comment">va_char<sp/>...<sp/>VA-char<sp/>vykonovych<sp/>spinacu</highlight></codeline>
<codeline lineno="59"><highlight class="comment">pocet<sp/><sp/><sp/>...<sp/>pocet<sp/>bodu<sp/>VA-charky</highlight></codeline>
<codeline lineno="60"><highlight class="comment">h<sp/><sp/><sp/><sp/>...<sp/>krok<sp/>simulace</highlight></codeline>
<codeline lineno="61"><highlight class="comment">*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="62"><highlight class="normal">{</highlight></codeline>
<codeline lineno="63"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">unsigned</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>i;</highlight></codeline>
<codeline lineno="64"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>iabc[3],<sp/>ur[3],ustr[3],ua,ub,uc;</highlight></codeline>
<codeline lineno="65"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>dtr[3],dd[3];<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>ubytky<sp/>na<sp/>polovodicich</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="66"><highlight class="normal"></highlight></codeline>
<codeline lineno="67"><highlight class="normal"><sp/><sp/>ladeni_pila=up;</highlight></codeline>
<codeline lineno="68"><highlight class="normal"></highlight></codeline>
<codeline lineno="69"><highlight class="normal"><sp/><sp/>iabc[0]=*is;</highlight></codeline>
<codeline lineno="70"><highlight class="normal"><sp/><sp/>iabc[1]=(-*is+sqrt(3.)**(is+1))/2.;</highlight></codeline>
<codeline lineno="71"><highlight class="normal"><sp/><sp/>iabc[2]=(-*is-sqrt(3.)**(is+1))/2.;</highlight></codeline>
<codeline lineno="72"><highlight class="normal"></highlight></codeline>
<codeline lineno="73"><highlight class="normal"><sp/><sp/>ur[0]=*u;</highlight></codeline>
<codeline lineno="74"><highlight class="normal"><sp/><sp/>ur[1]=(-*u+sqrt(3.)**(u+1))/2.;</highlight></codeline>
<codeline lineno="75"><highlight class="normal"><sp/><sp/>ur[2]=(-*u-sqrt(3.)**(u+1))/2.;</highlight></codeline>
<codeline lineno="76"><highlight class="normal"></highlight></codeline>
<codeline lineno="77"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i=0;i&lt;3;i++)</highlight></codeline>
<codeline lineno="78"><highlight class="normal"><sp/><sp/>{<sp/>dtr[i]=ubytek(va_char,fabs(iabc[i]),pocet);</highlight></codeline>
<codeline lineno="79"><highlight class="normal"><sp/><sp/><sp/><sp/>dd[i]=dtr[i]*.73;</highlight></codeline>
<codeline lineno="80"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="81"><highlight class="normal"></highlight></codeline>
<codeline lineno="82"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>implementace<sp/>ubytku<sp/>a<sp/>mrtvych<sp/>casu</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="83"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i=0;i&lt;3;i++)</highlight></codeline>
<codeline lineno="84"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(iabc[i]&gt;=0)</highlight></codeline>
<codeline lineno="85"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((ur[i]&gt;up)<sp/>&amp;&amp;<sp/>(ur[i]&gt;up2))</highlight></codeline>
<codeline lineno="86"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ustr[i]=Uc/2-dtr[i];</highlight></codeline>
<codeline lineno="87"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="88"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ustr[i]=-(Uc/2+dd[i]);</highlight></codeline>
<codeline lineno="89"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="90"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((ur[i]&lt;up)<sp/>&amp;&amp;<sp/>(ur[i]&lt;up2))</highlight></codeline>
<codeline lineno="91"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ustr[i]=-(Uc/2-dtr[i]);</highlight></codeline>
<codeline lineno="92"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="93"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ustr[i]=Uc/2+dd[i];</highlight></codeline>
<codeline lineno="94"><highlight class="normal"></highlight></codeline>
<codeline lineno="95"><highlight class="normal"></highlight><highlight class="comment">//<sp/>fazova<sp/>napeti<sp/>zateze</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="96"><highlight class="normal"><sp/><sp/>ua=(2*ustr[0]-ustr[1]-ustr[2])/3;</highlight></codeline>
<codeline lineno="97"><highlight class="normal"><sp/><sp/>ub=(2*ustr[1]-ustr[0]-ustr[2])/3;</highlight></codeline>
<codeline lineno="98"><highlight class="normal"><sp/><sp/>uc=(2*ustr[2]-ustr[0]-ustr[1])/3;</highlight></codeline>
<codeline lineno="99"><highlight class="normal"></highlight></codeline>
<codeline lineno="100"><highlight class="normal"></highlight><highlight class="comment">//<sp/>vystupni<sp/>napeti<sp/>stridace<sp/>v<sp/>(x,y)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="101"><highlight class="normal"><sp/><sp/>*us=(2.*ua-ub-uc)/3.;</highlight></codeline>
<codeline lineno="102"><highlight class="normal"><sp/><sp/>*(us+1)=(ub-uc)/sqrt(3.);</highlight></codeline>
<codeline lineno="103"><highlight class="normal"></highlight></codeline>
<codeline lineno="104"><highlight class="normal"></highlight><highlight class="comment">//<sp/>vypocet<sp/>pily<sp/>pro<sp/>PWM<sp/>a<sp/>pily<sp/>pro<sp/>mrtve<sp/>casy</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="105"><highlight class="normal"><sp/><sp/>dup=2.*Ucn*fc*h;</highlight></codeline>
<codeline lineno="106"><highlight class="normal"><sp/><sp/>up+=smer*dup;</highlight></codeline>
<codeline lineno="107"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(up&gt;Ucn/2)</highlight></codeline>
<codeline lineno="108"><highlight class="normal"><sp/><sp/>{<sp/>up-=2*dup;</highlight></codeline>
<codeline lineno="109"><highlight class="normal"><sp/><sp/><sp/><sp/>smer=-1;</highlight></codeline>
<codeline lineno="110"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="111"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(up&lt;-Ucn/2)</highlight></codeline>
<codeline lineno="112"><highlight class="normal"><sp/><sp/>{<sp/>up+=2.*dup;</highlight></codeline>
<codeline lineno="113"><highlight class="normal"><sp/><sp/><sp/><sp/>smer=1;</highlight></codeline>
<codeline lineno="114"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="115"><highlight class="normal"></highlight></codeline>
<codeline lineno="116"><highlight class="normal"><sp/><sp/>up2+=smer2*dup;</highlight></codeline>
<codeline lineno="117"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(up2&gt;Ucn/2)</highlight></codeline>
<codeline lineno="118"><highlight class="normal"><sp/><sp/>{<sp/>up2-=2.*dup;</highlight></codeline>
<codeline lineno="119"><highlight class="normal"><sp/><sp/><sp/><sp/>smer2=-1;</highlight></codeline>
<codeline lineno="120"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="121"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(up2&lt;-Ucn/2)</highlight></codeline>
<codeline lineno="122"><highlight class="normal"><sp/><sp/>{<sp/>up2+=2.*dup;</highlight></codeline>
<codeline lineno="123"><highlight class="normal"><sp/><sp/><sp/><sp/>smer2=1;</highlight></codeline>
<codeline lineno="124"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="125"><highlight class="normal"></highlight></codeline>
<codeline lineno="126"><highlight class="normal"><sp/><sp/>*Iz=(ustr[0]&gt;0)*iabc[0]+(ustr[1]&gt;0)*iabc[1]+(ustr[2]&gt;0)*iabc[2];</highlight></codeline>
<codeline lineno="127"><highlight class="normal">}</highlight></codeline>
<codeline lineno="128"><highlight class="normal"></highlight></codeline>
<codeline lineno="129"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>ubytek(</highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*va_char,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>I,<sp/></highlight><highlight class="keywordtype">unsigned</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>pocet)</highlight></codeline>
<codeline lineno="130"><highlight class="normal">{</highlight></codeline>
<codeline lineno="131"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">unsigned</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>ii;</highlight></codeline>
<codeline lineno="132"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>delta_u;</highlight></codeline>
<codeline lineno="133"><highlight class="normal"></highlight></codeline>
<codeline lineno="134"><highlight class="normal"><sp/><sp/>ii=0;</highlight></codeline>
<codeline lineno="135"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>((*(va_char+ii)&lt;I)<sp/>&amp;&amp;<sp/>(ii&lt;(pocet-1)))</highlight></codeline>
<codeline lineno="136"><highlight class="normal"><sp/><sp/><sp/><sp/>ii++;</highlight></codeline>
<codeline lineno="137"><highlight class="normal"></highlight></codeline>
<codeline lineno="138"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ii==(pocet-1))<sp/><sp/></highlight><highlight class="comment">//<sp/>konec<sp/>va_char<sp/>-<sp/>predpoklad<sp/>nasyceni<sp/>charky</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="139"><highlight class="normal"><sp/><sp/><sp/><sp/>delta_u=*(va_char+ii+pocet);</highlight></codeline>
<codeline lineno="140"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="141"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ii==0)</highlight></codeline>
<codeline lineno="142"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>delta_u=0;</highlight></codeline>
<codeline lineno="143"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="144"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>delta_u=*(va_char+ii-1+pocet)+(I-*(va_char+ii-1))/(*(va_char+ii)-*(va_char+ii-1))*(*(va_char+ii+pocet)-*(va_char+ii-1+pocet));</highlight></codeline>
<codeline lineno="145"><highlight class="normal"></highlight></codeline>
<codeline lineno="146"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>delta_u;</highlight></codeline>
<codeline lineno="147"><highlight class="normal">}</highlight></codeline>
<codeline lineno="148"><highlight class="normal"></highlight></codeline>
<codeline lineno="149"><highlight class="normal"></highlight></codeline>
<codeline lineno="150"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>pwm_full_new(</highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*us,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*u,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*Iz,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>Ucn,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>Uc,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*is,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*va_char,<sp/></highlight><highlight class="keywordtype">unsigned</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>pocet)</highlight></codeline>
<codeline lineno="151"><highlight class="normal"></highlight><highlight class="comment">/*</highlight></codeline>
<codeline lineno="152"><highlight class="comment">u<sp/><sp/><sp/><sp/>...<sp/>pozadovane<sp/>napeti</highlight></codeline>
<codeline lineno="153"><highlight class="comment">us<sp/><sp/><sp/>...<sp/>[usx,<sp/>usy]...vystupni<sp/>napeti<sp/>stridace<sp/>v<sp/>(x,y)</highlight></codeline>
<codeline lineno="154"><highlight class="comment">Iz<sp/><sp/><sp/>...<sp/>proud<sp/>v<sp/>ss<sp/>obvodu</highlight></codeline>
<codeline lineno="155"><highlight class="comment">Ucn<sp/><sp/>...<sp/>jmenovite<sp/>nap.<sp/>v<sp/>ss<sp/>obvodu</highlight></codeline>
<codeline lineno="156"><highlight class="comment">Uc<sp/><sp/><sp/>...<sp/>skutecne<sp/>napeti<sp/>na<sp/>C</highlight></codeline>
<codeline lineno="157"><highlight class="comment">is<sp/><sp/><sp/>...<sp/>[isx,<sp/>isy]...proud<sp/>motorem</highlight></codeline>
<codeline lineno="158"><highlight class="comment">va_char<sp/>...<sp/>VA-char<sp/>vykonovych<sp/>spinacu</highlight></codeline>
<codeline lineno="159"><highlight class="comment">pocet<sp/><sp/><sp/>...<sp/>pocet<sp/>bodu<sp/>VA-charky</highlight></codeline>
<codeline lineno="160"><highlight class="comment">t<sp/><sp/><sp/><sp/>...<sp/>aktualni<sp/>cas<sp/>simulace</highlight></codeline>
<codeline lineno="161"><highlight class="comment">*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="162"><highlight class="normal">{</highlight></codeline>
<codeline lineno="163"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">unsigned</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>i;</highlight></codeline>
<codeline lineno="164"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>iabc[3],<sp/>ur[3],ustr[3],ua,ub,uc;</highlight></codeline>
<codeline lineno="165"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>dtr[3],dd[3];<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>ubytky<sp/>na<sp/>polovodicich</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="166"><highlight class="normal"></highlight></codeline>
<codeline lineno="167"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>vypocet<sp/>pily</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="168"><highlight class="normal"><sp/><sp/>up=(double)citac/citac_PR*Ucn/2.;</highlight></codeline>
<codeline lineno="169"><highlight class="normal"><sp/><sp/>up2=(double)citac2/citac_PR*Ucn/2.;</highlight></codeline>
<codeline lineno="170"><highlight class="normal"></highlight></codeline>
<codeline lineno="171"><highlight class="normal"><sp/><sp/>ladeni_pila=up;</highlight></codeline>
<codeline lineno="172"><highlight class="normal"></highlight></codeline>
<codeline lineno="173"><highlight class="normal"><sp/><sp/>iabc[0]=*is;</highlight></codeline>
<codeline lineno="174"><highlight class="normal"><sp/><sp/>iabc[1]=(-*is+sqrt(3.)**(is+1))/2.;</highlight></codeline>
<codeline lineno="175"><highlight class="normal"><sp/><sp/>iabc[2]=(-*is-sqrt(3.)**(is+1))/2.;</highlight></codeline>
<codeline lineno="176"><highlight class="normal"></highlight></codeline>
<codeline lineno="177"><highlight class="normal"><sp/><sp/>ur[0]=*u;</highlight></codeline>
<codeline lineno="178"><highlight class="normal"><sp/><sp/>ur[1]=(-*u+sqrt(3.)**(u+1))/2.;</highlight></codeline>
<codeline lineno="179"><highlight class="normal"><sp/><sp/>ur[2]=(-*u-sqrt(3.)**(u+1))/2.;</highlight></codeline>
<codeline lineno="180"><highlight class="normal"></highlight></codeline>
<codeline lineno="181"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i=0;i&lt;3;i++)</highlight></codeline>
<codeline lineno="182"><highlight class="normal"><sp/><sp/>{<sp/>dtr[i]=ubytek(va_char,fabs(iabc[i]),pocet);</highlight></codeline>
<codeline lineno="183"><highlight class="normal"><sp/><sp/><sp/><sp/>dd[i]=dtr[i]*.73;</highlight></codeline>
<codeline lineno="184"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="185"><highlight class="normal"></highlight></codeline>
<codeline lineno="186"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>implementace<sp/>ubytku<sp/>a<sp/>mrtvych<sp/>casu</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="187"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i=0;i&lt;3;i++)</highlight></codeline>
<codeline lineno="188"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(iabc[i]&gt;=0)</highlight></codeline>
<codeline lineno="189"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((ur[i]&gt;up)<sp/>&amp;&amp;<sp/>(ur[i]&gt;up2))</highlight></codeline>
<codeline lineno="190"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ustr[i]=Uc/2-dtr[i];</highlight></codeline>
<codeline lineno="191"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="192"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ustr[i]=-(Uc/2+dd[i]);</highlight></codeline>
<codeline lineno="193"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="194"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((ur[i]&lt;up)<sp/>&amp;&amp;<sp/>(ur[i]&lt;up2))</highlight></codeline>
<codeline lineno="195"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ustr[i]=-(Uc/2-dtr[i]);</highlight></codeline>
<codeline lineno="196"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="197"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ustr[i]=Uc/2+dd[i];</highlight></codeline>
<codeline lineno="198"><highlight class="normal"></highlight></codeline>
<codeline lineno="199"><highlight class="normal"></highlight><highlight class="comment">//<sp/>fazova<sp/>napeti<sp/>zateze</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="200"><highlight class="normal"><sp/><sp/>ua=(2*ustr[0]-ustr[1]-ustr[2])/3;</highlight></codeline>
<codeline lineno="201"><highlight class="normal"><sp/><sp/>ub=(2*ustr[1]-ustr[0]-ustr[2])/3;</highlight></codeline>
<codeline lineno="202"><highlight class="normal"><sp/><sp/>uc=(2*ustr[2]-ustr[0]-ustr[1])/3;</highlight></codeline>
<codeline lineno="203"><highlight class="normal"></highlight></codeline>
<codeline lineno="204"><highlight class="normal"></highlight><highlight class="comment">//<sp/>vystupni<sp/>napeti<sp/>stridace<sp/>v<sp/>(x,y)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="205"><highlight class="normal"><sp/><sp/>*us=(2.*ua-ub-uc)/3.;</highlight></codeline>
<codeline lineno="206"><highlight class="normal"><sp/><sp/>*(us+1)=(ub-uc)/sqrt(3.);</highlight></codeline>
<codeline lineno="207"><highlight class="normal"></highlight></codeline>
<codeline lineno="208"><highlight class="normal"><sp/><sp/>*Iz=(ustr[0]&gt;0)*iabc[0]+(ustr[1]&gt;0)*iabc[1]+(ustr[2]&gt;0)*iabc[2];</highlight></codeline>
<codeline lineno="209"><highlight class="normal"></highlight></codeline>
<codeline lineno="210"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>posun<sp/>pily<sp/>...<sp/>inkrement<sp/>citacu</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="211"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((citac==citac_PR)||(citac==-citac_PR))<sp/>smer*=-1;</highlight></codeline>
<codeline lineno="212"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((citac2==citac_PR)||(citac2==-citac_PR))<sp/>smer2*=-1;</highlight></codeline>
<codeline lineno="213"><highlight class="normal"><sp/><sp/>citac+=smer;</highlight></codeline>
<codeline lineno="214"><highlight class="normal"><sp/><sp/>citac2+=smer2;</highlight></codeline>
<codeline lineno="215"><highlight class="normal">}</highlight></codeline>
<codeline lineno="216"><highlight class="normal"></highlight></codeline>
<codeline lineno="217"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>pwm_full_new_init(</highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>h,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>fc,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>DT,<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>citac_init,<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>D_smer,<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>D_smer2)</highlight></codeline>
<codeline lineno="218"><highlight class="normal"></highlight><highlight class="comment">/*</highlight></codeline>
<codeline lineno="219"><highlight class="comment">fc<sp/><sp/>...<sp/>spinaci<sp/>frekvence</highlight></codeline>
<codeline lineno="220"><highlight class="comment">h<sp/><sp/><sp/>...<sp/>krok<sp/>simulace</highlight></codeline>
<codeline lineno="221"><highlight class="comment">DT<sp/><sp/>...<sp/>velikost<sp/>mrtveho<sp/>casu</highlight></codeline>
<codeline lineno="222"><highlight class="comment">citac_init<sp/>...<sp/>pocatecni<sp/>nastaveni<sp/>citace</highlight></codeline>
<codeline lineno="223"><highlight class="comment">D_smer,<sp/>D_smer1<sp/>...<sp/>pocatecni<sp/>nastaveni<sp/>smeru<sp/>citani</highlight></codeline>
<codeline lineno="224"><highlight class="comment">*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="225"><highlight class="normal">{</highlight></codeline>
<codeline lineno="226"><highlight class="normal"><sp/><sp/>smer=D_smer;<sp/>smer2=D_smer2;</highlight></codeline>
<codeline lineno="227"><highlight class="normal"><sp/><sp/>citac=citac_init;</highlight></codeline>
<codeline lineno="228"><highlight class="normal"><sp/><sp/>citac2=citac_init-(int)(DT/h);</highlight></codeline>
<codeline lineno="229"><highlight class="normal"><sp/><sp/>citac_PR=(int)(1./4./fc/h);</highlight></codeline>
<codeline lineno="230"><highlight class="normal">}</highlight></codeline>
<codeline lineno="231"><highlight class="normal"></highlight></codeline>
<codeline lineno="232"><highlight class="normal"></highlight></codeline>
<codeline lineno="233"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>pwm_full_new_init_3h(</highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>h,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>fc,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>DT,<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>citac_init,<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>D_smer,<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>D_smer2)</highlight></codeline>
<codeline lineno="234"><highlight class="normal"></highlight><highlight class="comment">/*</highlight></codeline>
<codeline lineno="235"><highlight class="comment">fc<sp/><sp/>...<sp/>spinaci<sp/>frekvence</highlight></codeline>
<codeline lineno="236"><highlight class="comment">h<sp/><sp/><sp/>...<sp/>krok<sp/>simulace</highlight></codeline>
<codeline lineno="237"><highlight class="comment">DT<sp/><sp/>...<sp/>velikost<sp/>mrtveho<sp/>casu</highlight></codeline>
<codeline lineno="238"><highlight class="comment">citac_init<sp/>...<sp/>pocatecni<sp/>nastaveni<sp/>citace</highlight></codeline>
<codeline lineno="239"><highlight class="comment">D_smer,<sp/>D_smer1<sp/>...<sp/>pocatecni<sp/>nastaveni<sp/>smeru<sp/>citani</highlight></codeline>
<codeline lineno="240"><highlight class="comment">*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="241"><highlight class="normal">{</highlight></codeline>
<codeline lineno="242"><highlight class="normal"><sp/><sp/>smer=D_smer;<sp/>smer2=D_smer2;</highlight></codeline>
<codeline lineno="243"><highlight class="normal"><sp/><sp/>citac=citac_init;</highlight></codeline>
<codeline lineno="244"><highlight class="normal"><sp/><sp/>citac2=abs(citac_init-(</highlight><highlight class="keywordtype">int</highlight><highlight class="normal">)(DT/h));</highlight></codeline>
<codeline lineno="245"><highlight class="normal"><sp/><sp/>citac_PR=(int)(1./2./fc/h);</highlight></codeline>
<codeline lineno="246"><highlight class="normal">}</highlight></codeline>
<codeline lineno="247"><highlight class="normal"></highlight></codeline>
<codeline lineno="248"><highlight class="normal"></highlight></codeline>
<codeline lineno="249"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>pwm_full_new_3h(</highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*us,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*u,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*Iz,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>Ucn,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>Uc,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*is,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*va_char,<sp/></highlight><highlight class="keywordtype">unsigned</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>pocet,<sp/></highlight><highlight class="keywordtype">unsigned</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>mod)</highlight></codeline>
<codeline lineno="250"><highlight class="normal"></highlight><highlight class="comment">/*</highlight></codeline>
<codeline lineno="251"><highlight class="comment">u<sp/><sp/><sp/><sp/>...<sp/>pozadovane<sp/>napeti<sp/>ve<sp/>formatu<sp/>u={Um,<sp/>beta}</highlight></codeline>
<codeline lineno="252"><highlight class="comment">us<sp/><sp/><sp/>...<sp/>[usx,<sp/>usy]...vystupni<sp/>napeti<sp/>stridace<sp/>v<sp/>(x,y)</highlight></codeline>
<codeline lineno="253"><highlight class="comment">Iz<sp/><sp/><sp/>...<sp/>proud<sp/>v<sp/>ss<sp/>obvodu</highlight></codeline>
<codeline lineno="254"><highlight class="comment">Ucn<sp/><sp/>...<sp/>jmenovite<sp/>nap.<sp/>v<sp/>ss<sp/>obvodu</highlight></codeline>
<codeline lineno="255"><highlight class="comment">Uc<sp/><sp/><sp/>...<sp/>skutecne<sp/>napeti<sp/>na<sp/>C</highlight></codeline>
<codeline lineno="256"><highlight class="comment">is<sp/><sp/><sp/>...<sp/>[isx,<sp/>isy]...proud<sp/>motorem</highlight></codeline>
<codeline lineno="257"><highlight class="comment">va_char<sp/>...<sp/>VA-char<sp/>vykonovych<sp/>spinacu</highlight></codeline>
<codeline lineno="258"><highlight class="comment">pocet<sp/><sp/><sp/>...<sp/>pocet<sp/>bodu<sp/>VA-charky</highlight></codeline>
<codeline lineno="259"><highlight class="comment">t<sp/><sp/><sp/><sp/>...<sp/>aktualni<sp/>cas<sp/>simulace</highlight></codeline>
<codeline lineno="260"><highlight class="comment">mod<sp/>...<sp/>mod=<sp/>-<sp/>sinusova<sp/>PWM;<sp/>mod=1<sp/>-<sp/>PWM<sp/>se<sp/>3.<sp/>harmonickou</highlight></codeline>
<codeline lineno="261"><highlight class="comment">*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="262"><highlight class="normal">{</highlight></codeline>
<codeline lineno="263"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">unsigned</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>i;</highlight></codeline>
<codeline lineno="264"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>iabc[3],<sp/>ur[3],ustr[3],ua,ub,uc;</highlight></codeline>
<codeline lineno="265"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>dtr[3],dd[3];<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>ubytky<sp/>na<sp/>polovodicich</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="266"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>Um,<sp/>beta;</highlight></codeline>
<codeline lineno="267"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>U3;<sp/><sp/><sp/><sp/><sp/><sp/><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">//<sp/>korekce<sp/>3.<sp/>harmonickou</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="268"><highlight class="normal"></highlight></codeline>
<codeline lineno="269"><highlight class="normal"></highlight></codeline>
<codeline lineno="270"><highlight class="normal"><sp/><sp/>Um=*u;</highlight></codeline>
<codeline lineno="271"><highlight class="normal"><sp/><sp/>beta=*(u+1);</highlight></codeline>
<codeline lineno="272"><highlight class="normal"></highlight></codeline>
<codeline lineno="273"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>vypocet<sp/>pily</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="274"><highlight class="normal"></highlight><highlight class="comment">//<sp/><sp/>up=(double)citac/citac_PR*Ucn/2.;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="275"><highlight class="normal"></highlight><highlight class="comment">//<sp/><sp/>up2=(double)citac2/citac_PR*Ucn/2.;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="276"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>vypocet<sp/>pily<sp/>presne<sp/>jako<sp/>v<sp/>procesoru</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="277"><highlight class="normal"><sp/><sp/>up=((double)citac/citac_PR-0.5)*Ucn;</highlight></codeline>
<codeline lineno="278"><highlight class="normal"><sp/><sp/>up2=((double)citac2/citac_PR-0.5)*Ucn;</highlight></codeline>
<codeline lineno="279"><highlight class="normal"></highlight></codeline>
<codeline lineno="280"><highlight class="normal"><sp/><sp/>ladeni_pila=up;</highlight></codeline>
<codeline lineno="281"><highlight class="normal"></highlight></codeline>
<codeline lineno="282"><highlight class="normal"><sp/><sp/>iabc[0]=*is;</highlight></codeline>
<codeline lineno="283"><highlight class="normal"><sp/><sp/>iabc[1]=(-*is+sqrt(3.)**(is+1))/2.;</highlight></codeline>
<codeline lineno="284"><highlight class="normal"><sp/><sp/>iabc[2]=(-*is-sqrt(3.)**(is+1))/2.;</highlight></codeline>
<codeline lineno="285"><highlight class="normal"></highlight></codeline>
<codeline lineno="286"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(mod==0)<sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>sinusova<sp/>PWM</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="287"><highlight class="normal"><sp/><sp/>{</highlight></codeline>
<codeline lineno="288"><highlight class="normal"><sp/><sp/><sp/><sp/>ur[0]=Um*cos(beta);</highlight></codeline>
<codeline lineno="289"><highlight class="normal"><sp/><sp/><sp/><sp/>ur[1]=Um*cos(beta-2./3.*M_PI);</highlight></codeline>
<codeline lineno="290"><highlight class="normal"><sp/><sp/><sp/><sp/>ur[2]=Um*cos(beta+2./3.*M_PI);</highlight></codeline>
<codeline lineno="291"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="292"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>PWM<sp/>se<sp/>3.<sp/>harmonickou</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="293"><highlight class="normal"><sp/><sp/>{</highlight></codeline>
<codeline lineno="294"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>dle<sp/>Karla</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="295"><highlight class="normal"></highlight><highlight class="comment">//<sp/><sp/><sp/><sp/>U3=0.13*cos(3.*beta);</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="296"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>moje</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="297"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>U3=0.17*cos(3.*beta);</highlight></codeline>
<codeline lineno="298"><highlight class="normal"><sp/><sp/><sp/><sp/>ur[0]=Um*(cos(beta)-U3);</highlight></codeline>
<codeline lineno="299"><highlight class="normal"><sp/><sp/><sp/><sp/>ur[1]=Um*(cos(beta-2./3.*M_PI)-U3);</highlight></codeline>
<codeline lineno="300"><highlight class="normal"><sp/><sp/><sp/><sp/>ur[2]=Um*(cos(beta+2./3.*M_PI)-U3);</highlight></codeline>
<codeline lineno="301"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="302"><highlight class="normal"></highlight></codeline>
<codeline lineno="303"><highlight class="normal"><sp/><sp/>ladeni_ur=ur[0];</highlight></codeline>
<codeline lineno="304"><highlight class="normal"></highlight></codeline>
<codeline lineno="305"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i=0;i&lt;3;i++)</highlight></codeline>
<codeline lineno="306"><highlight class="normal"><sp/><sp/>{<sp/>dtr[i]=ubytek(va_char,fabs(iabc[i]),pocet);</highlight></codeline>
<codeline lineno="307"><highlight class="normal"><sp/><sp/><sp/><sp/>dd[i]=dtr[i]*.73;</highlight></codeline>
<codeline lineno="308"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="309"><highlight class="normal"></highlight></codeline>
<codeline lineno="310"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>implementace<sp/>ubytku<sp/>a<sp/>mrtvych<sp/>casu</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="311"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i=0;i&lt;3;i++)</highlight></codeline>
<codeline lineno="312"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(iabc[i]&gt;=0)</highlight></codeline>
<codeline lineno="313"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((ur[i]&gt;up)<sp/>&amp;&amp;<sp/>(ur[i]&gt;up2))</highlight></codeline>
<codeline lineno="314"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ustr[i]=Uc/2-dtr[i];</highlight></codeline>
<codeline lineno="315"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="316"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ustr[i]=-(Uc/2+dd[i]);</highlight></codeline>
<codeline lineno="317"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="318"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((ur[i]&lt;up)<sp/>&amp;&amp;<sp/>(ur[i]&lt;up2))</highlight></codeline>
<codeline lineno="319"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ustr[i]=-(Uc/2-dtr[i]);</highlight></codeline>
<codeline lineno="320"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="321"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ustr[i]=Uc/2+dd[i];</highlight></codeline>
<codeline lineno="322"><highlight class="normal"></highlight></codeline>
<codeline lineno="323"><highlight class="normal"></highlight><highlight class="comment">//<sp/>fazova<sp/>napeti<sp/>zateze</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="324"><highlight class="normal"><sp/><sp/>ua=(2.*ustr[0]-ustr[1]-ustr[2])/3.;</highlight></codeline>
<codeline lineno="325"><highlight class="normal"><sp/><sp/>ub=(2.*ustr[1]-ustr[0]-ustr[2])/3.;</highlight></codeline>
<codeline lineno="326"><highlight class="normal"><sp/><sp/>uc=(2.*ustr[2]-ustr[0]-ustr[1])/3.;</highlight></codeline>
<codeline lineno="327"><highlight class="normal"></highlight></codeline>
<codeline lineno="328"><highlight class="normal"></highlight><highlight class="comment">//<sp/>vystupni<sp/>napeti<sp/>stridace<sp/>v<sp/>(x,y)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="329"><highlight class="normal"><sp/><sp/>*us=(2.*ua-ub-uc)/3.;</highlight></codeline>
<codeline lineno="330"><highlight class="normal"><sp/><sp/>*(us+1)=(ub-uc)/sqrt(3.);</highlight></codeline>
<codeline lineno="331"><highlight class="normal"></highlight></codeline>
<codeline lineno="332"><highlight class="normal"><sp/><sp/>*Iz=(ustr[0]&gt;0)*iabc[0]+(ustr[1]&gt;0)*iabc[1]+(ustr[2]&gt;0)*iabc[2];</highlight></codeline>
<codeline lineno="333"><highlight class="normal"></highlight></codeline>
<codeline lineno="334"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>posun<sp/>pily<sp/>...<sp/>inkrement<sp/>citacu</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="335"><highlight class="normal"></highlight><highlight class="comment">//<sp/><sp/>if<sp/>((citac==citac_PR)||(citac==-citac_PR))<sp/>smer*=-1;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="336"><highlight class="normal"></highlight><highlight class="comment">//<sp/><sp/>if<sp/>((citac2==citac_PR)||(citac2==-citac_PR))<sp/>smer2*=-1;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="337"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((citac==citac_PR)||(citac==0))<sp/>smer*=-1;</highlight></codeline>
<codeline lineno="338"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((citac2==citac_PR)||(citac2==0))<sp/>smer2*=-1;</highlight></codeline>
<codeline lineno="339"><highlight class="normal"><sp/><sp/>citac+=smer;</highlight></codeline>
<codeline lineno="340"><highlight class="normal"><sp/><sp/>citac2+=smer2;</highlight></codeline>
<codeline lineno="341"><highlight class="normal">}</highlight></codeline>
    </programlisting>
    <location file="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp"/>
  </compounddef>
</doxygen>
