# \#c-script

**URL:** https://forum.plexim.com/tag/c-script/121.md

[Latest](https://forum.plexim.com/latest.md) · [Categories](https://forum.plexim.com/categories.md) · [Tags](https://forum.plexim.com/tags.md)

---

## [C-script block in Frequency Response Analysis (FRA)](https://forum.plexim.com/t/c-script-block-in-frequency-response-analysis-fra/3329)

<div class="topic-metadata">

**Author:** [@Omar](https://forum.plexim.com/u/Omar)\
**Replies:** 7\
**Last updated:** [October 14, 2026, 6:07pm UTC](https://forum.plexim.com/t/c-script-block-in-frequency-response-analysis-fra/3329 "2026-10-14T18:07:06Z")

</div>

Hello all, In the attached model, I’m trying to compare the frequency response of an analogue 3P3Z (type-III) controller to it’s discrete counter-parts (two versions: MMPZ and Tustin), but the discrete versions seems wa…

---

## [Positive Negative sequence seperation with DDSRF](https://forum.plexim.com/t/positive-negative-sequence-seperation-with-ddsrf/3261)

<div class="topic-metadata">

**Author:** [@smmuabd1](https://forum.plexim.com/u/smmuabd1)\
**Replies:** 1\
**Last updated:** [August 10, 2026, 5:24pm UTC](https://forum.plexim.com/t/positive-negative-sequence-seperation-with-ddsrf/3261 "2026-08-10T17:24:28Z")

</div>

I am building a cascaded H bridge model for unbalanced conditions and need a positive, negative sequence seperation approach, but any approach I have tried does not work so far are any pre built models or exampes of posi…

---

## [C-Script Blocks Prevent DSP Flashing on LAUNCHXL-F28379D](https://forum.plexim.com/t/c-script-blocks-prevent-dsp-flashing-on-launchxl-f28379d/3158)

<div class="topic-metadata">

**Author:** [@Yung](https://forum.plexim.com/u/Yung)\
**Replies:** 5\
**Last updated:** [June 15, 2026, 6:55pm UTC](https://forum.plexim.com/t/c-script-blocks-prevent-dsp-flashing-on-launchxl-f28379d/3158 "2026-06-15T18:55:32Z")

</div>

Hi everyone, I am using PLECS Coder with a LAUNCHXL-F28379D. My PWM outputs and SPI-A block work when I use fixed constant inputs, and I can see the SPI signals on the oscilloscope. However, when I replace the constant…

---

## [Chattering in 6-phase generator + diode rectifier under fixed-step codegen — role of parallel resistor and "step size compensation" block?](https://forum.plexim.com/t/chattering-in-6-phase-generator-diode-rectifier-under-fixed-step-codegen-role-of-parallel-resistor-and-step-size-compensation-block/3127)

<div class="topic-metadata">

**Author:** [@Yechan](https://forum.plexim.com/u/Yechan)\
**Replies:** 1\
**Last updated:** [June 4, 2026, 3:42am UTC](https://forum.plexim.com/t/chattering-in-6-phase-generator-diode-rectifier-under-fixed-step-codegen-role-of-parallel-resistor-and-step-size-compensation-block/3127 "2026-06-04T03:42:22Z")

</div>

Hi, I’m building a 6-phase synchronous generator feeding a diode rectifier, intended to run in codegen mode with a fixed-step solver (Tstep ≈ 2.5 µs) for a real-time hardware target. The generator is a custom model: th…

---

## [Discrepancy between Built-in Integrator and C-Script Implementation](https://forum.plexim.com/t/discrepancy-between-built-in-integrator-and-c-script-implementation/2808)

<div class="topic-metadata">

**Author:** [@haxx](https://forum.plexim.com/u/haxx)\
**Replies:** 4\
**Last updated:** [January 21, 2026, 4:21am UTC](https://forum.plexim.com/t/discrepancy-between-built-in-integrator-and-c-script-implementation/2808 "2026-01-21T04:21:12Z")

</div>

Hello everyone, I am currently working on implementing a Discrete Integrator using a C-Script block to compare it with the standard PLECS library block. For the comparison, I set the integration method of the standard …

---

## [Full Bridge MMC](https://forum.plexim.com/t/full-bridge-mmc/2816)

<div class="topic-metadata">

**Author:** [@Biruk123](https://forum.plexim.com/u/Biruk123)\
**Replies:** 0\
**Last updated:** [January 20, 2026, 12:59pm UTC](https://forum.plexim.com/t/full-bridge-mmc/2816 "2026-01-20T12:59:31Z")

</div>

V0\_MMC\_HVDC.plecs (351.4 KB) HELLO! I want to build a full‑bridge MMC and the demo model for the half‑bridge MMC in the Power Distribution PLECS library is a great reference. However, I would like to know what the diff…

---

## [Capture the PWM on-time using C-Script](https://forum.plexim.com/t/capture-the-pwm-on-time-using-c-script/2750)

<div class="topic-metadata">

**Author:** [@alps](https://forum.plexim.com/u/alps)\
**Replies:** 6\
**Last updated:** [December 12, 2025, 1:29am UTC](https://forum.plexim.com/t/capture-the-pwm-on-time-using-c-script/2750 "2025-12-12T01:29:38Z")

</div>

I want to use a C-script to calculate the on-time and period of an input PWM signal, but for some reason the output time values are always zero //code declarations #include \<math.h\> #include \<stdio.h\> static int pwm…

---

## [Dual phase shift of dual active bridge DAB](https://forum.plexim.com/t/dual-phase-shift-of-dual-active-bridge-dab/2259)

<div class="topic-metadata">

**Author:** [@kalana](https://forum.plexim.com/u/kalana)\
**Replies:** 6\
**Last updated:** [November 26, 2025, 2:41pm UTC](https://forum.plexim.com/t/dual-phase-shift-of-dual-active-bridge-dab/2259 "2025-11-26T14:41:39Z")

</div>

Hi, I am using a PI controller and the variable phase shift module to do a single phase shift in the DAB and it works very well. I am trying to do a double phase shift between the QP1 and QP2 ( 1st and the 2nd leg of th…

---

## [How to use 'make' or 'external build system' for C-Script?](https://forum.plexim.com/t/how-to-use-make-or-external-build-system-for-c-script/2409)

<div class="topic-metadata">

**Author:** [@JD123](https://forum.plexim.com/u/JD123)\
**Replies:** 15\
**Last updated:** [November 21, 2025, 3:34am UTC](https://forum.plexim.com/t/how-to-use-make-or-external-build-system-for-c-script/2409 "2025-11-21T03:34:36Z")

</div>

I am using some C libraries for embedded systems, particularly ‘SCS’ and ‘OSQP’, which normally need a ‘make’ file to link all the dependencies. In PLECS, the C-Script block does not seem to provide access to a terminal…

---

## [Digital Controller Design and Implementation Workflow in PLECS](https://forum.plexim.com/t/digital-controller-design-and-implementation-workflow-in-plecs/2673)

<div class="topic-metadata">

**Author:** [@Munadir\_Ahmed](https://forum.plexim.com/u/Munadir_Ahmed)\
**Replies:** 0\
**Last updated:** [November 3, 2025, 8:54pm UTC](https://forum.plexim.com/t/digital-controller-design-and-implementation-workflow-in-plecs/2673 "2025-11-03T20:54:19Z")

</div>

When developing digital control algorithms for power converters, engineers often need a structured workflow that bridges the gap between control design, simulation, and embedded implementation. The following workflow ou…

---

## [C-Script with stm32](https://forum.plexim.com/t/c-script-with-stm32/2497)

<div class="topic-metadata">

**Author:** [@Rafael\_de\_Almeida](https://forum.plexim.com/u/Rafael_de_Almeida)\
**Replies:** 1\
**Last updated:** [August 22, 2025, 12:22pm UTC](https://forum.plexim.com/t/c-script-with-stm32/2497 "2025-08-22T12:22:59Z")

</div>

How i use c-scrpit to make a signal with stm32? Always when i try appears this error

---

## [Plecs and python co-simulation error](https://forum.plexim.com/t/plecs-and-python-co-simulation-error/2477)

<div class="topic-metadata">

**Author:** [@ims999916](https://forum.plexim.com/u/ims999916)\
**Replies:** 5\
**Last updated:** [August 19, 2025, 1:58pm UTC](https://forum.plexim.com/t/plecs-and-python-co-simulation-error/2477 "2025-08-19T13:58:17Z")

</div>

https://www.plexim.com/content/plecs-buck-converter-controls-co-simulation I run the demo ‘buck\_converter\_with\_co\_simulation’ because i need to learn about plecs and python co-simulation. but I run the simulation with …

---

## [Problem with InitialSystemState between variable / discrete time implementations](https://forum.plexim.com/t/problem-with-initialsystemstate-between-variable-discrete-time-implementations/2411)

<div class="topic-metadata">

**Author:** [@FriendlyUser](https://forum.plexim.com/u/FriendlyUser)\
**Replies:** 2\
**Last updated:** [August 7, 2025, 6:22am UTC](https://forum.plexim.com/t/problem-with-initialsystemstate-between-variable-discrete-time-implementations/2411 "2025-08-07T06:22:17Z")

</div>

Hi, INTRODUCTION: I’m using scripting to run my PLECS simulations. Using ‘Analysis’ instead of ‘Simulate’ with variable step size was not satisfying, as I’m using nonlinear passive component models and the variable ste…

---

## [How to use C-Script to generate a triangular wave with adjustable amplitude and frequency, and use the triangular wave as a carrier for modulation](https://forum.plexim.com/t/how-to-use-c-script-to-generate-a-triangular-wave-with-adjustable-amplitude-and-frequency-and-use-the-triangular-wave-as-a-carrier-for-modulation/2405)

<div class="topic-metadata">

**Author:** [@Yangcheng](https://forum.plexim.com/u/Yangcheng)\
**Replies:** 1\
**Last updated:** [August 1, 2025, 7:10pm UTC](https://forum.plexim.com/t/how-to-use-c-script-to-generate-a-triangular-wave-with-adjustable-amplitude-and-frequency-and-use-the-triangular-wave-as-a-carrier-for-modulation/2405 "2025-08-01T19:10:10Z")

</div>

How to use C-Script to generate a triangular wave with adjustable amplitude and frequency, and use the triangular wave as a carrier for modulation

---

## [Unable to generate coder for Error in build step #4 (Make): Make process timed out after 10 seconds](https://forum.plexim.com/t/unable-to-generate-coder-for-error-in-build-step-4-make-make-process-timed-out-after-10-seconds/2398)

<div class="topic-metadata">

**Author:** [@Eric](https://forum.plexim.com/u/Eric)\
**Replies:** 3\
**Last updated:** [July 31, 2025, 2:52pm UTC](https://forum.plexim.com/t/unable-to-generate-coder-for-error-in-build-step-4-make-make-process-timed-out-after-10-seconds/2398 "2025-07-31T14:52:07Z")

</div>

Hello , I can’t even generate the simplest code such like Blinky Model on luanchpad F280049C, because i found my compiler stop at the way to generate the file .mk.uptodate , below is the issue test.plecs (8.9 KB) , …

---

## [Dual Active Bridge](https://forum.plexim.com/t/dual-active-bridge/2357)

<div class="topic-metadata">

**Author:** [@kalana](https://forum.plexim.com/u/kalana)\
**Replies:** 15\
**Last updated:** [July 23, 2025, 9:52pm UTC](https://forum.plexim.com/t/dual-active-bridge/2357 "2025-07-23T21:52:59Z")

</div>

Hi, I am using the plecs dual active bridge model. I changed my input voltage, turns ration and the leakage inductance and frequency and ran the simulation. The simulation becomes unstable and tried using various PI con…

---

## [The difference between DiscState and global variables in a C script](https://forum.plexim.com/t/the-difference-between-discstate-and-global-variables-in-a-c-script/2319)

<div class="topic-metadata">

**Author:** [@Jason\_Yan](https://forum.plexim.com/u/Jason_Yan)\
**Replies:** 1\
**Last updated:** [July 7, 2025, 3:18pm UTC](https://forum.plexim.com/t/the-difference-between-discstate-and-global-variables-in-a-c-script/2319 "2025-07-07T15:18:33Z")

</div>

I set the sampling time of the C script as Ts and implemented a simple discrete PI controller. For the previous error value, the example indicates that it should be defined using DiscState and updated within the update f…

---

## [Dual active Bridge Demo Continuous to Discrete Signal](https://forum.plexim.com/t/dual-active-bridge-demo-continuous-to-discrete-signal/2252)

<div class="topic-metadata">

**Author:** [@kalana](https://forum.plexim.com/u/kalana)\
**Replies:** 4\
**Last updated:** [June 9, 2025, 10:35pm UTC](https://forum.plexim.com/t/dual-active-bridge-demo-continuous-to-discrete-signal/2252 "2025-06-09T22:35:52Z")

</div>

Hi, I am trying to develop a DAB using the model given in the demo version. But however when I change the inputs like Vo, Pin, fsw etc. program crashes. I think its because of the transfer function given in the model.…

---

## [How to Model a 3-Phase STATCOM Using Three Independent Single-Phase Units in PLECS?](https://forum.plexim.com/t/how-to-model-a-3-phase-statcom-using-three-independent-single-phase-units-in-plecs/2243)

<div class="topic-metadata">

**Author:** [@Azeef99](https://forum.plexim.com/u/Azeef99)\
**Replies:** 1\
**Last updated:** [June 6, 2025, 3:24pm UTC](https://forum.plexim.com/t/how-to-model-a-3-phase-statcom-using-three-independent-single-phase-units-in-plecs/2243 "2025-06-06T15:24:52Z")

</div>

Hello, I’m working on building a 3-phase STATCOM model in PLECS for an unbalanced load system. My approach is to use three independently controlled single-phase STATCOMs, each connected to one phase. The goal is for eac…

---

## [C script: Start Function Code](https://forum.plexim.com/t/c-script-start-function-code/2224)

<div class="topic-metadata">

**Author:** [@Mike2](https://forum.plexim.com/u/Mike2)\
**Replies:** 1\
**Last updated:** [June 4, 2025, 2:01pm UTC](https://forum.plexim.com/t/c-script-start-function-code/2224 "2025-06-04T14:01:10Z")

</div>

Hi, I want to know how start function code works in C-script block, this block is executed only once at the start of simulation right? Can anyone direct me to the example , if any where the C-script block is executed o…

---

## [Triggering a reset via register or watchdog with TI C2000](https://forum.plexim.com/t/triggering-a-reset-via-register-or-watchdog-with-ti-c2000/2101)

<div class="topic-metadata">

**Author:** [@rgartemann](https://forum.plexim.com/u/rgartemann)\
**Replies:** 1\
**Last updated:** [May 13, 2025, 3:42pm UTC](https://forum.plexim.com/t/triggering-a-reset-via-register-or-watchdog-with-ti-c2000/2101 "2025-05-13T15:42:13Z")

</div>

Hello, I am working with an F28379D and Plecs 4.9.4. My task is to shut down an application created in Plecs in an orderly manner upon receiving a specific CAN message, and then trigger a CPU reset either via the reset r…

---

## [Create a delay block for discrete signals](https://forum.plexim.com/t/create-a-delay-block-for-discrete-signals/1134)

<div class="topic-metadata">

**Author:** [@fire](https://forum.plexim.com/u/fire)\
**Replies:** 4\
**Last updated:** [April 1, 2025, 1:45pm UTC](https://forum.plexim.com/t/create-a-delay-block-for-discrete-signals/1134 "2025-04-01T13:45:57Z")

</div>

I want to create a delay block like transport delay which is used for continue signals, and didn’t find solutions in the FAQ, so how ? I wish the delay block can delay the discrete signals with a external signals, like t…

---

## [Struggle with variable delay time using C-script](https://forum.plexim.com/t/struggle-with-variable-delay-time-using-c-script/1880)

<div class="topic-metadata">

**Author:** [@Camberlam](https://forum.plexim.com/u/Camberlam)\
**Replies:** 4\
**Last updated:** [March 13, 2025, 3:50pm UTC](https://forum.plexim.com/t/struggle-with-variable-delay-time-using-c-script/1880 "2025-03-13T15:50:32Z")

</div>

Dear all, the delay time I needed is from PI controller and I reviewed the topics about this part but still couldn’t get how to create delay time by using C-script, if there are any suggestion or example I would be very…

---

## [Store previous signal values in C-Script](https://forum.plexim.com/t/store-previous-signal-values-in-c-script/1867)

<div class="topic-metadata">

**Author:** [@meriem](https://forum.plexim.com/u/meriem)\
**Replies:** 5\
**Last updated:** [March 10, 2025, 7:38pm UTC](https://forum.plexim.com/t/store-previous-signal-values-in-c-script/1867 "2025-03-10T19:38:08Z")

</div>

Hi, I want to implement C-Script that calculate my system performances in PLECS standalone. I need to calculate the difference between my current signal value and previous ones. Is it possible to keep trace of previous…

---

## [Passing value from script to system parameters](https://forum.plexim.com/t/passing-value-from-script-to-system-parameters/1751)

<div class="topic-metadata">

**Author:** [@MohamedMansour](https://forum.plexim.com/u/MohamedMansour)\
**Replies:** 1\
**Last updated:** [February 3, 2025, 4:02pm UTC](https://forum.plexim.com/t/passing-value-from-script-to-system-parameters/1751 "2025-02-03T16:02:39Z")

</div>

I wrote a script where I update a certain parameter but I need to pass it to the initialization tab otherwise it gives me error where I should initialize it and of course this conflicts with written script for parameter …

---

## [Abc-\>alfabeta-\>dq transformation in c-script](https://forum.plexim.com/t/abc-alfabeta-dq-transformation-in-c-script/1718)

<div class="topic-metadata">

**Author:** [@kamos](https://forum.plexim.com/u/kamos)\
**Replies:** 2\
**Last updated:** [January 23, 2025, 8:02pm UTC](https://forum.plexim.com/t/abc-alfabeta-dq-transformation-in-c-script/1718 "2025-01-23T20:02:04Z")

</div>

Hi All, I am looking for an advise what I am doing wrong in the c-script code in terms of transforming currents from abc to alfabeta and alfabeta to dq. The file with relevant code is attached. Any advise is highly app…

---

## [Error are reported when using a module containing c-script](https://forum.plexim.com/t/error-are-reported-when-using-a-module-containing-c-script/1540)

<div class="topic-metadata">

**Author:** [@Ethan](https://forum.plexim.com/u/Ethan)\
**Replies:** 1\
**Last updated:** [November 25, 2024, 3:12pm UTC](https://forum.plexim.com/t/error-are-reported-when-using-a-module-containing-c-script/1540 "2024-11-25T15:12:53Z")

</div>

I built the DBSRC circuit model,and it could run in the open loop mode using the Pulse Generator module,but when I built the closed-loop simulation using the PWM generator,the c-script in the PWM module reported an error…

---

## [Can I use the PLECS block "space vector PWM(3-level)" to SVPWM 3-level PFC?](https://forum.plexim.com/t/can-i-use-the-plecs-block-space-vector-pwm-3-level-to-svpwm-3-level-pfc/1506)

<div class="topic-metadata">

**Author:** [@413dac](https://forum.plexim.com/u/413dac)\
**Replies:** 1\
**Last updated:** [November 11, 2024, 3:33pm UTC](https://forum.plexim.com/t/can-i-use-the-plecs-block-space-vector-pwm-3-level-to-svpwm-3-level-pfc/1506 "2024-11-11T15:33:21Z")

</div>

I found this block is used to inverter

---

## [Can i use the PLECS block "Space Vector PWM (3-Level)" with RT Box 1](https://forum.plexim.com/t/can-i-use-the-plecs-block-space-vector-pwm-3-level-with-rt-box-1/1421)

<div class="topic-metadata">

**Author:** [@jose](https://forum.plexim.com/u/jose)\
**Replies:** 1\
**Last updated:** [October 28, 2024, 3:46pm UTC](https://forum.plexim.com/t/can-i-use-the-plecs-block-space-vector-pwm-3-level-with-rt-box-1/1421 "2024-10-28T15:46:10Z")

</div>

Hi! I’m trying to use the Space Vector PWM (3-Level)" block with RT Box 1. and I always have this error. Variable-step discrete tasks are not supported with a fixed-step solver or a ‘Discrete state-space’ model. How c…

---

## [How can I implement PWM edge detection using a C-Script for the RT-Box?](https://forum.plexim.com/t/how-can-i-implement-pwm-edge-detection-using-a-c-script-for-the-rt-box/1400)

<div class="topic-metadata">

**Author:** [@Ali](https://forum.plexim.com/u/Ali)\
**Replies:** 2\
**Last updated:** [October 8, 2024, 4:07am UTC](https://forum.plexim.com/t/how-can-i-implement-pwm-edge-detection-using-a-c-script-for-the-rt-box/1400 "2024-10-08T04:07:37Z")

</div>

Hi everyone, I’m encountering an issue while trying to build my PLECS model into the RT-Box. The error message I receive is as follows: "The following components use the value of absolute time. This may cause overflow …

[Next page](https://forum.plexim.com/tag/c-script/121.md?match_all_tags=true&page=1&tags%5B%5D=c-script)
