Skip to content
FunCoding

Search

Search docs, Skills and MCP

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.

文档与办公1.2kskills-catalog/physical-modeling/simscape-write-ssc/SKILL.md

Install

Send this to Claude Code, Codex or Cursor. The agent checks the Skill for safety first and installs it only after you confirm.

读取 https://funcoding.ai/skills/matlab/simulink-agentic-toolkit/simscape-write-ssc/install.md ,按里面的步骤帮我安装这个 Skill。

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.


Similar Skills

pdf
anthropics/skills180k

pdf

Use this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple PDFs into one, splitting PDFs apart, rotating pages, adding watermarks, creating new PDFs, filling PDF forms, encrypting/decrypting PDFs, extracting images, and OCR on scanned PDFs to make them searchable. If the user mentions a .pdf file or asks to produce one, use this skill.

Docs & office

discernment-nudge
anthropics/skills180k

discernment-nudge

After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals, or emails, estimates or projections, analysis or interpretation of data, factual claims they may rely on, or a multi-step argument — invoke this skill BEFORE finalizing your reply and then, if it applies, append 2-3 short follow-up questions, each tied to something specific in what you just produced, that help the user check key facts, probe the reasoning or assumptions, and notice missing context. Do this at most once per conversation. Skip it when the user asked a trivial how-to or simple lookup, wants a purely educational explanation, asked you only to format, convert, or assemble a file from content they provided, is writing code they will run, is doing creative writing or casual chat, or already asked you to double-check, cite, or review — the skill file explains these boundaries and the exact output format.

Docs & office

doc-coauthoring
anthropics/skills180k

doc-coauthoring

Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision docs, or similar structured content. This workflow helps users efficiently transfer context, refine content through iteration, and verify the doc works for readers. Trigger when user mentions writing docs, creating proposals, drafting specs, or similar documentation tasks.

Docs & office

docx
anthropics/skills180k

docx

Use this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include: any mention of 'Word doc', 'word document', '.docx', '.dotx', or requests to produce professional documents with formatting like tables of contents, headings, page numbers, or letterheads. Also use when extracting or reorganizing content from .docx or .dotx files, inserting or replacing images in documents, performing find-and-replace in Word files, working with tracked changes or comments, or converting content into a polished Word document. If the user asks for a 'report', 'memo', 'letter', 'template', or similar deliverable as a Word or .docx file, use this skill. Do NOT use for PDFs, spreadsheets, Google Docs, or general coding tasks unrelated to document generation.

Docs & office

pptx
anthropics/skills180k

pptx

Use this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or presentations; reading, parsing, or extracting text from any .pptx or .potx file (even if the extracted content will be used elsewhere, like in an email or summary); editing, modifying, or updating existing presentations; combining or splitting slide files; working with templates (.potx), layouts, speaker notes, or comments. Trigger whenever the user mentions "deck," "slides," "presentation," or references a .pptx or .potx filename, regardless of what they plan to do with the content afterward. If a .pptx or .potx file needs to be opened, created, or touched, use this skill.

Docs & office

canvas-design
anthropics/skills180k

canvas-design

Create beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists' work to avoid copyright violations.

Docs & office