<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Using the KMS SVPWM to Create a 3 Phase PWM Modulator without a Motor in Kinetis Motor Suite</title>
    <link>https://community.nxp.com/t5/Kinetis-Motor-Suite/Using-the-KMS-SVPWM-to-Create-a-3-Phase-PWM-Modulator-without-a/m-p/772530#M504</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Adam and Philip,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help! I figured it out. All I had to do was call the following commands:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;user.state = USER_RUN_VOLTAGE;&lt;BR /&gt; user.command.statorRefVoltage.d = _LQ(0.0);&lt;BR /&gt; user.command.statorRefVoltage.q = _LQ(0.50);&lt;BR /&gt; user.state = USER_RUN_VOLTAGE;&lt;BR /&gt; user.command.statorRefVoltage.d = _LQ(0.0);&lt;BR /&gt; user.command.statorRefVoltage.q = _LQ(0.50);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This produces a three phase PWM using the SVPWM block.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hardcoded in the 0.50 which gave me 50% of my 400VAC input voltage, 200V. The scaling was an important mistake I was making. It is important that this value is scaled _LQ(0.0) to _LQ(1.0). To achieve this I could also have done:&amp;nbsp;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;_LQ(200.0 / FULL_SCALE_VOLTAGE).&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;It is also important to replace the rotorAngle output from the QEI block with a simulated rotating rotor angle, or you will just get a DC output from the SVPWM block (because the rotor angle is not changing because the motor is disconnected). I did this by creating a 50Hz rotating angle from _LQ(-1.0) -&amp;gt; _LQ(1.0), and then wrapping the angle back around to -1 once it reached 1. This value was set to the rotorAngle value.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 02 May 2018 12:41:15 GMT</pubDate>
    <dc:creator>derekcook</dc:creator>
    <dc:date>2018-05-02T12:41:15Z</dc:date>
    <item>
      <title>Using the KMS SVPWM to Create a 3 Phase PWM Modulator without a Motor</title>
      <link>https://community.nxp.com/t5/Kinetis-Motor-Suite/Using-the-KMS-SVPWM-to-Create-a-3-Phase-PWM-Modulator-without-a/m-p/772527#M501</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am using the mkv31f512vll12p. I would like to use the SVPWM KMS block to create a constant 200V 50Hz 3 phase PWM to validate my IGBT hardware. How would I go about doing this? I do not have a motor connected to the system during the validation. Therefore, there is no resolver or encoder reading in the rotor angle of the motor. Because of this, I have commented out most of the&amp;nbsp;DRV_updateAtFastTick() to test this out. I have also tried this with&amp;nbsp;the commented parts of&amp;nbsp;DRV_updateAtFastTick() left in.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I see the SVPWM block takes in as an input the stationary voltage reference frame from the IPARK block, which takes in as an input the rotor angle and voltage reference to produce this.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_1.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/11161i947AEFDF97BB4397/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_1.png" alt="pastedImage_1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_2.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/11163i952C6E2469ACCE79/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_2.png" alt="pastedImage_2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have tried a couple of things:&amp;nbsp;&lt;/P&gt;&lt;P&gt;##&lt;/P&gt;&lt;P&gt;1) Using a stationary rotor angle. It looks like KMS expects this to be between -_LQ(1.0) and _LQ(1.0)?&amp;nbsp;&lt;/P&gt;&lt;P&gt;2) Using a rotor angle that increments from -_LQ(1.0) to _LQ(1.0) changing _LQ(0.1) every fast tick.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Stationary rotor angle:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* START SVPWM BLOCK ***********************************************************/&lt;BR /&gt; /* Turn inverter switches on */&lt;BR /&gt; SVPWM_enable(&amp;amp;svpwm);&lt;BR /&gt; // Define Rotor Angle&lt;/P&gt;&lt;P&gt;tempAngle = _LQ(1.0);&amp;nbsp;&lt;/P&gt;&lt;P&gt;// Define Reference Voltage&lt;BR /&gt; tempStatorRefVoltageDQ.d = _LQ(0.0);&lt;BR /&gt; tempStatorRefVoltageDQ.q = _LQ(200.0);&lt;/P&gt;&lt;P&gt;// Assign sin and cos of angle&lt;BR /&gt; _LQsincosPU(tempAngle, &amp;amp;tempOrient.sinAngle, &amp;amp;tempOrient.cosAngle);&lt;/P&gt;&lt;P&gt;// Run Inverse Park Transform&lt;BR /&gt; IPARK_run(&amp;amp;ipark, &amp;amp;tempOrient, &amp;amp;tempStatorRefVoltageDQ);&lt;/P&gt;&lt;P&gt;// Run 3 Phase PWM&lt;BR /&gt; SVPWM_updateFastTick(&amp;amp;svpwm, &amp;amp;(ipark.output.vector), ipark.output.magnitude);&lt;BR /&gt; /* END SVPWM BLOCK *************************************************************/&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Rotating Rotor Angle:&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;/* START SVPWM BLOCK ***********************************************************/&lt;BR /&gt; /* Turn inverter switches on */&lt;BR /&gt; SVPWM_enable(&amp;amp;svpwm);&lt;BR /&gt; // Define Rotor Angle&lt;BR /&gt; if(rotorAngle &amp;lt; 0.9)&lt;BR /&gt; {&lt;BR /&gt; rotorAngle += 0.1;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;else&lt;BR /&gt; {&lt;BR /&gt; rotorAngle = -1.0;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;tempAngle = _LQ(rotorAngle); // between -LQ(1.0) and LQ(1.0)&lt;/P&gt;&lt;P&gt;// Define Reference Voltage&lt;BR /&gt; tempStatorRefVoltageDQ.d = _LQ(0.0);&lt;BR /&gt; tempStatorRefVoltageDQ.q = _LQ(200.0);&lt;/P&gt;&lt;P&gt;// Assign sin and cos of angle&lt;BR /&gt; _LQsincosPU(tempAngle, &amp;amp;tempOrient.sinAngle, &amp;amp;tempOrient.cosAngle);&lt;/P&gt;&lt;P&gt;// Run Inverse Park Transform&lt;BR /&gt; IPARK_run(&amp;amp;ipark, &amp;amp;tempOrient, &amp;amp;tempStatorRefVoltageDQ);&lt;/P&gt;&lt;P&gt;// Run 3 Phase PWM&lt;BR /&gt; SVPWM_updateFastTick(&amp;amp;svpwm, &amp;amp;(ipark.output.vector), ipark.output.magnitude);&lt;BR /&gt; /* END SVPWM BLOCK *************************************************************/&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I never see any PWM output out of the Phase A, B and C PWM outputs. This remains low. Also, if I want 200V out am I correct to do this?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Define Reference Voltage&lt;BR /&gt; tempStatorRefVoltageDQ.d = _LQ(0.0);&lt;BR /&gt; tempStatorRefVoltageDQ.q = _LQ(200.0);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your assistance in this matter,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Derek&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Apr 2018 21:08:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Motor-Suite/Using-the-KMS-SVPWM-to-Create-a-3-Phase-PWM-Modulator-without-a/m-p/772527#M501</guid>
      <dc:creator>derekcook</dc:creator>
      <dc:date>2018-04-26T21:08:51Z</dc:date>
    </item>
    <item>
      <title>Re: Using the KMS SVPWM to Create a 3 Phase PWM Modulator without a Motor</title>
      <link>https://community.nxp.com/t5/Kinetis-Motor-Suite/Using-the-KMS-SVPWM-to-Create-a-3-Phase-PWM-Modulator-without-a/m-p/772528#M502</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What other engineers have done with their custom hardware is use the tools available in the KMS GUI.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I would suggest is that you use the notes in the &lt;A href="https://community.nxp.com/"&gt;Adapting KMS for Custom Hardware &lt;/A&gt;see section 4 on page 52&amp;nbsp;on how to verify the operation of your hardware from the KMS GUI. The concepts used in this app note are covered in the Lab Guide if you need to figure out some of the use of the GUI.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this before going through the trouble of re-architecting the reference design.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Philip Drake.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Apr 2018 14:59:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Motor-Suite/Using-the-KMS-SVPWM-to-Create-a-3-Phase-PWM-Modulator-without-a/m-p/772528#M502</guid>
      <dc:creator>philip_drake</dc:creator>
      <dc:date>2018-04-27T14:59:57Z</dc:date>
    </item>
    <item>
      <title>Re: Using the KMS SVPWM to Create a 3 Phase PWM Modulator without a Motor</title>
      <link>https://community.nxp.com/t5/Kinetis-Motor-Suite/Using-the-KMS-SVPWM-to-Create-a-3-Phase-PWM-Modulator-without-a/m-p/772529#M503</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Derek,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your concept is spot on. I think the issues you are running into are due to the normalization scheme in KMS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All voltages in the KMS firmware are normalized against the FULL_SCALE_VOLTAGE define in the system.h file.&amp;nbsp; So to specify a voltage you would need to make your call look like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;tempStatorRefVoltageDQ.q = _LQ(200.0 / FULL_SCALE_VOLTAGE);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;But, the Park block specifically takes the input in terms of modulation, NOT voltage.&amp;nbsp; So your call should change to:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;&lt;SPAN&gt;tempStatorRefVoltageDQ.q = _LQmpy(&lt;SPAN style="background-color: #ffffff;"&gt;_LQ(200.0 / FULL_SCALE_VOLTAGE),&amp;nbsp;feedback.output.invVdc_1kHz)&lt;/SPAN&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;&lt;SPAN&gt;That will convert your 200V into the normalized version (by dividing by the normalizing factor) and convert it into modulation by dividing by the current bus voltage (multiplying by the inverse of the bus voltage).&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;&lt;SPAN&gt;You also might have removed the call that will enable the PWM outputs.&amp;nbsp; Look for a function call&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;SVPWM_enable.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Apr 2018 19:13:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Motor-Suite/Using-the-KMS-SVPWM-to-Create-a-3-Phase-PWM-Modulator-without-a/m-p/772529#M503</guid>
      <dc:creator>linestream-adam</dc:creator>
      <dc:date>2018-04-27T19:13:57Z</dc:date>
    </item>
    <item>
      <title>Re: Using the KMS SVPWM to Create a 3 Phase PWM Modulator without a Motor</title>
      <link>https://community.nxp.com/t5/Kinetis-Motor-Suite/Using-the-KMS-SVPWM-to-Create-a-3-Phase-PWM-Modulator-without-a/m-p/772530#M504</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Adam and Philip,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help! I figured it out. All I had to do was call the following commands:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;user.state = USER_RUN_VOLTAGE;&lt;BR /&gt; user.command.statorRefVoltage.d = _LQ(0.0);&lt;BR /&gt; user.command.statorRefVoltage.q = _LQ(0.50);&lt;BR /&gt; user.state = USER_RUN_VOLTAGE;&lt;BR /&gt; user.command.statorRefVoltage.d = _LQ(0.0);&lt;BR /&gt; user.command.statorRefVoltage.q = _LQ(0.50);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This produces a three phase PWM using the SVPWM block.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hardcoded in the 0.50 which gave me 50% of my 400VAC input voltage, 200V. The scaling was an important mistake I was making. It is important that this value is scaled _LQ(0.0) to _LQ(1.0). To achieve this I could also have done:&amp;nbsp;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;_LQ(200.0 / FULL_SCALE_VOLTAGE).&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;It is also important to replace the rotorAngle output from the QEI block with a simulated rotating rotor angle, or you will just get a DC output from the SVPWM block (because the rotor angle is not changing because the motor is disconnected). I did this by creating a 50Hz rotating angle from _LQ(-1.0) -&amp;gt; _LQ(1.0), and then wrapping the angle back around to -1 once it reached 1. This value was set to the rotorAngle value.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 May 2018 12:41:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Motor-Suite/Using-the-KMS-SVPWM-to-Create-a-3-Phase-PWM-Modulator-without-a/m-p/772530#M504</guid>
      <dc:creator>derekcook</dc:creator>
      <dc:date>2018-05-02T12:41:15Z</dc:date>
    </item>
  </channel>
</rss>

