跳到正文
cccskills
免费在 GitHub 公开

simulink-test-sequence-from-ears

Generate Simulink Test Sequence blocks and harnesses from EARS requirements. Use when asked to create a test case from a requirement, generate tests from a .slreqx file, or verify a Simulink model with requirement-based tests.

中文简介正在准备中。当前显示原文说明。

查看安装方法

包含的文件(21)

  • SKILL.md5.6 KB
  • LICENSE.md1.4 KB
  • references/workflow-details.md15.1 KB
  • scripts/addPreconditionSteps.m1.4 KB
  • scripts/analizeRequirements.m2.9 KB
  • scripts/analyzeRequirements.m279 B
  • scripts/buildHarnessesFromApprovedYaml.m6.7 KB
  • scripts/collectSkillContext.m29.7 KB
  • scripts/compileHarnessModel.m326 B
  • scripts/configureEventDriven.m1.8 KB
  • scripts/configureStateDriven.m1.9 KB
  • scripts/configureTestSequence.m1.6 KB
  • scripts/configureUbiquitous.m1.5 KB
  • scripts/configureUnwantedBehavior.m1.9 KB
  • scripts/generateMappingReviewFromRequirements.m29.7 KB
  • scripts/generateSignalMappingsFromYaml.m4.3 KB
  • scripts/generateTestSequencesFromRequirements.m4.7 KB
  • scripts/parseEARSPattern.m2.3 KB
  • scripts/prepareWritableBuildWorkspace.m1.5 KB
  • scripts/readMappingReviewYaml.m6.6 KB
  • scripts/writeMappingReviewYaml.m9.2 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

Simulink Test Sequences from EARS Requirements

Map requirement phrases to model signals, review the mappings, and generate Test Sequence harnesses with the bundled MATLAB helpers.

Core rules

  • Start with a YAML mapping review. Use an existing explicit approval when available; do not infer approval from a filename or from a mapping appearing obvious.
  • Scope the review and generation to the requested requirement IDs.
  • Resolve open questions about signals, units, enum values, precondition paths, and timing before generating tests. Include complete initialization, stimulus, and verify() statements.
  • Associated harness creation saves registration metadata on the owner model. Use a writable working copy for demos. Explain this effect when preparing generation against a user's model.
  • Inspect per-requirement warnings and compile results. The generator can continue after a harness fails; the final completion message and presence of a .slx file do not establish success.
  • Compilation is not test execution. Run the generated test when requested, and distinguish a compile check from simulation and assertion results.

Setup and inputs

Identify the model under test, the .slreqx requirement set, and any .sldd dictionaries or enumeration classes. Resolve the folder containing this file as skillRoot, then add fullfile(skillRoot, "scripts") to the MATLAB path.

Run MATLAB from the model artifacts folder (or set the evaluation tool's working-folder option). Discovery scans that folder for dictionaries and enum classes. Verify which("analyzeRequirements") resolves to this installation. The older analizeRequirements spelling remains a compatibility alias.

Phase 1: Review the mappings

Use analyzeRequirements(modelName, reqSetPath) for requirement and model discovery. For a review of selected requirements:

review = generateMappingReviewFromRequirements( ...
    'ModeLogic', 'HLR_ModeLogic_EARS.slreqx', ...
    'mapping_review_req17.yaml', 'RequirementIds', "17");

Read workflow-details.md when constructing or editing the YAML. Lead with phrase_mappings containing the requirement phrase, model element, and interpretation. Keep generation fields in the same file: init_assignments, precondition_path, stimulus_assignments, and verify_statements.

Record assumptions in test_assumptions, unresolved meanings in open_questions, and approval in status. Show the final review file in the MATLAB Editor when available, unless the user requests otherwise. For headless operation or intermediate files, pass 'OpenInEditor', false.

Present a short mapping summary and request review when approval is missing. After the user approves, set the accepted entries to status: 'approved'. Edits with unresolved questions do not constitute approval.

Phase 2: Generate and inspect

result = buildHarnessesFromApprovedYaml( ...
    'ModeLogic', 'mapping_review_req17.yaml');

The default creates externally saved harnesses in test_harnesses/ and registers them on the source model. If the requested output is standalone harness files, the staged alternative is:

result = buildHarnessesFromApprovedYaml( ...
    'ModeLogic', 'mapping_review_req17.yaml', ...
    'AssociateWithSourceModel', false);

That alternative generates in a temporary workspace and copies harness files back; it does not register them on the source model. Inspect the reported build folder when troubleshooting dictionary or model shadowing.

Open the generated harness and relevant result.test_sequence_blocks when a desktop session is available and the user has not requested headless work. Use the returned paths to inspect the Test Sequence. Do not recreate the bundled helpers.

Supported patterns and limits

EARS patternFormGenerated steps
UbiquitousThe system shall ...Initialize and verify
Event-drivenWhen ..., the system shall ...Establish preconditions, trigger, verify
State-drivenWhile ..., the system shall ...Establish the state and check behavior
Unwanted behaviorIf ..., then the system shall ...Apply the condition and check the response
OptionalWhere ..., the system shall ...Use the event-driven configurator

The parser recognizes these sentence forms; arbitrary natural-language requirements may need clarification. Automated phrase and precondition inference includes ModeLogic-specific heuristics, so review mappings against the actual system. The bundled timing defaults and one scenario per requirement do not establish exhaustive verification.

Requirements Toolbox traceability links must be added separately through Simulink Test Manager. Do not claim certification, standards compliance, or complete requirement coverage from generated harnesses.

Supporting functions

Workflow details includes the YAML schema, a ModeLogic example, the low-level signalMappings struct, and the helper catalog. Use it for custom mappings and multi-step preconditions.

Copyright 2026 The MathWorks, Inc.

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Use this skill when the user wants to author, design, scope, or refine an Agent Skill (a SKILL.md file). Trigger phrases include "build a new skill", "design an agent skill", "scope a SKILL.md", "how should I structure this skill", "write a skill for X", "my skill isn't working well", or any request to improve an existing SKILL.md. Walks the user through an empirical, test-first process — probe the agent for real failures, design only for genuine knowledge gaps, iterate against runnable examples, and verify across models.

中文简介正在准备中。当前显示原文说明。

matlab/agent-skills-playground1892026年10月15日 更新

Deploy AI models to embedded hardware using MathWorks tools (MATLAB, Simulink, Embedded Coder). Covers two workflow patterns: (1) MathWorks-native or 3P-imported models rebuilt as dlnetwork for lean hardware (Cortex-M, DSP), (2) direct C/C++ code generation from PyTorch and LiteRT models for high-performance hardware (Cortex-A, x86, GPU). Trigger when: user wants to deploy AI to embedded targets; generate C/CUDA from neural networks; compress AI models for MCU/DSP; integrate AI in Simulink for system-level simulation; import PyTorch/ONNX/TensorFlow models for embedded deployment; optimize AI for resource-constrained hardware; or use loadPyTorchExportedProgram, importNetworkFromPyTorch, dlquantizer, exportNetworkToSimulink, or Embedded Coder with AI models.

中文简介正在准备中。当前显示原文说明。

matlab/agent-skills-playground1892026年10月15日 更新

Use when a learner asks for help with MATLAB homework, labs, projects, graded assignments, take-home exams, quizzes, or any programming task where academic integrity, course policy, or instructor constraints may limit direct solutions. Use to provide policy-aware hints, conceptual coaching, partial feedback, and assignment-safe MATLAB tutoring.

中文简介正在准备中。当前显示原文说明。

matlab/agent-skills-playground1892026年10月15日 更新

Use when tutoring a learner through MATLAB debugging, error interpretation, failed tests, incorrect outputs, array-shape problems, indexing mistakes, function argument issues, or code repair practice. Use for guided debugging sessions, debugging drills, teach-the-agent critique, and evidence-based MATLAB troubleshooting.

中文简介正在准备中。当前显示原文说明。

matlab/agent-skills-playground1892026年10月15日 更新

Use when an AI tutor session concerns MATLAB programming concepts, MATLAB syntax, MATLAB errors, MATLAB code style, MATLAB projects, or MATLAB toolbox workflows.

中文简介正在准备中。当前显示原文说明。

matlab/agent-skills-playground1892026年10月15日 更新

Use when an instructor wants to create, interview for, configure, install, update, or review a course AI-use policy for MATLAB AI tutoring. Produces an AI-POLICY.md file for LMS sharing and local tutoring-session enforcement by assignment guardrails.

中文简介正在准备中。当前显示原文说明。

matlab/agent-skills-playground1892026年10月15日 更新

查看 matlab 的全部技能

报告此技能的问题