diff --git a/.cursorignore b/.cursorignore
index ea9d4a2..7a97a48 100644
--- a/.cursorignore
+++ b/.cursorignore
@@ -1,4 +1,5 @@
# Add directories or file patterns to ignore during indexing (e.g. foo/ or *.csv)
bin/
obj/
-.DS_Store
\ No newline at end of file
+.DS_Store
+SimulationRecords/
diff --git a/Program.cs b/Program.cs
index 6b4efae..cce746c 100644
--- a/Program.cs
+++ b/Program.cs
@@ -12,10 +12,10 @@ namespace ActiveProtect
static void Main(string[] args)
{
// 运行仿真示例
- //SimulationExample.RunAllExamples();
+ SimulationExample.RunAllExamples();
// 运行效能评估示例
- //EvaluationExample.RunAllExamples();
+ EvaluationExample.RunAllExamples();
// 运行数据记录示例
SimulationRecordExample.RunExample();
diff --git a/src/Models/Jammer/InfraredJammer.cs b/src/Models/Jammer/InfraredJammer.cs
new file mode 100644
index 0000000..1f94cfb
--- /dev/null
+++ b/src/Models/Jammer/InfraredJammer.cs
@@ -0,0 +1,121 @@
+using System;
+using ActiveProtect.Simulation;
+using ActiveProtect.Utility;
+
+namespace ActiveProtect.Models
+{
+ ///
+ /// 红外干扰器类,用于对抗红外制导武器
+ ///
+ public class InfraredJammer : JammerBase
+ {
+ ///
+ /// 干扰波长范围(微米)
+ ///
+ private readonly (double Min, double Max) wavelengthRange;
+
+ ///
+ /// 构造函数
+ ///
+ /// 红外干扰器ID
+ /// 初始位置
+ /// 初始朝向
+ /// 仿真管理器
+ /// 所属坦克ID
+ /// 最大干扰功率(瓦特)
+ /// 初始干扰功率(瓦特)
+ /// 功率增长率(瓦特/秒)
+ /// 最大冷却时间(秒)
+ /// 干扰波长范围(微米)
+ public InfraredJammer(string id, Vector3D position, Orientation orientation,
+ ISimulationManager manager, string tankId, double maxJammingPower,
+ double initialJammingPower, double powerIncreaseRate, double maxCooldownTime,
+ (double Min, double Max) wavelengthRange)
+ : base(id, position, orientation, manager, tankId, maxJammingPower,
+ initialJammingPower, powerIncreaseRate, maxCooldownTime)
+ {
+ this.wavelengthRange = wavelengthRange;
+ SimulationManager.SubscribeToEvent(OnInfraredWarnerAlarm);
+ SimulationManager.SubscribeToEvent(OnInfraredWarnerAlarmStop);
+ }
+
+ ///
+ /// 处理红外告警器警报事件
+ ///
+ private void OnInfraredWarnerAlarm(InfraredWarnerAlarmEvent evt)
+ {
+ if (evt?.TargetId == TankId)
+ {
+ StartJamming();
+ }
+ }
+
+ ///
+ /// 处理红外告警器警报停止事件
+ ///
+ private void OnInfraredWarnerAlarmStop(InfraredWarnerAlarmStopEvent evt)
+ {
+ if (evt?.TargetId == TankId)
+ {
+ StopJamming();
+ }
+ }
+
+ ///
+ /// 更新干扰功率
+ ///
+ protected override void UpdateJammingPower(double deltaTime)
+ {
+ if (IsJamming)
+ {
+ CurrentJammingPower = Math.Min(MaxJammingPower,
+ CurrentJammingPower + PowerIncreaseRate * deltaTime);
+ }
+ }
+
+ ///
+ /// 发布干扰事件
+ ///
+ protected override void PublishJammingEvent()
+ {
+ if (IsJamming)
+ {
+ SimulationManager.PublishEvent(new InfraredJammingEvent
+ {
+ SenderId = Id,
+ Timestamp = SimulationManager.CurrentTime,
+ TargetId = TankId,
+ JammingPower = CurrentJammingPower,
+ WavelengthMin = wavelengthRange.Min,
+ WavelengthMax = wavelengthRange.Max
+ });
+ }
+ }
+
+ ///
+ /// 获取干扰状态
+ ///
+ public override string GetJammingStatus()
+ {
+ return $"红外干扰器 {Id}:\n" +
+ $" 干扰状态: {(IsJamming ? "干扰中" : "待机中")}\n" +
+ $" 当前功率: {CurrentJammingPower:F2}/{MaxJammingPower:F2}\n" +
+ $" 冷却时间: {CurrentCooldownTime:F2}/{MaxCooldownTime:F2}\n" +
+ $" 波长范围: {wavelengthRange.Min:F2}-{wavelengthRange.Max:F2}微米";
+ }
+
+ public override void Activate()
+ {
+ base.Activate();
+ SimulationManager.SubscribeToEvent(OnInfraredWarnerAlarm);
+ SimulationManager.SubscribeToEvent(OnInfraredWarnerAlarmStop);
+ }
+
+ public override void Deactivate()
+ {
+ base.Deactivate();
+ SimulationManager.UnsubscribeFromEvent(OnInfraredWarnerAlarm);
+ SimulationManager.UnsubscribeFromEvent(OnInfraredWarnerAlarmStop);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Models/Wanner/InfraredWarner.cs b/src/Models/Wanner/InfraredWarner.cs
new file mode 100644
index 0000000..d4ab7e9
--- /dev/null
+++ b/src/Models/Wanner/InfraredWarner.cs
@@ -0,0 +1,51 @@
+using ActiveProtect.Simulation;
+using ActiveProtect.Utility;
+
+namespace ActiveProtect.Models
+{
+ ///
+ /// 红外告警器类,用于检测红外辐射并发出警报
+ ///
+ public class InfraredWarner : WarnerBase
+ {
+ ///
+ /// 红外告警器灵敏度阈值
+ ///
+ private readonly double sensitivityThreshold;
+
+ public InfraredWarner(string id, Vector3D position, Orientation orientation,
+ ISimulationManager manager, string tankId, double warningDuration, double sensitivityThreshold)
+ : base(id, position, orientation, manager, tankId, warningDuration)
+ {
+ this.sensitivityThreshold = sensitivityThreshold;
+ SimulationManager.SubscribeToEvent(OnInfraredDetection);
+ }
+
+ private void OnInfraredDetection(InfraredDetectionEvent evt)
+ {
+ if (evt?.TargetId == TankId && evt.Intensity >= sensitivityThreshold)
+ {
+ StartWarning();
+ }
+ }
+
+ public override string GetWarningStatus()
+ {
+ return $"红外告警器 {Id}:\n" +
+ $" 告警状态: {(IsWarning ? "告警中" : "正常")}\n" +
+ $" 告警持续时间: {CurrentWarningTime:F2}/{WarningDuration:F2}";
+ }
+
+ public override void Activate()
+ {
+ base.Activate();
+ SimulationManager.SubscribeToEvent(OnInfraredDetection);
+ }
+
+ public override void Deactivate()
+ {
+ base.Deactivate();
+ SimulationManager.UnsubscribeFromEvent(OnInfraredDetection);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Models/Wanner/MillimeterWaveWarner.cs b/src/Models/Wanner/MillimeterWaveWarner.cs
new file mode 100644
index 0000000..e8b65f3
--- /dev/null
+++ b/src/Models/Wanner/MillimeterWaveWarner.cs
@@ -0,0 +1,62 @@
+using ActiveProtect.Simulation;
+using ActiveProtect.Utility;
+
+namespace ActiveProtect.Models
+{
+ ///
+ /// 毫米波告警器类,用于检测毫米波辐射并发出警报
+ ///
+ public class MillimeterWaveWarner : WarnerBase
+ {
+ ///
+ /// 毫米波告警器灵敏度阈值
+ ///
+ private readonly double sensitivityThreshold;
+
+ ///
+ /// 频率范围(GHz)
+ ///
+ private readonly (double Min, double Max) frequencyRange;
+
+ public MillimeterWaveWarner(string id, Vector3D position, Orientation orientation,
+ ISimulationManager manager, string tankId, double warningDuration,
+ double sensitivityThreshold, (double Min, double Max) frequencyRange)
+ : base(id, position, orientation, manager, tankId, warningDuration)
+ {
+ this.sensitivityThreshold = sensitivityThreshold;
+ this.frequencyRange = frequencyRange;
+ SimulationManager.SubscribeToEvent(OnMillimeterWaveDetection);
+ }
+
+ private void OnMillimeterWaveDetection(MillimeterWaveDetectionEvent evt)
+ {
+ if (evt?.TargetId == TankId &&
+ evt.Intensity >= sensitivityThreshold &&
+ evt.Frequency >= frequencyRange.Min &&
+ evt.Frequency <= frequencyRange.Max)
+ {
+ StartWarning();
+ }
+ }
+
+ public override string GetWarningStatus()
+ {
+ return $"毫米波告警器 {Id}:\n" +
+ $" 告警状态: {(IsWarning ? "告警中" : "正常")}\n" +
+ $" 告警持续时间: {CurrentWarningTime:F2}/{WarningDuration:F2}\n" +
+ $" 频率范围: {frequencyRange.Min}-{frequencyRange.Max} GHz";
+ }
+
+ public override void Activate()
+ {
+ base.Activate();
+ SimulationManager.SubscribeToEvent(OnMillimeterWaveDetection);
+ }
+
+ public override void Deactivate()
+ {
+ base.Deactivate();
+ SimulationManager.UnsubscribeFromEvent(OnMillimeterWaveDetection);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Models/Wanner/UltravioletWarner.cs b/src/Models/Wanner/UltravioletWarner.cs
new file mode 100644
index 0000000..4d169f3
--- /dev/null
+++ b/src/Models/Wanner/UltravioletWarner.cs
@@ -0,0 +1,51 @@
+using ActiveProtect.Simulation;
+using ActiveProtect.Utility;
+
+namespace ActiveProtect.Models
+{
+ ///
+ /// 紫外告警器类,用于检测紫外辐射并发出警报
+ ///
+ public class UltravioletWarner : WarnerBase
+ {
+ ///
+ /// 紫外告警器灵敏度阈值
+ ///
+ private readonly double sensitivityThreshold;
+
+ public UltravioletWarner(string id, Vector3D position, Orientation orientation,
+ ISimulationManager manager, string tankId, double warningDuration, double sensitivityThreshold)
+ : base(id, position, orientation, manager, tankId, warningDuration)
+ {
+ this.sensitivityThreshold = sensitivityThreshold;
+ SimulationManager.SubscribeToEvent(OnUltravioletDetection);
+ }
+
+ private void OnUltravioletDetection(UltravioletDetectionEvent evt)
+ {
+ if (evt?.TargetId == TankId && evt.Intensity >= sensitivityThreshold)
+ {
+ StartWarning();
+ }
+ }
+
+ public override string GetWarningStatus()
+ {
+ return $"紫外告警器 {Id}:\n" +
+ $" 告警状态: {(IsWarning ? "告警中" : "正常")}\n" +
+ $" 告警持续时间: {CurrentWarningTime:F2}/{WarningDuration:F2}";
+ }
+
+ public override void Activate()
+ {
+ base.Activate();
+ SimulationManager.SubscribeToEvent(OnUltravioletDetection);
+ }
+
+ public override void Deactivate()
+ {
+ base.Deactivate();
+ SimulationManager.UnsubscribeFromEvent(OnUltravioletDetection);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Simulation/SimulationEvents.cs b/src/Simulation/SimulationEvents.cs
index fcb3f22..2087057 100644
--- a/src/Simulation/SimulationEvents.cs
+++ b/src/Simulation/SimulationEvents.cs
@@ -265,4 +265,154 @@ namespace ActiveProtect.Simulation
public string? MissileId { get; set; }
}
+ ///
+ /// 红外探测事件
+ ///
+ public class InfraredDetectionEvent : SimulationEvent
+ {
+ ///
+ /// 目标ID
+ ///
+ public string? TargetId { get; set; }
+
+ ///
+ /// 红外辐射强度
+ ///
+ public double Intensity { get; set; }
+ }
+
+ ///
+ /// 红外告警器警报事件
+ ///
+ public class InfraredWarnerAlarmEvent : SimulationEvent
+ {
+ ///
+ /// 目标ID
+ ///
+ public string? TargetId { get; set; }
+ }
+
+ ///
+ /// 红外告警器警报停止事件
+ ///
+ public class InfraredWarnerAlarmStopEvent : SimulationEvent
+ {
+ ///
+ /// 目标ID
+ ///
+ public string? TargetId { get; set; }
+ }
+
+ ///
+ /// 紫外探测事件
+ ///
+ public class UltravioletDetectionEvent : SimulationEvent
+ {
+ ///
+ /// 目标ID
+ ///
+ public string? TargetId { get; set; }
+
+ ///
+ /// 紫外辐射强度
+ ///
+ public double Intensity { get; set; }
+ }
+
+ ///
+ /// 紫外告警器警报事件
+ ///
+ public class UltravioletWarnerAlarmEvent : SimulationEvent
+ {
+ ///
+ /// 目标ID
+ ///
+ public string? TargetId { get; set; }
+ }
+
+ ///
+ /// 紫外告警器警报停止事件
+ ///
+ public class UltravioletWarnerAlarmStopEvent : SimulationEvent
+ {
+ ///
+ /// 目标ID
+ ///
+ public string? TargetId { get; set; }
+ }
+
+ ///
+ /// 毫米波探测事件
+ ///
+ public class MillimeterWaveDetectionEvent : SimulationEvent
+ {
+ ///
+ /// 目标ID
+ ///
+ public string? TargetId { get; set; }
+
+ ///
+ /// 毫米波辐射强度
+ ///
+ public double Intensity { get; set; }
+
+ ///
+ /// 毫米波频率(GHz)
+ ///
+ public double Frequency { get; set; }
+ }
+
+ ///
+ /// 毫米波告警器警报事件
+ ///
+ public class MillimeterWaveWarnerAlarmEvent : SimulationEvent
+ {
+ ///
+ /// 目标ID
+ ///
+ public string? TargetId { get; set; }
+
+ ///
+ /// 探测到的频率(GHz)
+ ///
+ public double DetectedFrequency { get; set; }
+ }
+
+ ///
+ /// 毫米波告警器警报停止事件
+ ///
+ public class MillimeterWaveWarnerAlarmStopEvent : SimulationEvent
+ {
+ ///
+ /// 目标ID
+ ///
+ public string? TargetId { get; set; }
+ }
+
+ ///
+ /// 红外干扰事件
+ ///
+ public class InfraredJammingEvent : SimulationEvent
+ {
+ ///
+ /// 目标ID
+ ///
+ public string? TargetId { get; set; }
+
+ ///
+ /// 干扰功率(瓦特)
+ ///
+ public double JammingPower { get; set; }
+
+ ///
+ /// 最小波长(微米)
+ ///
+ public double WavelengthMin { get; set; }
+
+ ///
+ /// 最大波长(微米)
+ ///
+ public double WavelengthMax { get; set; }
+ }
+
}