ocpp

package
v0.0.0-...-6d7b8bb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 23, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Core profile keys
	KeyMeterValueSampleInterval        = "MeterValueSampleInterval"
	KeyMeterValuesSampledData          = "MeterValuesSampledData"
	KeyMeterValuesSampledDataMaxLength = "MeterValuesSampledDataMaxLength"
	KeyNumberOfConnectors              = "NumberOfConnectors"
	KeySupportedFeatureProfiles        = "SupportedFeatureProfiles"
	KeyWebSocketPingInterval           = "WebSocketPingInterval"

	// SmartCharging profile keys
	KeyChargeProfileMaxStackLevel              = "ChargeProfileMaxStackLevel"
	KeyChargingScheduleAllowedChargingRateUnit = "ChargingScheduleAllowedChargingRateUnit"
	KeyConnectorSwitch3to1PhaseSupported       = "ConnectorSwitch3to1PhaseSupported"
	KeyMaxChargingProfilesInstalled            = "MaxChargingProfilesInstalled"

	// Vendor specific keys
	KeyAlfenPlugAndChargeIdentifier      = "PlugAndChargeIdentifier"
	KeyChargeAmpsPhaseSwitchingSupported = "ACPhaseSwitchingSupported"
	KeyEvBoxSupportedMeasurands          = "evb_SupportedMeasurands"
)

Variables

View Source
var (
	ErrInvalidRequest     = errors.New("invalid request")
	ErrInvalidConnector   = errors.New("invalid connector")
	ErrInvalidTransaction = errors.New("invalid transaction")
)
View Source
var Timeout = 30 * time.Second // default request / response timeout on protocol level

Functions

This section is empty.

Types

type CP

type CP struct {

	// configuration properties
	PhaseSwitching          bool
	HasRemoteTriggerFeature bool
	ChargingRateUnit        types.ChargingRateUnitType
	ChargingProfileId       int
	StackLevel              int
	NumberOfConnectors      int
	IdTag                   string

	BootNotificationResult *core.BootNotificationRequest
	// contains filtered or unexported fields
}

func NewChargePoint

func NewChargePoint(log *util.Logger, id string) *CP

func (*CP) ChangeAvailabilityRequest

func (cp *CP) ChangeAvailabilityRequest(connectorId int, availabilityType core.AvailabilityType) error

func (*CP) ChangeConfigurationRequest

func (cp *CP) ChangeConfigurationRequest(key, value string) error

func (*CP) Connected

func (cp *CP) Connected() bool

func (*CP) GetCompositeScheduleRequest

func (cp *CP) GetCompositeScheduleRequest(connectorId int, duration int) (*smartcharging.GetCompositeScheduleConfirmation, error)

func (*CP) GetConfigurationRequest

func (cp *CP) GetConfigurationRequest() (*core.GetConfigurationConfirmation, error)

func (*CP) HasConnected

func (cp *CP) HasConnected() <-chan struct{}

func (*CP) HasMeasurement

func (cp *CP) HasMeasurement(val types.Measurand) bool

HasMeasurement checks if meterValuesSample contains given measurement

func (*CP) ID

func (cp *CP) ID() string

func (*CP) OnBootNotification

func (cp *CP) OnBootNotification(request *core.BootNotificationRequest) (*core.BootNotificationConfirmation, error)

func (*CP) OnMeterValues

func (cp *CP) OnMeterValues(request *core.MeterValuesRequest) (*core.MeterValuesConfirmation, error)

func (*CP) OnStartTransaction

func (cp *CP) OnStartTransaction(request *core.StartTransactionRequest) (*core.StartTransactionConfirmation, error)

func (*CP) OnStatusNotification

func (cp *CP) OnStatusNotification(request *core.StatusNotificationRequest) (*core.StatusNotificationConfirmation, error)

func (*CP) OnStopTransaction

func (cp *CP) OnStopTransaction(request *core.StopTransactionRequest) (*core.StopTransactionConfirmation, error)

func (*CP) RegisterID

func (cp *CP) RegisterID(id string)

func (*CP) RemoteStartTransactionRequest

func (cp *CP) RemoteStartTransactionRequest(connectorId int, idTag string) error

func (*CP) SetChargingProfileRequest

func (cp *CP) SetChargingProfileRequest(connectorId int, profile *types.ChargingProfile) error

func (*CP) Setup

func (cp *CP) Setup(meterValues string, meterInterval time.Duration) error

func (*CP) TriggerMessageRequest

func (cp *CP) TriggerMessageRequest(connectorId int, requestedMessage remotetrigger.MessageTrigger) error

type CS

type CS struct {
	ocpp16.CentralSystem
	// contains filtered or unexported fields
}

func Instance

func Instance() *CS

func (*CS) ChargePointDisconnected

func (cs *CS) ChargePointDisconnected(chargePoint ocpp16.ChargePointConnection)

ChargePointDisconnected implements ocpp16.ChargePointConnectionHandler

func (*CS) ChargepointByID

func (cs *CS) ChargepointByID(id string) (*CP, error)

func (*CS) Debug

func (cs *CS) Debug(args ...interface{})

func (*CS) Debugf

func (cs *CS) Debugf(f string, args ...interface{})

func (*CS) Error

func (cs *CS) Error(args ...interface{})

func (*CS) Errorf

func (cs *CS) Errorf(f string, args ...interface{})

func (*CS) Info

func (cs *CS) Info(args ...interface{})

func (*CS) Infof

func (cs *CS) Infof(f string, args ...interface{})

func (*CS) NewChargePoint

func (cs *CS) NewChargePoint(chargePoint ocpp16.ChargePointConnection)

NewChargePoint implements ocpp16.ChargePointConnectionHandler

func (*CS) OnAuthorize

func (cs *CS) OnAuthorize(id string, request *core.AuthorizeRequest) (*core.AuthorizeConfirmation, error)

func (*CS) OnBootNotification

func (cs *CS) OnBootNotification(id string, request *core.BootNotificationRequest) (*core.BootNotificationConfirmation, error)

func (*CS) OnDataTransfer

func (cs *CS) OnDataTransfer(id string, request *core.DataTransferRequest) (*core.DataTransferConfirmation, error)

func (*CS) OnHeartbeat

func (cs *CS) OnHeartbeat(id string, request *core.HeartbeatRequest) (*core.HeartbeatConfirmation, error)

func (*CS) OnMeterValues

func (cs *CS) OnMeterValues(id string, request *core.MeterValuesRequest) (*core.MeterValuesConfirmation, error)

func (*CS) OnStartTransaction

func (cs *CS) OnStartTransaction(id string, request *core.StartTransactionRequest) (*core.StartTransactionConfirmation, error)

func (*CS) OnStatusNotification

func (cs *CS) OnStatusNotification(id string, request *core.StatusNotificationRequest) (*core.StatusNotificationConfirmation, error)

func (*CS) OnStopTransaction

func (cs *CS) OnStopTransaction(id string, request *core.StopTransactionRequest) (*core.StopTransactionConfirmation, error)

func (*CS) RegisterChargepoint

func (cs *CS) RegisterChargepoint(id string, newfun func() *CP, init func(*CP) error) (*CP, error)

type Connector

type Connector struct {
	// contains filtered or unexported fields
}

func NewConnector

func NewConnector(log *util.Logger, id int, cp *CP, idTag string) (*Connector, error)

func (*Connector) ChangeAvailabilityRequest

func (conn *Connector) ChangeAvailabilityRequest(availabilityType core.AvailabilityType) error

func (*Connector) CurrentPower

func (conn *Connector) CurrentPower() (float64, error)

func (*Connector) Currents

func (conn *Connector) Currents() (float64, float64, float64, error)

func (*Connector) GetCompositeScheduleRequest

func (conn *Connector) GetCompositeScheduleRequest(duration int) (*smartcharging.GetCompositeScheduleConfirmation, error)

func (*Connector) GetMaxCurrent

func (conn *Connector) GetMaxCurrent() (float64, error)

GetMaxCurrent returns the maximum phase current the charge point is set to offer

func (*Connector) GetMaxPower

func (conn *Connector) GetMaxPower() (float64, error)

GetMaxPower returns the maximum power the charge point is set to offer

func (*Connector) GetScheduleLimit

func (conn *Connector) GetScheduleLimit(duration int) (float64, error)

getScheduleLimit queries the current or power limit the charge point is currently set to offer

func (*Connector) ID

func (conn *Connector) ID() int

func (*Connector) IdTag

func (conn *Connector) IdTag() string

func (*Connector) Initialized

func (conn *Connector) Initialized() error

Initialized waits for initial charge point status notification

func (*Connector) NeedsAuthentication

func (conn *Connector) NeedsAuthentication() bool

NeedsAuthentication checks if local authentication or an initial RemoteStartTransaction is required

func (*Connector) OnMeterValues

func (conn *Connector) OnMeterValues(request *core.MeterValuesRequest) (*core.MeterValuesConfirmation, error)

func (*Connector) OnStartTransaction

func (conn *Connector) OnStartTransaction(request *core.StartTransactionRequest) (*core.StartTransactionConfirmation, error)

func (*Connector) OnStatusNotification

func (conn *Connector) OnStatusNotification(request *core.StatusNotificationRequest) (*core.StatusNotificationConfirmation, error)

func (*Connector) OnStopTransaction

func (conn *Connector) OnStopTransaction(request *core.StopTransactionRequest) (*core.StopTransactionConfirmation, error)

func (*Connector) RemoteStartTransactionRequest

func (conn *Connector) RemoteStartTransactionRequest(idTag string) error

func (*Connector) SetChargingProfileRequest

func (conn *Connector) SetChargingProfileRequest(profile *types.ChargingProfile) error

func (*Connector) Soc

func (conn *Connector) Soc() (float64, error)

func (*Connector) Status

func (conn *Connector) Status() (core.ChargePointStatus, error)

Status returns the unmapped charge point status

func (*Connector) TestClock

func (conn *Connector) TestClock(clock clock.Clock)

func (*Connector) TotalEnergy

func (conn *Connector) TotalEnergy() (float64, error)

func (*Connector) TransactionID

func (conn *Connector) TransactionID() (int, error)

TransactionID returns the current transaction id

func (*Connector) TriggerMessageRequest

func (conn *Connector) TriggerMessageRequest(requestedMessage remotetrigger.MessageTrigger) error

func (*Connector) Voltages

func (conn *Connector) Voltages() (float64, float64, float64, error)

func (*Connector) WatchDog

func (conn *Connector) WatchDog(timeout time.Duration)

WatchDog triggers meter values messages if older than timeout. Must be wrapped in a goroutine.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL