{"id":227,"date":"2021-03-23T10:00:02","date_gmt":"2021-03-23T10:00:02","guid":{"rendered":"https:\/\/imperix.com\/doc\/?p=227"},"modified":"2026-05-05T06:56:30","modified_gmt":"2026-05-05T06:56:30","slug":"simulation-essentials-simulink","status":"publish","type":"post","link":"https:\/\/imperix.com\/doc\/help\/simulation-essentials-simulink","title":{"rendered":"Simulation essentials with Simulink"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 ez-toc-wrap-right-text counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/imperix.com\/doc\/help\/simulation-essentials-simulink\/#Offline-simulation-overview\" >Offline simulation overview<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/imperix.com\/doc\/help\/simulation-essentials-simulink\/#Fundamental-concepts\" >Fundamental concepts<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/imperix.com\/doc\/help\/simulation-essentials-simulink\/#Control-modeling\" >Control modeling<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/imperix.com\/doc\/help\/simulation-essentials-simulink\/#Plant-modeling\" >Plant modeling<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/imperix.com\/doc\/help\/simulation-essentials-simulink\/#Solver-configuration\" >Solver configuration<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/imperix.com\/doc\/help\/simulation-essentials-simulink\/#Working-principle-of-the-main-peripheral-blocks\" >Working principle of the main peripheral blocks<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/imperix.com\/doc\/help\/simulation-essentials-simulink\/#Configuration-block\" >Configuration block<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/imperix.com\/doc\/help\/simulation-essentials-simulink\/#ADC-block\" >ADC block<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/imperix.com\/doc\/help\/simulation-essentials-simulink\/#PWM-block\" >PWM block<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/imperix.com\/doc\/help\/simulation-essentials-simulink\/#Mastering-the-sample-times\" >Mastering the sample times<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/imperix.com\/doc\/help\/simulation-essentials-simulink\/#Verifying-the-sample-times\" >Verifying the sample times<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/imperix.com\/doc\/help\/simulation-essentials-simulink\/#Correcting-the-sample-times\" >Correcting the sample times<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/imperix.com\/doc\/help\/simulation-essentials-simulink\/#Further-readings\" >Further readings<\/a><\/li><\/ul><\/nav><\/div>\n\n<p>This note provides in-depth content for an accurate and efficient offline simulation of an imperix controller and the corresponding plant model using&nbsp;<a href=\"https:\/\/imperix.com\/software\/acg-sdk\/\">ACG SDK<\/a>&nbsp;on Simulink. Because the underlying mechanisms are identical to those used in real-time operation, this content is also valuable for understanding the controller\u2019s behavior during real-time execution. While run-time behavior and hardware-level functioning are detailed in <a href=\"https:\/\/imperix.com\/doc\/help\/timing-configuration-on-imperix-controllers\" type=\"link\" id=\"https:\/\/imperix.com\/doc\/help\/timing-configuration-on-imperix-controllers\">PN259<\/a>, the current page focuses specifically on the simulation mode.<\/p>\n\n\n\n<p>Recommended articles related to the ACG workflow are shown below. A series of video tutorials is also available with similar content.<\/p>\n\n\n\n<style>\r\n  .tech-table {\r\n    border-collapse: collapse;\r\n    width: 100%;\r\n    max-width: 800px;\r\n    color: #000;\r\n  }\r\n\r\n  .tech-table th {\r\n    text-align: left;\r\n    font-weight: bold;\r\n    padding: 6px;\r\n    font-size: 18px;\r\n  }\r\n\r\n  \/* The first column header is empty in the image *\/\r\n  .tech-table th:f<style>\r\n  .tech-table {\r\n    border-collapse: collapse;\r\n    width: 100%;\r\n    max-width: 800px;\r\n    color: #000;\r\n  }\r\n\r\n  .tech-table th {\r\n    text-align: left;\r\n    font-weight: bold;\r\n    font-style: italic;\r\n    padding: 6px;\r\n    font-size: 18px;\r\n  }\r\n\r\n  .tech-table th:first-child {\r\n    width: 20%;\r\n  }\r\n\r\n  .tech-table td {\r\n    background-color: #f2f2f2;\r\n    padding: 8px;\r\n    vertical-align: top;\r\n    border: 4px solid white;\r\n  }\r\n\r\n  \/* UPDATED PN styling *\/\r\n  .pn-code {\r\n    color: #d32f2f;\r\n    display: inline;\r\n    margin-left: 6px;\r\n    font-weight: normal;\r\n    white-space: nowrap;\r\n  }\r\n\r\n  \/* UPDATED Video styling *\/\r\n  .video-code {\r\n    color: #d32f2f;\r\n    display: inline;\r\n    margin-left: 6px;\r\n    font-weight: normal;\r\n    white-space: nowrap;\r\n  }\r\n  .video-code::before {\r\n  content: \"\ud83c\udfac \";\r\n  }\r\n\r\n.cell-highlight {\r\n  outline: 3px solid #d32f2f;\r\n  outline-offset: -4px;\r\n}\r\n<\/style>\r\n\r\n<table class=\"tech-table\">\r\n  <thead>\r\n    <tr>\r\n      <th>Step<\/th>\r\n      <th>Documentation<\/th>\r\n      <th><\/th>\r\n      <th>Videos<\/th>\r\n    <\/tr>\r\n  <\/thead>\r\n  <tbody>\r\n    <tr  class=\"row-red\">\r\n      <td>1. Software installation<\/td>\r\n      <td colspan=\"2\">\r\n        Installation guide for the ACG SDK\r\n        <a href=\"https:\/\/imperix.com\/doc\/help\/installation-guide-acg-sdk\" class=\"pn-code\">PN133<\/a>      <\/td>\r\n      <td>\r\n        N\/A\r\n      <\/td>\r\n    <\/tr>\r\n\r\n    <tr>\r\n      <td>2. Getting started<\/td>\r\n      <td colspan=\"2\">\r\n        Getting started with the ACG SDK\r\n        <a href=\"https:\/\/imperix.com\/doc\/help\/getting-started-with-acg-sdk\" class=\"pn-code\">PN134<\/a> \r\n      <td>\r\n        Create the model\r\n        <a href=\"https:\/\/www.youtube.com\/watch?v=8TBpIigcN2w\" class=\"video-code\">Video 1<\/a>\r\n      <\/td>\r\n    <\/tr>\r\n\r\n    <tr>\r\n      <td>3. Running simulations<\/td>\r\n      <td class=\"cell-highlight\">\r\n        Simulation essentials with Simulink\r\n        <a href=\"https:\/\/imperix.com\/doc\/help\/simulation-essentials-simulink\" class=\"pn-code\">PN135<\/a> \r\n      <\/td>\r\n      <td>\r\n        Simulation essentials with PLECS\r\n        <a href=\"https:\/\/imperix.com\/doc\/help\/simulation-essentials-plecs\" class=\"pn-code\">PN137<\/a>       \r\n      <td>\r\n        Simulate it\r\n        <a href=\"https:\/\/www.youtube.com\/watch?v=HklMDtAADUU\" class=\"video-code\">Video 2<\/a>\r\n      <\/td>\r\n    <\/tr>\r\n\r\n    <tr>\r\n      <td>4. Device programming<\/td>\r\n      <td colspan=\"2\">\r\n        Programming and operating imperix controllers\r\n        <a href=\"https:\/\/imperix.com\/doc\/help\/programming-imperix-controllers\" class=\"pn-code\">PN138<\/a> \r\n      <\/td>\r\n      <td rowspan=\"2\">\r\n        Generate code\r\n        <a href=\"https:\/\/www.youtube.com\/watch?v=6dGeExgX-rE\" class=\"video-code\">Video 3<\/a>\r\n      <\/td>\r\n    <\/tr>\r\n\r\n    <tr>\r\n      <td>5. Monitoring<\/td>\r\n      <td colspan=\"2\">\r\n        Cockpit user guide\r\n        <a href=\"https:\/\/imperix.com\/doc\/help\/cockpit-user-guide\" class=\"pn-code\">PN300<\/a>\r\n      <\/td>\r\n    <\/tr>\r\n  <\/tbody>\r\n<\/table>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Offline-simulation-overview\"><\/span>Offline simulation overview<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>As explained in <a href=\"https:\/\/imperix.com\/doc\/help\/getting-started-with-acg-sdk\">PN134<\/a>, offline simulation is an optional but highly valuable step in control code development that enables the validation of control logic directly on a PC before deployment. This process relies on simulation models of both the <strong>Controller<\/strong> and the <strong>Plant <\/strong>that faithfully reproduce real-world behavior using specialized blocks from the <strong>Control<\/strong> and <strong>Power<\/strong> libraries included in the <strong>ACG SDK<\/strong>.<\/p>\n\n\n\n<p>The same Simulink model serves both simulation and code generation purposes, with the following differences, as further explained in <a href=\"https:\/\/imperix.com\/doc\/help\/programming-imperix-controllers\" type=\"post\" id=\"13383\">PN138<\/a>:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>In offline simulation mode, both the Control and Plant subsystems are simulated.<\/li>\n\n\n\n<li>In code generation mode, only the Control subsystem is compiled, and the Plant subsystem is ignored.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"590\" src=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2021\/03\/simulink_model_structure-1024x590.png\" alt=\"\" class=\"wp-image-42527\" srcset=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2021\/03\/simulink_model_structure-1024x590.png 1024w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2021\/03\/simulink_model_structure-300x173.png 300w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2021\/03\/simulink_model_structure-768x443.png 768w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2021\/03\/simulink_model_structure.png 1225w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\">Usual structure of a Simulink model with (left) control implementation and (right) plant simulation model<\/figcaption><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Fundamental-concepts\"><\/span>Fundamental concepts<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>To model control and plant variables, the following fundamental concepts are used:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Plant modeling (continuous domain)<\/strong>: <span style=\"box-sizing: border-box; margin: 0px; padding: 0px;\">Plant quantities are generally modelled with&nbsp;<strong>continuous&nbsp;signals<\/strong> (labelled <em>Cont<\/em> or <em>FiM<\/em> in the illustration below), as it is usually more efficient to simulate physical systems with wide-ranging dynamics.<\/span> To support this, the model must be simulated using a <strong>variable-step solver<\/strong>.<\/li>\n\n\n\n<li><strong>Control modeling (discrete domain)<\/strong>: The&nbsp;<strong>control&nbsp;<\/strong>algorithm is modeled using <strong>discrete&nbsp;signals<\/strong> <span style=\"box-sizing: border-box; margin: 0px; padding: 0px;\">(labelled <em>D1<\/em> in the illustration below)<\/span>, sampled at the hardware's interrupt frequency and shifted by the sampling phase.\n<ul class=\"wp-block-list\">\n<li>This requires an algorithm implemented in the discrete domain (in&nbsp;\\(z\\)&nbsp;domain).<\/li>\n\n\n\n<li>This is modeled accurately with the variable-step solver, as it is forced to take a major step at each execution of the interrupt.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"662\" height=\"305\" src=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2026\/02\/usual_configuration_with_plant_v2.png\" alt=\"\" class=\"wp-image-41937\" srcset=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2026\/02\/usual_configuration_with_plant_v2.png 662w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2026\/02\/usual_configuration_with_plant_v2-300x138.png 300w\" sizes=\"auto, (max-width: 662px) 100vw, 662px\" \/><\/figure>\n<\/div>\n\n\n<p>While the imperix blocksets are designed to handle these concepts automatically, certain user-implemented code may require extra caution to remain coherent with the rest of the model. For this reason, it is crucial to have a clear comprehension of how these simulation models function \"under the hood.\"<\/p>\n\n\n\n<div class=\"wp-block-simple-alerts-for-gutenberg-alert-boxes sab-alert sab-alert-info\" role=\"alert\">Some models may include a <strong>Memory<\/strong> block between the Plant and the Controller subsystem to break algebraic loops. However, this block is unnecessary because the peripheral blocks in the control library do not have a direct feedthrough behavior, which ensures that no algebraic loops are formed. While a <strong>Memory<\/strong> block does not cause simulation errors, it may reduce simulation speed. Therefore, its use is not recommended.<\/div>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Control-modeling\"><\/span>Control modeling<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>An accurate representation of the physical controller is ensured through careful modeling of the parameters integrated into the simulation models of the peripheral blocks, as presented in the <a href=\"#PN135:SimulationessentialswithSimulink-Workingprincipleofthemainblocks\">next section<\/a>. These parameters include the interrupt frequency, sampling phases, execution delays, and driver latencies. Specifically, the following features are modeled:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Sampling<\/strong> (CONFIG and ADC blocks): Both the sampling frequency and the sampling phases are accounted for. These parameters are defined in the CONFIG block.<\/li>\n\n\n\n<li><strong>Algorithm execution<\/strong> (CONFIG block): The delay induced by the execution of the control algorithm is modeled, ensuring that the overall controller delay is correctly represented. This value can be specified in the CONFIG block. To determine the actual execution time of a specific algorithm, the code should be executed on a controller; the execution time corresponds to the <em>Cycle delay<\/em> displayed in the <a href=\"https:\/\/imperix.com\/doc\/help\/cockpit-user-guide#target-timings\">Timings tab<\/a> of Cockpit.<\/li>\n\n\n\n<li><strong>PWM generation<\/strong> (PWM block): The frequency, phase, and shape of the PWM carrier are accurately modeled, along with the update instants for duty-cycle and phase parameters (occurring at the carrier\u2019s zero and\/or maximum). Optionally, dead-time can also be simulated.<\/li>\n<\/ul>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"759\" height=\"403\" src=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2021\/03\/image-350.png\" alt=\"\" class=\"wp-image-43804\" srcset=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2021\/03\/image-350.png 759w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2021\/03\/image-350-300x159.png 300w\" sizes=\"auto, (max-width: 759px) 100vw, 759px\" \/><figcaption class=\"wp-element-caption\">Library blocks from the Control library for control modeling<\/figcaption><\/figure>\n<\/div>\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Plant-modeling\"><\/span>Plant modeling<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>To test the developed control logic during offline simulation, a simulation model of the controlled plant is required. This model can be built using any standard toolbox or even through direct implementation of physical equations. To assist customers in deriving a model of their imperix power hardware, the <a href=\"https:\/\/imperix.com\/doc\/help\/getting-started-with-imperix-power-library\">Power library<\/a> provides models for all imperix power products. The supported toolboxes for implementing these electrical circuits in the Simulink environment are:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Simscape Specialized Power Systems (SPS)*<\/li>\n\n\n\n<li>Simscape Electrical (blue blocks)<\/li>\n\n\n\n<li>PLECS Blockset for Simulink<\/li>\n<\/ul>\n\n\n\n<div class=\"wp-block-simple-alerts-for-gutenberg-alert-boxes sab-alert sab-alert-info\" role=\"alert\">* From MATLAB R2026a, the Specialized Power Systems (SPS) library is no longer distributed with Simscape Electrical by MathWorks. Users who wish to continue using SPS need to obtain the SPS Software distributed by OPAL-RT. Alternatively, users can migrate their models to Simscape Electrical, which will continue to be developed and supported by MathWorks.<\/div>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"735\" height=\"609\" src=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2021\/03\/image-348.png\" alt=\"\" class=\"wp-image-43802\" style=\"aspect-ratio:1.2069036198909524;width:496px;height:auto\" srcset=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2021\/03\/image-348.png 735w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2021\/03\/image-348-300x249.png 300w\" sizes=\"auto, (max-width: 735px) 100vw, 735px\" \/><figcaption class=\"wp-element-caption\">Library blocks from the Power library for plant modeling<\/figcaption><\/figure>\n<\/div>\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Solver-configuration\"><\/span>Solver configuration<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>The variable-step solver can be configured to manage time-step calculations and simulation accuracy. These parameters are accessible via the Solver tab in the model's Configuration Parameters (Ctrl+E) or through the Simulation &gt; Solver tab of the CONFIG block.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"424\" height=\"187\" src=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2026\/02\/image-6.png\" alt=\"\" class=\"wp-image-42130\" srcset=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2026\/02\/image-6.png 424w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2026\/02\/image-6-300x132.png 300w\" sizes=\"auto, (max-width: 424px) 100vw, 424px\" \/><\/figure>\n<\/div>\n\n\n<p>In most cases, the default values are sufficient. However, in some rare scenarios, manual adjustments may be necessary for the following reasons:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Capturing fast transients: If rapid switching events are missed, lowering the <em>Relative tolerance<\/em> or the <em>Max step size<\/em> will force the solver to use higher precision and reduce the step size.<\/li>\n\n\n\n<li>Optimizing simulation speed: For long-duration simulations where high precision is less critical, increasing the <em>Relative tolerance<\/em> allows the solver to take larger steps, thereby reducing total simulation time. Obviously, this must be done carefully, as it may cause the solver to skip over critical high-frequency dynamics (e.g., PWM switching instants), resulting in significant inaccuracies in the simulated behavior.<\/li>\n<\/ul>\n\n\n\n<p>Detailed information about variable-step solvers in Simulink can be found at <a href=\"https:\/\/www.mathworks.com\/help\/simulink\/ug\/variable-step-solvers-in-simulink-1.html\">https:\/\/www.mathworks.com\/help\/simulink\/ug\/variable-step-solvers-in-simulink-1.html<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"PN135:SimulationessentialswithSimulink-Workingprincipleofthemainblocks\"><span class=\"ez-toc-section\" id=\"Working-principle-of-the-main-peripheral-blocks\"><\/span>Working principle of the main peripheral blocks<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>The three fundamental library blocks are the <a href=\"https:\/\/imperix.com\/doc\/software\/config-control-task-configuration\">CONFIG<\/a>, <a href=\"https:\/\/imperix.com\/doc\/software\/analog-data-acquisition\">ADC<\/a>, and <a href=\"https:\/\/imperix.com\/doc\/software\/carrier-based-pwm\">PWM<\/a> blocks. Most applications can work with only those three, as in the standard configuration shown below:<\/p>\n\n\n<div class=\"wp-block-image is-resized\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"285\" src=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2021\/03\/usual_configuration_3_blocks-1024x285.png\" alt=\"Typical content of the controller model\" class=\"wp-image-230\" style=\"aspect-ratio:3.5930945926665716;width:621px;height:auto\" srcset=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2021\/03\/usual_configuration_3_blocks-1024x285.png 1024w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2021\/03\/usual_configuration_3_blocks-300x83.png 300w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2021\/03\/usual_configuration_3_blocks-768x214.png 768w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2021\/03\/usual_configuration_3_blocks-1536x427.png 1536w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2021\/03\/usual_configuration_3_blocks-2048x570.png 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\">Typical content of the controller model\n<\/figcaption><\/figure>\n<\/div>\n\n\n<h3 class=\"wp-block-heading\" id=\"PN135:SimulationessentialswithSimulink-ClockandConfiguration\"><span class=\"ez-toc-section\" id=\"Configuration-block\"><\/span>Configuration block<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>The <a href=\"https:\/\/imperix.com\/doc\/software\/config-control-task-configuration\" type=\"link\" id=\"https:\/\/imperix.com\/doc\/software\/config-control-task-configuration\">Config block<\/a> configures the main global parameters of the model, such as:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The model execution purpose (offline simulation or code generation for a real-time target).<\/li>\n\n\n\n<li>The frequency of the base clock \\(F_{\\text{CLK0}}\\), which defines the sampling frequency and serves as time basis for triggering the control interrupt. CLK0 can also serve as time base for PWM modulation.<\/li>\n\n\n\n<li>The sampling phase \\(\\phi_s\\), which shifts the sampling instant within the <code>CLK0<\/code> period.<\/li>\n\n\n\n<li>Optionally, the interrupt postscaler, which decimates the interrupt execution by a factor \\(k_{\\text{post}}\\).<\/li>\n\n\n\n<li>The cycle delay, which represents the computation time of the control algorithm. In most cases, the default value of 0.2 interrupt periods is sufficient. For higher simulation fidelity, the actual value can be measured from the <a href=\"https:\/\/imperix.com\/doc\/help\/cockpit-user-guide#target-timings\">Timings tab<\/a> of Cockpit while the code is running in real-time.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"829\" height=\"599\" src=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2021\/03\/CONFIG_configuration_window_merged.png\" alt=\"\" class=\"wp-image-42505\" srcset=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2021\/03\/CONFIG_configuration_window_merged.png 829w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2021\/03\/CONFIG_configuration_window_merged-300x217.png 300w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2021\/03\/CONFIG_configuration_window_merged-768x555.png 768w\" sizes=\"auto, (max-width: 829px) 100vw, 829px\" \/><figcaption class=\"wp-element-caption\">Configuration window of the CONFIG block<\/figcaption><\/figure>\n\n\n\n<p>These configuration parameters define the following hardware-level parameters, as further detailed in <a href=\"https:\/\/imperix.com\/doc\/help\/timing-configuration-on-imperix-controllers\">PN259<\/a>:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The sampling clock, with frequency \\(F_{\\text{SCLK}} = F_{\\text{CLK0}}\\) and sampling phase \\(\\phi_s\\)<\/li>\n\n\n\n<li>The CPU interrupt, triggered at a frequency \\(F_{\\text{CPU}} = F_{\\text{CLK0}}\/k_{\\text{post}}\\) and a phase of \\(\\phi_s\\)<\/li>\n<\/ul>\n\n\n\n<p>In terms of simulation model implementation, the Config block contains a <a href=\"https:\/\/imperix.com\/doc\/software\/clock-generators\">CLK<\/a> block that generates a sawtooth signal with frequency \\( F_{\\text{CLK0}}\\)\u200b and zero phase. This clock signal is then passed through a subsystem that generates the sampling clock with a relative phase shift \\(\\phi_s\\)\u200b, as illustrated below:<\/p>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\"><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"387\" height=\"191\" src=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2026\/02\/CONFIG_model.png\" alt=\"\" class=\"wp-image-41970\" srcset=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2026\/02\/CONFIG_model.png 387w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2026\/02\/CONFIG_model-300x148.png 300w\" sizes=\"auto, (max-width: 387px) 100vw, 387px\" \/><\/figure>\n<\/div><\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\"><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"586\" src=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2021\/03\/image-10-1024x586.png\" alt=\"Configuration block signals\" class=\"wp-image-232\" title=\"Product notes &gt; PN135: Simulation essentials with Simulink &gt; Simulation_schemes_1.png\" srcset=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2021\/03\/image-10-1024x586.png 1024w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2021\/03\/image-10-300x172.png 300w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2021\/03\/image-10-768x440.png 768w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2021\/03\/image-10.png 1280w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<\/div><\/div>\n<\/div>\n\n\n\n<p>The Config block also defines the value of the <code>CTRLPERIOD<\/code> global variable. This variable can be used throughout the Simulink model as the sample time for any block (e.g. discrete transfer functions), ensuring its execution at the designated control rate. This provides an explicit alternative to using the inherited sample time (<code>-1<\/code>), which is particularly useful in complex models where Simulink\u2019s automatic rate resolution differs from the user's intent (see <a href=\"#mastering-sample-times\">Mastering the sample time<\/a> section). <code>CTRLPERIOD<\/code> is defined as a vector that incorporates both the interrupt (i.e. control) period and the sampling phase \\(\\phi_s\\):<\/p>\n\n\n\n<p>$${\\small\\texttt{CTRLPERIOD}} = \\left[ k_{\\text{post}}\\cdot T_{\\text{CLK0}}, \\phi_s \\cdot T_{\\text{CLK0}}\\right]$$<\/p>\n\n\n\n<p>The interrupt execution period is therefore available with the variable \\({\\small\\texttt{CTRLPERIOD(1)}}\\).<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"ADC-block\"><\/span>ADC block<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>The <a href=\"https:\/\/imperix.com\/doc\/software\/analog-data-acquisition\" type=\"link\" id=\"https:\/\/imperix.com\/doc\/software\/analog-data-acquisition\">ADC block<\/a> retrieves the sampled value of a given ADC channel and converts it into a value expressed in physical units, using the sensitivity and offset parameters specified in the block's configuration dialog.<\/p>\n\n\n\n<p>The simulation model simply sample-and-holds the input signal \u2461 on the rising edges of the sampling clock \u2460. The input signal is typically a continuous signal from the plant model representing a measured value. The sample time of the output signal \u2462 is set to CTRLPERIOD, allowing it to be automatically propagated to other connected blocks.<\/p>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\"><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"375\" height=\"175\" src=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2026\/02\/ADC_model.png\" alt=\"\" class=\"wp-image-41969\" style=\"width:359px;height:auto\" srcset=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2026\/02\/ADC_model.png 375w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2026\/02\/ADC_model-300x140.png 300w\" sizes=\"auto, (max-width: 375px) 100vw, 375px\" \/><figcaption class=\"wp-element-caption\">ADC block simulation model<\/figcaption><\/figure>\n<\/div><\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\"><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"535\" src=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2021\/03\/image-14-1024x535.png\" alt=\"ADC block signals\" class=\"wp-image-236\" title=\"Product notes &gt; PN135: Simulation essentials with Simulink &gt; Simulation_schemes_2.png\" srcset=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2021\/03\/image-14-1024x535.png 1024w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2021\/03\/image-14-300x157.png 300w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2021\/03\/image-14-768x401.png 768w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2021\/03\/image-14.png 1280w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\">Sampling clock and sampled signal<\/figcaption><\/figure>\n<\/div><\/div>\n<\/div>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"PWM-block\"><\/span>PWM block<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Various types of pulse-width modulators are available in the imperix blockset. Among them, the carrier-based PWM modulator (<a href=\"https:\/\/imperix.com\/doc\/software\/carrier-based-pwm\" type=\"link\" id=\"https:\/\/imperix.com\/doc\/software\/carrier-based-pwm\">CB PWM block<\/a>) is the most widely used option. It configures the corresponding FPGA peripheral and generates PWM signals according to the specified duty-cycle and phase parameters.<\/p>\n\n\n\n<p>In the simulation model, the clock signal \u2460 at the clock input serves as the time reference for generating the carrier signal \u2461. In parallel, the duty-cycle value \u2462 is delayed by the algorithm execution time specified in the CONFIG block, and sampled once or twice per switching period (depending on the update-rate parameter). It is then compared to the carrier to produce the output PWM signal \u2464. If <em>Simulate dead time<\/em> is checked in the mask parameter, a dead time is inserted between the complementary signals.<\/p>\n\n\n\n<div class=\"wp-block-columns are-vertically-aligned-top is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-vertically-aligned-top is-layout-flow wp-block-column-is-layout-flow\"><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"474\" height=\"194\" src=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2026\/02\/CB_PWM_model.png\" alt=\"\" class=\"wp-image-41967\" srcset=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2026\/02\/CB_PWM_model.png 474w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2026\/02\/CB_PWM_model-300x123.png 300w\" sizes=\"auto, (max-width: 474px) 100vw, 474px\" \/><figcaption class=\"wp-element-caption\">CB-PWM block simulation model<\/figcaption><\/figure>\n<\/div><\/div>\n\n\n\n<div class=\"wp-block-column is-vertically-aligned-top is-layout-flow wp-block-column-is-layout-flow\"><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"869\" src=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2021\/03\/image-12-1024x869.png\" alt=\"PWM modulator signals\" class=\"wp-image-234\" title=\"Product notes &gt; PN135: Simulation essentials with Simulink &gt; Simulation_schemes-PWM.png\" srcset=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2021\/03\/image-12-1024x869.png 1024w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2021\/03\/image-12-300x255.png 300w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2021\/03\/image-12-768x652.png 768w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2021\/03\/image-12.png 1267w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\">Main signals of the CB-PWM block<\/figcaption><\/figure>\n<\/div><\/div>\n<\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"mastering-sample-times\"><span class=\"ez-toc-section\" id=\"Mastering-the-sample-times\"><\/span>Mastering the sample times<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Mastering the <em>sample time<\/em> (essentially the <em>execution rate<\/em>) of each block is key for an accurate and efficient simulation of discrete control algorithms in Simulink, as well as the generation of proper run-time code. In particular, the execution rates must comply with the fundamental concepts listed above and be clearly identified by the Simulink engine, namely:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The plant (i.e. <strong>physical<\/strong>) signals are represented by <strong>continuous <\/strong>signals<\/li>\n\n\n\n<li>The <strong>control <\/strong>signals (i.e. those computed during the controller main interrupt) are represented by <strong>discrete <\/strong>signals with a sampling rate and phase corresponding to the configuration of the main interrupt. Their sample time is, therefore, the vector <code>CTRLPERIOD<\/code>.<\/li>\n<\/ul>\n\n\n\n<p>The blocks of the imperix blockset are built in such a way that they comply with these concepts. The user is only recommended to make sure that his\/her control implementation is executed at the proper rate. In some situations, the <code>CTRLPERIOD<\/code> may not be propagated automatically to the whole control model (see the example of the step block below).<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Verifying-the-sample-times\"><\/span>Verifying the sample times<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>In Simulink, the sample time of each signal can be conveniently displayed by right-clicking a blank area of the model and choosing <em>Sample Time Display<\/em> &gt; <em>All<\/em>. The controller model should have the following colors in Simulation mode:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"522\" height=\"130\" src=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2026\/02\/Usual-sample-time-colors.png\" alt=\"\" class=\"wp-image-41977\" style=\"object-fit:cover\" srcset=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2026\/02\/Usual-sample-time-colors.png 522w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2026\/02\/Usual-sample-time-colors-300x75.png 300w\" sizes=\"auto, (max-width: 522px) 100vw, 522px\" \/><figcaption class=\"wp-element-caption\">Different sample times in a typical control model<\/figcaption><\/figure>\n<\/div>\n\n\n<p>The color legend can be displayed by pressing Ctrl+J (see below).<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"333\" height=\"471\" src=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2026\/02\/sample_time_legend_v2.png\" alt=\"Sample time color legend\" class=\"wp-image-41976\" style=\"object-fit:cover;width:287px;height:auto\" srcset=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2026\/02\/sample_time_legend_v2.png 333w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2026\/02\/sample_time_legend_v2-212x300.png 212w\" sizes=\"auto, (max-width: 333px) 100vw, 333px\" \/><figcaption class=\"wp-element-caption\">Sample time color legend<\/figcaption><\/figure>\n<\/div>\n\n\n<p>The expected sample times are as follows:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Continuous:<\/strong> Applied to the base clock signal and signals originating from the plant model.<\/li>\n\n\n\n<li><strong>Fixed in Minor Step (FiM):<\/strong> An optimized version of \"Continuous\" applicable when a signal's value remains constant between the solver's major steps. This typically applies to switched signals (e.g. sampling clock and PWM), which do not vary between switching events.<\/li>\n\n\n\n<li><strong>Variable 1, 2, 3:<\/strong> Assigned to specific clock signals internal to the <strong>CONFIG<\/strong> block.<\/li>\n\n\n\n<li><strong>Discrete (D1):<\/strong> Used for all signals within the control implementation (the logic residing between the ADC and PWM blocks). D1 is a vector equal to <code>CTRLPERIOD<\/code>, which accounts for both the control execution period and the sampling phase (if non-zero).<\/li>\n\n\n\n<li><strong>Multirate:<\/strong> Found in peripheral blocks. Because these blocks bridge continuous plant signals and discrete control logic, they inherently incorporate multiple sample times.<\/li>\n<\/ul>\n\n\n\n<p>To ensure the simulation accurately represents a feasible real-time execution, the following two conditions must be met:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>The control implementation (all blocks between the ADC and PWM peripheral blocks) must consist exclusively of discrete signals.<\/li>\n\n\n\n<li>The red signals (D1) must have a sample time equal to <code>CTRLPERIOD<\/code>. This ensures that no part of the controller attempts to execute faster than the hardware interrupt, which is physically impossible. Other discrete signals may be present if they are integer multiples of the D1 rate. In such cases, these signals necessarily appear in colors other than red. For more information on multi-rate control, please refer to <a href=\"https:\/\/imperix.com\/doc\/help\/multi-rate-control-with-acg-sdk-on-simulink\">PN145<\/a>.<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Correcting-the-sample-times\"><\/span>Correcting the sample times<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>If these conditions are not satisfied, the sample time of the problematic block(s) must be set to <code>CTRLPERIOD<\/code>. In many cases, an inherited sample time (<code>-1<\/code>) is also effective, as it will typically resolve to <code>CTRLPERIOD<\/code> during model initialization.<\/p>\n\n\n\n<p>The following example illustrates a problematic configuration where the <strong>Sine Wave<\/strong> block defaults to continuous behavior. In this scenario, both conditions are unmet: the control path contains a continuous signal, and Simulink has resolved the fastest discrete sample time (red - D1) to something different than <code>CTRLPERIOD<\/code>.<\/p>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\"><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"401\" height=\"143\" src=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2026\/02\/image-5.png\" alt=\"\" class=\"wp-image-42080\" style=\"width:351px;height:auto\" srcset=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2026\/02\/image-5.png 401w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2026\/02\/image-5-300x107.png 300w\" sizes=\"auto, (max-width: 401px) 100vw, 401px\" \/><\/figure>\n<\/div><\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\"><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"323\" height=\"110\" src=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2026\/02\/image-1.png\" alt=\"\" class=\"wp-image-42050\" srcset=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2026\/02\/image-1.png 323w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2026\/02\/image-1-300x102.png 300w\" sizes=\"auto, (max-width: 323px) 100vw, 323px\" \/><\/figure>\n<\/div><\/div>\n<\/div>\n\n\n\n<p>To resolve this issue, the sample time of the <strong>Sine Wave<\/strong> block must be set to <code>-1<\/code> or <code>CTRLPERIOD<\/code>. Once the model is updated (Ctrl+D), the entire control path will resolve to a red discrete rate, equal to <code>CTRLPERIOD<\/code>.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"357\" height=\"561\" src=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2026\/02\/image-2.png\" alt=\"\" class=\"wp-image-42070\" style=\"width:301px;height:auto\" srcset=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2026\/02\/image-2.png 357w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2026\/02\/image-2-191x300.png 191w\" sizes=\"auto, (max-width: 357px) 100vw, 357px\" \/><figcaption class=\"wp-element-caption\">Configuration dialog of the Sine Wave block<\/figcaption><\/figure>\n<\/div>\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\"><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"398\" height=\"142\" src=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2026\/02\/image-3.png\" alt=\"\" class=\"wp-image-42078\" style=\"width:351px\" srcset=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2026\/02\/image-3.png 398w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2026\/02\/image-3-300x107.png 300w\" sizes=\"auto, (max-width: 398px) 100vw, 398px\" \/><\/figure>\n<\/div><\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\"><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"323\" height=\"80\" src=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2026\/02\/image-4.png\" alt=\"\" class=\"wp-image-42079\" srcset=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2026\/02\/image-4.png 323w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2026\/02\/image-4-300x74.png 300w\" sizes=\"auto, (max-width: 323px) 100vw, 323px\" \/><\/figure>\n<\/div><\/div>\n<\/div>\n\n\n\n<p>In cases where the source of the rate conflict is difficult to identify or a block's sample time cannot be modified, a <strong>Signal Specification<\/strong> block set to <code>CTRLPERIOD<\/code> can be used. This helps the Simulink engine resolve the sample times correctly throughout the signal path.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Further-readings\"><\/span>Further readings<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/imperix.com\/doc\/help\/programming-imperix-controllers\">Programming and operating imperix controllers (PN138)<\/a> is a guide for deploying code onto imperix controllers<\/li>\n\n\n\n<li><a href=\"https:\/\/imperix.com\/doc\/help\/cockpit-user-guide\">Cockpit user guide (PN300)<\/a> gives an overview of the tools provided by Cockpit and how to use them<\/li>\n\n\n\n<li><a href=\"https:\/\/imperix.com\/doc\/help\/going-further-with-acg-sdk\/speeding-up-simulink-simulation\">Speeding up simulation with Simulink (PN131)<\/a> gives practical tips and tricks to speed up Simulink simulation<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>This note provides in-depth content for an accurate and efficient offline simulation of an imperix controller and the corresponding plant model using&nbsp;ACG SDK&nbsp;on Simulink. Because&#8230;<\/p>\n","protected":false},"author":2,"featured_media":3005,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_kad_post_classname":"","footnotes":""},"categories":[12,3],"tags":[],"software-environments":[103],"provided-results":[],"related-products":[50,31,32,92],"guidedreadings":[],"tutorials":[],"user-manuals":[177],"coauthors":[63],"class_list":["post-227","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-getting-started-acg-sdk","category-help","software-environments-matlab","related-products-acg-sdk","related-products-b-board-pro","related-products-b-box-rcp","related-products-b-box-micro","user-manuals-getting-started-with-acg-sdk"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Simulation essentials with Simulink - imperix<\/title>\n<meta name=\"description\" content=\"This notes describes the main principles of the simulation models included inside the ACG SDK library for Simulink.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/imperix.com\/doc\/help\/simulation-essentials-simulink\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Simulation essentials with Simulink - imperix\" \/>\n<meta property=\"og:description\" content=\"This notes describes the main principles of the simulation models included inside the ACG SDK library for Simulink.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/imperix.com\/doc\/help\/simulation-essentials-simulink\" \/>\n<meta property=\"og:site_name\" content=\"imperix\" \/>\n<meta property=\"article:published_time\" content=\"2021-03-23T10:00:02+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-05-05T06:56:30+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2021\/03\/3_2_ratio_PN135.png\" \/>\n\t<meta property=\"og:image:width\" content=\"450\" \/>\n\t<meta property=\"og:image:height\" content=\"300\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Julien Orsinger\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Julien Orsinger\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"15 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/imperix.com\\\/doc\\\/help\\\/simulation-essentials-simulink#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/imperix.com\\\/doc\\\/help\\\/simulation-essentials-simulink\"},\"author\":{\"name\":\"Julien Orsinger\",\"@id\":\"https:\\\/\\\/imperix.com\\\/doc\\\/#\\\/schema\\\/person\\\/65ef663818eab76f53cc627ab80e0a51\"},\"headline\":\"Simulation essentials with Simulink\",\"datePublished\":\"2021-03-23T10:00:02+00:00\",\"dateModified\":\"2026-05-05T06:56:30+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/imperix.com\\\/doc\\\/help\\\/simulation-essentials-simulink\"},\"wordCount\":2403,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/imperix.com\\\/doc\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/imperix.com\\\/doc\\\/help\\\/simulation-essentials-simulink#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/imperix.com\\\/doc\\\/wp-content\\\/uploads\\\/2021\\\/03\\\/3_2_ratio_PN135.png\",\"articleSection\":[\"Getting started with ACG SDK\",\"Product notes\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/imperix.com\\\/doc\\\/help\\\/simulation-essentials-simulink#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/imperix.com\\\/doc\\\/help\\\/simulation-essentials-simulink\",\"url\":\"https:\\\/\\\/imperix.com\\\/doc\\\/help\\\/simulation-essentials-simulink\",\"name\":\"Simulation essentials with Simulink - imperix\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/imperix.com\\\/doc\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/imperix.com\\\/doc\\\/help\\\/simulation-essentials-simulink#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/imperix.com\\\/doc\\\/help\\\/simulation-essentials-simulink#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/imperix.com\\\/doc\\\/wp-content\\\/uploads\\\/2021\\\/03\\\/3_2_ratio_PN135.png\",\"datePublished\":\"2021-03-23T10:00:02+00:00\",\"dateModified\":\"2026-05-05T06:56:30+00:00\",\"description\":\"This notes describes the main principles of the simulation models included inside the ACG SDK library for Simulink.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/imperix.com\\\/doc\\\/help\\\/simulation-essentials-simulink#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/imperix.com\\\/doc\\\/help\\\/simulation-essentials-simulink\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/imperix.com\\\/doc\\\/help\\\/simulation-essentials-simulink#primaryimage\",\"url\":\"https:\\\/\\\/imperix.com\\\/doc\\\/wp-content\\\/uploads\\\/2021\\\/03\\\/3_2_ratio_PN135.png\",\"contentUrl\":\"https:\\\/\\\/imperix.com\\\/doc\\\/wp-content\\\/uploads\\\/2021\\\/03\\\/3_2_ratio_PN135.png\",\"width\":450,\"height\":300,\"caption\":\"PWM modulator content\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/imperix.com\\\/doc\\\/help\\\/simulation-essentials-simulink#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Knowledge base\",\"item\":\"https:\\\/\\\/imperix.com\\\/doc\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Product notes\",\"item\":\"https:\\\/\\\/imperix.com\\\/doc\\\/category\\\/help\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Simulation essentials with Simulink\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/imperix.com\\\/doc\\\/#website\",\"url\":\"https:\\\/\\\/imperix.com\\\/doc\\\/\",\"name\":\"imperix\",\"description\":\"power electronics\",\"publisher\":{\"@id\":\"https:\\\/\\\/imperix.com\\\/doc\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/imperix.com\\\/doc\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/imperix.com\\\/doc\\\/#organization\",\"name\":\"imperix\",\"url\":\"https:\\\/\\\/imperix.com\\\/doc\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/imperix.com\\\/doc\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/imperix.com\\\/doc\\\/wp-content\\\/uploads\\\/2021\\\/03\\\/imperix_logo.png\",\"contentUrl\":\"https:\\\/\\\/imperix.com\\\/doc\\\/wp-content\\\/uploads\\\/2021\\\/03\\\/imperix_logo.png\",\"width\":350,\"height\":120,\"caption\":\"imperix\"},\"image\":{\"@id\":\"https:\\\/\\\/imperix.com\\\/doc\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/imperix.com\\\/doc\\\/#\\\/schema\\\/person\\\/65ef663818eab76f53cc627ab80e0a51\",\"name\":\"Julien Orsinger\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/0a0328b09c6abe61fa1e263a1066dcb26ea8f3b9e8b1d78056047620947bb388?s=96&d=mm&r=g6545a7220411572e799ad58574cce259\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/0a0328b09c6abe61fa1e263a1066dcb26ea8f3b9e8b1d78056047620947bb388?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/0a0328b09c6abe61fa1e263a1066dcb26ea8f3b9e8b1d78056047620947bb388?s=96&d=mm&r=g\",\"caption\":\"Julien Orsinger\"},\"description\":\"Julien is a senior power electronics engineer. On the knowledge base, he is acting as the editorial manager and is therefore the co-author of numerous articles on a broad variety of topics.\",\"sameAs\":[\"https:\\\/\\\/www.linkedin.com\\\/in\\\/julien-orsinger-640ab2129\\\/\"],\"url\":\"https:\\\/\\\/imperix.com\\\/doc\\\/author\\\/orsinger\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Simulation essentials with Simulink - imperix","description":"This notes describes the main principles of the simulation models included inside the ACG SDK library for Simulink.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/imperix.com\/doc\/help\/simulation-essentials-simulink","og_locale":"en_US","og_type":"article","og_title":"Simulation essentials with Simulink - imperix","og_description":"This notes describes the main principles of the simulation models included inside the ACG SDK library for Simulink.","og_url":"https:\/\/imperix.com\/doc\/help\/simulation-essentials-simulink","og_site_name":"imperix","article_published_time":"2021-03-23T10:00:02+00:00","article_modified_time":"2026-05-05T06:56:30+00:00","og_image":[{"width":450,"height":300,"url":"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2021\/03\/3_2_ratio_PN135.png","type":"image\/png"}],"author":"Julien Orsinger","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Julien Orsinger","Est. reading time":"15 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/imperix.com\/doc\/help\/simulation-essentials-simulink#article","isPartOf":{"@id":"https:\/\/imperix.com\/doc\/help\/simulation-essentials-simulink"},"author":{"name":"Julien Orsinger","@id":"https:\/\/imperix.com\/doc\/#\/schema\/person\/65ef663818eab76f53cc627ab80e0a51"},"headline":"Simulation essentials with Simulink","datePublished":"2021-03-23T10:00:02+00:00","dateModified":"2026-05-05T06:56:30+00:00","mainEntityOfPage":{"@id":"https:\/\/imperix.com\/doc\/help\/simulation-essentials-simulink"},"wordCount":2403,"commentCount":0,"publisher":{"@id":"https:\/\/imperix.com\/doc\/#organization"},"image":{"@id":"https:\/\/imperix.com\/doc\/help\/simulation-essentials-simulink#primaryimage"},"thumbnailUrl":"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2021\/03\/3_2_ratio_PN135.png","articleSection":["Getting started with ACG SDK","Product notes"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/imperix.com\/doc\/help\/simulation-essentials-simulink#respond"]}]},{"@type":"WebPage","@id":"https:\/\/imperix.com\/doc\/help\/simulation-essentials-simulink","url":"https:\/\/imperix.com\/doc\/help\/simulation-essentials-simulink","name":"Simulation essentials with Simulink - imperix","isPartOf":{"@id":"https:\/\/imperix.com\/doc\/#website"},"primaryImageOfPage":{"@id":"https:\/\/imperix.com\/doc\/help\/simulation-essentials-simulink#primaryimage"},"image":{"@id":"https:\/\/imperix.com\/doc\/help\/simulation-essentials-simulink#primaryimage"},"thumbnailUrl":"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2021\/03\/3_2_ratio_PN135.png","datePublished":"2021-03-23T10:00:02+00:00","dateModified":"2026-05-05T06:56:30+00:00","description":"This notes describes the main principles of the simulation models included inside the ACG SDK library for Simulink.","breadcrumb":{"@id":"https:\/\/imperix.com\/doc\/help\/simulation-essentials-simulink#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/imperix.com\/doc\/help\/simulation-essentials-simulink"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/imperix.com\/doc\/help\/simulation-essentials-simulink#primaryimage","url":"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2021\/03\/3_2_ratio_PN135.png","contentUrl":"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2021\/03\/3_2_ratio_PN135.png","width":450,"height":300,"caption":"PWM modulator content"},{"@type":"BreadcrumbList","@id":"https:\/\/imperix.com\/doc\/help\/simulation-essentials-simulink#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Knowledge base","item":"https:\/\/imperix.com\/doc\/"},{"@type":"ListItem","position":2,"name":"Product notes","item":"https:\/\/imperix.com\/doc\/category\/help"},{"@type":"ListItem","position":3,"name":"Simulation essentials with Simulink"}]},{"@type":"WebSite","@id":"https:\/\/imperix.com\/doc\/#website","url":"https:\/\/imperix.com\/doc\/","name":"imperix","description":"power electronics","publisher":{"@id":"https:\/\/imperix.com\/doc\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/imperix.com\/doc\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/imperix.com\/doc\/#organization","name":"imperix","url":"https:\/\/imperix.com\/doc\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/imperix.com\/doc\/#\/schema\/logo\/image\/","url":"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2021\/03\/imperix_logo.png","contentUrl":"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2021\/03\/imperix_logo.png","width":350,"height":120,"caption":"imperix"},"image":{"@id":"https:\/\/imperix.com\/doc\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/imperix.com\/doc\/#\/schema\/person\/65ef663818eab76f53cc627ab80e0a51","name":"Julien Orsinger","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/0a0328b09c6abe61fa1e263a1066dcb26ea8f3b9e8b1d78056047620947bb388?s=96&d=mm&r=g6545a7220411572e799ad58574cce259","url":"https:\/\/secure.gravatar.com\/avatar\/0a0328b09c6abe61fa1e263a1066dcb26ea8f3b9e8b1d78056047620947bb388?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/0a0328b09c6abe61fa1e263a1066dcb26ea8f3b9e8b1d78056047620947bb388?s=96&d=mm&r=g","caption":"Julien Orsinger"},"description":"Julien is a senior power electronics engineer. On the knowledge base, he is acting as the editorial manager and is therefore the co-author of numerous articles on a broad variety of topics.","sameAs":["https:\/\/www.linkedin.com\/in\/julien-orsinger-640ab2129\/"],"url":"https:\/\/imperix.com\/doc\/author\/orsinger"}]}},"_links":{"self":[{"href":"https:\/\/imperix.com\/doc\/wp-json\/wp\/v2\/posts\/227","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/imperix.com\/doc\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/imperix.com\/doc\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/imperix.com\/doc\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/imperix.com\/doc\/wp-json\/wp\/v2\/comments?post=227"}],"version-history":[{"count":78,"href":"https:\/\/imperix.com\/doc\/wp-json\/wp\/v2\/posts\/227\/revisions"}],"predecessor-version":[{"id":45497,"href":"https:\/\/imperix.com\/doc\/wp-json\/wp\/v2\/posts\/227\/revisions\/45497"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/imperix.com\/doc\/wp-json\/wp\/v2\/media\/3005"}],"wp:attachment":[{"href":"https:\/\/imperix.com\/doc\/wp-json\/wp\/v2\/media?parent=227"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/imperix.com\/doc\/wp-json\/wp\/v2\/categories?post=227"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/imperix.com\/doc\/wp-json\/wp\/v2\/tags?post=227"},{"taxonomy":"software-environments","embeddable":true,"href":"https:\/\/imperix.com\/doc\/wp-json\/wp\/v2\/software-environments?post=227"},{"taxonomy":"provided-results","embeddable":true,"href":"https:\/\/imperix.com\/doc\/wp-json\/wp\/v2\/provided-results?post=227"},{"taxonomy":"related-products","embeddable":true,"href":"https:\/\/imperix.com\/doc\/wp-json\/wp\/v2\/related-products?post=227"},{"taxonomy":"guidedreadings","embeddable":true,"href":"https:\/\/imperix.com\/doc\/wp-json\/wp\/v2\/guidedreadings?post=227"},{"taxonomy":"tutorials","embeddable":true,"href":"https:\/\/imperix.com\/doc\/wp-json\/wp\/v2\/tutorials?post=227"},{"taxonomy":"user-manuals","embeddable":true,"href":"https:\/\/imperix.com\/doc\/wp-json\/wp\/v2\/user-manuals?post=227"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/imperix.com\/doc\/wp-json\/wp\/v2\/coauthors?post=227"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}