本文へ移動
cccskills
無料GitHub で公開

simscape-write-ssc

Use when writing or editing Simscape Language (.ssc) source files — components, domains, or functions. Triggers include: model a physical component in .ssc; write physical equations for a Simscape block; add or modify physics or parameterization options in a Simscape component; build a composite component. Also use for validating .ssc syntax, fixing Simscape Language errors, or converting governing equations into working Simscape component code. Do NOT use for configuring or connecting existing Simscape blocks in a Simulink model — that is model building, not language authoring.

インストール方法を見る

含まれるファイル(33)

  • SKILL.md8.4 KB
  • assets/isothermal-liquid-two-port-dynamic.ssc1.2 KB
  • manifest.yaml2.2 KB
  • references/composition/arrays-of-nodes.md1.0 KB
  • references/composition/composite-components-and-connections.md2.5 KB
  • references/composition/composites-member-variable-initialization.md1.1 KB
  • references/composition/for-loop-component-arrays.md1.9 KB
  • references/composition/inheritance-and-subclassing.md745 B
  • references/composition/optional-and-variant-members.md972 B
  • references/equations-and-variables/assertions-and-bounds.md667 B
  • references/equations-and-variables/intermediates-and-let.md926 B
  • references/equations-and-variables/variables-derivatives-initialization.md3.8 KB
  • references/foundation/domain-selection.md6.2 KB
  • references/foundation/gas.md6.1 KB
  • references/foundation/isothermal-liquid.md4.3 KB
  • references/foundation/moist-air.md8.1 KB
  • references/foundation/thermal-liquid.md6.2 KB
  • references/foundation/two-phase-fluid.md10.4 KB
  • references/language-functions/matlab-declaration-functions.md994 B
  • references/language-functions/tablelookup.md1.7 KB
  • references/language-functions/writing-simscape-functions.md1.7 KB
  • references/modecharts-and-events/events-and-event-variables.md2.0 KB
  • references/modecharts-and-events/modecharts.md2.7 KB
  • references/parameters-and-conditionals/access-and-visibility-attributes.md1.2 KB
  • references/parameters-and-conditionals/conditional-sections-and-hiding-members.md2.1 KB
  • references/parameters-and-conditionals/enumerations.md963 B
  • references/parameters-and-conditionals/parameter-declaration.md1.2 KB
  • references/ports-and-nodes/branches.md2.5 KB
  • references/ports-and-nodes/nodes-conserving-ports.md1.3 KB
  • references/ports-and-nodes/physical-signal-inputs-and-outputs.md1.2 KB
  • references/presentation/block-appearance-and-ports.md1.6 KB
  • references/presentation/uilayout-and-dialog-tabs.md987 B
  • scripts/+simscape/+agentic/sscIssues.p2.5 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

Simscape Language Authoring

Write .ssc files (components, domains, functions) that pass validation and are physically correct.

When to Use

  • Writing a new .ssc component, domain, or function from scratch
  • Adding or modifying physics, equations, or parameterization in an existing .ssc file
  • Converting governing equations into a working Simscape component
  • Adding mode charts, events, or switching logic to a component
  • Building a composite component that connects subcomponents together
  • Fixing Simscape Language syntax or validation errors

When NOT to Use

  • Configuring or connecting existing Simscape blocks in a Simulink model — use building-simulink-models instead
  • Simulating a model or inspecting results — use simulating-simulink-models
  • Setting block parameters from MATLAB or a script without editing .ssc source

Workflow

Designing a component

Below are the sections that make up a Simscape component. Include only what is needed.

nodes, inputs, outputs

  • nodes — quantity participates in bilateral energy exchange (the network enforces Across equalization + Through summation).
  • inputs — physical signal imposed from outside (control signal, environment).
  • outputs — physical signal for a measurement or computed result.

Node ports have a domain. Reuse an existing one, especially foundation; author a custom domain only when none covers the physics.

PhysicsDomain path
Electrical (single-phase)foundation.electrical.electrical
Rotational mechanicalfoundation.mechanical.rotational.rotational
Translational mechanicalfoundation.mechanical.translational.translational
Thermal (heat transfer)foundation.thermal.thermal

For fluid domains, polyphase electrical, position/angle-based mechanical variants, or any domain not in the table, you must read: references/foundation/domain-selection.md.

parameters, variables

Parameters — user-configurable inputs; part of the interface.

  • Expose as parameters for physical quantities the engineer sets (resistances, dimensions, thresholds).
  • Use parameters(Access=private) for quantities computed from other parameters. Use intermediates when the value depends on a runtime value.
  • Defaults: physically typical values, so the component works out of the box.

Variables — differential, algebraic, or event.

  • Differential (appear in der(x)): set priority.high; use an initial equation only when the start depends on another variable rather than a fixed/parameter value — never both.
  • Event: declare (Event = true)

Visibility (both): default Access = public, ExternalAccess = modify for user-facing items. Access = private + ExternalAccess = none for pure implementation detail; protected + observe for internal quantities that subclasses or logging should see.

Units — declare everywhere. Every parameter and variable carries a unit ({value, 'unit'}, or '1' for dimensionless). Simscape validates commensurability at compile time and auto-converts across the network. Declare in the unit the engineer naturally uses (mm, deg, bar). A bare number is a silent mismatch waiting to happen.

Compile-time vs. runtime conditionals (if)

  • Interface items (ports, variables the user sees): declared unconditionally (public). Use conditional annotations + ExternalAccess to hide/show them based on a parameter — they remain part of the interface but become invisible in inactive variants.
  • Internal items (hidden variables, internal equations): prefer compile-time if (top-level, parameter-guarded) to eliminate them entirely — reduces states, logging, and solver work.
  • Runtime if (inside equations): use when the governing equation changes at runtime. Must have an else branch. Equation count/dimensionality must be identical in every branch.

equations, intermediates, components, connections, for, modecharts, events, annotations

SectionInclude when
equationscontinuous relationships (== is symmetric equality), assert for parameter validation, equations (Initial=true) for init-only constraints
intermediatesfactor a reused subexpression or want it logged
components / connectionsassembling from existing subcomponents (composite)
forarrays of components or nodes
modechartsthe component has discrete operating states, each with a structurally different equation set (different equation counts, or der terms that come/go) — and transitions between them, possibly with hysteresis. Overkill when a smooth approximation (tanh, tablelookup) or runtime if with identical equation counts fits.
eventsupdate variables(Event=true) (latches, sample-hold, one-shot triggers) at discrete instants via edge() / initialevent. Prefer modecharts when suitable.
annotationsconditional visibility (ExternalAccess overrides), icons (Icon), dialog tabs (UILayout), port sides (Side), logging units (LoggingUnit), fault modeling (Faults), or unit dropdowns (UnitDropdown)
setupnever — deprecated; use assert in equations instead

Write the .ssc file

Write for textbook readability — equations should read as physics. Match the surrounding library's conventions when editing an existing file.

Validate

simscape.agentic.sscIssues (in scripts/+simscape/+agentic/) takes the fully qualified name of a Simscape component, domain, or function and prints diagnostics or "No issues found." Run it with evaluate_matlab_code, project_path set to the skill's scripts/ folder so MATLAB can find the package. Fix reported issues and re-validate until clean.

simscape.agentic.sscIssues("mylib.components.MyComponent")

Pass the fully qualified name — dot-separated namespaces, not a file path. A file at +mylib/+components/MyComponent.ssc on the MATLAB path is named mylib.components.MyComponent. The function errors if the name is not on the path or does not resolve to a .ssc/.sscp file.

Setting project_path changes the current folder, so the working folder and the files the component references may drop off the path. A not found on the MATLAB search path error, or a Validation failed: diagnostic naming a missing referenced file, is a path problem — not a bug in the .ssc. Add necessary folders to the path before treating diagnostics as real.

Reference files (references/)

Each file is self-contained. Read only what you need.

references/
  composition/
    arrays-of-nodes.md
    composite-components-and-connections.md
    composites-member-variable-initialization.md
    for-loop-component-arrays.md
    inheritance-and-subclassing.md
    optional-and-variant-members.md
  equations-and-variables/
    assertions-and-bounds.md
    intermediates-and-let.md
    variables-derivatives-initialization.md
  foundation/
    domain-selection.md
    gas.md
    isothermal-liquid.md
    moist-air.md
    thermal-liquid.md
    two-phase-fluid.md
  language-functions/
    matlab-declaration-functions.md
    tablelookup.md
    writing-simscape-functions.md
  modecharts-and-events/
    events-and-event-variables.md
    modecharts.md
  parameters-and-conditionals/
    access-and-visibility-attributes.md
    conditional-sections-and-hiding-members.md
    enumerations.md
    parameter-declaration.md
  ports-and-nodes/
    branches.md
    nodes-conserving-ports.md
    physical-signal-inputs-and-outputs.md
  presentation/
    block-appearance-and-ports.md
    uilayout-and-dialog-tabs.md

Copyright 2026 The MathWorks, Inc.


レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

Author or upgrade Model Advisor checks for Simulink and System Composer models. Covers the full lifecycle: guideline authoring, check specification, Model Advisor check implementation, and qualification testing. Use when creating new checks (edit-time, standard batch, config-parameter, auto-fix), converting legacy StyleOne/StyleTwo/StyleThree checks to modern DetailStyle, creating a guideline for modeling, enforcing a modeling rule, or testing/qualifying a check. Triggers on any modeling constraint (e.g., "blocks shall...", "signals must match...", "parameters shall be set to...").

日本語の概要は準備中です。原文の説明を表示しています。

matlab/simulink-agentic-toolkit1,2142026年10月8日 更新

Synthesize new waveforms from scratch for Simulink inports using createInputDataset. Use ONLY when the user asks to generate, create, or synthesize signals (step, ramp, sine, chirp, pulse, noise) to populate a Dataset for External Inputs or Signal Editor. Covers timeseries and timetable formats with correct data type, interpolation, units, and dimensions. Also covers function-call and trigger inport timing setup. Do NOT use when the user wants to load, import, or read existing data from files (MAT, CSV, spreadsheet) — even if that data will be used as model input. Do NOT use for running simulations or plotting outputs.

日本語の概要は準備中です。原文の説明を表示しています。

matlab/simulink-agentic-toolkit1,2142026年10月8日 更新

Common steps for building multi-layer system architecture models using System Composer. Use when implementing architecture models or when interacting with interface dictionaries, allocation sets, stereotypes, and requirements for architecture components.

日本語の概要は準備中です。原文の説明を表示しています。

matlab/simulink-agentic-toolkit1,2142026年10月8日 更新

Builds and edits Simulink, System Composer, Stateflow, and Simscape models. Use when modifying model structure, parameters, ports, connections, or Stateflow chart internals.

日本語の概要は準備中です。原文の説明を表示しています。

matlab/simulink-agentic-toolkit1,2142026年10月8日 更新

Use this skill when the user asks to check Simulink model compliance against a standard (MISRA, MAB, JMAAB, ISO, DO, IEC, EN, CERT C/CWE, AUTOSAR, Simulink Code Inspector (SLCI)), wants to run Model Advisor checks, or needs a compliance report with fix suggestions. For JMAAB/MAB, supplement deterministic checks with agentic review of uncheckable guidelines.

日本語の概要は準備中です。原文の説明を表示しています。

matlab/simulink-agentic-toolkit1,2142026年10月8日 更新

Guide users through creating and managing .satk/block-policy.json for controlling which blocks the agent can use, which are excluded, and which block parameters the agent should not modify. Use when setting up block usage policy for a project.

日本語の概要は準備中です。原文の説明を表示しています。

matlab/simulink-agentic-toolkit1,2142026年10月8日 更新

matlab のスキルをすべて見る

このスキルの問題を報告する