New UI lib, OOP refactoring, new frames added #1
+42
@@ -13,8 +13,29 @@ import (
|
||||
|
||||
const CAN_ID_071 = 0x071
|
||||
const CAN_ID_073 = 0x073
|
||||
const CAN_ID_074 = 0x074
|
||||
const CAN_ID_075 = 0x075
|
||||
const CAN_ID_021 = 0x021
|
||||
const CAN_ID_022 = 0x022
|
||||
const CAN_ID_023 = 0x023
|
||||
const CAN_ID_011 = 0x011
|
||||
const CAN_ID_014 = 0x014
|
||||
const CAN_ID_015 = 0x015
|
||||
const CAN_ID_016 = 0x016
|
||||
const CAN_ID_01A = 0x01A
|
||||
const CAN_ID_02A = 0x02A
|
||||
const CAN_ID_041 = 0x041
|
||||
const CAN_ID_042 = 0x042
|
||||
const CAN_ID_046 = 0x046
|
||||
const CAN_ID_047 = 0x047
|
||||
const CAN_ID_048 = 0x048
|
||||
const CAN_ID_049 = 0x049
|
||||
const CAN_ID_067 = 0x067
|
||||
const CAN_ID_068 = 0x068
|
||||
const CAN_ID_06C = 0x06C
|
||||
const CAN_ID_061 = 0x061
|
||||
const CAN_ID_062 = 0x062
|
||||
const CAN_ID_065 = 0x065
|
||||
|
||||
type CanFrame struct {
|
||||
CanId uint32
|
||||
@@ -109,8 +130,29 @@ func StartCan(canbus string) (<-chan *CanFrame, error) {
|
||||
var filter []unix.CanFilter = []unix.CanFilter{
|
||||
{Id: CAN_ID_071, Mask: 0xFFF},
|
||||
{Id: CAN_ID_073, Mask: 0xFFF},
|
||||
{Id: CAN_ID_074, Mask: 0xFFF},
|
||||
{Id: CAN_ID_075, Mask: 0xFFF},
|
||||
{Id: CAN_ID_021, Mask: 0xFFF},
|
||||
{Id: CAN_ID_022, Mask: 0xFFF},
|
||||
{Id: CAN_ID_011, Mask: 0xFFF},
|
||||
{Id: CAN_ID_014, Mask: 0xFFF},
|
||||
{Id: CAN_ID_015, Mask: 0xFFF},
|
||||
{Id: CAN_ID_016, Mask: 0xFFF},
|
||||
{Id: CAN_ID_01A, Mask: 0xFFF},
|
||||
{Id: CAN_ID_023, Mask: 0xFFF},
|
||||
{Id: CAN_ID_02A, Mask: 0xFFF},
|
||||
{Id: CAN_ID_041, Mask: 0xFFF},
|
||||
{Id: CAN_ID_042, Mask: 0xFFF},
|
||||
{Id: CAN_ID_046, Mask: 0xFFF},
|
||||
{Id: CAN_ID_047, Mask: 0xFFF},
|
||||
{Id: CAN_ID_048, Mask: 0xFFF},
|
||||
{Id: CAN_ID_049, Mask: 0xFFF},
|
||||
{Id: CAN_ID_067, Mask: 0xFFF},
|
||||
{Id: CAN_ID_068, Mask: 0xFFF},
|
||||
{Id: CAN_ID_06C, Mask: 0xFFF},
|
||||
{Id: CAN_ID_061, Mask: 0xFFF},
|
||||
{Id: CAN_ID_062, Mask: 0xFFF},
|
||||
{Id: CAN_ID_065, Mask: 0xFFF},
|
||||
}
|
||||
|
||||
if socket, err := NewCan(); err == nil {
|
||||
|
||||
+536
-1
@@ -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
|
||||
}
|
||||
|
||||
+269
-1
@@ -48,6 +48,10 @@ func (t *ContactorInternalErrors) setDebug(val uint64) {
|
||||
t.Debug = BooleanType(val)
|
||||
}
|
||||
|
||||
func (t *ContactorInternalErrors) setPresentContactorMode(val uint64) {
|
||||
t.PresentContactorMode = ContactorModeType(val)
|
||||
}
|
||||
|
||||
func (t *PuPresentEnergy) setV2GMode(val uint64) {
|
||||
t.V2GMode = V2GModeType(val)
|
||||
}
|
||||
@@ -93,7 +97,7 @@ func (t *PuPeriphery) setPwmEnabled(val uint64) {
|
||||
}
|
||||
|
||||
func (t *PuPeriphery) setCpLineVoltage(val uint64) {
|
||||
t.CpLineVoltage = Voltage9BitType(val)
|
||||
t.CpLineVoltage = Voltage9BitType(val)/10 - 15
|
||||
}
|
||||
|
||||
func (t *LogicAuth) setAuthMode(val uint64) {
|
||||
@@ -339,3 +343,267 @@ func (e *SeccErrors) setBoardReady(val uint64) {
|
||||
func (e *SeccErrors) setNotReadyLogic(val uint64) {
|
||||
e.NotReadyLogic = ErrorType(val)
|
||||
}
|
||||
|
||||
func (l *LogicEnergyMode) setV2gMode(val uint64) {
|
||||
l.V2gMode = V2GModeType(val)
|
||||
}
|
||||
|
||||
func (l *LogicEnergyMode) setCurrentMax(val uint64) {
|
||||
l.CurrentMax = Current10BitType(val)
|
||||
}
|
||||
|
||||
func (l *LogicEnergyMode) setVoltageMax(val uint64) {
|
||||
l.VoltageMax = Voltage11BitType(val)
|
||||
}
|
||||
|
||||
func (l *LogicEnergyMode) setPowerMax(val uint64) {
|
||||
l.PowerMax = Power14BitType(val * 100)
|
||||
}
|
||||
|
||||
func (l *LogicErrors) setBoardReady(val uint64) {
|
||||
l.BoardReady = BoardReadyType(val)
|
||||
}
|
||||
|
||||
func (l *LogicErrors) setNotReadySettings(val uint64) {
|
||||
l.NotReadySettings = ErrorType(val)
|
||||
}
|
||||
|
||||
func (c *ContactorsInternalForce) setForceModeEnabled(val uint64) {
|
||||
c.ForceModeEnabled = BooleanType(val)
|
||||
}
|
||||
|
||||
func (c *ContactorsInternalForce) setForceModeValue(val uint64) {
|
||||
c.ForceModeValue = ForceModeType(val)
|
||||
}
|
||||
|
||||
func (c *ContactorInternalDebug) setDebugModeOn(val uint64) {
|
||||
c.DebugModeOn = BooleanType(val)
|
||||
}
|
||||
|
||||
func (c *ContactorInternalDebug) setDebugContactorOn(val uint64) {
|
||||
c.DebugContactorOn = DebugSwitchModeType(val)
|
||||
}
|
||||
|
||||
func (p *PeripheryState) setOtherErrorSeverity(val uint64) {
|
||||
p.OtherErrorSeverity = BoardReadyType(val)
|
||||
}
|
||||
|
||||
func (p *PeripheryState) setOtherError(val uint64) {
|
||||
p.OtherError = OtherError4BitType(val)
|
||||
}
|
||||
|
||||
func (p *PeripheryState) setErrorShakeSensor(val uint64) {
|
||||
p.ErrorShakeSensor = ErrorType(val)
|
||||
}
|
||||
|
||||
func (p *PeripheryState) setErrorCoolingGroup(val uint64) {
|
||||
p.ErrorCoolingGroup = ErrorType(val)
|
||||
}
|
||||
|
||||
func (p *PeripheryState) setPeripheryErrorCoolingGroup(val uint64) {
|
||||
p.PeripheryErrorCoolingGroup = ErrorType(val)
|
||||
}
|
||||
|
||||
func (p *PeripheryState) setErrorFireEmergency(val uint64) {
|
||||
p.ErrorFireEmergency = ErrorType(val)
|
||||
}
|
||||
|
||||
func (p *PeripheryState) setErrorFireEmergencyRun(val uint64) {
|
||||
p.ErrorFireEmergencyRun = ErrorType(val)
|
||||
}
|
||||
|
||||
func (p *PeripheryState) setErrorFireEmergencyControl(val uint64) {
|
||||
p.ErrorFireEmergencyControl = ErrorType(val)
|
||||
}
|
||||
|
||||
func (p *PeripheryState) setErrorOvervoltageIn(val uint64) {
|
||||
p.ErrorOvervoltageIn = ErrorType(val)
|
||||
}
|
||||
|
||||
func (p *PeripheryState) setPeripheryErrorPowerSupply(val uint64) {
|
||||
p.PeripheryErrorPowerSupply = ErrorType(val)
|
||||
}
|
||||
|
||||
func (p *PeripheryState) setErrorFan(val uint64) {
|
||||
p.ErrorFan = ErrorType(val)
|
||||
}
|
||||
|
||||
func (p *PeripheryState) setErrorOvervoltageOut(val uint64) {
|
||||
p.ErrorOvervoltageOut = ErrorType(val)
|
||||
}
|
||||
|
||||
func (p *PeripheryState) setErrorStateRemoteMode(val uint64) {
|
||||
p.ErrorStateRemoteMode = ErrorType(val)
|
||||
}
|
||||
|
||||
func (p *PeripheryState) setDebugShsnFanEnabled(val uint64) {
|
||||
p.DebugShsnFanEnabled = BooleanType(val)
|
||||
}
|
||||
|
||||
func (p *PeripheryState) setDebugShptFanEnabled(val uint64) {
|
||||
p.DebugShptFanEnabled = BooleanType(val)
|
||||
}
|
||||
|
||||
func (p *PeripheryState) setDebugIoBoardTestLampEnabled(val uint64) {
|
||||
p.DebugIoBoardTestLampEnabled = BooleanType(val)
|
||||
}
|
||||
|
||||
func (p *PeripheryState) setErrorFireEmergencyCircuitBreaker(val uint64) {
|
||||
p.ErrorFireEmergencyCircuitBreaker = ErrorType(val)
|
||||
}
|
||||
|
||||
func (p *PeripheryState) setErrorExtLightCircuitBreaker(val uint64) {
|
||||
p.ErrorExtLightCircuitBreaker = ErrorType(val)
|
||||
}
|
||||
|
||||
func (p *PeripheryState) setErrorIndicationCircuitBreaker(val uint64) {
|
||||
p.ErrorIndicationCircuitBreaker = ErrorType(val)
|
||||
}
|
||||
|
||||
func (p *PeripheryState) setErrorLowVoltagePowerCircuitBreaker(val uint64) {
|
||||
p.ErrorLowVoltagePowerCircuitBreaker = ErrorType(val)
|
||||
}
|
||||
|
||||
func (p *PeripheryState) setErrorContactorsInternalCircuitBreaker(val uint64) {
|
||||
p.ErrorContactorsInternalCircuitBreaker = ErrorType(val)
|
||||
}
|
||||
|
||||
func (p *PeripheryState) setErrorPlcCircuitBreaker(val uint64) {
|
||||
p.ErrorPlcCircuitBreaker = ErrorType(val)
|
||||
}
|
||||
|
||||
func (p *PeripheryInfo) setInfoDoorOpen(val uint64) {
|
||||
p.InfoDoorOpen = BooleanType(val)
|
||||
}
|
||||
|
||||
func (p *PeripheryInfo) setTempAirIn(val uint64) {
|
||||
p.TempAirIn = SignedAirTemp8BitType(val - 67)
|
||||
}
|
||||
|
||||
func (p *PeripheryInfo) setTempAirOut(val uint64) {
|
||||
p.TempAirOut = SignedAirTemp8BitType(val - 67)
|
||||
}
|
||||
|
||||
func (p *PeripheryInfo) setStateShsnFan(val uint64) {
|
||||
p.StateShsnFan = BooleanType(val)
|
||||
}
|
||||
|
||||
func (p *PeripheryInfo) setStateShptFan(val uint64) {
|
||||
p.StateShptFan = BooleanType(val)
|
||||
}
|
||||
|
||||
func (p *PeripheryDebug) setDebugModeOn(val uint64) {
|
||||
p.DebugModeOn = BooleanType(val)
|
||||
}
|
||||
|
||||
func (p *PeripheryDebug) setDebugShsnFan(val uint64) {
|
||||
p.DebugShsnFan = DebugSwitchModeType(val)
|
||||
}
|
||||
|
||||
func (p *PeripheryDebug) setDebugShptFan(val uint64) {
|
||||
p.DebugShptFan = DebugSwitchModeType(val)
|
||||
}
|
||||
|
||||
func (p *PeripheryDebug) setDebugIoBoardTestLamp(val uint64) {
|
||||
p.DebugIoBoardTestLamp = DebugSwitchModeType(val)
|
||||
}
|
||||
|
||||
func (c *ConverterPresentEnergy) setV2gMode(val uint64) {
|
||||
c.V2gMode = V2GModeType(val)
|
||||
}
|
||||
|
||||
func (c *ConverterPresentEnergy) setPresentVoltage(val uint64) {
|
||||
c.PresentVoltage = Voltage11BitType(val)
|
||||
}
|
||||
|
||||
func (c *ConverterPresentEnergy) setPresentCurrent(val uint64) {
|
||||
c.PresentCurrent = Current10BitType(val)
|
||||
}
|
||||
|
||||
func (c *ConverterPresentEnergy) setConnectedOut(val uint64) {
|
||||
c.ConnectedOut = ConnectedOut8bitType(val)
|
||||
}
|
||||
|
||||
func (c *ConverterErrors) setBoardReady(val uint64) {
|
||||
c.BoardReady = BoardReadyType(val)
|
||||
}
|
||||
|
||||
func (c *ConverterErrors) setOtherError(val uint64) {
|
||||
c.OtherError = OtherError4BitType(val)
|
||||
}
|
||||
|
||||
func (c *ConverterErrors) setNotConnectedOut(val uint64) {
|
||||
c.NotConnectedOut = ErrorType(val)
|
||||
}
|
||||
|
||||
func (c *ConverterErrors) setNoCommunicationConverter(val uint64) {
|
||||
c.NoCommunicationConverter = ErrorType(val)
|
||||
}
|
||||
|
||||
func (c *ConverterErrors) setNoCommunicationPuConverter(val uint64) {
|
||||
c.NoCommunicationPuConverter = ErrorType(val)
|
||||
}
|
||||
|
||||
func (c *ConverterErrors) setInputGridVoltageHigh(val uint64) {
|
||||
c.InputGridVoltageHigh = ErrorType(val)
|
||||
}
|
||||
|
||||
func (c *ConverterErrors) setInputGridVoltageLow(val uint64) {
|
||||
c.InputGridVoltageLow = ErrorType(val)
|
||||
}
|
||||
|
||||
func (c *ConverterErrors) setOutputGridVoltageHigh(val uint64) {
|
||||
c.OutputGridVoltageHigh = ErrorType(val)
|
||||
}
|
||||
|
||||
func (c *ConverterErrors) setOutputGridVoltageLow(val uint64) {
|
||||
c.OutputGridVoltageLow = ErrorType(val)
|
||||
}
|
||||
|
||||
func (c *ConverterErrors) setInputGridVoltage(val uint64) {
|
||||
c.InputGridVoltage = Voltage11BitType(val)
|
||||
}
|
||||
|
||||
func (c *ConverterErrors) setOutputGridVoltage(val uint64) {
|
||||
c.OutputGridVoltage = Voltage11BitType(val)
|
||||
}
|
||||
|
||||
func (c *ConverterErrors) setShortCircuit(val uint64) {
|
||||
c.ShortCircuit = ErrorType(val)
|
||||
}
|
||||
|
||||
func (c *ConverterErrors) setOverHeat(val uint64) {
|
||||
c.OverHeat = ErrorType(val)
|
||||
}
|
||||
|
||||
func (c *ConverterErrors) setFanBroken(val uint64) {
|
||||
c.FanBroken = ErrorType(val)
|
||||
}
|
||||
|
||||
func (c *ConverterErrors) setOtherHardwareError(val uint64) {
|
||||
c.OtherHardwareError = ErrorType(val)
|
||||
}
|
||||
|
||||
func (c *ConverterErrors) setDebugConvEnabled(val uint64) {
|
||||
c.DebugConvEnabled = BooleanType(val)
|
||||
}
|
||||
|
||||
func (c *ConverterErrors) setDebugConvDisabled(val uint64) {
|
||||
c.DebugConvDisabled = BooleanType(val)
|
||||
}
|
||||
|
||||
func (d *ConverterDebug) setDebugModeOn(val uint64) {
|
||||
d.DebugModeOn = BooleanType(val)
|
||||
}
|
||||
|
||||
func (d *ConverterDebug) setDebugEnergyOn(val uint64) {
|
||||
d.DebugEnergyOn = DebugSwitchModeType(val)
|
||||
}
|
||||
|
||||
func (d *ConverterDebug) setDebugTargetVoltage(val uint64) {
|
||||
d.DebugTargetVoltage = Voltage11BitType(val)
|
||||
}
|
||||
|
||||
func (d *ConverterDebug) setDebugTargetCurrent(val uint64) {
|
||||
d.DebugTargetCurrent = Current10BitType(val)
|
||||
}
|
||||
|
||||
@@ -199,3 +199,15 @@ func (d DebugSwitchModeType) String() string {
|
||||
func (s SignedVoltage12bitType) String() string {
|
||||
return fmt.Sprintf("%d", s)
|
||||
}
|
||||
|
||||
func (f ForceModeType) String() string {
|
||||
return fmt.Sprintf("MODE_%d", f)
|
||||
}
|
||||
|
||||
func (t SignedAirTemp8BitType) String() string {
|
||||
return fmt.Sprintf("%d", t)
|
||||
}
|
||||
|
||||
func (c ConnectedOut8bitType) String() string {
|
||||
return fmt.Sprintf("%d", c)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user