6. 通信链
之前的sam防空导弹平台是配备雷达传感器的,检测到目标后发动打击,而真实场景中,雷达是一个单独的探测器,需要将探测到的目标trace传递给其他平台做处理,因此就需要通信链路
# File generated by Wizard 2.9.0 on May 3, 2025.
include_once platforms/common.txt
include_once weapons/sam/large_sam.txt
include_once processors/single_large_sam_tactices.txt
platform_type SINGLE_LARGE_SAM WSF_PLATFORM
icon TWIN_BOX
category ENGAGEMENT
infrared_signature VEHICLE_INFRARED_SIGNATURE
optical_signature VEHICLE_OPTICAL_SIGNATURE
radar_signature VEHICLE_RADAR_SIGNATURE
track_manager
filter FILTER_TACTICS end_filter
end_track_manager
comm cmdr_net WSF_COMM_TRANSCEIVER
network_name sam_comm_net
internal_link data_mgr
end_comm
zone full_kinematic
circular
maximum_altitude 30 km
maximum_radius 25 nm
end_zone
weapon sam LARGE_SAM
quantity 160
end_weapon
processor data_mgr WSF_TRACK_PROCESSOR
purge_interval 60 seconds
end_processor
processor task_mgr SINGLE_LARGE_SAM_TACTICS
end_processor
end_platform_type
这是新的SAM平台,没有配备传感器、只有武器;
- comm 定义了个WSF_COMM_TRANSCEIVER 收发器, 里面定义了个通信网络sam_comm_net和轨迹处理器data_mgr
# File generated by Wizard 2.9.0 on May 3, 2025.
include_once sensors/radar/acq_radar.txt
platform_type ACQ_RADAR_PLATFORM WSF_PLATFORM
icon TWIN_BOX
category ENGAGEMENT
infrared_signature VEHICLE_INFRARED_SIGNATURE
optical_signature VEHICLE_OPTICAL_SIGNATURE
radar_signature VEHICLE_RADAR_SIGNATURE
track_manager
filter FILTER_TACTICS end_filter
end_track_manager
comm cmdr_net2 WSF_COMM_TRANSCEIVER
network_name sam_comm_net
end_comm
zone full_kinematic
circular
maximum_altitude 30 km
maximum_radius 25 nm
end_zone
sensor acq ACQ_RADAR
on
internal_link data_mgr
end_sensor
processor data_mgr WSF_TRACK_PROCESSOR
purge_interval 60 seconds
external_link platform sam_1 comm cmdr_net via cmdr_net2
end_processor
end_platform_type
这是单独得传感器脚本,配备了ACQ_RADAR传感器,然后通过internal_link将数据发送给data_mgr
- data_mgr中对搜索到的轨迹做了处理,传给了外部平台sam_1的cmdr_net网络,利用自身的cmdr_net2网络
就这样实现了雷达传感器检测目标trace,然后传递给sam,sam收到后进行打击
6.1 网络
通信中会在各个平台间建立网络,
例如WSF_COMM_NETWORK_AD_HOC无线自组网:当往网络中增加设备时候,会定期验证其和其他网络设备的可达性,基于可达性来建立和断开网络,来模拟大量实体的网络的动态变化情况
本节实现一个无人机网络,然后定义一个总的指挥平台,每次只有无人机群中只有一个实体与指挥平台通信,将整个无人机网络情况传递给指挥平台;整个无人机群检测敌方轰炸机,之间通过网络传递trace,最终给leader;
首先定义指挥平台
# File generated by Wizard 2.9.0 on May 27, 2025.
platform_type BLACK_VAN WSF_PLATFORM
icon semi
comm van_comm WSF_COMM_TRANSCEIVER
network_name van_net
internal_link bogey_book
end_comm
processor bogey_book WSF_TRACK_PROCESSOR
on_message
type WSF_TRACK_MESSAGE
script
writeln(PLATFORM.Name(), " RECEIVES TRACK AT TIME:" , TIME_NOW);
end_script
end_on_message
end_processor
end_platform_type
- van_comm 表示通信链路,连接到一个叫van_net得链路,同时还有个bogey_book内部处理器
- 整体其监听作用,只要有收到消息,就会print内容
# File generated by Wizard 2.9.0 on May 27, 2025.
include_once comms/ad_hoc_comm.txt
platform_type UAV_DETECTOR WSF_PLATFORM
category ad_hoc
icon predator
comm ad_hoc AD_HOC
end_comm
add router default DEFAULT end_router
add mover WSF_AIR_MOVER
end_mover
add sensor sense WSF_GEOMETRIC_SENSOR
on
maximum_range 50 km
frame_time 10 s
reports_location
ignore ad_hoc
internal_link tracker
end_sensor
add processor tracker WSF_TRACK_PROCESSOR
external_link platform black_van comm van_comm via ad_hoc
end_processor
route
label start offset 0 5 km speed 200 km/h
offset -5 0 km
offset 0 -5 km
offset 5 0 km
goto start
end_route
on_initialize
double latitude = -21;
double longitude = 132;
double altitude = 2000;
double heading = 0;
latitude = latitude + RANDOM.Uniform(-1, 1);
longitude = longitude + RANDOM.Uniform(-1, 1);
altitude = altitude + RANDOM.Uniform(-2000, 2000);
heading = RANDOM.Uniform(0, 359);
PLATFORM.SetLocation(latitude, longitude, altitude);
PLATFORM.SetHeading(heading);
end_on_initialize
end_platform_type
这是无人机平台的定义;
- comm一个通信链路AD_HOC 命名为ad_hoc,
- router 使用默认路由,有了网络,消息传递还需要实际路由
- sensor 还有传感器,要来探测敌方目标,一旦检测道,就会传递给black_van,就是之前的指挥平台得van_comm链路,通过自己形成的ad_hoc通信网络。一个无人机检测到,消息就会在形成的网络中层层传递,最终到达指挥平台
最后是无人机组成的通信网络的实现,AD_HOC
# File generated by Wizard 2.9.0 on May 27, 2025.
network ad_hoc WSF_COMM_NETWORK_AD_HOC
update_rate normal mean 5.0 s sigma 0.25 s
end_network
comm AD_HOC WSF_RADIO_TRANSCEIVER
network_name ad_hoc
transmitter
frequency 100 mhz
power 50 mw
maximum_range 100 km
end_transmitter
receiver
frequency 100 mhz
end_receiver
end_comm
script_variables
WsfDraw draw = WsfDraw();
end_script_variables
script void DrawConnection(WsfAddress aSourceAddress, WsfAddress aDestinationAddress)
WsfPlatform sourcePlat = WsfComm.GetComm(aSourceAddress).Platform();
WsfPlatform destinationPlat = WsfComm.GetComm(aDestinationAddress).Platform();
draw.SetId(aSourceAddress.GetAddress() + aDestinationAddress.GetAddress());
draw.SetLineStyle("dotted");
draw.BeginLines();
draw.SetDuration(Math.DOUBLE_MAX());
draw.SetLineSize(2);
draw.SetColor(1.0, 1.0, 1.0);
draw.Vertex(sourcePlat);
draw.Vertex(destinationPlat);
draw.End();
end_script
script void EraseDrawConnection(WsfAddress aSourceAddress, WsfAddress aDestionationAddress)
draw.Erase(aSourceAddress.GetAddress()+aDestionationAddress.GetAddress());
end_script
script void DrawRouting(WsfAddress aSourceAddress, WsfAddress aDestinationAddress)
WsfPlatform sourcePlat = WsfComm.GetComm(aSourceAddress).Platform();
WsfPlatform destinationPlat= WsfComm.GetComm(aDestinationAddress).Platform();
draw.SetLineStyle("solid");
draw.BeginLines();
draw.SetDuration(2.0);
draw.SetLineSize(4.0);
draw.SetColor(1.0, 0.0, 0.0);
draw.Vertex(sourcePlat);
draw.Vertex(destinationPlat);
draw.End();
end_script
router_protocol AD_HOC WSF_COMM_ROUTER_PROTOCOL_AD_HOC
script bool OnCommAdded(WsfAddress aAddress, WsfCommGraph aGraph, WsfCommRouter aRouter)
return true;
end_script
script bool OnCommRemoved(WsfAddress aAddress, WsfCommGraph aGraph, WsfCommRouter aRouter)
return true;
end_script
script bool OnConnectionAdded(WsfAddress aSourceAddress, WsfAddress aDestinationAddress, WsfCommGraph aGraph, WsfCommRouter aRouter)
DrawConnection(aSourceAddress, aDestinationAddress);
return true;
end_script
script bool OnConnectionRemoved(WsfAddress aSourceAddress, WsfAddress aDestinationAddress, WsfCommGraph aGraph, WsfCommRouter aRouter)
EraseDrawConnection(aSourceAddress, aDestinationAddress);
return true;
end_script
script WsfAddress OnMessageRouting(WsfCommMessage aMessage, WsfAddress aAddress, WsfCommGraph aGraph, WsfCommRouter aRouter)
Array<WsfCommGraphEdge> edges = aGraph.GetOutgoingNodeEdges(aAddress);
WsfComm destinationComm = WsfComm.GetComm(aMessage.GetSourceMessage().Destination());
WsfGeoPoint destLoc = destinationComm.Platform().Location();
WsfAddress hop = {};
double totalDistance = MATH.DOUBLE_MAX();
Array<WsfAddress> traceRoute = aMessage.GetTraceRoute();
foreach(WsfCommGraphEdge edge in edges)
{
if(edge.DestinationAddress().GetAddress() == aAddress.GetAddress())
{
continue;
}
foreach(WsfAddress visited in traceRoute)
{
if(visited.GetAddress() == edge.DestinationAddress().GetAddress())
{
continue;
}
}
WsfComm potentialComm = WsfComm.GetComm(edge.DestinationAddress());
double distance = destLoc.GroundRangeTo(potentialComm.Platform().Location());
if(distance < totalDistance)
{
totalDistance = distance;
hop = edge.DestinationAddress();
}
}
if(!hop.IsNull())
{
DrawRouting(aAddress, hop);
}
return hop;
end_script
end_router_protocol
router DEFAULT WSF_COMM_ROUTER
add router_protocol ad_hoc AD_HOC end_router_protocol
use_default_protocol false
hop_limit 10
end_router
- network 定义一个无线自组网,每5s更新一次
- AD_HOC 表示通信设备 ,有工作频率,发射功率,理论最大通信距离
- router_protocol 这是定义的路由协议,每次选择最近的无人机作为消息传递得下一跳

最终效果就是,轰炸机正常航行,一旦被一个无人机传感器探测到,就会把消息通过通信网络,根据指定的路由协议,选择一条路径,传递给离指挥平台最近的无人机,将该路径用红色标注,然后最后的无人机和指挥平台进行通信。
再做进一步优化,指挥平台收到轰炸机消息后,传递给己方sam导弹连,对敌方轰炸机实现打击。使用通信分组实现连队。
group sam_group WSF_GROUP
end_group
platform sam1 SINGLE_LARGE_SAM_MEMBER
side blue
edit comm van_comm group_join sam_group end_comm
end_platform
platform sam2 SINGLE_LARGE_SAM_MEMBER
side blue
edit comm van_comm group_join sam_group end_comm
end_platform
platform sam3 SINGLE_LARGE_SAM_MEMBER
side blue
edit comm van_comm group_join sam_group end_comm
end_platform
platform sam4 SINGLE_LARGE_SAM_MEMBER
side blue
edit comm van_comm group_join sam_group end_comm
end_platform
这是实例化的SAM导弹连
- group 创建一个组
- 将平台的通信设备van_comm加入到组内,就说明这些平台同属于一个组,也就实现了sam连。
platform_type BLACK_VAN WSF_PLATFORM
icon semi
comm van_comm WSF_COMM_TRANSCEIVER
network_name van_net
internal_link bogey_book
end_comm
processor bogey_book WSF_TRACK_PROCESSOR
report_to_group sam_group via van_comm
end_processor
end_platform_type
再更新指挥平台,当van_comm收到消息后,不在打印消息,而是将消息report给sam导弹连,最后在实现打击;
6.2 指挥链
先通信,在process处理时候,区分指挥官和下属得消息传递。本质还是消息传递。
指挥链不能代替通信链,只有在通信设备建设完整下,指挥链才能进行消息传递。
platform_type UAV_DETECTOR WSF_PLATFORM
category ad_hoc
icon predator
command_chain UAV_CHAIN black_van
comm ad_hoc AD_HOC
end_comm
add router default DEFAULT end_router
add mover WSF_AIR_MOVER
end_mover
add sensor sense WSF_GEOMETRIC_SENSOR
on
maximum_range 50 km
frame_time 10 s
reports_location
ignore ad_hoc
ignore_same_side
internal_link tracker
end_sensor
add processor tracker WSF_TRACK_PROCESSOR
#external_link platform black_van comm van_comm via ad_hoc
report_to command_chain UAV_CHAIN commander via ad_hoc to van_comm
end_processor
- command_chain 定义指挥链UAV_CHAIN,表示无人机层,指挥官是black_van,也就是之前的指挥平台
- 最后消息处理processor中,利用report_to将消息传递给指挥链UAV_CHAIN得commander(指挥官),通过建立的ad_hoc通信链,发给van_comm设备(指挥官平台的通信设备)
platform_type BLACK_VAN WSF_PLATFORM
icon semi
comm van_comm WSF_COMM_TRANSCEIVER
network_name van_net
internal_link bogey_book
end_comm
processor bogey_book WSF_TRACK_PROCESSOR
#report_to_group sam_group via van_comm
report_to command_chain SAM_CHAIN subordinates via van_comm
end_processor
end_platform_type
指挥平台得van_comm收到消息后,会将消息传递给SAM_CHAIN链,相当于通信,之后sam收到会自行打击。