본문으로 건너뛰기
cccskills
무료GitHub에 공개

inject-faults

Add, configure, and manage faults on Simulink, Simscape, and System Composer model signals for robustness analysis and safety validation. Use when injecting faults (stuck, noise, gain, offset) onto block inports/outports, enabling fault simulation, or analyzing fault effects. Covers sensor failures, signal corruptions, actuator faults, FMEA validation, and robustness testing. Requires Simulink Fault Analyzer.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(8)

  • SKILL.md8.8 KB
  • manifest.yaml905 B
  • references/advanced-operations.md7.8 KB
  • references/fault-behaviors.md8.9 KB
  • references/preflight-and-adding-faults.md5.5 KB
  • references/simulation-workflows.md5.0 KB
  • references/test-case-integration.md2.7 KB
  • references/triggers-and-conditionals.md3.8 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Fault Injection

Use evaluate_matlab_code with the Simulink.fault API to programmatically inject faults into Simulink models. Faults override signal values at block ports to simulate hardware failures, sensor faults, and actuator malfunctions.

When to Use

  • Injecting sensor stuck-at faults, noise, or bias for safety analysis (Simulink, Simscape, System Composer)
  • Validating FMEA failure modes through simulation
  • Testing controller robustness against actuator or sensor failures
  • Adding fault placeholders (without behavior) for FMEA traceability before defining fault logic
  • Configuring fault trigger conditions (timed, conditional, always-on)
  • Creating fault scenarios for automated testing
  • Comparing nominal vs. faulted behavior
  • Linking faults to FMEA failure mode cells
  • Generating fault specification reports
  • Exporting models with embedded fault behavior for teams without Simulink Fault Analyzer
  • Registering custom fault behavior libraries
  • Synchronizing (also called resync / sync / synchronize faults / update fault references) fault information from referenced models, subsystems, or linked libraries into a parent model

When NOT to Use

  • Creating FMEA spreadsheets or safety analysis documents -> use manage-safety-analysis
  • Building or editing model structure -> use building-simulink-models
  • Running standard (non-faulted) simulations -> use simulating-simulink-models
  • Writing pass/fail tests -> use testing-simulink-models

Probe

hasFA = ~isempty(which('Simulink.fault.addFault'));
fprintf('Simulink Fault Analyzer available: %d\n', hasFA);

Key Concepts

  • Fault: A modification applied to a block port (inport or outport) that overrides the signal value.
  • Fault without Behavior: A placeholder that documents a failure point but cannot be simulated.
  • Fault with Behavior: A fault with an associated behavior model that can be simulated (see references/fault-behaviors.md).
  • Fault Model: The .slx file containing fault behavior subsystem(s).
  • Trigger: When the fault activates (Always On, Timed, Conditional, Manual).
  • Fault Info File: <ModelName>_faultInfo.xml stores all fault metadata alongside the model.

Critical Constraints

  1. Faults attach to block PORTS, not blocks. You must get the port handle via get_param(blockPath, 'PortHandles').
  2. NEVER directly edit _faultInfo.xml files. Always use MATLAB APIs to modify fault definitions.
  3. Fault names must be valid MATLAB identifiers (no spaces, slashes, or special characters). Use camelCase or PascalCase.
  4. The fault behavior model name (first arg to addBehavior) must also be a valid MATLAB identifier.
  5. NEVER use Simulink.fault.deleteAll or Simulink.fault.deleteFault to toggle faults on/off for simulation. Deleting faults destroys fault objects, their behavior models (.slx files), and their traceability links permanently. Use Simulink.fault.injection(model, false) to disable ALL fault injection for a nominal run, and Simulink.fault.injection(model, true) to re-enable. Use Simulink.fault.enable(modelElement, false) to disable faults on specific elements.
  6. Not supported: Faults inside Stateflow charts, fault models, or observer models.

Workflow

  1. Understand the model. Use model_overview and model_read to identify fragile signal paths -- single-point actuators, sensor feedback, computed quantities with wide fan-out.
  2. Pre-flight check. Query compiled port properties to confirm signal compatibility. If the model is not already compiled, ask the user before compiling. See references/preflight-and-adding-faults.md.
  3. Get port handles. Faults attach to port handles, not block paths. Use get_param(blk, 'PortHandles').
  4. Add fault. Call Simulink.fault.addFault(portHandle, Name=..., Description=...). See references/preflight-and-adding-faults.md.
  5. Add behavior. Call addBehavior(fault, modelName, FaultBehavior='mwfaultlib/...'). See references/fault-behaviors.md.
  6. Configure trigger. Set fault.TriggerType and the corresponding properties (e.g., StartTime for Timed, Conditional for Conditional, TriggerActive for Manual). See references/triggers-and-conditionals.md.
  7. Save. Call Simulink.fault.save('ModelName').
  8. Simulate. Enable injection with Simulink.fault.injection(mdl, true) then sim(...). See references/simulation-workflows.md.

Guardrails

Always

  • Use model_read to identify target blocks before injecting faults
  • Check compiled port info before creating faults (see references/preflight-and-adding-faults.md)
  • Add behavior BEFORE setting trigger properties
  • Save with Simulink.fault.save('ModelName') after any fault changes
  • Verify fault is active before running faulted simulation with activate(fault)
  • Disable fault injection after analysis with Simulink.fault.injection(mdl, false)
  • Verify test input signals are non-zero at fault injection points
  • Check bus compatibility before choosing a mwfaultlib behavior

Never

  • Use the Simulink.fault.Fault() constructor -- use Simulink.fault.addFault() instead
  • Pass library block paths (e.g., mwfaultlib/Stuck-at-Ground) as the fault model name argument to addBehavior -- use the FaultBehavior name-value pair
  • Assume fault simulation is off -- verify before each nominal run
  • Violate any item in the Critical Constraints section

Ask First

  • Before modifying the design model for any reason (adding blocks, changing sample times, reconnecting signals)
  • Before enabling faults on a model that may be shared (it modifies model behavior)
  • Before deleting existing faults (the behavior model .slx is also deleted)
  • Before enabling fault.Persistent = true -- it makes the fault irreversible during simulation

Troubleshooting

IssueCauseFix
Assertion failed in Simulink.fault.Fault()Do not use the Fault() constructor directlyUse Simulink.fault.addFault(portHandle, Name=..., Description=...) instead
Fault name must follow MATLAB variable naming conventionsName contains spaces or special charsUse camelCase/PascalCase with no spaces (e.g., SensorStuckAtZero)
Invalid name for a fault modelBehavior model name has invalid charactersUse a simple MATLAB identifier (e.g., StuckAtZero, not Stuck-at-Zero)
Unable to add fault... only to block input or output portsPassed a block path/handle instead of port handleUse ph = get_param(blockPath, 'PortHandles'); ph.Outport(1)
Target signal is a continuous-time signalFault Analyzer cannot inject on continuous signals going to continuous blocksSee Continuous-Time Signal Decision Tree in references/advanced-operations.md
Output dimensions do not match or Data type mismatchFault constant size/type ≠ target signalSee "Vector and Matrix Fault Values" in references/fault-behaviors.md
Bus signal fault fails with non-Ground behaviorMost mwfaultlib behaviors are scalar-onlyUse Stuck-at-Ground for full bus, or use BusElement to target individual elements
Multiple faults on same port but only one firesOnly one fault per port is active at a timeUse activate(fault) to select, or use different StartTime values
Fault exists but simulation runs nominallyFault injection not enabled or fault not activeCall Simulink.fault.injection('Model', true) and activate(f)

Reference Files

FileContents
references/preflight-and-adding-faults.mdPort inspection, compile checks, adding faults, port handle resolution, fault object properties/methods
references/fault-behaviors.mdBuilt-in behaviors, custom behaviors, bus faults, vector/matrix faults, discovery, data inport source
references/triggers-and-conditionals.mdTrigger types, conditional creation, conditional/symbol object properties
references/simulation-workflows.mdRunning simulations, nominal vs. faulted comparison, selective fault isolation
references/advanced-operations.mdFMEA linking, reports, export, deletion, continuous-time workarounds, synchronizing faults from referenced models/subsystems/libraries
references/test-case-integration.mdAdding fault sets to Simulink Test cases (R2024a+)

Copyright 2026 The MathWorks, Inc.


리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

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.2천2026년 10월 15일 업데이트

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.2천2026년 10월 15일 업데이트

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.2천2026년 10월 15일 업데이트

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.2천2026년 10월 15일 업데이트

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.2천2026년 10월 15일 업데이트

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.2천2026년 10월 15일 업데이트

matlab의 스킬 모두 보기

이 스킬의 문제 신고