| | |
| | | /** 追加检测柜模拟历史,供重启续采合同使用。 */ |
| | | default void appendBtsHistory(String historyKey, BtsHistoryRecord record) { } |
| | | |
| | | /** 读取检测柜通道的播放状态;实现可在不支持播放持久化时返回 null。 */ |
| | | default BtsPlaybackState loadBtsPlaybackState(String historyKey) { return null; } |
| | | |
| | | /** 保存检测柜通道的播放状态。 */ |
| | | default void saveBtsPlaybackState(String historyKey, BtsPlaybackState state) { } |
| | | |
| | | /** 删除检测柜通道的播放状态。 */ |
| | | default void deleteBtsPlaybackState(String historyKey) { } |
| | | |
| | | /** 删除检测柜通道的持久化历史和对应索引。 */ |
| | | default void deleteBtsHistory(String historyKey) { } |
| | | |
| | | /** 原子提交检测柜新增历史与推进后的播放状态。 */ |
| | | default void saveBtsPlaybackAndAppendHistory(String historyKey, BtsPlaybackState state, |
| | | List<BtsHistoryRecord> records) |
| | | { |
| | | for (BtsHistoryRecord record : records) appendBtsHistory(historyKey, record); |
| | | saveBtsPlaybackState(historyKey, state); |
| | | } |
| | | |
| | | /** 原子保存删除采集器后的主状态,并删除该采集器的独立历史。 */ |
| | | default void saveAndDeleteCollectorHistory(SimulatorState state, String collectorCode) |
| | | { |
| | |
| | | } |
| | | |
| | | record BtsHistoryRecord(long sequenceId, Instant deviceTime, double currentA, double voltageV, |
| | | double capacityAh, double energyWh) { } |
| | | double capacityAh, double energyWh, int cycleNo, int stepNo, String stepName, String stepType) |
| | | { |
| | | /** 兼容 Ticket13 之前仅包含核心测量值的历史记录。 */ |
| | | public BtsHistoryRecord(long sequenceId, Instant deviceTime, double currentA, double voltageV, |
| | | double capacityAh, double energyWh) |
| | | { |
| | | this(sequenceId, deviceTime, currentA, voltageV, capacityAh, energyWh, 1, 1, "恒流充电", "cc"); |
| | | } |
| | | } |
| | | |
| | | /** 检测柜单通道演示播放状态;与测试的接收状态相互独立。 */ |
| | | record BtsPlaybackState(boolean playing, int speedMultiplier, int cycleNo, int stepNo, |
| | | String stepName, String stepType, Instant simulatedAt, Instant wallClockAt, |
| | | long nextSequence, boolean naturallyFinished) |
| | | { |
| | | public BtsPlaybackState |
| | | { |
| | | if (speedMultiplier != 1 && speedMultiplier != 60 && speedMultiplier != 600) |
| | | throw new IllegalArgumentException("speedMultiplier must be 1, 60 or 600"); |
| | | if (cycleNo < 1 || stepNo < 1 || nextSequence < 1 || stepName == null || stepName.isBlank() |
| | | || stepType == null || stepType.isBlank()) |
| | | throw new IllegalArgumentException("Invalid BTS playback state"); |
| | | } |
| | | } |
| | | |
| | | record BtsHistoryBatch(long offset, long nextOffset, boolean hasMore, long total, |
| | | List<BtsHistoryRecord> records) |