能力标签:能力地图 / 学习路径 / 想定工程方法论 / 模块解耦 / 最小可跑片段
这个系列在展示什么
AFSIM 的能力面很广------从"让一个平台动起来"到"月球轨道机动""分布式多进程推演"都有覆盖。这些能力分散在大量的 AFSIM 公开示例中,是最好的学习素材;但受分发与合规限制,直接照搬安装包内的示例想定数据发布并不合适。
所以本系列的定位很明确:以 AFSIM 的公开示例能力为索引,把某项能力讲透。每篇只回答三个问题:
- 这个示例展示了 AFSIM 的哪项能力?
- 背后的原理/机制是什么(涉及哪些 mover、sensor、processor、comm、脚本块)?
- 你如何用自己搭的最小示例复现这个技法?
文中的代码示例都是重新写的最小可用片段,不含任何安装包数据;你能直接拿去改、拿去跑。
核心机制:AFSIM 想定的"积木"结构
不管多复杂的想定,底层都是同一套积木:平台(platform)挂组件(mover / sensor / processor / comm / weapon),组件按标准接口交换数据,脚本/行为树负责决策。理解这一点,60 多个示例就不再是 60 多份孤立代码,而是一张可拼装的能力网。
#mermaid-svg-6GWRihWNHWE1S0Zj{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-6GWRihWNHWE1S0Zj .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-6GWRihWNHWE1S0Zj .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-6GWRihWNHWE1S0Zj .error-icon{fill:#552222;}#mermaid-svg-6GWRihWNHWE1S0Zj .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-6GWRihWNHWE1S0Zj .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-6GWRihWNHWE1S0Zj .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-6GWRihWNHWE1S0Zj .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-6GWRihWNHWE1S0Zj .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-6GWRihWNHWE1S0Zj .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-6GWRihWNHWE1S0Zj .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-6GWRihWNHWE1S0Zj .marker{fill:#333333;stroke:#333333;}#mermaid-svg-6GWRihWNHWE1S0Zj .marker.cross{stroke:#333333;}#mermaid-svg-6GWRihWNHWE1S0Zj svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-6GWRihWNHWE1S0Zj p{margin:0;}#mermaid-svg-6GWRihWNHWE1S0Zj .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-6GWRihWNHWE1S0Zj .cluster-label text{fill:#333;}#mermaid-svg-6GWRihWNHWE1S0Zj .cluster-label span{color:#333;}#mermaid-svg-6GWRihWNHWE1S0Zj .cluster-label span p{background-color:transparent;}#mermaid-svg-6GWRihWNHWE1S0Zj .label text,#mermaid-svg-6GWRihWNHWE1S0Zj span{fill:#333;color:#333;}#mermaid-svg-6GWRihWNHWE1S0Zj .node rect,#mermaid-svg-6GWRihWNHWE1S0Zj .node circle,#mermaid-svg-6GWRihWNHWE1S0Zj .node ellipse,#mermaid-svg-6GWRihWNHWE1S0Zj .node polygon,#mermaid-svg-6GWRihWNHWE1S0Zj .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-6GWRihWNHWE1S0Zj .rough-node .label text,#mermaid-svg-6GWRihWNHWE1S0Zj .node .label text,#mermaid-svg-6GWRihWNHWE1S0Zj .image-shape .label,#mermaid-svg-6GWRihWNHWE1S0Zj .icon-shape .label{text-anchor:middle;}#mermaid-svg-6GWRihWNHWE1S0Zj .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-6GWRihWNHWE1S0Zj .rough-node .label,#mermaid-svg-6GWRihWNHWE1S0Zj .node .label,#mermaid-svg-6GWRihWNHWE1S0Zj .image-shape .label,#mermaid-svg-6GWRihWNHWE1S0Zj .icon-shape .label{text-align:center;}#mermaid-svg-6GWRihWNHWE1S0Zj .node.clickable{cursor:pointer;}#mermaid-svg-6GWRihWNHWE1S0Zj .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-6GWRihWNHWE1S0Zj .arrowheadPath{fill:#333333;}#mermaid-svg-6GWRihWNHWE1S0Zj .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-6GWRihWNHWE1S0Zj .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-6GWRihWNHWE1S0Zj .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-6GWRihWNHWE1S0Zj .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-6GWRihWNHWE1S0Zj .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-6GWRihWNHWE1S0Zj .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-6GWRihWNHWE1S0Zj .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-6GWRihWNHWE1S0Zj .cluster text{fill:#333;}#mermaid-svg-6GWRihWNHWE1S0Zj .cluster span{color:#333;}#mermaid-svg-6GWRihWNHWE1S0Zj div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-6GWRihWNHWE1S0Zj .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-6GWRihWNHWE1S0Zj rect.text{fill:none;stroke-width:0;}#mermaid-svg-6GWRihWNHWE1S0Zj .icon-shape,#mermaid-svg-6GWRihWNHWE1S0Zj .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-6GWRihWNHWE1S0Zj .icon-shape p,#mermaid-svg-6GWRihWNHWE1S0Zj .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-6GWRihWNHWE1S0Zj .icon-shape .label rect,#mermaid-svg-6GWRihWNHWE1S0Zj .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-6GWRihWNHWE1S0Zj .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-6GWRihWNHWE1S0Zj .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-6GWRihWNHWE1S0Zj :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} 平台 platform
战场上的实体
机动 mover
怎么动
传感 sensor
怎么看
处理 processor
怎么想/决策
通信 comm
怎么说
武器 weapon
怎么打
统一平台状态总线
位置/速度/航迹对外暴露
交战 / 跟踪 / 协同
标准接口消费
这套结构决定了本系列的解读顺序:先搞懂"动"(卷一),再"看/说"(卷二、卷三),然后把三者串成"杀伤链"(卷四),最后拉到"体系与跨域"(卷五、卷六),工程化工具留作卷七备查。
真实可跑的最小片段(AFSIM 2.9 语法,示意)
"把一个平台跑起来,是一切的开始"。下面这段是你能写出的最简 AFSIM 输入:一个蓝方运动学飞机,沿三段航线飞 600 秒。语法范式取自 AFSIM 2.9 公开能力文档,按本系列"片段式、无顶层包裹"的结构书写:
text
end_time 600 sec # 推演总时长(不设会瞬间结束)
platform_type BLUE_AIR WSF_PLATFORM # ① 定义类型模板
side blue
mover WSF_KINEMATIC_MOVER # 运动学机动:最低成本让平台动
update_interval 0.5 sec
no_thrust_accel_limit
no_turn_rate_limit
end_mover
end_platform_type
platform ac_01 BLUE_AIR # ② 实例化并摆到战场
position 34.0n 120.0e altitude 5000 m msl
route
position 34.0n 120.0e altitude 5000 m msl speed 200 m/s
position 34.5n 121.0e altitude 5000 m msl speed 200 m/s
position 35.0n 121.0e altitude 5000 m msl speed 200 m/s
end_route
end_platform
存成 minimal.txt,在场景目录 mission.exe minimal.txt 即可看到平台沿航线移动。注意:没有 scenario/simulation 顶层包裹------AFSIM 输入就是一条条声明按顺序排下来。
关键参数速查(全局推演设置)
| 参数 | 所在组件 | 类型 / 单位 | 默认值 | 取值说明 | 调参影响 |
|---|---|---|---|---|---|
end_time |
全局 | 时间 (sec) | 无(建议必设) | 推演总时长 | 不设则输入读完即停,平台"原地消失" |
time_step |
全局 | 时间 (sec) | 引擎默认 | 全局解算步长 | 决定所有组件推进的基准节奏;过小整体变慢 |
write_interval |
全局 | 时间 (sec) | 引擎默认 | 输出写入间隔 | 越小输出文件越大、回放越细腻 |
random_seed |
全局 | 整数 | 引擎默认(随机) | 随机种子 | 固定后结果可复现,便于对比试验 |
terminate_when |
全局 | 条件表达式 | 无 | 提前终止条件 | 用于"红方全灭即停"等早停逻辑 |
能力地图:七卷结构
我把这些示例按能力域归并成 7 卷,复杂主题拆成上下两篇:
- 卷一 机动与平台运动:运动学机动、六自由度飞行、高保真气动、地形跟随、空间轨道
- 卷二 传感器与探测:雷达/光电/ESM/SAR、传感器性能绘图、声学、超视距雷达、噪声干扰、特征信号
- 卷三 通信·网络·分布式:通信组网、分布式推演、Link-16 赋能、多分辨率仿真
- 卷四 交战与武器:交战框架、火炮/近防、制导律、激光/地狱火、弹道反导、发射器 SAM、高能激光、集群、箔条、轰炸投送
- 卷五 行为·决策·C2·体系作战:行为树、综合防空反导、IADS 指挥控制、空战 SA、火力协同、热力图、后勤、网络、体系作战
- 卷六 空间与特种平台:卫星能力、空间作战、特种平台与 DIS 铰接
- 卷七 想定工程与推演工具:概率初始位置、航线规划、背景交通、覆盖分析、多人兵棋、脚本与最小想定、模型库导览
建议的学习顺序与一张判断卡
#mermaid-svg-sRvjGLDVnE1TYS3d{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-sRvjGLDVnE1TYS3d .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-sRvjGLDVnE1TYS3d .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-sRvjGLDVnE1TYS3d .error-icon{fill:#552222;}#mermaid-svg-sRvjGLDVnE1TYS3d .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-sRvjGLDVnE1TYS3d .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-sRvjGLDVnE1TYS3d .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-sRvjGLDVnE1TYS3d .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-sRvjGLDVnE1TYS3d .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-sRvjGLDVnE1TYS3d .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-sRvjGLDVnE1TYS3d .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-sRvjGLDVnE1TYS3d .marker{fill:#333333;stroke:#333333;}#mermaid-svg-sRvjGLDVnE1TYS3d .marker.cross{stroke:#333333;}#mermaid-svg-sRvjGLDVnE1TYS3d svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-sRvjGLDVnE1TYS3d p{margin:0;}#mermaid-svg-sRvjGLDVnE1TYS3d .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-sRvjGLDVnE1TYS3d .cluster-label text{fill:#333;}#mermaid-svg-sRvjGLDVnE1TYS3d .cluster-label span{color:#333;}#mermaid-svg-sRvjGLDVnE1TYS3d .cluster-label span p{background-color:transparent;}#mermaid-svg-sRvjGLDVnE1TYS3d .label text,#mermaid-svg-sRvjGLDVnE1TYS3d span{fill:#333;color:#333;}#mermaid-svg-sRvjGLDVnE1TYS3d .node rect,#mermaid-svg-sRvjGLDVnE1TYS3d .node circle,#mermaid-svg-sRvjGLDVnE1TYS3d .node ellipse,#mermaid-svg-sRvjGLDVnE1TYS3d .node polygon,#mermaid-svg-sRvjGLDVnE1TYS3d .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-sRvjGLDVnE1TYS3d .rough-node .label text,#mermaid-svg-sRvjGLDVnE1TYS3d .node .label text,#mermaid-svg-sRvjGLDVnE1TYS3d .image-shape .label,#mermaid-svg-sRvjGLDVnE1TYS3d .icon-shape .label{text-anchor:middle;}#mermaid-svg-sRvjGLDVnE1TYS3d .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-sRvjGLDVnE1TYS3d .rough-node .label,#mermaid-svg-sRvjGLDVnE1TYS3d .node .label,#mermaid-svg-sRvjGLDVnE1TYS3d .image-shape .label,#mermaid-svg-sRvjGLDVnE1TYS3d .icon-shape .label{text-align:center;}#mermaid-svg-sRvjGLDVnE1TYS3d .node.clickable{cursor:pointer;}#mermaid-svg-sRvjGLDVnE1TYS3d .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-sRvjGLDVnE1TYS3d .arrowheadPath{fill:#333333;}#mermaid-svg-sRvjGLDVnE1TYS3d .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-sRvjGLDVnE1TYS3d .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-sRvjGLDVnE1TYS3d .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-sRvjGLDVnE1TYS3d .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-sRvjGLDVnE1TYS3d .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-sRvjGLDVnE1TYS3d .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-sRvjGLDVnE1TYS3d .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-sRvjGLDVnE1TYS3d .cluster text{fill:#333;}#mermaid-svg-sRvjGLDVnE1TYS3d .cluster span{color:#333;}#mermaid-svg-sRvjGLDVnE1TYS3d div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-sRvjGLDVnE1TYS3d .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-sRvjGLDVnE1TYS3d rect.text{fill:none;stroke-width:0;}#mermaid-svg-sRvjGLDVnE1TYS3d .icon-shape,#mermaid-svg-sRvjGLDVnE1TYS3d .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-sRvjGLDVnE1TYS3d .icon-shape p,#mermaid-svg-sRvjGLDVnE1TYS3d .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-sRvjGLDVnE1TYS3d .icon-shape .label rect,#mermaid-svg-sRvjGLDVnE1TYS3d .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-sRvjGLDVnE1TYS3d .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-sRvjGLDVnE1TYS3d .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-sRvjGLDVnE1TYS3d :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} 卷一 机动
地基
卷二 传感器
+卷三 通信
卷四 交战
串成杀伤链
卷五 行为/C2
卷六 空间
卷七 工程化
按需查阅
先看卷一的"机动"------这是所有想定的地基;再读卷二"传感器"和卷三"通信",这三者(机动+探测+网络)构成一次仿真的基本要素;然后卷四"交战"把它们串成杀伤链;最后卷五"行为/C2"和卷六"空间"把规模拉到体系与跨域。卷七是工程化工具箱,按需查阅。
给任意单位选能力时,用这张卡:
- 它的机动影响结论吗?(影响→高保真;不影响→运动学)
- 需要气动边界细节吗?(需要→P6DOF;只要"飞得像"→Brawler/运动学)
- 它有多少兄弟单位?(海量→运动学省钱;少数关键→上高保真)
工程实践与常见坑
- 先单平台自测,再谈组网。新手最常犯的错是一上来就拼 50 个平台,结果谁都不动、还不知道错在哪。先用上面那段最小片段确认"平台能飞、能写输出",再逐步加传感器、通信、武器。
end_time忘了设 。AFSIM 默认输入读完就停,你会看到平台"刚出现就消失"。end_time是必设项,敏感想定还要配time_step。random_seed不固定,结果不可复现。做对比试验("用雷达 A 还是雷达 B")时务必固定种子,否则两次跑的差异可能只是随机噪声。include路径坑 。把飞机类型、武器库拆到子文件后,习惯用include "six_dof_types/fighter.txt"引入;相对路径以"运行 mission.exe 的目录"为基准,IDE 里点运行常常因为工作目录不对而找不到文件。
备注 :本系列全部文章只解读 AFSIM 的机制与技法,不照搬任何安装包内的示例想定数据;所有代码均为作者自建的最小片段。遇到不确定的语法,以你本地 AFSIM 2.9 的公开能力文档为准。
小结与下一篇
本篇是把"薄 demo"读成"厚能力"的方法论:AFSIM 想定 = 平台挂组件、组件按标准接口交换数据;示例再多,也只是这套积木的不同拼法。读懂积木,大量示例就成了一张大网。
下一篇,我们从最朴素的运动学机动讲起------把一个平台跑起来,是一切的开始。
下一篇预告:(01)运动学机动基础 kinematic_mover
再多,也只是这套积木的不同拼法。读懂积木,大量示例就成了一张大网。
下一篇,我们从最朴素的运动学机动讲起------把一个平台跑起来,是一切的开始。
下一篇预告:(01)运动学机动基础 kinematic_mover