133 lines
5.8 KiB
C#
133 lines
5.8 KiB
C#
using System.Collections.Generic;
|
||
|
||
namespace StandardScene.Scheduler.FassEvent
|
||
{
|
||
/// <summary>
|
||
/// FASS 车辆事件配置项,对应 <c>Configs/EventCar/*.json</c> 数组中的单个元素。
|
||
/// 配置格式与 FASS.Scheduler 的 EventCar 模型保持一致,便于直接复用现场 JSON。
|
||
/// </summary>
|
||
public class FassEventCarConfig
|
||
{
|
||
/// <summary>是否启用本条事件规则。</summary>
|
||
public bool TriggerEnable { get; set; } = true;
|
||
|
||
/// <summary>
|
||
/// 事件来源。StandardScene 进程仅处理值为 <c>Car</c> 的项(车辆定时轮询触发)。
|
||
/// </summary>
|
||
public string TriggerSource { get; set; } = "Car";
|
||
|
||
/// <summary>
|
||
/// 触发时机。当前实现仅支持 <c>TimerTick</c>(与 FASS <c>EventCarService.CarTimerTick</c> 等价)。
|
||
/// </summary>
|
||
public string TriggerEvent { get; set; } = "TimerTick";
|
||
|
||
/// <summary>触发条件:车辆编号(逗号分隔,空表示不限制)。</summary>
|
||
public string TriggerCarCode { get; set; }
|
||
|
||
/// <summary>触发条件:上一地标号(逗号分隔)。</summary>
|
||
public string TriggerCarPrevNodeCode { get; set; }
|
||
|
||
/// <summary>触发条件:当前地标号(逗号分隔)。</summary>
|
||
public string TriggerCarCurrentNodeCode { get; set; }
|
||
|
||
/// <summary>触发条件:下一地标号(逗号分隔)。</summary>
|
||
public string TriggerCarNextNodeCode { get; set; }
|
||
|
||
/// <summary>
|
||
/// 触发条件:车辆 FASS 状态(逗号分隔)。
|
||
/// 常见值:Running、Stopping、WaitPass、Charging、Stopping,Charging 等。
|
||
/// </summary>
|
||
public string TriggerCarState { get; set; }
|
||
|
||
/// <summary>触发条件:车头角度(逗号分隔的整数字符串)。</summary>
|
||
public string TriggerCarAngle { get; set; }
|
||
|
||
/// <summary>
|
||
/// 条件事件列表。全部满足后才执行任务;
|
||
/// 对应 FASS 中 <c>ConditionHandler</c> 的逐项 AND 逻辑。
|
||
/// </summary>
|
||
public List<FassConditionEventConfig> ConditionEvents { get; set; } = new List<FassConditionEventConfig>();
|
||
|
||
/// <summary>条件满足后是否执行任务(false 时仅做条件判断,不下发 Start/Stop)。</summary>
|
||
public bool TaskEnable { get; set; } = true;
|
||
|
||
/// <summary>
|
||
/// 任务类型。MagCar 当前支持 <c>Start</c>(放行)与 <c>Stop</c>(急停)。
|
||
/// </summary>
|
||
public string TaskType { get; set; }
|
||
}
|
||
|
||
/// <summary>
|
||
/// 单条条件事件配置,描述一个条件判断(交管、PLC 信号、电量等)。
|
||
/// </summary>
|
||
public class FassConditionEventConfig
|
||
{
|
||
/// <summary>是否启用本条件;false 时跳过(视为通过)。</summary>
|
||
public bool ConditionEnable { get; set; } = true;
|
||
|
||
/// <summary>
|
||
/// 条件类型:<c>Method</c>(内置方法)、<c>Assembly</c>、<c>Plugin</c>。
|
||
/// StandardScene 当前仅实现 Method;后两者会记录日志并返回 false。
|
||
/// </summary>
|
||
public string ConditionType { get; set; } = "Method";
|
||
|
||
/// <summary>Assembly 条件:程序集文件路径(未实现)。</summary>
|
||
public string ConditionAssemblyFile { get; set; }
|
||
|
||
/// <summary>Assembly/Plugin 条件:类型名(未实现)。</summary>
|
||
public string ConditionTypeName { get; set; }
|
||
|
||
/// <summary>Assembly/Plugin 条件:构造参数(未实现)。</summary>
|
||
public string ConditionTypeArgs { get; set; }
|
||
|
||
/// <summary>
|
||
/// Method 条件:方法名,如 NodeAllUnlockedNotCar、requestStaion、EmegerStop 等。
|
||
/// 名称与 FASS <c>EventCarService.InitEventMethod</c> 注册表一致(含历史拼写)。
|
||
/// </summary>
|
||
public string ConditionMethodName { get; set; }
|
||
|
||
/// <summary>
|
||
/// Method 条件:方法参数,一般为逗号分隔的节点号或 PLC 地址。
|
||
/// 例如交管:<c>3,53,21</c>;PLC:<c>DB5524.0.0,DB5524.0.1</c>。
|
||
/// </summary>
|
||
public string ConditionMethodArgs { get; set; }
|
||
}
|
||
|
||
/// <summary>
|
||
/// 车辆事件处理用的只读快照,从 StandardScene <see cref="Simple3.RCS.CarTypes.Car"/> 提取 FASS 语义字段。
|
||
/// 每次 TimerTick 为每辆车构建一份,供触发器与条件方法使用。
|
||
/// </summary>
|
||
public class FassEventCarSnapshot
|
||
{
|
||
/// <summary>场景内车辆 ID(SimpleLib)。</summary>
|
||
public int CarId { get; set; }
|
||
|
||
/// <summary>FASS 车辆编号(MagCar.VehicleCode 或 fields["Code"])。</summary>
|
||
public string Code { get; set; }
|
||
|
||
/// <summary>车型标识,用于 ME11 下料站逻辑(fields["CarModel"])。</summary>
|
||
public string CarModel { get; set; }
|
||
|
||
/// <summary>上一周期记录的地标号,用于 TriggerCarPrevNodeCode 匹配。</summary>
|
||
public string PrevNodeCode { get; set; }
|
||
|
||
/// <summary>当前地标号(status.enums["CurrentNode"] 或 siteID)。</summary>
|
||
public string CurrentNodeCode { get; set; }
|
||
|
||
/// <summary>下一地标号(pendingLocks / tags / enums 推断)。</summary>
|
||
public string NextNodeCode { get; set; }
|
||
|
||
/// <summary>
|
||
/// FASS 状态字符串:Running、Stopping、WaitPass、Charging 等。
|
||
/// 由 <see cref="FassEventCarSnapshotFactory.GetFassState"/> 从中文状态映射。
|
||
/// </summary>
|
||
public string State { get; set; }
|
||
|
||
/// <summary>车头角度(度),对应 FASS Car.Angle。</summary>
|
||
public int Angle { get; set; }
|
||
|
||
/// <summary>电量百分比(Soc)。</summary>
|
||
public double Charge { get; set; }
|
||
}
|
||
}
|