- protocol/DisProtocol: 配电协议8条消息(指令0x0001~4/反馈0x0005~8, Sum8),复用pmSysvariable结构体+static_assert核对 - ChecksumPolicy 新增 Sum8;Frame 支持 1 字节校验和 - MessageRegistry 支持 (id+帧总长) 二维查找:配电指令与PM操控指令共用id按帧长区分(帧头length字段不可信) - LinkManager: 按实际帧长分发 + sendRaw原帧透传 + 非本协议帧头落库节流告警;UdpEndpoint sendTo 加锁 - comm/RcuLinkManager: 真实CCU链路;core/DisBridge: 配电桥接器(反馈转pPowerManger+解码显示,指令转真实CCU,0x0004仅显示不转发) - 网页新增"真实CCU"页签全字段展示;SnapshotBuilder realCcu 节 + rcu 链路描述 - h100.moos: 端口腾挪(真实CCU固定上报5001归pCCU,pPowerManger iport=5002),rcu_remote=192.168.0.140:7000 - 测试: pccuTest 新增配电/Sum8/长度分发/RCU注册表用例(176项);集成测试新增桥接字节一致+不误转发用例
114 lines
6.6 KiB
C++
114 lines
6.6 KiB
C++
/****************************************************************/
|
||
/* NAME: CCU_Info */
|
||
/* FILE: CCU_Info.cpp */
|
||
/****************************************************************/
|
||
|
||
#include <cstdlib>
|
||
#include <iostream>
|
||
#include "CCU_Info.h"
|
||
#include "ColorParse.h"
|
||
#include "ReleaseInfo.h"
|
||
|
||
using namespace std;
|
||
|
||
void showSynopsis() {
|
||
blk("SYNOPSIS: ");
|
||
blk("------------------------------------ ");
|
||
blk(" The pCCU application is the composite controller (CCU) ");
|
||
blk(" gateway between the fuel cell (FC) system and pPowerManger. ");
|
||
blk(" It receives FC status, integrates & forwards to pPowerManger,");
|
||
blk(" maps pPowerManger commands to FC operations, receives CAN ");
|
||
blk(" bus BMS battery frames via pCanBridge (CAN_0x* MOOS msgs), ");
|
||
blk(" bridges power-distribution (配电) frames between pPowerManger");
|
||
blk(" and a real CCU device (rcu link), stores data in SQLite and ");
|
||
blk(" provides a web monitoring page. ");
|
||
blk(" ");
|
||
}
|
||
|
||
void showHelpAndExit() {
|
||
blk(" ");
|
||
blu("=============================================================== ");
|
||
blu("Usage: pCCU file.moos [OPTIONS] ");
|
||
blu("=============================================================== ");
|
||
blk(" ");
|
||
showSynopsis();
|
||
blk(" ");
|
||
blk("Options: ");
|
||
mag(" --alias","=<ProcessName> ");
|
||
blk(" Launch pCCU with the given process name ");
|
||
blk(" rather than pCCU. ");
|
||
mag(" --example, -e ");
|
||
blk(" Display example MOOS configuration block. ");
|
||
mag(" --help, -h ");
|
||
blk(" Display this help message. ");
|
||
mag(" --interface, -i ");
|
||
blk(" Display MOOS publications and subscriptions. ");
|
||
mag(" --version,-v ");
|
||
blk(" Display the release version of pCCU. ");
|
||
blk(" ");
|
||
blk("Note: If argv[2] does not otherwise match a known option, ");
|
||
blk(" then it will be interpreted as a run alias. This is ");
|
||
blk(" to support pAntler launching conventions. ");
|
||
blk(" ");
|
||
exit(0);
|
||
}
|
||
|
||
void showExampleConfigAndExit() {
|
||
blk(" ");
|
||
blu("=============================================================== ");
|
||
blu("pCCU Example MOOS Configuration ");
|
||
blu("=============================================================== ");
|
||
blk(" ");
|
||
blk("ProcessConfig = pCCU ");
|
||
blk("{ ");
|
||
blk(" AppTick = 4 ");
|
||
blk(" CommsTick = 4 ");
|
||
blk(" ");
|
||
blk(" fc_local_port = 6000 // FC 状态接收端口 ");
|
||
blk(" fc_remote_ip = 192.168.1.162 // 燃料电池控制器 IP ");
|
||
blk(" fc_remote_port = 7000 // FC 控制端口 ");
|
||
blk(" pm_local_port = 7000 // PM 指令接收端口 ");
|
||
blk(" pm_remote_ip = 192.168.0.140 // 控制主机 IP ");
|
||
blk(" pm_remote_port = 5001 // 控制主机接收端口 ");
|
||
blk(" rcu_enable = true // 是否启用真实CCU配电桥接 ");
|
||
blk(" rcu_local_port = 7100 // 真实CCU 数据接收端口 ");
|
||
blk(" rcu_remote_ip = 192.168.0.200 // 真实CCU IP(占位,按实际修改) ");
|
||
blk(" rcu_remote_port= 7000 // 真实CCU 接收端口 ");
|
||
blk(" // 锂电池 BMS 走 CAN 总线(经 pCanBridge 的 CAN_0x* 透传) ");
|
||
blk(" dbpath = pccu_data.db // 数据库路径 ");
|
||
blk(" logpath = pCCU.log // 日志路径 ");
|
||
blk(" web_port = 8080 // 网页端口(避开8090/18080) ");
|
||
blk(" web_enable = true // 是否启用网页 ");
|
||
blk("} ");
|
||
blk(" ");
|
||
exit(0);
|
||
}
|
||
|
||
void showInterfaceAndExit() {
|
||
blk(" ");
|
||
blu("=============================================================== ");
|
||
blu("pCCU INTERFACE ");
|
||
blu("=============================================================== ");
|
||
blk(" ");
|
||
showSynopsis();
|
||
blk(" ");
|
||
blk("SUBSCRIPTIONS: ");
|
||
blk("------------------------------------ ");
|
||
blk(" CAN_0x* = pCanBridge 透传的 CAN 帧(锂电池 BMS) ");
|
||
blk(" CCU_FC_LINK_STATE = 运行状态字符串 ");
|
||
blk(" CCU_PM_LINK_STATE = 运行状态字符串 ");
|
||
blk(" CCU_RCU_LINK_STATE = 运行状态字符串 ");
|
||
blk(" ");
|
||
blk("PUBLICATIONS: ");
|
||
blk("------------------------------------ ");
|
||
blk(" CCU_FC_LINK_STATE = 运行状态字符串 ");
|
||
blk(" CCU_PM_LINK_STATE = 运行状态字符串 ");
|
||
blk(" CCU_RCU_LINK_STATE = 运行状态字符串 ");
|
||
blk(" ");
|
||
exit(0);
|
||
}
|
||
|
||
void showReleaseInfoAndExit() {
|
||
showReleaseInfo("pCCU", "gpl");
|
||
exit(0);
|
||
} |