|
|
|
|
@ -3,11 +3,14 @@ package yabl |
|
|
|
|
import ( |
|
|
|
|
"cli-mon/can" |
|
|
|
|
"encoding/binary" |
|
|
|
|
"time" |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
const ( |
|
|
|
|
CONVERTERS_MAX = 18 + 1 |
|
|
|
|
CONTACTOR_MAX = 18 + 1 |
|
|
|
|
CONNECTOR_MAX = 6 + 1 |
|
|
|
|
CONNECTOR_COUNT = 6 |
|
|
|
|
CONNECTOR_MAX = CONNECTOR_COUNT + 1 |
|
|
|
|
ALL_BITS = 0xFFFFFFFFFFFFFFFF |
|
|
|
|
UNIT_ID_OFFSET = 12 |
|
|
|
|
UNIT_ID_MASK = 0b111111111111 << UNIT_ID_OFFSET |
|
|
|
|
@ -81,6 +84,19 @@ type ContactorInternalErrors struct { |
|
|
|
|
CpuNotReady ErrorType |
|
|
|
|
PuNotReady ErrorType |
|
|
|
|
Debug BooleanType |
|
|
|
|
PresentContactorMode ContactorModeType |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
type ContactorsInternalForce struct { |
|
|
|
|
UnitId uint |
|
|
|
|
ForceModeEnabled BooleanType |
|
|
|
|
ForceModeValue ForceModeType |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
type ContactorInternalDebug struct { |
|
|
|
|
UnitId uint |
|
|
|
|
DebugModeOn BooleanType |
|
|
|
|
DebugContactorOn DebugSwitchModeType |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
type PuPresentEnergy struct { |
|
|
|
|
@ -117,6 +133,12 @@ type LogicEnergyMode struct { |
|
|
|
|
PowerMax Power14BitType |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
type LogicErrors struct { |
|
|
|
|
UnitId uint |
|
|
|
|
BoardReady BoardReadyType |
|
|
|
|
NotReadySettings ErrorType |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
type LogicWorkingMode struct { |
|
|
|
|
UnitId uint |
|
|
|
|
TargetContactorMode ContactorModeType |
|
|
|
|
@ -216,6 +238,89 @@ type SeccErrors struct { |
|
|
|
|
NotReadyLogic ErrorType |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
type PeripheryState struct { |
|
|
|
|
UnitId uint |
|
|
|
|
OtherErrorSeverity BoardReadyType |
|
|
|
|
OtherError OtherError4BitType |
|
|
|
|
ErrorShakeSensor ErrorType |
|
|
|
|
ErrorCoolingGroup ErrorType |
|
|
|
|
PeripheryErrorCoolingGroup ErrorType |
|
|
|
|
ErrorFireEmergency ErrorType |
|
|
|
|
ErrorFireEmergencyRun ErrorType |
|
|
|
|
ErrorFireEmergencyControl ErrorType |
|
|
|
|
ErrorOvervoltageIn ErrorType |
|
|
|
|
PeripheryErrorPowerSupply ErrorType |
|
|
|
|
ErrorFan ErrorType |
|
|
|
|
ErrorOvervoltageOut ErrorType |
|
|
|
|
ErrorStateRemoteMode ErrorType |
|
|
|
|
DebugShsnFanEnabled BooleanType |
|
|
|
|
DebugShptFanEnabled BooleanType |
|
|
|
|
DebugIoBoardTestLampEnabled BooleanType |
|
|
|
|
ErrorFireEmergencyCircuitBreaker ErrorType |
|
|
|
|
ErrorExtLightCircuitBreaker ErrorType |
|
|
|
|
ErrorIndicationCircuitBreaker ErrorType |
|
|
|
|
ErrorLowVoltagePowerCircuitBreaker ErrorType |
|
|
|
|
ErrorContactorsInternalCircuitBreaker ErrorType |
|
|
|
|
ErrorPlcCircuitBreaker ErrorType |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
type PeripheryInfo struct { |
|
|
|
|
UnitId uint |
|
|
|
|
InfoDoorOpen BooleanType |
|
|
|
|
TempAirIn SignedAirTemp8BitType |
|
|
|
|
TempAirOut SignedAirTemp8BitType |
|
|
|
|
StateShsnFan BooleanType |
|
|
|
|
StateShptFan BooleanType |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
type PeripheryDebug struct { |
|
|
|
|
UnitId uint |
|
|
|
|
DebugModeOn BooleanType |
|
|
|
|
DebugShsnFan DebugSwitchModeType |
|
|
|
|
DebugShptFan DebugSwitchModeType |
|
|
|
|
DebugIoBoardTestLamp DebugSwitchModeType |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
type ConverterPresentEnergy struct { |
|
|
|
|
UnitId uint |
|
|
|
|
V2gMode V2GModeType |
|
|
|
|
PresentVoltage Voltage11BitType |
|
|
|
|
PresentCurrent Current10BitType |
|
|
|
|
ConnectedOut ConnectedOut8bitType |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
type ConverterErrors struct { |
|
|
|
|
UnitId uint |
|
|
|
|
BoardReady BoardReadyType |
|
|
|
|
OtherError OtherError4BitType |
|
|
|
|
NotConnectedOut ErrorType |
|
|
|
|
NoCommunicationConverter ErrorType |
|
|
|
|
NoCommunicationPuConverter ErrorType |
|
|
|
|
InputGridVoltageHigh ErrorType |
|
|
|
|
InputGridVoltageLow ErrorType |
|
|
|
|
OutputGridVoltageHigh ErrorType |
|
|
|
|
OutputGridVoltageLow ErrorType |
|
|
|
|
InputGridVoltage Voltage11BitType |
|
|
|
|
OutputGridVoltage Voltage11BitType |
|
|
|
|
ShortCircuit ErrorType |
|
|
|
|
OverHeat ErrorType |
|
|
|
|
FanBroken ErrorType |
|
|
|
|
OtherHardwareError ErrorType |
|
|
|
|
DebugConvEnabled BooleanType |
|
|
|
|
DebugConvDisabled BooleanType |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
type ConverterDebug struct { |
|
|
|
|
UnitId uint |
|
|
|
|
DebugModeOn BooleanType |
|
|
|
|
DebugEnergyOn DebugSwitchModeType |
|
|
|
|
DebugTargetVoltage Voltage11BitType |
|
|
|
|
DebugTargetCurrent Current10BitType |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
type SignedAirTemp8BitType int |
|
|
|
|
type ConnectedOut8bitType uint |
|
|
|
|
type ForceModeType uint |
|
|
|
|
type SignedVoltage12bitType int |
|
|
|
|
type DebugSwitchModeType uint |
|
|
|
|
type OtherError4BitType uint |
|
|
|
|
@ -235,6 +340,400 @@ type CpLineLevelType uint |
|
|
|
|
type IsolationStateType uint |
|
|
|
|
type Voltage9BitType float32 |
|
|
|
|
|
|
|
|
|
type parameters struct { |
|
|
|
|
fields []content |
|
|
|
|
interval uint |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
type content struct { |
|
|
|
|
length uint8 |
|
|
|
|
setter func(uint64 uint64) |
|
|
|
|
value uint64 |
|
|
|
|
last time.Time |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
type key struct { |
|
|
|
|
canId, unitId uint |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
var protocolMap map[key]parameters |
|
|
|
|
var cpuPresentEnergyArray [CONNECTOR_MAX]*CpuPresentEnergy |
|
|
|
|
var cpuPeripheryInstance *CpuPeriphery |
|
|
|
|
var cpuEnergySettingsArray [CONNECTOR_MAX]*CpuEnergySettings |
|
|
|
|
var cpuErrorsInstance *CpuErrors |
|
|
|
|
var cpuDebugInstance *CpuDebug |
|
|
|
|
var puPresentEnergyArray [CONNECTOR_MAX]*PuPresentEnergy |
|
|
|
|
var puPeripheryArray [CONNECTOR_MAX]*PuPeriphery |
|
|
|
|
var puErrorsArray [CONNECTOR_MAX]*PuErrors |
|
|
|
|
var puDebugArray [CONNECTOR_MAX]*PuDebug |
|
|
|
|
var seccTargetEnergyArray [CONNECTOR_MAX]*SeccTargetEnergy |
|
|
|
|
var seccErrorsArray [CONNECTOR_MAX]*SeccErrors |
|
|
|
|
var logicAuthArray [CONNECTOR_MAX]*LogicAuth |
|
|
|
|
var logicEnergyMode [CONNECTOR_MAX]*LogicEnergyMode |
|
|
|
|
var logicErrorsInstance *LogicErrors |
|
|
|
|
var logicWorkingMode *LogicWorkingMode |
|
|
|
|
var contactorInternalStateArray [CONNECTOR_MAX]*ContactorInternalState |
|
|
|
|
var contactorInternalErrorsInstance *ContactorInternalErrors |
|
|
|
|
var contactorsInternalForce *ContactorsInternalForce |
|
|
|
|
var contactorInternalDebugArray [CONNECTOR_MAX]*ContactorInternalDebug |
|
|
|
|
var peripheryStateArray [CONNECTOR_MAX]*PeripheryState |
|
|
|
|
var peripheryInfoArray [CONNECTOR_MAX]*PeripheryInfo |
|
|
|
|
var peripheryDebugArray [CONNECTOR_MAX]*PeripheryDebug |
|
|
|
|
var converterPresentEnergyArray [CONVERTERS_MAX]*ConverterPresentEnergy |
|
|
|
|
var converterErrorsArray [CONVERTERS_MAX]*ConverterErrors |
|
|
|
|
var converterDebugArray [CONVERTERS_MAX]*ConverterDebug |
|
|
|
|
|
|
|
|
|
func init() { |
|
|
|
|
for i := 1; i <= CONNECTOR_COUNT; i++ { |
|
|
|
|
key := key{can.CAN_ID_011, uint(i)} |
|
|
|
|
cpe := CpuPresentEnergy{} |
|
|
|
|
cpuPresentEnergyArray[i] = &cpe |
|
|
|
|
fields := []content{ |
|
|
|
|
{length: 2, setter: cpe.setPowerDirectionMode}, |
|
|
|
|
{length: 10, setter: cpe.setPresentCurrent}, |
|
|
|
|
{length: 11, setter: cpe.setPresentVoltage}, |
|
|
|
|
} |
|
|
|
|
protocolMap[key] = parameters{fields: fields, interval: 50} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
cpuPeripheryInstance = &CpuPeriphery{} |
|
|
|
|
fields := []content{ |
|
|
|
|
{length: 2, setter: cpuPeripheryInstance.setContactorInput}, |
|
|
|
|
{length: 2, setter: cpuPeripheryInstance.setCircuitBreakerInput}, |
|
|
|
|
{length: 2, setter: cpuPeripheryInstance.setCircuitBreakerPowerCBInput}, |
|
|
|
|
} |
|
|
|
|
protocolMap[key{can.CAN_ID_014, 0}] = parameters{fields: fields, interval: 1000} |
|
|
|
|
|
|
|
|
|
for i := 0; i <= CONNECTOR_COUNT; i++ { |
|
|
|
|
key := key{can.CAN_ID_015, uint(i)} |
|
|
|
|
ces := CpuEnergySettings{} |
|
|
|
|
cpuEnergySettingsArray[i] = &ces |
|
|
|
|
fields := []content{ |
|
|
|
|
{length: 10, setter: ces.setCurrentMax}, |
|
|
|
|
{length: 11, setter: ces.setVoltageMax}, |
|
|
|
|
{length: 14, setter: ces.setPowerMax}, |
|
|
|
|
{length: 11, setter: ces.setTargetBatteryVoltage}, |
|
|
|
|
{length: 11, setter: ces.setTargetGoalVoltage}, |
|
|
|
|
} |
|
|
|
|
protocolMap[key] = parameters{fields: fields, interval: 1000} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
cpuErrorsInstance = &CpuErrors{} |
|
|
|
|
fields = []content{ |
|
|
|
|
{length: 3, setter: cpuErrorsInstance.setBoardReady}, |
|
|
|
|
{length: 4, setter: cpuErrorsInstance.setOtherError}, |
|
|
|
|
{length: 2, setter: cpuErrorsInstance.setRedButtonHard}, |
|
|
|
|
{length: 2, setter: cpuErrorsInstance.setRedButtonSoft}, |
|
|
|
|
{length: 2, setter: cpuErrorsInstance.setModulesGone}, |
|
|
|
|
{length: 2, setter: cpuErrorsInstance.setGridVoltageHighErr}, |
|
|
|
|
{length: 2, setter: cpuErrorsInstance.setGridVoltageHighWarn}, |
|
|
|
|
{length: 2, setter: cpuErrorsInstance.setGridVoltageLowWarn}, |
|
|
|
|
{length: 2, setter: cpuErrorsInstance.setGridVoltageLowErr}, |
|
|
|
|
{length: 11, setter: cpuErrorsInstance.setGridVoltageLow}, |
|
|
|
|
{length: 11, setter: cpuErrorsInstance.setGridVoltageHigh}, |
|
|
|
|
{length: 2, setter: cpuErrorsInstance.setGridVoltageEmpty}, |
|
|
|
|
{length: 2, setter: cpuErrorsInstance.setNotReadySecc}, |
|
|
|
|
{length: 2, setter: cpuErrorsInstance.setNotReadyPu}, |
|
|
|
|
{length: 2, setter: cpuErrorsInstance.setNotReadyContactors}, |
|
|
|
|
{length: 2, setter: cpuErrorsInstance.setDebugConvertersEnabled}, |
|
|
|
|
{length: 2, setter: cpuErrorsInstance.setContactorInputError}, |
|
|
|
|
{length: 2, setter: cpuErrorsInstance.setNotReadyPeriphery}, |
|
|
|
|
} |
|
|
|
|
protocolMap[key{can.CAN_ID_016, 0}] = parameters{fields: fields, interval: 1000} |
|
|
|
|
|
|
|
|
|
cpuDebugInstance = &CpuDebug{} |
|
|
|
|
fields = []content{ |
|
|
|
|
{length: 2, setter: cpuDebugInstance.setDebugModeOn}, |
|
|
|
|
{length: 3, setter: cpuDebugInstance.setDebugContactorInputOn}, |
|
|
|
|
{length: 3, setter: cpuDebugInstance.setDebugCircuitBreakerOn}, |
|
|
|
|
{length: 3, setter: cpuDebugInstance.setDebugRedButtonSoftware}, |
|
|
|
|
} |
|
|
|
|
protocolMap[key{can.CAN_ID_01A, 0}] = parameters{fields: fields, interval: 1000} |
|
|
|
|
|
|
|
|
|
for i := 1; i <= CONNECTOR_COUNT; i++ { |
|
|
|
|
key := key{can.CAN_ID_021, uint(i)} |
|
|
|
|
ppe := PuPresentEnergy{} |
|
|
|
|
puPresentEnergyArray[i] = &ppe |
|
|
|
|
fields := []content{ |
|
|
|
|
{length: 2, setter: ppe.setV2GMode}, |
|
|
|
|
{length: 11, setter: ppe.setVoltageBefore}, |
|
|
|
|
{length: 11, setter: ppe.setVoltageAfter}, |
|
|
|
|
{length: 10, setter: ppe.setPresentCurrent}, |
|
|
|
|
} |
|
|
|
|
protocolMap[key] = parameters{fields: fields, interval: 50} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for i := 1; i <= CONNECTOR_COUNT; i++ { |
|
|
|
|
key := key{can.CAN_ID_022, uint(i)} |
|
|
|
|
pp := PuPeriphery{} |
|
|
|
|
puPeripheryArray[i] = &pp |
|
|
|
|
fields := []content{ |
|
|
|
|
{length: 2, setter: pp.setConnectorInsert}, |
|
|
|
|
{length: 2, setter: pp.setContactorOn}, |
|
|
|
|
{length: 2, setter: pp.setConnectorLocked}, |
|
|
|
|
{length: 3, setter: pp.setCpLineLevel}, |
|
|
|
|
{length: 3, setter: pp.setIsolationState}, |
|
|
|
|
{length: 2, setter: pp.setChargingAllowed}, |
|
|
|
|
{length: 2, setter: pp.setPwmEnabled}, |
|
|
|
|
{length: 9, setter: pp.setCpLineVoltage}, |
|
|
|
|
} |
|
|
|
|
protocolMap[key] = parameters{fields: fields, interval: 1000} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for i := 1; i <= CONNECTOR_COUNT; i++ { |
|
|
|
|
key := key{can.CAN_ID_023, uint(i)} |
|
|
|
|
pe := PuErrors{} |
|
|
|
|
puErrorsArray[i] = &pe |
|
|
|
|
fields := []content{ |
|
|
|
|
{length: 3, setter: pe.setBoardReady}, |
|
|
|
|
{length: 4, setter: pe.setOtherError}, |
|
|
|
|
{length: 2, setter: pe.setIncorrectVoltage}, |
|
|
|
|
{length: 11, setter: pe.setIncorrectVoltageValue}, |
|
|
|
|
{length: 2, setter: pe.setIncorrectCurrent}, |
|
|
|
|
{length: 10, setter: pe.setIncorrectCurrentValue}, |
|
|
|
|
{length: 2, setter: pe.setIsolationBroken}, |
|
|
|
|
{length: 2, setter: pe.setCpLineBroken}, |
|
|
|
|
{length: 2, setter: pe.setCpLineGap69}, |
|
|
|
|
{length: 3, setter: pe.setCableReady}, |
|
|
|
|
{length: 2, setter: pe.setNotReadyCpu}, |
|
|
|
|
{length: 2, setter: pe.setNotReadySecc}, |
|
|
|
|
{length: 2, setter: pe.setContactorOutputError}, |
|
|
|
|
{length: 2, setter: pe.setDebugContactorOutputEnabled}, |
|
|
|
|
{length: 2, setter: pe.setOutputCircuitBreakerEnabled}, |
|
|
|
|
{length: 12, setter: pe.setOutputCircuitBreakerEnabledValue}, |
|
|
|
|
} |
|
|
|
|
protocolMap[key] = parameters{fields: fields, interval: 1000} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for i := 0; i <= CONNECTOR_COUNT; i++ { |
|
|
|
|
key := key{can.CAN_ID_02A, uint(i)} |
|
|
|
|
pd := PuDebug{} |
|
|
|
|
puDebugArray[i] = &pd |
|
|
|
|
fields = []content{ |
|
|
|
|
{length: 2, setter: pd.setDebugModeOn}, |
|
|
|
|
{length: 3, setter: pd.setDebugContactorOutputOn}, |
|
|
|
|
} |
|
|
|
|
protocolMap[key] = parameters{fields: fields, interval: 1000} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for i := 1; i <= CONNECTOR_COUNT; i++ { |
|
|
|
|
key := key{can.CAN_ID_041, uint(i)} |
|
|
|
|
ste := SeccTargetEnergy{} |
|
|
|
|
seccTargetEnergyArray[i] = &ste |
|
|
|
|
fields = []content{ |
|
|
|
|
{length: 2, setter: ste.setTargetChargingAllow}, |
|
|
|
|
{length: 11, setter: ste.setTargetBatteryVoltage}, |
|
|
|
|
{length: 11, setter: ste.setTargetGoalVoltage}, |
|
|
|
|
{length: 10, setter: ste.setTargetCurrent}, |
|
|
|
|
} |
|
|
|
|
protocolMap[key] = parameters{fields: fields, interval: 1000} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for i := 1; i <= CONNECTOR_COUNT; i++ { |
|
|
|
|
key := key{can.CAN_ID_042, uint(i)} |
|
|
|
|
se := SeccErrors{} |
|
|
|
|
seccErrorsArray[i] = &se |
|
|
|
|
fields = []content{ |
|
|
|
|
{length: 3, setter: se.setBoardReady}, |
|
|
|
|
{length: 2, setter: se.setNotReadyLogic}, |
|
|
|
|
} |
|
|
|
|
protocolMap[key] = parameters{fields: fields, interval: 1000} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for i := 0; i <= CONNECTOR_COUNT; i++ { |
|
|
|
|
key := key{can.CAN_ID_046, uint(i)} |
|
|
|
|
la := LogicAuth{} |
|
|
|
|
logicAuthArray[i] = &la |
|
|
|
|
fields = []content{ |
|
|
|
|
{length: 2, setter: la.setAuthMode}, |
|
|
|
|
{length: 3, setter: la.setAuthState}, |
|
|
|
|
} |
|
|
|
|
protocolMap[key] = parameters{fields: fields, interval: 1000} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for i := 0; i <= CONNECTOR_COUNT; i++ { |
|
|
|
|
key := key{can.CAN_ID_047, uint(i)} |
|
|
|
|
la := LogicEnergyMode{} |
|
|
|
|
logicEnergyMode[i] = &la |
|
|
|
|
fields = []content{ |
|
|
|
|
{length: 2, setter: la.setV2gMode}, |
|
|
|
|
{length: 10, setter: la.setCurrentMax}, |
|
|
|
|
{length: 11, setter: la.setVoltageMax}, |
|
|
|
|
{length: 14, setter: la.setPowerMax}, |
|
|
|
|
} |
|
|
|
|
protocolMap[key] = parameters{fields: fields, interval: 1000} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
logicErrorsInstance = &LogicErrors{} |
|
|
|
|
fields = []content{ |
|
|
|
|
{length: 3, setter: logicErrorsInstance.setBoardReady}, |
|
|
|
|
{length: 2, setter: logicErrorsInstance.setNotReadySettings}, |
|
|
|
|
} |
|
|
|
|
protocolMap[key{can.CAN_ID_048, 0}] = parameters{fields: fields, interval: 1000} |
|
|
|
|
|
|
|
|
|
logicWorkingMode = &LogicWorkingMode{} |
|
|
|
|
fields = []content{ |
|
|
|
|
{length: 5, setter: logicWorkingMode.setTargetContactorMode}, |
|
|
|
|
{length: 2, setter: logicWorkingMode.setAvailability}, |
|
|
|
|
} |
|
|
|
|
protocolMap[key{can.CAN_ID_049, 0}] = parameters{fields: fields, interval: 1000} |
|
|
|
|
|
|
|
|
|
for i := 0; i <= CONTACTOR_MAX; i++ { |
|
|
|
|
key := key{can.CAN_ID_071, uint(i)} |
|
|
|
|
cis := ContactorInternalState{} |
|
|
|
|
contactorInternalStateArray[i] = &cis |
|
|
|
|
fields = []content{ |
|
|
|
|
{length: 3, setter: cis.setContactorReady}, |
|
|
|
|
{length: 2, setter: cis.setContactorOn}, |
|
|
|
|
{length: 2, setter: cis.setUnexpectedState}, |
|
|
|
|
{length: 2, setter: cis.setIsolated}, |
|
|
|
|
{length: 2, setter: cis.setDebugEnabled}, |
|
|
|
|
} |
|
|
|
|
protocolMap[key] = parameters{fields: fields, interval: 1000} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
contactorInternalErrorsInstance = &ContactorInternalErrors{} |
|
|
|
|
fields = []content{ |
|
|
|
|
{length: 3, setter: contactorInternalErrorsInstance.setBoardReady}, |
|
|
|
|
{length: 4, setter: contactorInternalErrorsInstance.setOtherError}, |
|
|
|
|
{length: 3, setter: contactorInternalErrorsInstance.setContactorGroupChanged}, |
|
|
|
|
{length: 4, setter: contactorInternalErrorsInstance.setUnexpectedFormation}, |
|
|
|
|
{length: 2, setter: contactorInternalErrorsInstance.setCpuNotReady}, |
|
|
|
|
{length: 2, setter: contactorInternalErrorsInstance.setPuNotReady}, |
|
|
|
|
{length: 2, setter: contactorInternalErrorsInstance.setDebug}, |
|
|
|
|
{length: 5, setter: contactorInternalErrorsInstance.setPresentContactorMode}, |
|
|
|
|
} |
|
|
|
|
protocolMap[key{can.CAN_ID_073, 0}] = parameters{fields: fields, interval: 1000} |
|
|
|
|
|
|
|
|
|
contactorsInternalForce = &ContactorsInternalForce{} |
|
|
|
|
fields = []content{ |
|
|
|
|
{length: 2, setter: contactorsInternalForce.setForceModeEnabled}, |
|
|
|
|
{length: 4, setter: contactorsInternalForce.setForceModeValue}, |
|
|
|
|
} |
|
|
|
|
protocolMap[key{can.CAN_ID_074, 0}] = parameters{fields: fields, interval: 1000} |
|
|
|
|
|
|
|
|
|
for i := 0; i <= CONTACTOR_MAX; i++ { |
|
|
|
|
key := key{can.CAN_ID_075, uint(i)} |
|
|
|
|
cid := ContactorInternalDebug{} |
|
|
|
|
contactorInternalDebugArray[i] = &cid |
|
|
|
|
fields = []content{ |
|
|
|
|
{length: 2, setter: cid.setDebugModeOn}, |
|
|
|
|
{length: 3, setter: cid.setDebugContactorOn}, |
|
|
|
|
} |
|
|
|
|
protocolMap[key] = parameters{fields: fields, interval: 1000} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for i := 0; i <= CONNECTOR_COUNT; i++ { |
|
|
|
|
key := key{can.CAN_ID_067, uint(i)} |
|
|
|
|
ps := PeripheryState{} |
|
|
|
|
peripheryStateArray[i] = &ps |
|
|
|
|
fields = []content{ |
|
|
|
|
{length: 3, setter: ps.setOtherErrorSeverity}, |
|
|
|
|
{length: 4, setter: ps.setOtherError}, |
|
|
|
|
{length: 2, setter: ps.setErrorShakeSensor}, |
|
|
|
|
{length: 2, setter: ps.setErrorCoolingGroup}, |
|
|
|
|
{length: 2, setter: ps.setPeripheryErrorCoolingGroup}, |
|
|
|
|
{length: 2, setter: ps.setErrorFireEmergency}, |
|
|
|
|
{length: 2, setter: ps.setErrorFireEmergencyRun}, |
|
|
|
|
{length: 2, setter: ps.setErrorFireEmergencyControl}, |
|
|
|
|
{length: 2, setter: ps.setErrorOvervoltageIn}, |
|
|
|
|
{length: 2, setter: ps.setPeripheryErrorPowerSupply}, |
|
|
|
|
{length: 2, setter: ps.setErrorFan}, |
|
|
|
|
{length: 2, setter: ps.setErrorOvervoltageOut}, |
|
|
|
|
{length: 2, setter: ps.setErrorStateRemoteMode}, |
|
|
|
|
{length: 2, setter: ps.setDebugShsnFanEnabled}, |
|
|
|
|
{length: 2, setter: ps.setDebugShptFanEnabled}, |
|
|
|
|
{length: 2, setter: ps.setDebugIoBoardTestLampEnabled}, |
|
|
|
|
{length: 2, setter: ps.setErrorFireEmergencyCircuitBreaker}, |
|
|
|
|
{length: 2, setter: ps.setErrorExtLightCircuitBreaker}, |
|
|
|
|
{length: 2, setter: ps.setErrorIndicationCircuitBreaker}, |
|
|
|
|
{length: 2, setter: ps.setErrorLowVoltagePowerCircuitBreaker}, |
|
|
|
|
{length: 2, setter: ps.setErrorContactorsInternalCircuitBreaker}, |
|
|
|
|
{length: 2, setter: ps.setErrorPlcCircuitBreaker}, |
|
|
|
|
} |
|
|
|
|
protocolMap[key] = parameters{fields: fields, interval: 1000} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for i := 0; i <= CONNECTOR_COUNT; i++ { |
|
|
|
|
key := key{can.CAN_ID_068, uint(i)} |
|
|
|
|
pi := PeripheryInfo{} |
|
|
|
|
peripheryInfoArray[i] = &pi |
|
|
|
|
fields = []content{ |
|
|
|
|
{length: 2, setter: pi.setInfoDoorOpen}, |
|
|
|
|
{length: 8, setter: pi.setTempAirIn}, |
|
|
|
|
{length: 8, setter: pi.setTempAirOut}, |
|
|
|
|
{length: 2, setter: pi.setStateShsnFan}, |
|
|
|
|
{length: 2, setter: pi.setStateShptFan}, |
|
|
|
|
} |
|
|
|
|
protocolMap[key] = parameters{fields: fields, interval: 5000} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for i := 0; i <= CONNECTOR_COUNT; i++ { |
|
|
|
|
key := key{can.CAN_ID_06C, uint(i)} |
|
|
|
|
pd := PeripheryDebug{} |
|
|
|
|
peripheryDebugArray[i] = &pd |
|
|
|
|
fields = []content{ |
|
|
|
|
{length: 2, setter: pd.setDebugModeOn}, |
|
|
|
|
{length: 3, setter: pd.setDebugShsnFan}, |
|
|
|
|
{length: 3, setter: pd.setDebugShptFan}, |
|
|
|
|
{length: 3, setter: pd.setDebugIoBoardTestLamp}, |
|
|
|
|
} |
|
|
|
|
protocolMap[key] = parameters{fields: fields, interval: 1000} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for i := 1; i <= CONVERTERS_MAX; i++ { |
|
|
|
|
key := key{can.CAN_ID_061, uint(i)} |
|
|
|
|
cpe := ConverterPresentEnergy{} |
|
|
|
|
converterPresentEnergyArray[i] = &cpe |
|
|
|
|
fields = []content{ |
|
|
|
|
{length: 2, setter: cpe.setV2gMode}, |
|
|
|
|
{length: 11, setter: cpe.setPresentVoltage}, |
|
|
|
|
{length: 10, setter: cpe.setPresentCurrent}, |
|
|
|
|
{length: 8, setter: cpe.setConnectedOut}, |
|
|
|
|
} |
|
|
|
|
protocolMap[key] = parameters{fields: fields, interval: 500} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for i := 1; i <= CONVERTERS_MAX; i++ { |
|
|
|
|
key := key{can.CAN_ID_062, uint(i)} |
|
|
|
|
ce := ConverterErrors{} |
|
|
|
|
converterErrorsArray[i] = &ce |
|
|
|
|
fields = []content{ |
|
|
|
|
{length: 3, setter: ce.setBoardReady}, |
|
|
|
|
{length: 4, setter: ce.setOtherError}, |
|
|
|
|
{length: 2, setter: ce.setNotConnectedOut}, |
|
|
|
|
{length: 2, setter: ce.setNoCommunicationConverter}, |
|
|
|
|
{length: 2, setter: ce.setNoCommunicationPuConverter}, |
|
|
|
|
{length: 2, setter: ce.setInputGridVoltageHigh}, |
|
|
|
|
{length: 2, setter: ce.setInputGridVoltageLow}, |
|
|
|
|
{length: 2, setter: ce.setOutputGridVoltageHigh}, |
|
|
|
|
{length: 2, setter: ce.setOutputGridVoltageLow}, |
|
|
|
|
{length: 11, setter: ce.setInputGridVoltage}, |
|
|
|
|
{length: 11, setter: ce.setOutputGridVoltage}, |
|
|
|
|
{length: 2, setter: ce.setShortCircuit}, |
|
|
|
|
{length: 2, setter: ce.setOverHeat}, |
|
|
|
|
{length: 2, setter: ce.setFanBroken}, |
|
|
|
|
{length: 2, setter: ce.setOtherHardwareError}, |
|
|
|
|
{length: 2, setter: ce.setDebugConvEnabled}, |
|
|
|
|
{length: 2, setter: ce.setDebugConvDisabled}, |
|
|
|
|
} |
|
|
|
|
protocolMap[key] = parameters{fields: fields, interval: 1000} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for i := 0; i <= CONVERTERS_MAX; i++ { |
|
|
|
|
key := key{can.CAN_ID_065, uint(i)} |
|
|
|
|
cd := ConverterDebug{} |
|
|
|
|
converterDebugArray[i] = &cd |
|
|
|
|
fields = []content{ |
|
|
|
|
{length: 3, setter: cd.setDebugModeOn}, |
|
|
|
|
{length: 4, setter: cd.setDebugEnergyOn}, |
|
|
|
|
{length: 2, setter: cd.setDebugTargetVoltage}, |
|
|
|
|
{length: 2, setter: cd.setDebugTargetCurrent}, |
|
|
|
|
} |
|
|
|
|
protocolMap[key] = parameters{fields: fields, interval: 1000} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func StartProtocolParsing(frames <-chan *can.CanFrame) <-chan Packet { |
|
|
|
|
result := make(chan Packet) |
|
|
|
|
|
|
|
|
|
@ -423,6 +922,10 @@ func (l *LogicEnergyMode) GetUnitId() uint { |
|
|
|
|
return l.UnitId |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (l *LogicErrors) GetUnitId() uint { |
|
|
|
|
return l.UnitId |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (l *LogicWorkingMode) GetUnitId() uint { |
|
|
|
|
return l.UnitId |
|
|
|
|
} |
|
|
|
|
@ -462,3 +965,35 @@ func (s *SeccTargetEnergy) GetUnitId() uint { |
|
|
|
|
func (e *SeccErrors) GetUnitId() uint { |
|
|
|
|
return e.UnitId |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (c *ContactorsInternalForce) GetUnitId() uint { |
|
|
|
|
return c.UnitId |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (c *ContactorInternalDebug) GetUnitId() uint { |
|
|
|
|
return c.UnitId |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (p *PeripheryState) GetUnitId() uint { |
|
|
|
|
return p.UnitId |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (p *PeripheryInfo) GetUnitId() uint { |
|
|
|
|
return p.UnitId |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (p *PeripheryDebug) GetUnitId() uint { |
|
|
|
|
return p.UnitId |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (c *ConverterPresentEnergy) GetUnitId() uint { |
|
|
|
|
return c.UnitId |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (c *ConverterErrors) GetUnitId() uint { |
|
|
|
|
return c.UnitId |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (c *ConverterDebug) GetUnitId() uint { |
|
|
|
|
return c.UnitId |
|
|
|
|
} |
|
|
|
|
|