reservation

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: May 30, 2022 License: MIT Imports: 4 Imported by: 7

Documentation

Overview

The reservation functional block contains OCPP 2.0 features that enable EV drivers to make and manage reservations of charging stations.

Index

Constants

View Source
const CancelReservationFeatureName = "CancelReservation"
View Source
const ProfileName = "reservation"
View Source
const ReservationStatusUpdateFeatureName = "ReservationStatusUpdate"
View Source
const ReserveNowFeatureName = "ReserveNow"

Variables

Functions

This section is empty.

Types

type CSMSHandler

type CSMSHandler interface {
	// OnReservationStatusUpdate is called on the CSMS whenever a ReservationStatusUpdateRequest is received from a charging station.
	OnReservationStatusUpdate(chargingStationID string, request *ReservationStatusUpdateRequest) (resp *ReservationStatusUpdateResponse, err error)
}

Needs to be implemented by a CSMS for handling messages part of the OCPP 2.0 Reservation profile.

type CancelReservationFeature

type CancelReservationFeature struct{}

To cancel a reservation the CSMS SHALL send an CancelReservationRequest to the Charging Station. If the Charging Station has a reservation matching the reservationId in the request payload, it SHALL return status ‘Accepted’. Otherwise it SHALL return ‘Rejected’.

func (CancelReservationFeature) GetFeatureName

func (f CancelReservationFeature) GetFeatureName() string

func (CancelReservationFeature) GetRequestType

func (f CancelReservationFeature) GetRequestType() reflect.Type

func (CancelReservationFeature) GetResponseType

func (f CancelReservationFeature) GetResponseType() reflect.Type

type CancelReservationRequest

type CancelReservationRequest struct {
	ReservationID int `json:"reservationId" validate:"gte=0"`
}

The field definition of the CancelReservation request payload sent by the CSMS to the Charging Station.

func NewCancelReservationRequest

func NewCancelReservationRequest(reservationId int) *CancelReservationRequest

Creates a new CancelReservationRequest, containing all required fields. There are no optional fields for this message.

func (CancelReservationRequest) GetFeatureName

func (r CancelReservationRequest) GetFeatureName() string

type CancelReservationResponse

type CancelReservationResponse struct {
	Status     CancelReservationStatus `json:"status" validate:"required,cancelReservationStatus"`
	StatusInfo *types.StatusInfo       `json:"statusInfo,omitempty" validate:"omitempty"`
}

This field definition of the CancelReservation response payload, sent by the Charging Station to the CSMS in response to a CancelReservationRequest. In case the request was invalid, or couldn't be processed, an error will be sent instead.

func NewCancelReservationResponse

func NewCancelReservationResponse(status CancelReservationStatus) *CancelReservationResponse

Creates a new CancelReservationResponse, containing all required fields. There are no optional fields for this message.

func (CancelReservationResponse) GetFeatureName

func (c CancelReservationResponse) GetFeatureName() string

type CancelReservationStatus

type CancelReservationStatus string

Status reported in CancelReservationResponse.

const (
	CancelReservationStatusAccepted CancelReservationStatus = "Accepted"
	CancelReservationStatusRejected CancelReservationStatus = "Rejected"
)

type ChargingStationHandler

type ChargingStationHandler interface {
	// OnCancelReservation is called on a charging station whenever a CancelReservationRequest is received from the CSMS.
	OnCancelReservation(request *CancelReservationRequest) (resp *CancelReservationResponse, err error)
	// OnReserveNow is called on a charging station whenever a ReserveNowRequest is received from the CSMS.
	OnReserveNow(request *ReserveNowRequest) (resp *ReserveNowResponse, err error)
}

Needs to be implemented by Charging stations for handling messages part of the OCPP 2.0 Reservation profile.

type ConnectorType

type ConnectorType string

Allowed ConnectorType, as supported by most charging station vendors. The OCPP protocol directly supports the most widely known connector types. For not mentioned types, refer to the Other1PhMax16A, Other1PhOver16A and Other3Ph fallbacks.

const (
	ConnectorTypeCCS1              ConnectorType = "cCCS1"           // Combined Charging System 1 (captive cabled) a.k.a. Combo 1
	ConnectorTypeCCS2              ConnectorType = "cCCS2"           // Combined Charging System 2 (captive cabled) a.k.a. Combo 2
	ConnectorTypeG105              ConnectorType = "cG105"           // JARI G105-1993 (captive cabled) a.k.a. CHAdeMO
	ConnectorTypeTesla             ConnectorType = "cTesla"          // Tesla Connector
	ConnectorTypeCType1            ConnectorType = "cType1"          // IEC62196-2 Type 1 connector (captive cabled) a.k.a. J1772
	ConnectorTypeCType2            ConnectorType = "cType2"          // IEC62196-2 Type 2 connector (captive cabled) a.k.a. Mennekes connector
	ConnectorType3091P16A          ConnectorType = "s309-1P-16A"     // 16A 1 phase IEC60309 socket
	ConnectorType3091P32A          ConnectorType = "s309-1P-32A"     // 32A 1 phase IEC60309 socket
	ConnectorType3093P16A          ConnectorType = "s309-3P-16A"     // 16A 3 phase IEC60309 socket
	ConnectorType3093P32A          ConnectorType = "s309-3P-32A"     // 32A 3 phase IEC60309 socket
	ConnectorTypeBS1361            ConnectorType = "sBS1361"         // UK domestic socket a.k.a. 13Amp
	ConnectorTypeCEE77             ConnectorType = "sCEE-7-7"        // CEE 7/7 16A socket. May represent 7/4 & 7/5 a.k.a Schuko
	ConnectorTypeSType2            ConnectorType = "sType2"          // EC62196-2 Type 2 socket a.k.a. Mennekes connector
	ConnectorTypeSType3            ConnectorType = "sType3"          // IEC62196-2 Type 2 socket a.k.a. Scame
	ConnectorTypeOther1PhMax16A    ConnectorType = "Other1PhMax16A"  // Other single phase (domestic) sockets not mentioned above, rated at no more than 16A. CEE7/17, AS3112, NEMA 5-15, NEMA 5-20, JISC8303, TIS166, SI 32, CPCS-CCC, SEV1011, etc.
	ConnectorTypeOther1PhOver16A   ConnectorType = "Other1PhOver16A" // Other single phase sockets not mentioned above (over 16A)
	ConnectorTypeOther3Ph          ConnectorType = "Other3Ph"        // Other 3 phase sockets not mentioned above. NEMA14-30, NEMA14-50.
	ConnectorTypePan               ConnectorType = "Pan"             // Pantograph connector
	ConnectorTypeWirelessInductive ConnectorType = "wInductive"      // Wireless inductively coupled connection
	ConnectorTypeWirelessResonant  ConnectorType = "wResonant"       // Wireless resonant coupled connection
	ConnectorTypeUndetermined      ConnectorType = "Undetermined"    // Yet to be determined (e.g. before plugged in)
	ConnectorTypeUnknown           ConnectorType = "Unknown"         // Unknown; not determinable
)

type ReservationStatusUpdateFeature

type ReservationStatusUpdateFeature struct{}

A Charging Station shall cancel an existing reservation when:

  • the status of a targeted EVSE changes to either Faulted or Unavailable
  • the reservation has expired, before the EV driver started using the Charging Station

This message is not triggered, if a reservation is explicitly canceled by the user or the CSMS.

The Charging Station sends a ReservationStatusUpdateRequest to the CSMS, with the according status set. The CSMS responds with a ReservationStatusUpdateResponse.

func (ReservationStatusUpdateFeature) GetFeatureName

func (f ReservationStatusUpdateFeature) GetFeatureName() string

func (ReservationStatusUpdateFeature) GetRequestType

func (f ReservationStatusUpdateFeature) GetRequestType() reflect.Type

func (ReservationStatusUpdateFeature) GetResponseType

func (f ReservationStatusUpdateFeature) GetResponseType() reflect.Type

type ReservationStatusUpdateRequest

type ReservationStatusUpdateRequest struct {
	ReservationID int                     `json:"reservationId" validate:"gte=0"`
	Status        ReservationUpdateStatus `json:"reservationUpdateStatus" validate:"required,reservationUpdateStatus"`
}

The field definition of the ReservationStatusUpdate request payload sent by the Charging Station to the CSMS.

func NewReservationStatusUpdateRequest

func NewReservationStatusUpdateRequest(reservationID int, status ReservationUpdateStatus) *ReservationStatusUpdateRequest

Creates a new ReservationStatusUpdateRequest, containing all required fields. There are no optional fields for this message.

func (ReservationStatusUpdateRequest) GetFeatureName

func (r ReservationStatusUpdateRequest) GetFeatureName() string

type ReservationStatusUpdateResponse

type ReservationStatusUpdateResponse struct {
}

This field definition of the ReservationStatusUpdate response payload, sent by the CSMS to the Charging Station in response to a ReservationStatusUpdateRequest. In case the request was invalid, or couldn't be processed, an error will be sent instead.

func NewReservationStatusUpdateResponse

func NewReservationStatusUpdateResponse() *ReservationStatusUpdateResponse

Creates a new ReservationStatusUpdateResponse, which doesn't contain any required or optional fields.

func (ReservationStatusUpdateResponse) GetFeatureName

func (c ReservationStatusUpdateResponse) GetFeatureName() string

type ReservationUpdateStatus

type ReservationUpdateStatus string

Status reported in ReservationStatusUpdateRequest.

const (
	ReservationUpdateStatusExpired ReservationUpdateStatus = "Expired"
	ReservationUpdateStatusRemoved ReservationUpdateStatus = "Removed"
)

type ReserveNowFeature

type ReserveNowFeature struct{}

To ensure an EV drive can charge their EV at a charging station, the EV driver may make a reservation until a certain expiry time. A user may reserve a specific EVSE.

The EV driver asks the CSMS to reserve an unspecified EVSE at a charging station. The CSMS sends a ReserveNowRequest to a charging station. The charging station responds with ReserveNowResponse, with an according status.

After confirming a reservation, the charging station shall asynchronously send a StatusNotificationRequest to the CSMS.

func (ReserveNowFeature) GetFeatureName

func (f ReserveNowFeature) GetFeatureName() string

func (ReserveNowFeature) GetRequestType

func (f ReserveNowFeature) GetRequestType() reflect.Type

func (ReserveNowFeature) GetResponseType

func (f ReserveNowFeature) GetResponseType() reflect.Type

type ReserveNowRequest

type ReserveNowRequest struct {
	ID             int               `json:"id" validate:"gte=0"` // ID of reservation
	ExpiryDateTime *types.DateTime   `json:"expiryDateTime" validate:"required"`
	ConnectorType  ConnectorType     `json:"connectorType,omitempty" validate:"omitempty,connectorType"`
	EvseID         *int              `json:"evseId,omitempty" validate:"omitempty,gte=0"`
	IdToken        types.IdTokenType `json:"idToken" validate:"required,idTokenType"`
	GroupIdToken   types.IdTokenType `json:"groupIdToken,omitempty" validate:"omitempty,idTokenType"`
}

The field definition of the ReserveNow request payload sent by the CSMS to the Charging Station.

func NewReserveNowRequest

func NewReserveNowRequest(id int, expiryDateTime *types.DateTime, idToken types.IdTokenType) *ReserveNowRequest

Creates a new ReserveNowRequest, containing all required fields. Optional fields may be set afterwards.

func (ReserveNowRequest) GetFeatureName

func (r ReserveNowRequest) GetFeatureName() string

type ReserveNowResponse

type ReserveNowResponse struct {
	Status     ReserveNowStatus  `json:"status" validate:"required,reserveNowStatus"`
	StatusInfo *types.StatusInfo `json:"statusInfo,omitempty" validate:"omitempty"`
}

This field definition of the ReserveNow response payload, sent by the Charging Station to the CSMS in response to a ReserveNowRequest. In case the request was invalid, or couldn't be processed, an error will be sent instead.

func NewReserveNowResponse

func NewReserveNowResponse(status ReserveNowStatus) *ReserveNowResponse

Creates a new ReserveNowResponse, containing all required fields. Optional fields may be set afterwards.

func (ReserveNowResponse) GetFeatureName

func (c ReserveNowResponse) GetFeatureName() string

type ReserveNowStatus

type ReserveNowStatus string

Status reported in ReserveNowResponse.

const (
	ReserveNowStatusAccepted    ReserveNowStatus = "Accepted"
	ReserveNowStatusFaulted     ReserveNowStatus = "Faulted"
	ReserveNowStatusOccupied    ReserveNowStatus = "Occupied"
	ReserveNowStatusRejected    ReserveNowStatus = "Rejected"
	ReserveNowStatusUnavailable ReserveNowStatus = "Unavailable"
)

Jump to

Keyboard shortcuts

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