common

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CommodityHasQuantity

func CommodityHasQuantity(commodity generated.Commodity, quantity generated.CommodityQuantity) (bool, error)

CommodityHasQuantity returns a bool indicating whether the commodity has the respective quantity. If the commodity is unsupported, it returns an error.

Types

type Duration

type Duration struct {
	Milliseconds uint64 `json:"milliseconds" description:"Duration in milliseconds"`
}

func FromMilliseconds

func FromMilliseconds(time uint64) *Duration

FromMilliseconds creates a new Duration from milliseconds

func FromTimedelta

func FromTimedelta(duration time.Duration) *Duration

FromTimedelta creates a new Duration from time.Duration

func NewDuration

func NewDuration(d uint64) *Duration

NewDuration creates a new Duration

func NewVarDuration

func NewVarDuration(n uint64, milliseconds []uint64) ([]*Duration, error)

NewVarDuration creates n number of new Duration types

func (*Duration) ModifyDuration

func (d *Duration) ModifyDuration(newDur uint64) *Duration

ModifyDuration changes the duration of a Duration instance.

func (*Duration) ToTimedelta

func (d *Duration) ToTimedelta() time.Duration

ToTimedelta converts Duration to time.Duration

type Handshake

type Handshake struct {
	MessageID                 *generated.ID                  `json:"message_id" description:"ID of this message"`
	MessageType               string                         `json:"message_type" description:"Handshake" const:"true"`
	Role                      generated.EnergyManagementRole `json:"role" description:"The role of the sender of this message"`
	SupportedProtocolVersions *[]string                      `` /* 192-byte string literal not displayed */
}

Handshake represents a handshake message.

func NewHandshake

func NewHandshake(role generated.EnergyManagementRole, supportedProtocols []string) (*Handshake, error)

NewHandshake creates a new Handshake instance.

func NewVarHandshake

func NewVarHandshake(roles []generated.EnergyManagementRole, supportedProtocols [][]string) ([]*Handshake, error)

NewVarHandshake creates multiple instances of Handshakes.

func (*Handshake) SetMessageID

func (h *Handshake) SetMessageID(pattern string) *Handshake

SetMessageID sets a new MessageID based on the pattern string given in the Handshake.

func (*Handshake) SetSupportedProtocolVersions

func (h *Handshake) SetSupportedProtocolVersions(s []string) *Handshake

SetSupportedProtocolVersions sets the protocol versions in the Handshake.

type HandshakeResponse

type HandshakeResponse struct {
	MessageID               *generated.ID `json:"message_id" description:"ID of this message"`
	MessageType             string        `json:"message_type" description:"HandshakeResponse" const:"true"`
	SelectedProtocolVersion *[]string     `json:"selected_protocol_version" description:"The protocol version the CEM selected for this session"`
}

HandshakeResponse represents the handshake response message.

func NewHandshakeResponse

func NewHandshakeResponse(handshake *Handshake) (*HandshakeResponse, error)

NewHandshakeResponse creates a new instance of the HandshakeResponse.

func (*HandshakeResponse) GetSelectedProtocolVersions

func (h *HandshakeResponse) GetSelectedProtocolVersions() *[]string

GetSelectedProtocolVersions returns a slice of the protocol versions defined in the HandshakeResponse.

type InstructionStatusUpdate

type InstructionStatusUpdate struct {
	InstructionID *generated.ID               `json:"instruction_id" description:"ID of this instruction (as provided by the CEM)"`
	MessageID     *generated.ID               `json:"message_id" description:"ID of this message"`
	MessageType   string                      `json:"message_type" description:"Type of the message" const:"true"`
	StatusType    generated.InstructionStatus `json:"status_type" description:"Present status of this instruction."`
	Timestamp     time.Time                   `json:"timestamp" description:"Timestamp when status_type has changed the last time."`
}

func NewInstructionStatusUpdate

func NewInstructionStatusUpdate(statusType generated.InstructionStatus) (*InstructionStatusUpdate, error)

NewInstructionStatusUpdate creates a new instance of InstructionStatusUpdate.

func (*InstructionStatusUpdate) GetInstructionID

func (isu *InstructionStatusUpdate) GetInstructionID() *generated.ID

InstructionID returns the instruction ID field info

func (*InstructionStatusUpdate) GetMessageID

func (isu *InstructionStatusUpdate) GetMessageID() *generated.ID

GetMessageID returns the message ID field info

type NumberRange

type NumberRange struct {
	EndOfRange   float64 `json:"end_of_range" description:"Number that defines the end of the range"`
	StartOfRange float64 `json:"start_of_range" description:"Number that defines the start of the range"`
}

func NewNumberRange

func NewNumberRange(start float64, end float64) (*NumberRange, error)

NewNumberRange creates a new NumberRange instance

func (*NumberRange) Equals

func (nr *NumberRange) Equals(other *NumberRange) bool

Equals checks if two NumberRange instances are equal

func (*NumberRange) Hash

func (nr *NumberRange) Hash() string

Hash calculates the hash of the NumberRange instance

func (*NumberRange) ValidateStartEndOrder

func (nr *NumberRange) ValidateStartEndOrder() error

ValidateStartEndOrder validates the order of start and end values

type PowerForecast

type PowerForecast struct {
	Elements    []*PowerForecastElement `` /* 150-byte string literal not displayed */
	MessageID   *generated.ID           `json:"message_id" description:"ID of this message"`
	MessageType string                  `json:"message_type" description:"Type of this message" const:"PowerForecast"`
	StartTime   time.Time               `json:"start_time" description:"Start time of time period that is covered by the profile."`
}

func NewPowerForecast

func NewPowerForecast(elements []*PowerForecastElement, startTime int64) (*PowerForecast, error)

NewPowerForecast creates a new instance of PowerForecast and an error

type PowerForecastElement

type PowerForecastElement struct {
	Duration    *Duration             `json:"duration" description:"Duration of the PowerForecastElement"`
	PowerValues []*PowerForecastValue `json:"power_values" description:"The values of power that are expected for the given period of time."`
}

func NewPowerForecastElement

func NewPowerForecastElement(duration *Duration, powerValues []*PowerForecastValue) (*PowerForecastElement, error)

NewPowerForecastElement creates a new PowerForecastElement instance and returns an error if validation fails

type PowerForecastValue

type PowerForecastValue struct {
	CommodityQuantity generated.CommodityQuantity `json:"commodity_quantity" description:"The power quantity the value refers to"`
	ValueExpected     float64                     `json:"value_expected" description:"The expected power value."`
	ValueLower68PPR   *float64                    `json:"value_lower_68PPR,omitempty" description:"The lower boundary of the range with 68% certainty the power value is in it"`
	ValueLower95PPR   *float64                    `json:"value_lower_95PPR,omitempty" description:"The lower boundary of the range with 95% certainty the power value is in it"`
	ValueLowerLimit   *float64                    `json:"value_lower_limit,omitempty" description:"The lower boundary of the range with 100% certainty the power value is in it"`
	ValueUpper68PPR   *float64                    `json:"value_upper_68PPR,omitempty" description:"The upper boundary of the range with 68% certainty the power value is in it"`
	ValueUpper95PPR   *float64                    `json:"value_upper_95PPR,omitempty" description:"The upper boundary of the range with 95% certainty the power value is in it"`
	ValueUpperLimit   *float64                    `json:"value_upper_limit,omitempty" description:"The upper boundary of the range with 100% certainty the power value is in it"`
}

func NewPowerForecastValue

func NewPowerForecastValue(commodity generated.CommodityQuantity, valueExp float64, optionalValues ...*float64) (*PowerForecastValue, error)

NewPowerForecast creates a new instance of the PowerForecast value and an error.

type PowerMeasurement

type PowerMeasurement struct {
	MeasurementTimestamp time.Time     `json:"measurement_timestamp" description:"Timestamp when PowerValues were measured."`
	MessageID            *generated.ID `json:"message_id" description:"ID of this message"`
	MessageType          string        `json:"message_type" description:"Type of the message"`
	Values               *[]PowerValue `json:"values" description:"Array of measured PowerValues"`
}

func NewPowerMeasurement

func NewPowerMeasurement(values *[]PowerValue) (*PowerMeasurement, error)

NewPowerMeasurement creates a new instance of PowerMeasurement and returns an error if any validation fai

type PowerRange

type PowerRange struct {
	CommodityQuantity generated.CommodityQuantity `json:"commodity_quantity" description:"The power quantity the values refer to"`
	EndOfRange        float64                     `json:"end_of_range" description:"Power value that defines the end of the range."`
	StartOfRange      float64                     `json:"start_of_range" description:"Power value that defines the start of the range."`
}

func NewPowerRange

func NewPowerRange(commodity generated.CommodityQuantity, start float64, end float64) (*PowerRange, error)

NewPowerRange creates a new PowerRange instance and returns an error if validation fails

type PowerValue

type PowerValue struct {
	CommodityQuantity generated.CommodityQuantity `json:"commodity_quantity" description:"The power quantity the value refers to"`
	Value             float64                     `json:"value" description:"Power value expressed in the unit associated with the CommodityQuantity"`
}

func NewPowerValue

func NewPowerValue(commodity generated.CommodityQuantity, value float64) (*PowerValue, error)

NewPowerValue creates a new instance of the PowerValue type and returns an error if validation fails.

type ReceptionStatus

type ReceptionStatus struct {
	DiagnosticLabel *string `` // USed a pointer due optional
	/* 130-byte string literal not displayed */
	MessageType      string                           `json:"message_type" description:"Type of the message"`
	Status           *generated.ReceptionStatusValues `json:"status" description:"Enumeration of status values"`
	SubjectMessageID *generated.ID                    `json:"subject_message_id" description:"The message this ReceptionStatus refers to"`
}

func NewReceptionStatus

func NewReceptionStatus(status *generated.ReceptionStatusValues, subjectMessageID *generated.ID, label *string) (*ReceptionStatus, error)

NewReceptionSatus creates new ReceptionStatusInstances with the subjectmessageid as the messages's ID.

type ResourceManagerDetails

type ResourceManagerDetails struct {
	AvailableControlTypes        []generated.ControlType       `` /* 126-byte string literal not displayed */
	Currency                     generated.Currency            `` /* 140-byte string literal not displayed */
	FirmwareVersion              *string                       `` /* 132-byte string literal not displayed */
	InstructionProcessingDelay   *Duration                     `` /* 183-byte string literal not displayed */
	Manufacturer                 *string                       `json:"manufacturer,omitempty" description:"Name of Manufacturer"`
	MessageID                    *generated.ID                 `json:"message_id" description:"ID of this message"`
	MessageType                  string                        `json:"message_type" description:"Type of this message" const:"ResourceManagerDetails"`
	Model                        *string                       `json:"model,omitempty" description:"Name of the model of the device (provided by the manufacturer)"`
	Name                         *string                       `json:"name,omitempty" description:"Human readable name given by user"`
	ProvidesForecast             bool                          `json:"provides_forecast" description:"Indicates whether the ResourceManager is able to provide PowerForecasts"`
	ProvidesPowerMeasurementType []generated.CommodityQuantity `` /* 172-byte string literal not displayed */
	ResourceID                   *generated.ID                 `json:"resource_id" description:"Identifier of the Resource Manager. Must be unique within the scope of the CEM."`
	Roles                        []*Role                       `json:"roles" description:"Each Resource Manager provides one or more energy Roles" min_items:"1" max_items:"3"`
	SerialNumber                 *string                       `json:"serial_number,omitempty" description:"Serial number of the device (provided by the manufacturer)"`
}

func NewResourceManagerDetails

func NewResourceManagerDetails(
	availableControlTypes []generated.ControlType,
	currency generated.Currency,
	firmwareVersion, manufacturer, model, name string,
	instructionProcessingDelay *Duration,
	providesForecast bool,
	providesPowerMeasurementType []generated.CommodityQuantity,
	resourceID *generated.ID,
	roles []*Role,

	serialNumber string,
) (*ResourceManagerDetails, error)

NewResourceManagerDetails creates a new ResourceManagerDetails instance and returns an error if validation fails

type RevokeObject

type RevokeObject struct {
	MessageID   *generated.ID             `json:"message_id" description:"ID of this message"`
	MessageType string                    `json:"message_type" description:"Type of this message"`
	ObjectID    *generated.ID             `json:"object_id" description:"ID of object that needs to be revoked"`
	ObjectType  generated.RevokableObject `json:"object_type" description:"Type of object that needs to be revoked"`
}

func NewRevokeObject

func NewRevokeObject(objectID *generated.ID, objectType generated.RevokableObject) (*RevokeObject, error)

NewRevokeObject crewates a new instance of the RevokeObject and an error

type Role

type Role struct {
	Commodity generated.Commodity `json:"commodity" description:"Commodity the role refers to."`
	Role      generated.RoleType  `json:"role" description:"Role type of the Resource Manager for the given commodity"`
}

func NewRole

func NewRole(commodity generated.Commodity, role generated.RoleType) (*Role, error)

NewRole creates a new Role instance and returns an error if validation fails

type SelectControlType

type SelectControlType struct {
	ControlType generated.ControlType `json:"control_type" description:"The ControlType to activate"`
	MessageID   *generated.ID         `json:"message_id" description:"ID of this message"`
	MessageType string                `json:"message_type" description:"Type of this message"`
}

func NewSelectControlType

func NewSelectControlType(controlType generated.ControlType) (*SelectControlType, error)

NewSelectControlType creates a new instance of SelectControlType.

type SessionRequest

type SessionRequest struct {
	DiagnosticLabel *string                      `json:"diagnostic_label,omitempty" description:"Optional field for a human readable description for debugging purposes"`
	MessageID       *generated.ID                `json:"message_id" description:"ID of this message"`
	MessageType     string                       `json:"message_type" const:"true"`
	Request         generated.SessionRequestType `json:"request" description:"The type of request"`
}

func NewSessionRequest

func NewSessionRequest(request generated.SessionRequestType, diagnosticLabel ...string) (*SessionRequest, error)

NewSessionRequest creates a new instance of SessionRequest.

type Timer

type Timer struct {
	DiagnosticLabel *string       `json:"diagnostic_label,omitempty" description:"Human readable name/description of the Timer"`
	Duration        *Duration     `json:"duration" description:"The time it takes for the Timer to finish after it has been started"`
	ID              *generated.ID `` /* 173-byte string literal not displayed */
}

Timer represents a timer with a duration and optional diagnostic label.

func NewTimer

func NewTimer(duration *Duration, diagnosticLabel ...string) (*Timer, error)

NewTimer creates a new Timer instance.

type Transition

type Transition struct {
	AbnormalConditionOnly bool            `json:"abnormal_condition_only" description:"Indicates if this Transition may only be used during an abnormal condition."`
	BlockingTimers        []*generated.ID `` /* 185-byte string literal not displayed */
	From                  *generated.ID   `` /* 130-byte string literal not displayed */
	ID                    *generated.ID   `` /* 178-byte string literal not displayed */
	StartTimers           []*generated.ID `` /* 143-byte string literal not displayed */
	To                    *generated.ID   `json:"to" description:"ID of the OperationMode (exact type differs per ControlType) that will be switched to."`
	TransitionCosts       *float64        `` /* 156-byte string literal not displayed */
	TransitionDuration    *Duration       `` /* 228-byte string literal not displayed */
}

Transition represents a transition between operation modes.

func NewTransition

func NewTransition(id *generated.ID, from *generated.ID, to *generated.ID, startTimers []*generated.ID, blockingTimers []*generated.ID, abnormalConditionOnly bool, transitionCosts *float64, transitionDuration *Duration) (*Transition, error)

NewTransition creates a new instance of Transition.

Jump to

Keyboard shortcuts

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