Documentation
¶
Overview ¶
Package cx34 provides a client for working with the Chiltrix CX34 heat pump.
Index ¶
- func DebugSequenceInfo(states []*State) string
- func DiffStates(a, b *State) (string, map[Register]bool)
- type AirConditioningMode
- type Client
- type Logger
- type Mode
- type Params
- type Register
- type State
- func (s *State) ACCurrent() units.Current
- func (s *State) ACHeatingTargetTemp() units.Temperature
- func (s *State) ACInletWaterTemp() units.Temperature
- func (s *State) ACMode() AirConditioningMode
- func (s *State) ACOutletWaterTemp() units.Temperature
- func (s *State) ACTargetTemp() units.Temperature
- func (s *State) ACVoltage() units.Voltage
- func (s *State) AmbientTemp() units.Temperature
- func (s *State) ApparentPower() units.Power
- func (s *State) BoosterPumpSpeed() units.PumpSpeed
- func (s *State) COP() (units.CoefficientOfPerformance, bool)
- func (s *State) CollectionTime() time.Time
- func (s *State) CompressorCurrent() units.Current
- func (s *State) DeltaT() units.Temperature
- func (s *State) FlowRate() units.FlowRate
- func (s *State) InductorACCurrent() units.Current
- func (s *State) InternalPumpSpeed() units.PumpSpeed
- func (s *State) MassFlowPerSecond() units.Mass
- func (s *State) Proto() *chiltrix.State
- func (s *State) RegisterValues() map[Register]uint16
- func (s *State) Report(omitZeros bool, interestingRegisters map[Register]bool) string
- func (s *State) String() string
- func (s *State) SuctionTemp() units.Temperature
- func (s *State) UsefulHeatRate() units.Power
- func (s *State) UsefulHeatRateExplained() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DebugSequenceInfo ¶
Types ¶
type AirConditioningMode ¶ added in v0.0.3
type AirConditioningMode uint8
AirConditioningMode specifies whether the heat pump is configured to heat, cool, heat+domestic hot water, or cool+domestic hot water.
const ( AirConditioningModeCooling AirConditioningMode = 0 AirConditioningModeHeating AirConditioningMode = 1 )
Valid AirConditioningMode values.
func (AirConditioningMode) IsCooling ¶ added in v0.0.3
func (m AirConditioningMode) IsCooling() bool
IsCooling reports if the mode is cooling or cooling+domestic hot water.
func (AirConditioningMode) IsHeating ¶ added in v0.0.3
func (m AirConditioningMode) IsHeating() bool
IsHeating reports if the mode is heating or heating+domestic hot water.
type Client ¶
type Client struct { chiltrix.ReadWriteServiceServer // contains filtered or unexported fields }
Client is used to communicate with the Chiltrix CX34 heat pump.
func (*Client) CheckConnection ¶
CheckConnection attempts to connect to the heat pump and returns an error if the connection fails.
func (*Client) SetParameter ¶ added in v0.0.3
func (c *Client) SetParameter(ctx context.Context, req *chiltrix.SetParameterRequest) (*chiltrix.SetParameterResponse, error)
SetParameter sets the target heating temperature for the CX34.
type Mode ¶
type Mode string
Mode indicates the protocol that should be used to communicate with the CX34.
type Params ¶
type Params struct { // The /dev/ttyX device shown by dmesg for the RS-485 connection to the heat pump. TTYDevice string LogWriter io.Writer Mode Mode }
Params configures the connection to the Chiltrix.
type Register ¶
type Register uint16
Register is a modsbus register
const ( ACMode Register = 141 // 0 = cool, 1 = heat TargetACCoolingModeTemp Register = 142 TargetACHeatingModeTemp Register = 143 TargetDomesticHotWaterTemp Register = 144 // See page 47-48 of https://www.chiltrix.com/documents/CX34-IOM-3.pdf ECWaterPumpMinimumSpeed Register = 53 // 40-80 (corresponding to 40%-80%): Minimum electronically commutated water pump speed. // See page 51 of https://www.chiltrix.com/documents/CX34-IOM-3.pdf OutPipeTemp Register = 200 CompressorDischargeTemp Register = 201 AmbientTemp Register = 202 SuctionTemp Register = 203 PlateHeatExchangerTemp Register = 204 ACOutletWaterTemp Register = 205 SolarTemp Register = 206 CompressorCurrentValueP15 Register = 209 // 0.00-30.0A WaterFlowRate Register = 213 // tenths of a liter per minute P03Status Register = 214 P04Status Register = 215 P05Status Register = 216 P06Status Register = 217 P07Status Register = 218 P08Status Register = 219 // 0= DHW valid, 1= DHW invalid 0=DHW valid, 1= DHW invalid P09Status Register = 220 // 0=Heating valid, 1= Heating invalid AC heating valid= 0 valid, 1= invalid P10Status Register = 221 // 0=cooling valid, 1=cooling invalid 0=cooling valid, 1=cooling invalid HighPressureSwitchStatus Register = 222 // 1= on, 0= off 1= on, 0= off LowPressureSwitchStatus Register = 223 // 1=on, 0= off 1=on, 0= off SecondHighPressureSwitchStatus Register = 224 // 1=on, 0= off 1=on, 0= off InnerWaterFlowSwitch Register = 225 // 1=on, 0= off 1=on, 0= off CompressorFrequency Register = 227 // Displays the actual operating frequency Show actual frequency ThermalSwitchStatus Register = 228 // 1=on, 0= off 1=on, 0= off OutdoorFanMotor Register = 229 // 1= run, 0= stop 1=on, 0= off ElectricalValve1 Register = 230 // 1= run, 0= stop 1= run, 0= stop ElectricalValve2 Register = 231 // 1= run, 0= stop 1= run, 0= stop ElectricalValve3 Register = 232 // 1= run, 0= stop 1= run, 0= stop ElectricalValve4 Register = 233 // 1= run, 0= stop 1= run, 0= stop C4WaterPump Register = 234 // 1= run, 0= stop 1= run, 0= stop C5WaterPump Register = 235 // 1= run, 0= stop 1= run, 0= stop C6waterPump Register = 236 // 1= run, 0= stop 1= run, 0= stop AccumulativeDaysAFterLastVirusKilling Register = 237 // The accumulative days after last virus killing 0-99 (From the last complete sterilization to the present, cumulative number of days) 0-99 (from the last complete sterilization to the present, cumulative number of days) OutdoorModularTemp Register = 238 // -30~97℃ -30~97℃ ExpansionValve1OpeningDegree Register = 239 // 0~500 0~500 ExpansionValve2OpeningDegree Register = 240 // 0~500 0~500 InnerPipeTemp Register = 241 // -30~97℃ -30~97℃ HeatingMethod2TargetTemperature Register = 242 // -30~97℃ -30~97℃ IndoorTemperatureControlSwitch Register = 243 // 1=on, 0= off 1=on, 0= off FanType Register = 244 // 0= AC fan, 1= EC fan 1, 2= EC fan 2 0= AC fan, 1= EC fan 1, 2= EC fan 2 ECFanMotor1Speed Register = 245 // 0~3000 0~3000 ECFanMotor2Speed Register = 246 //0~3000 0~3000 WaterPumpTypes Register = 247 // 0= AC Water pump 1= EC Water pump 0= AC Water pump 1= EC Water pump InternalPumpSpeed Register = 248 // (C4) 1~10 (10 Show 100%) 1~10 (10 means 100%) BoosterPumpSpeed Register = 249 //1~10 (10 Show 100%) 1~10 (10 means 100%) InductorACCurrent Register = 250 //0~50A 0~50A DriverWorkingStatusValue Register = 251 //Hexadecimal value Hexadecimal values CompressorShutDownCode Register = 252 //Hexadecimal value Hexadecimal values DriverAllowedHighestFrequency Register = 253 //30-120Hz 30-120Hz ReduceFrequencyTemperature Register = 254 //setting 55~200℃ 55~200℃ InputACVoltage Register = 255 //0~550V 0~550V InputACCurrent Register = 256 //0~50A(IPM test) 0~50A(IPM Check) CompressorPhaseCurrent Register = 257 //0~50A(IPM test) 0~50A(IPM Check) BusLineVoltage Register = 258 //0~750V 0~750V FanShutdownCode Register = 259 // Hexadecimal value Hexadecimal values IPMTemp Register = 260 //55~200℃ 55~200℃ CompressorTotalRunningTime Register = 261 // Will reset after power cycle 0~65000 0~65000 hour // Inferred values. WaterInletSensorTemp1 Register = 281 WaterInletSensorTemp2 Register = 282 CurrentFaultCode Register = 284 // Set to 32 when I get a P5 error, not sure about other faults. )
Known Register values.
type State ¶
type State struct {
// contains filtered or unexported fields
}
State is a snapshot of the heat pump's state.
func StateFromProto ¶
StateFromProto converts a state proto into a State object.
func (*State) ACHeatingTargetTemp ¶
func (s *State) ACHeatingTargetTemp() units.Temperature
ACHeatingTargetTemp returns the active setpoint temperature.
Currently this only returns the target AC temperature in heating mode. It should be updated to return the cooling mode temperature when in cooling mode.
func (*State) ACInletWaterTemp ¶
func (s *State) ACInletWaterTemp() units.Temperature
ACInletWaterTemp returns the temperature at the water inlet; values are -30~97℃.
func (*State) ACMode ¶ added in v0.0.3
func (s *State) ACMode() AirConditioningMode
ACMode returns the outlet temperature minust he inlet temperature
func (*State) ACOutletWaterTemp ¶
func (s *State) ACOutletWaterTemp() units.Temperature
ACOutletWaterTemp returns the temperature at the water outlet; values are -30~97℃.
func (*State) ACTargetTemp ¶ added in v0.0.3
func (s *State) ACTargetTemp() units.Temperature
ACTargetTemp returns the active setpoint temperature.
func (*State) AmbientTemp ¶
func (s *State) AmbientTemp() units.Temperature
AmbientTemp returns the temperature reported by the CX34's ambient temperature sensor.
func (*State) ApparentPower ¶
ApparentPower returns the measured input AC Current times the measured AC Voltage.
I'm guessing there is no way to separate the real and reactive parts of the power value, so the actual power consumption is likely less than the returned value.
func (*State) BoosterPumpSpeed ¶
BoosterPumpSpeed returns the power setting of the variable-speed water pump external to the CX34. (not tested)
func (*State) COP ¶
func (s *State) COP() (units.CoefficientOfPerformance, bool)
COP returns the coefficient of performance for the heat pump.
func (*State) CollectionTime ¶
CollectionTime returns the collection time of the heat pump state log entry.
func (*State) CompressorCurrent ¶
CompressorCurrent returns the "Compressor phase current value".
func (*State) DeltaT ¶
func (s *State) DeltaT() units.Temperature
DeltaT returns the outlet temperature minust he inlet temperature
func (*State) FlowRate ¶
FlowRate returns the water flow rate measured by the CX34's flow sensor.
The flow sensor is made by the same company that makes this one: https://www.adafruit.com/product/828?gclid=Cj0KCQiAlZH_BRCgARIsAAZHSBmfM9AVkdnye4p7RVf_cbKDm6n6jILBT9ILjkvpg8PnLjz_38tU324aAsk0EALw_wcB
func (*State) InductorACCurrent ¶
InductorACCurrent returns the "inductor AC current value P15".
func (*State) InternalPumpSpeed ¶
InternalPumpSpeed returns the power setting of the variable-speed water pump inside of the CX34.
func (*State) MassFlowPerSecond ¶
MassFlowPerSecond returns the amount of water flowing through the heat pump per second.
func (*State) RegisterValues ¶
RegisterValues returns a map of register values. The map should not be modified by the caller.
func (*State) SuctionTemp ¶
func (s *State) SuctionTemp() units.Temperature
SuctionTemp returns the "suction temperature" of the unit.
A typical value in heating mode is 3.3 degrees C, so I'm not sure what this measures exactly.
func (*State) UsefulHeatRate ¶
UsefulHeatRate returns the amount of useful heat added or removed from the system per unit time. The value may be negative in the case of cooling.
func (*State) UsefulHeatRateExplained ¶
UsefulHeatRateExplained returns the amount of useful heat added or removed from the system per unit time. The value may be negative in the case of cooling.