uclpcserver

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: May 18, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Load control obligation limit data update received
	//
	// Use `ConsumptionLimit` to get the current data
	//
	// Use Case LPC, Scenario 1
	DataUpdateLimit api.EventType = "DataUpdateLimit"

	// An incoming load control obligation limit needs to be approved or denied
	//
	// Use `PendingConsumptionLimits` to get the currently pending write approval requests
	// and invoke `ApproveOrDenyConsumptionLimit` for each
	//
	// Use Case LPC, Scenario 1
	WriteApprovalRequired api.EventType = "WriteApprovalRequired"

	// Failsafe limit for the consumed active (real) power of the
	// Controllable System data update received
	//
	// Use `FailsafeConsumptionActivePowerLimit` to get the current data
	//
	// Use Case LPC, Scenario 2
	DataUpdateFailsafeConsumptionActivePowerLimit api.EventType = "DataUpdateFailsafeConsumptionActivePowerLimit"

	// Minimum time the Controllable System remains in "failsafe state" unless conditions
	// specified in this Use Case permit leaving the "failsafe state" data update received
	//
	// Use `FailsafeDurationMinimum` to get the current data
	//
	// Use Case LPC, Scenario 2
	DataUpdateFailsafeDurationMinimum api.EventType = "DataUpdateFailsafeDurationMinimum"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type UCLPCServer

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

func NewUCLPC

func NewUCLPC(service eebusapi.ServiceInterface, eventCB api.EntityEventCallback) *UCLPCServer

func (*UCLPCServer) AddFeatures

func (e *UCLPCServer) AddFeatures()

func (*UCLPCServer) AddUseCase

func (e *UCLPCServer) AddUseCase()

func (*UCLPCServer) ApproveOrDenyConsumptionLimit

func (e *UCLPCServer) ApproveOrDenyConsumptionLimit(msgCounter model.MsgCounterType, approve bool, reason string)

accept or deny an incoming consumption write limit

use PendingConsumptionLimits to get the list of currently pending requests

func (*UCLPCServer) ConsumptionLimit

func (e *UCLPCServer) ConsumptionLimit() (limit api.LoadLimit, resultErr error)

return the current loadcontrol limit data

return values:

  • limit: load limit data

possible errors:

  • ErrDataNotAvailable if no such limit is (yet) available
  • and others

func (*UCLPCServer) ContractualConsumptionNominalMax

func (e *UCLPCServer) ContractualConsumptionNominalMax() (value float64, resultErr error)

return nominal maximum active (real) power the Controllable System is allowed to consume due to the customer's contract.

func (*UCLPCServer) FailsafeConsumptionActivePowerLimit

func (e *UCLPCServer) FailsafeConsumptionActivePowerLimit() (limit float64, isChangeable bool, resultErr error)

return Failsafe limit for the consumed active (real) power of the Controllable System. This limit becomes activated in "init" state or "failsafe state".

func (*UCLPCServer) FailsafeDurationMinimum

func (e *UCLPCServer) FailsafeDurationMinimum() (duration time.Duration, isChangeable bool, resultErr error)

return minimum time the Controllable System remains in "failsafe state" unless conditions specified in this Use Case permit leaving the "failsafe state"

func (*UCLPCServer) HandleEvent

func (e *UCLPCServer) HandleEvent(payload spineapi.EventPayload)

handle SPINE events

func (*UCLPCServer) IsUseCaseSupported

func (e *UCLPCServer) IsUseCaseSupported(entity spineapi.EntityRemoteInterface) (bool, error)

returns if the entity supports the usecase

possible errors:

  • ErrDataNotAvailable if that information is not (yet) available
  • and others

func (*UCLPCServer) PendingConsumptionLimits

func (e *UCLPCServer) PendingConsumptionLimits() map[model.MsgCounterType]api.LoadLimit

return the currently pending incoming consumption write limits

func (*UCLPCServer) SetConsumptionLimit

func (e *UCLPCServer) SetConsumptionLimit(limit api.LoadLimit) (resultErr error)

set the current loadcontrol limit data

func (*UCLPCServer) SetContractualConsumptionNominalMax

func (e *UCLPCServer) SetContractualConsumptionNominalMax(value float64) error

set nominal maximum active (real) power the Controllable System is allowed to consume due to the customer's contract.

func (*UCLPCServer) SetFailsafeConsumptionActivePowerLimit

func (e *UCLPCServer) SetFailsafeConsumptionActivePowerLimit(value float64, changeable bool) error

set Failsafe limit for the consumed active (real) power of the Controllable System. This limit becomes activated in "init" state or "failsafe state".

func (*UCLPCServer) SetFailsafeDurationMinimum

func (e *UCLPCServer) SetFailsafeDurationMinimum(duration time.Duration, changeable bool) error

set minimum time the Controllable System remains in "failsafe state" unless conditions specified in this Use Case permit leaving the "failsafe state"

parameters:

  • duration: has to be >= 2h and <= 24h
  • changeable: boolean if the client service can change this value

func (*UCLPCServer) UpdateUseCaseAvailability

func (e *UCLPCServer) UpdateUseCaseAvailability(available bool)

func (*UCLPCServer) UseCaseName

func (c *UCLPCServer) UseCaseName() model.UseCaseNameType

type UCLPCServerInterface

type UCLPCServerInterface interface {
	api.UseCaseInterface

	// return the current consumption limit data
	//
	// return values:
	//   - limit: load limit data
	//
	// possible errors:
	//   - ErrDataNotAvailable if no such limit is (yet) available
	//   - and others
	ConsumptionLimit() (api.LoadLimit, error)

	// set the current loadcontrol limit data
	SetConsumptionLimit(limit api.LoadLimit) (resultErr error)

	// return the currently pending incoming consumption write limits
	PendingConsumptionLimits() map[model.MsgCounterType]api.LoadLimit

	// accept or deny an incoming consumption write limit
	//
	// parameters:
	//  - msg: the incoming write message
	//  - approve: if the write limit for msg should be approved or not
	//  - reason: the reason why the approval is denied, otherwise an empty string
	ApproveOrDenyConsumptionLimit(msgCounter model.MsgCounterType, approve bool, reason string)

	// return Failsafe limit for the consumed active (real) power of the
	// Controllable System. This limit becomes activated in "init" state or "failsafe state".
	//
	// return values:
	//   - value: the power limit in W
	//   - changeable: boolean if the client service can change the limit
	FailsafeConsumptionActivePowerLimit() (value float64, isChangeable bool, resultErr error)

	// set Failsafe limit for the consumed active (real) power of the
	// Controllable System. This limit becomes activated in "init" state or "failsafe state".
	//
	// parameters:
	//   - value: the power limit in W
	//   - changeable: boolean if the client service can change the limit
	SetFailsafeConsumptionActivePowerLimit(value float64, changeable bool) (resultErr error)

	// return minimum time the Controllable System remains in "failsafe state" unless conditions
	// specified in this Use Case permit leaving the "failsafe state"
	//
	// return values:
	//   - value: the power limit in W
	//   - changeable: boolean if the client service can change the limit
	FailsafeDurationMinimum() (duration time.Duration, isChangeable bool, resultErr error)

	// set minimum time the Controllable System remains in "failsafe state" unless conditions
	// specified in this Use Case permit leaving the "failsafe state"
	//
	// parameters:
	//   - duration: has to be >= 2h and <= 24h
	//   - changeable: boolean if the client service can change this value
	SetFailsafeDurationMinimum(duration time.Duration, changeable bool) (resultErr error)

	// return nominal maximum active (real) power the Controllable System is
	// allowed to consume due to the customer's contract.
	ContractualConsumptionNominalMax() (float64, error)

	// set nominal maximum active (real) power the Controllable System is
	// allowed to consume due to the customer's contract.
	//
	// parameters:
	//   - value: contractual nominal max power consumption in W
	SetContractualConsumptionNominalMax(value float64) (resultErr error)
}

interface for the Limitation of Power Consumption UseCase as a server

Jump to

Keyboard shortcuts

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