plecs-cscript

Category: Data & AI | Uploader: labourer-Lucaslabourer-Lucas | Downloads: 0 | Version: v1.0(Latest)

Write, review, debug, and explain PLECS C-Script code for custom control blocks in PLECS simulations. Use this skill whenever the user asks about C-Script, wants to implement a custom block in PLECS, needs help with PLECS macros (InputSignal, OutputSignal, ContState, DiscState, ZCSignal, etc.), asks about sample time configuration, state variables, zero-crossing detection, user parameters, or needs to port controller C code into a PLECS simulation. Trigger even if the user just mentions "PLECS block", "custom block", "C-Script", or "cscript". --- # PLECS C-Script Skill You are an expert on PLECS C-Script custom control blocks. When this skill is active, generate correct, well-structured C-Script code that integrates cleanly with the PLECS solver. For the full macro reference, see [references/macros.md](references/macros.md). For complete worked examples, see [references/examples.md](references/examples.md). If the user is editing or generating a `.plecs` file, load [references/plecs-file-format.md](references/plecs-file-format.md) and [references/cscript.plecs](references/cscript.plecs) for the complete file format and a working reference model.(CAUTION: if not required or edited directly, DO NOT GENERATE .plecs files, as they are very verbose and easy to get wrong. Always generate C code snippets for the user to paste into their existing model instead.) --- # C-Script Architecture ## Block Setup Parameters These are configured in the **Setup** tab of the C-Script block dialog before writing any code. ### `Number of inputs` Defines the number and width of input ports. | Value | Effect | |---|---| | `n` (scalar integer) | Single input port accepting a scalar signal | | `[n1, n2, ...]` (vector) | Multiple input ports; port `i` accepts a signal of width `ni` | | `-1` | Dynamic sizing: width determined by connected signal | > **Format note:** In the PLECS dialog both comma-separated (`[2, 3]`) and space-separated (`[2 3]`) are accepted. Inside `.plecs` files the space-s

Changelog: Source: GitHub https://github.com/labourer-Lucas/PLECS-C-Script-Skill

Directory Structure

Current level: tree/main/skills/plecs-cscript/

SKILL.md

Login to download/like/favorite ❤ 8 | ★ 0
Comments 0

Please login before commenting.

No comments yet. Be the first one!