<?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: S32K144 Control algorithm conversion in Model-Based Design Toolbox (MBDT)</title>
    <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/S32K144-Control-algorithm-conversion/m-p/962247#M3725</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;Hi&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;Daniel&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&amp;nbsp; Thank you for your information!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&amp;nbsp;&amp;nbsp;When Ts/2 is used for the parameter fltC1 of the GFLIB_IntegratorTR_FLT module, the running result of the replaced algorithm model is exactly the same as that of the original model。&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&amp;nbsp;&amp;nbsp;When useing C1 calculation formula of fixed point module as following before：&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&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/89562i2952E38147149FB1/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_1.png" alt="pastedImage_1.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;The resulting parameters do not work at all.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;Follows is the results of correct operation:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&amp;nbsp; &amp;nbsp;&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/89563i41B54B6F3EBD5B89/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_2.png" alt="pastedImage_2.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&amp;nbsp;&amp;nbsp;Next step needs to be verified on MCU hardware.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&amp;nbsp; &amp;nbsp;Best Regards!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&amp;nbsp; &amp;nbsp;Liu qimin&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 24 Jun 2019 14:33:46 GMT</pubDate>
    <dc:creator>liuqimin</dc:creator>
    <dc:date>2019-06-24T14:33:46Z</dc:date>
    <item>
      <title>S32K144 Control algorithm conversion</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/S32K144-Control-algorithm-conversion/m-p/962242#M3720</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello:&lt;BR /&gt;&amp;nbsp; We have a control algorithm verified under simulink needs to be transferred to S32K144 to run. My idea is to replace the corresponding modules in the control algorithm with the calculation module in the S32K toolbox.However, there are some modules that do not have corresponding modules in the S32K toolbox. We would like to keep these modules and not replace them, but the data types of the modules do not match.&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;Just like the Power operations and state space equations in the following figure.&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;Is there any way to handle this situation?&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/89498i6212219EDBC7B138/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;/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/89499i390246217323E049/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;Best Regards!&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; Liu qimin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 23 Jun 2019 03:47:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/S32K144-Control-algorithm-conversion/m-p/962242#M3720</guid>
      <dc:creator>liuqimin</dc:creator>
      <dc:date>2019-06-23T03:47:47Z</dc:date>
    </item>
    <item>
      <title>Re: S32K144 Control algorithm conversion</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/S32K144-Control-algorithm-conversion/m-p/962243#M3721</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;For the state space equation, let's change it to the following diagram. Now it's a new proble coming. When the continuous integral module in the figure is replaced by discrete integral module, it works normally.However, it is not correct to use the GFLIB_IntegratorTR_FLT module in the S32K toolkit instead.Perhaps the parameter fltC1 is incorrect.Is this parameter the same as the parameter in the discrete integral module as the gain coefficient?If not, how to determine this parameter?&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/89526iC14E8592B4CE89F4/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;/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/89527i5871F6E6B5D513F7/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;Best Regards!&lt;/P&gt;&lt;P&gt;Liu qimin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Jun 2019 08:45:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/S32K144-Control-algorithm-conversion/m-p/962243#M3721</guid>
      <dc:creator>liuqimin</dc:creator>
      <dc:date>2019-06-24T08:45:13Z</dc:date>
    </item>
    <item>
      <title>Re: S32K144 Control algorithm conversion</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/S32K144-Control-algorithm-conversion/m-p/962244#M3722</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A class="jx-jive-macro-user" href="https://community.nxp.com/people/liuqimin"&gt;liuqimin&lt;/A&gt;‌,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Relate with your original post:&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;&amp;nbsp;Is there any way to handle this situation?&lt;/SPAN&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;You should be able to generate the code from Simulink for the original model - even if it is represented in continuous time domain (1/s).&amp;nbsp; Not sure what error are you getting. If there is an error about data types i think you can use data type conversion between subsystems. You will probably lose some precision between double-&amp;gt;single but it should work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The S32K MCU has a FPU unit on 32bit hence it should deal with such algorithms pretty well. It will not be optimal but it should work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;An addition step that you can do to improve the execution on S32K MCU, is to convert your original model from s-domain to z-domain and implement it into single data type.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;In regards with your second post:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;However, it is not correct to use the GFLIB_IntegratorTR_FLT module in the S32K toolkit instead.Perhaps the parameter fltC1 is incorrect.Is this parameter the same as the parameter in the discrete integral module as the gain coefficient?If not, how to determine this parameter?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Please have a look into the S32K14xMCLUB.pdf manual $5.48 page 567. It shows how to compute the paramter C1f&amp;nbsp;depending on the type of integrator you may want to use.&lt;/P&gt;&lt;P&gt;Basically for the floating point implementation it should be: fltC1 = Ts/2&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Jun 2019 09:08:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/S32K144-Control-algorithm-conversion/m-p/962244#M3722</guid>
      <dc:creator>Daniel_Popa</dc:creator>
      <dc:date>2019-06-24T09:08:38Z</dc:date>
    </item>
    <item>
      <title>Re: S32K144 Control algorithm conversion</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/S32K144-Control-algorithm-conversion/m-p/962245#M3723</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;Daniel&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Thanks for your reply ！&lt;/P&gt;&lt;P&gt;Is that the manual you're talking about?I can't find a description of this parameter.&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/89547i4D2468DAD892303F/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;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;As for generating S32K code directly with Simulink original model, I think it can be done.However, I am concerned that the generated code will run inefficiently on the MCU.Therefore, when generating code, the computation module in the original model should be replaced by S32K toolbox'module to improve the efficiency of code operation. Am I right?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;For fltC1, I'll try Ts/2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards!&lt;/P&gt;&lt;P&gt;&amp;nbsp;Liu qimin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Jun 2019 09:55:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/S32K144-Control-algorithm-conversion/m-p/962245#M3723</guid>
      <dc:creator>liuqimin</dc:creator>
      <dc:date>2019-06-24T09:55:46Z</dc:date>
    </item>
    <item>
      <title>Re: S32K144 Control algorithm conversion</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/S32K144-Control-algorithm-conversion/m-p/962246#M3724</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A class="jx-jive-macro-user" href="https://community.nxp.com/people/liuqimin"&gt;liuqimin&lt;/A&gt;‌&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;However, I am concerned that the generated code will run inefficiently on the MCU.Therefore, when generating code, the computation module in the original model should be replaced by S32K toolbox'module to improve the efficiency of code operation. Am I right?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;100% true. Nonetheless, that's the main idea of Model-Based Design: Simulate -&amp;gt; Prototype -&amp;gt; Improve.&lt;/P&gt;&lt;P&gt;For sure it will not run efficient but you will have a baseline to start from.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The AMMCLIB User Manual is delivered with the MBDT Toolbox. Can be found in ..\\src\mbdtbx_s32k14x\AMMCLIB_s32k14x\doc&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Attached here for your reference too.&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/89551i7EAF9E0D37529B3B/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;and the procedure for computing the C1f is described for fixed point implementation only:&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/89552i264057A4933ACAFD/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;for the floating point case, you can see it in the example:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_3.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/89553i79A5FDB536E2D2E0/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_3.png" alt="pastedImage_3.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Jun 2019 11:13:45 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/S32K144-Control-algorithm-conversion/m-p/962246#M3724</guid>
      <dc:creator>Daniel_Popa</dc:creator>
      <dc:date>2019-06-24T11:13:45Z</dc:date>
    </item>
    <item>
      <title>Re: S32K144 Control algorithm conversion</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/S32K144-Control-algorithm-conversion/m-p/962247#M3725</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;Hi&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;Daniel&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&amp;nbsp; Thank you for your information!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&amp;nbsp;&amp;nbsp;When Ts/2 is used for the parameter fltC1 of the GFLIB_IntegratorTR_FLT module, the running result of the replaced algorithm model is exactly the same as that of the original model。&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&amp;nbsp;&amp;nbsp;When useing C1 calculation formula of fixed point module as following before：&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&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/89562i2952E38147149FB1/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_1.png" alt="pastedImage_1.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;The resulting parameters do not work at all.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;Follows is the results of correct operation:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&amp;nbsp; &amp;nbsp;&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/89563i41B54B6F3EBD5B89/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_2.png" alt="pastedImage_2.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&amp;nbsp;&amp;nbsp;Next step needs to be verified on MCU hardware.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&amp;nbsp; &amp;nbsp;Best Regards!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&amp;nbsp; &amp;nbsp;Liu qimin&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Jun 2019 14:33:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/S32K144-Control-algorithm-conversion/m-p/962247#M3725</guid>
      <dc:creator>liuqimin</dc:creator>
      <dc:date>2019-06-24T14:33:46Z</dc:date>
    </item>
  </channel>
</rss>

