Simulink Customize A2l 标志

Simulink Customize A2l

组织热门
matlab
simulink-customize-a2l

使用 coder.asap2 和 coder.mapping API 自定义 Simulink 模型生成的 A2L(ASAP2)文件。在添加 COMPU_METHOD、创建 GROUP、将 STD_AXIS 转换为 COM_AXIS、添加 BIT_OPERATION、创建 VARIANT_CODING、排除测量项或结构体元素、移除 DEFAULT_EVENT_LIST,或为了兼容标定工具(INCA、CANape)而进行任何 A2L 自定义时使用此技能。用户提到 ASAP2、ECU 标定数据或 A2L 导出时也使用此技能。

Add to TypingMind

概览

发布者matlab
代码仓库simulink-agentic-toolkit
技能名称simulink-customize-a2l
星标数
1.2K
复刻数
112
附带文件
6
链接
  • Markdown 格式的指令

    模型按需加载 SKILL.md 文件,因此只有在请求确实与该技能匹配时才会消耗 Token。

  • 兼容任何大语言模型

    AI 技能采用纯 Markdown,而非特定提供商的代码,因此可搭配 GPT、Claude、Gemini、Grok 或本地模型使用。

  • 6 个附带文件

    模型执行任务时可读取的脚本、模板和参考资料。这些文件为只读文件,绝不会被执行。

  • 开源

    由 matlab 发布于 GitHub。请在安装前查看技能的源文件。

安装

在 TypingMind 中安装 Simulink Customize A2l AI 技能,即可搭配任意大语言模型使用;也可以将其放入其他支持读取 SKILL.md 的智能体中。

1

安装到 TypingMind

TypingMind 可直接从 GitHub 文件夹安装技能:读取 SKILL.md,打包资源文件,并将结果保存在本地。

  1. 打开应用,前往“插件 → 技能”。
  2. 选择“从 GitHub 安装”。
  3. 粘贴下方的技能文件夹 URL 并确认。
    https://github.com/matlab/simulink-agentic-toolkit/tree/main/skills-catalog/code-generation/simulink-customize-a2l
  4. 请在每个需要使用该技能的聊天中启用它。
依次选择“插件 → 技能 → 添加技能 → 从 GitHub URL 导入”,然后粘贴文件夹 URL 并点击“继续”。
2

安装到其他智能体

任何支持 Agent Skills 格式的智能体都可以使用此技能,只需将文件夹复制到该智能体的技能目录中。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/matlab/simulink-agentic-toolkit.git /tmp/simulink-agentic-toolkit
mkdir -p .claude/skills
cp -r /tmp/simulink-agentic-toolkit/skills-catalog/code-generation/simulink-customize-a2l .claude/skills/simulink-customize-a2l
复制后,请重启 Claude Code,以加载新技能。

在 TypingMind 中使用此技能

在任意 TypingMind 聊天中启用 Simulink Customize A2l,后续即可交由模型处理。技能的名称和描述会放在系统提示词中,一旦请求匹配,模型就会自动加载完整指令,无需您手动调用,且在实际使用前不会消耗 Token。

一旦请求与技能匹配,模型就会自动加载 Simulink Customize A2l。

兼容任何 AI 模型

AI 技能是纯 Markdown 指令,而非特定提供商的代码,因此 Simulink Customize A2l 不局限于最初适配的模型。只需在 TypingMind 中安装一次,即可搭配 GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 或您自行运行的本地模型使用,全程使用您自己的 API 密钥。

  • 仅在需要时加载

    系统提示词中仅包含技能名称和描述。首次遇到匹配的请求时才会加载完整指令,因此技能未使用时,这些指令不会消耗 Token。

  • 在聊天中切换模型

    技能是指令而非代码,因此切换模型不会导致技能失效,新模型会读取同一个 SKILL.md。

技能指令

这是模型会加载的 SKILL.md 内容。请在安装前阅读,因为技能就是模型将遵循的指令。

Customize A2L Files

Customize A2L (ASAP2) files generated from Simulink models using the coder.asap2 and coder.mapping APIs, avoiding silent errors and undocumented pitfalls.

When to Use

  • Adding or modifying COMPU_METHODs (LINEAR, RAT_FUNC, TAB_VERB, IDENTICAL)
  • Creating or modifying GROUPs in the A2L file
  • Converting STD_AXIS to COM_AXIS for lookup tables
  • Adding BIT_OPERATION (LEFT_SHIFT, RIGHT_SHIFT, SIGN_EXTEND) to measurements
  • Creating VARIANT_CODING (VarCriterion, VarCharacteristic)
  • Excluding inports, outports, or struct elements from the A2L
  • Removing DEFAULT_EVENT_LIST or other IF_DATA blocks
  • Any customization passed via CustomEcuDescriptions to coder.asap2.export

When NOT to Use

  • Reading or parsing existing A2L files (use Vehicle Network Toolbox a2lfile)
  • Configuring XCP/CAN transport layers
  • Setting up Simulink model code generation (storage classes, data dictionaries)
  • General Embedded Coder build workflows without A2L customization

Core Workflow

Decision: Direct export vs. customization workflow

  • No element customization needed (only configuration like excluding struct elements or DEFAULT_EVENT_LIST): call coder.asap2.export directly with name-value options. No getEcuDescriptions needed.
  • Element customization needed (adding/modifying/deleting measurements, characteristics, groups, etc.): use the full getEcuDescriptions → customize → export workflow.
matlab
% === Path A: Config-only (no element changes) ===
load_system(modelName);
slbuild(modelName);
coder.asap2.export(modelName, SupportStructureElements=false, IncludeDefaultEventList=false);

% === Path B: Element customization ===
load_system(modelName);
slbuild(modelName);

% 1. Create ECU descriptions — pass ALL configuration options here
descObj = coder.asap2.getEcuDescriptions(modelName, ...
    SupportStructureElements=false, ...
    IncludeDefaultEventList=false);

% 2. Customize elements
add(descObj, newElement);
set(descObj, 'ElementType', 'Name', Prop=value);
info = get(descObj, 'ElementType', 'Name');
names = find(descObj, 'ElementType');
delete(descObj, 'ElementType', 'Name');

% 3. Export — MUST pass descObj back or all customizations are silently lost
coder.asap2.export(modelName, CustomEcuDescriptions=descObj);

Critical: When using Path B, omitting CustomEcuDescriptions=descObj in the export call silently discards all customizations with no error.

Critical: When using Path B, construction-time options (SupportStructureElements, etc.) CANNOT be passed to export alongside CustomEcuDescriptions — they must be passed to getEcuDescriptions.

Key Functions

FunctionPurpose
coder.asap2.getEcuDescriptionsCreate ECU description object (construction-time config)
coder.asap2.exportExport A2L file with customizations
coder.asap2.CompuMethodCreate computation method
coder.asap2.CharacteristicCreate characteristic (parameter)
coder.asap2.MeasurementCreate measurement (signal)
coder.asap2.GroupCreate A2L group
coder.asap2.RecordLayoutCreate record layout
coder.asap2.AxisInfoCreate axis points or axis descriptor
coder.asap2.VarCriterionCreate variant criterion
coder.asap2.VarCharacteristicCreate variant characteristic
coder.asap2.FunctionCreate FUNCTION object for grouping measurements/characteristics
coder.mapping.api.getGet code mapping object (persistent settings)
setInport / setOutportControl inport/outport A2L export (persistent)

See references/object-properties.md for mandatory fields, valid types, and creation order for each coder.asap2.* class.

Pattern Routing

Match the user's task to the correct reference for detailed guidance:

TaskKey RuleReference
Add COMPU_METHOD (RAT_FUNC, LINEAR, TAB_VERB)RAT_FUNC COEFFS direction is PHYS→INT — invert the desired formulareferences/compu-method-guidance.md
Convert STD_AXIS to COM_AXIS (shared breakpoints)Use ForceShared=true on the Characteristic — do NOT manually create AXIS_PTSreferences/customization-patterns.md
Add BIT_OPERATION to a measurementMust set BOTH BitMask AND MaskData — either alone produces no outputreferences/customization-patterns.md
Exclude inports/outports persistentlyUse coder.mapping.api + setInport/setOutport + slbuildreferences/customization-patterns.md
Create VARIANT_CODINGMust create supporting CHARACTERISTIC objects (selection + variant-dependent) with RecordLayouts and CompuMethods BEFORE VarCriterion/VarCharacteristic. All multi-value properties must be string arrays (not char/cell).references/variant-coding-guidance.md
Create Characteristic (CURVE, MAP, CUBOID)RecordLayout struct array must match axis count for STD_AXIS typesreferences/object-properties.md
Create MeasurementSet DataType='SWORD', EcuAddress='@ECU_Address@name@', CompuMethodName='NO_COMPU_METHOD' as defaultsreferences/object-properties.md
Create GroupSee mandatory fields and ROOT constraintreferences/object-properties.md
Create RecordLayoutStruct array required for multi-axis types (MAP, CUBOID); single struct for VALUE/VAL_BLKreferences/object-properties.md
Create AxisInfo / AXIS_PTSDual role: add(descObj, axisInfo) creates AXIS_PTS; characteristic.AxisInfo = [...] creates AXIS_DESCRreferences/object-properties.md
Control construction-time options (SupportStructureElements, IncludeDefaultEventList, etc.)Must pass at getEcuDescriptions() — cannot set after construction or pass to export with CustomEcuDescriptionsreferences/construction-time-properties.md

Release Requirements

FeatureMinimum Release
COMPU_METHOD, Measurement, Characteristic, BIT_OPERATIONR2022b
RecordLayout, AxisInfo (STD_AXIS, CUBOID)R2023a
Group (ROOT groups)R2023b
VarCriterion, VarCharacteristic (variant coding)R2025a

If the user's release is too old, inform them. Do not attempt workarounds — the APIs do not exist on older releases.

Common Mistakes

These cause silent failures or incorrect calibration data. Always check before generating code:

MistakeWhy It's WrongCorrect Approach
coder.asap2.export(modelName) without CustomEcuDescriptions=descObjSilently discards all customizations — no error, exports default A2LAlways pass descObj back when using the customization workflow
RAT_FUNC Coefficients = [0 0.5 -40 0 0 1] for "PHYS = 0.5×INT - 40"COEFFS is PHYS→INT, not INT→PHYS — produces the inverse conversionInvert: INT = 2×PHYS + 80 → [0 2 80 0 0 1]. See references/compu-method-guidance.md
set(descObj, ..., 'CompuMethodName', name) before adding the CompuMethodset() auto-creates a placeholder that blocks subsequent add()delete() the auto-created placeholder, then add() the user's version
MaskData.Shift without BitMaskBIT_OPERATION block is only emitted when both are setAlways set BitMask (e.g., '0xFF') alongside MaskData
MaskData.Shift = 3 expecting LEFT_SHIFTPositive = RIGHT_SHIFT; sign is counterintuitiveUse -3 for LEFT_SHIFT 3
Manually creating AXIS_PTS for STD→COM_AXISUnnecessary complexity; error-prone struct array handlingUse set(descObj, 'Characteristic', name, 'ForceShared', true)
descObj.SupportStructureElements = falseNot a settable property after constructionPass at creation: getEcuDescriptions(mdl, SupportStructureElements=false)
VarAddress = '0x5000' (char vector)Char vector silently produces empty output — no addresses, no criterion nameMust be string array: ["0x5000","0x5008"]
CompuVTabValues.Integers = [0,1,2]Property does not existUse CompuVTabValues.Values = [0, 1, 2]
CompuVTabValues.Literals = {'A','B'} (cell array)Accepted without error but exports 0 elementsMust be string array: ["A","B"]
Skipping slbuild after setInport/setOutportExport silently produces stale A2L with old settingsAlways slbuild after code mapping changes before export
Hardcoding EcuAddress = '0x0000'Calibration tools cannot resolve the address at import timeUse '@ECU_Address@<elementName>@' for linker resolution
Leaving mandatory fields unset on new objectsBlank fields produce invalid A2L — calibration tools reject the fileSee references/object-properties.md for required fields per class
Creating VarCriterion/VarCharacteristic without supporting CHARACTERISTICsVARIANT_CODING references characteristics that don't exist — calibration tool rejects the fileCreate selection CHARACTERISTIC (with TAB_VERB CompuMethod) and variant-dependent CHARACTERISTIC (with RecordLayout) BEFORE VarCriterion/VarCharacteristic. See references/variant-coding-guidance.md

Conventions

  • Verify A2L output with fileread after export — use contains for additions, ~contains for deletions/exclusions
  • Use string arrays (not char vectors or cell arrays) for all multi-value properties
  • Pass all configuration at getEcuDescriptions() construction time
  • Use ForceShared=true for STD→COM_AXIS (never build AXIS_PTS manually for this)
  • Use delete(descObj, 'ElementType', 'Name') to remove auto-created placeholders — this is the only recovery from the auto-creation trap caused by set() on a reference name before the referenced object exists
  • Prefer coder.mapping.api over coder.asap2 when settings should persist with the model

Copyright 2026 The MathWorks, Inc.


附带文件

技能加载后,模型会按需读取这些文件。它们仅作为可读文件提供,绝不会被执行。

常见问题

Simulink Customize A2l AI 技能有什么作用?

使用 coder.asap2 和 coder.mapping API 自定义 Simulink 模型生成的 A2L(ASAP2)文件。在添加 COMPU_METHOD、创建 GROUP、将 STD_AXIS 转换为 COM_AXIS、添加 BIT_OPERATION、创建 VARIANT_CODING、排除测量项或结构体元素、移除 DEFAULT_EVENT_LIST,或为了兼容标定工具(INCA、CANape)而进行任何 A2L 自定义时使用此技能。用户提到 ASAP2、ECU 标定数据或 A2L 导出时也使用此技能。

为什么在 TypingMind 中使用 Simulink Customize A2l?

因为您只需安装一次,就能搭配任何模型使用。Simulink Customize A2l 采用纯 Markdown 格式,而非特定提供商专用的代码,因此同一技能可用于 GPT-5、Claude、Gemini、Grok 或本地模型。您甚至可以在聊天中途切换模型,而不会影响技能的正常使用。TypingMind 使用您自己的 API 密钥,因此您直接向提供商付费,而不是按席位订阅;您的技能和聊天记录也都保留在您自己的存储空间中。

如何在 TypingMind 中安装 Simulink Customize A2l?

在 TypingMind 中打开“插件 → 技能 → 从 GitHub 安装”,然后粘贴 https://github.com/matlab/simulink-agentic-toolkit/tree/main/skills-catalog/code-generation/simulink-customize-a2l。TypingMind 会读取其中的 SKILL.md,打包相关文件,并将其安装为技能,供您在各个聊天中按需启用。

哪些 AI 模型可以使用 Simulink Customize A2l?

您在 TypingMind 中连接的任何模型都可以。AI 技能采用纯 Markdown 指令,而非特定提供商专用的代码,因此 GPT、Claude、Gemini、Grok 和本地模型都能在请求匹配时加载此技能。

Simulink Customize A2l 可以搭配多少个 AI 模型使用?

数量不限。只要模型支持技能,您就可以将它与 Simulink Customize A2l 搭配使用。GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 等模型都可以通过您自己的 API 密钥接入 TypingMind。

Simulink Customize A2l AI 技能免费吗?

matlab 已在 GitHub 上发布了该技能。请查看代码仓库了解许可条款。您只需向自己的 AI 提供商支付所用 Token 的费用。

什么是 AI 技能?

AI 技能是一组可复用的指令,用于教会 AI 模型完成某项特定任务。它遵循开放的 Agent Skills 格式:包含名称和描述的 SKILL.md 文件,以及模型可能需要的脚本、模板或参考文件。模型仅在您的请求与技能匹配时才会读取这些指令,因此已安装的技能在使用前不会产生任何费用。

AI 技能与插件或 MCP 服务器有何不同?

插件或 MCP 服务器为模型提供可调用的新工具,也就是在某处运行并返回结果的代码。AI 技能则为模型提供知识和流程:如何处理任务、遵循哪些步骤,以及怎样的输出才算优质。技能采用纯 Markdown 格式,因此不需要服务器、API 密钥或运行时环境,并且适用于任何模型。

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇