controller

package
v2.12.0 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewGradientControllerAndOptions

func NewGradientControllerAndOptions(
	gradientControllerProto *policylangv1.GradientController,
	componentID runtime.ComponentID,
	policyReadAPI iface.Policy,
) (runtime.Component, fx.Option, error)

NewGradientControllerAndOptions creates a Gradient Controller Component and its fx options.

Types

type Controller

type Controller interface {
	// ComputeOutput: Compute the output given the current and previous signal readings. Refer to last values of other readings via ControlLoopReadAPI.
	ComputeOutput(signal, setpoint, controlVariable runtime.Reading, controllerStateReadAPI ControllerStateReadAPI, tickInfo runtime.TickInfo) (runtime.Reading, error)
	// WindOutput: Wind the output given the previous and target output readings. Refer to last values of other readings via ControlLoopReadAPI.
	WindOutput(currentOutput, targetOutput runtime.Reading, controllerStateReadAPI ControllerStateReadAPI, tickInfo runtime.TickInfo) (runtime.Reading, error)
	// MaintainOutput: Try to maintain the output on setpoint change. Refer to last values of other readings via ControlLoopReadAPI.
	MaintainOutput(prevSetpoint, currentSetpoint runtime.Reading, controllerStateReadAPI ControllerStateReadAPI, tickInfo runtime.TickInfo) error
}

Controller is the interface for the controller.

type ControllerComponent

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

ControllerComponent provides a runtime.Component for Controllers. It can be initialized with a Controller implementation. It exposes a ControllerStateReadAPI for Controllers.

func NewControllerComponent

func NewControllerComponent(
	controller Controller,
	componentName string,
	shortDescription string,
	componentID string,
	policyReadAPI iface.Policy,
	dynamicConfigKey string,
	manualMode bool,
) *ControllerComponent

NewControllerComponent creates a new ControllerComponent.

func (*ControllerComponent) DynamicConfigUpdate

func (cc *ControllerComponent) DynamicConfigUpdate(event notifiers.Event, unmarshaller config.Unmarshaller)

DynamicConfigUpdate handles setting of controller.ControllerMode.

func (*ControllerComponent) Execute

func (cc *ControllerComponent) Execute(inPortReadings runtime.PortToReading, tickInfo runtime.TickInfo) (outPortReadings runtime.PortToReading, err error)

Execute implements runtime.Component.Execute.

func (*ControllerComponent) GetControlVariable

func (cc *ControllerComponent) GetControlVariable() runtime.Reading

GetControlVariable returns the control variable's last reading.

func (*ControllerComponent) GetControllerOutput

func (cc *ControllerComponent) GetControllerOutput() runtime.Reading

GetControllerOutput returns the controller output's last reading.

func (*ControllerComponent) GetSetpoint

func (cc *ControllerComponent) GetSetpoint() runtime.Reading

GetSetpoint returns the setpoint's last reading.

func (*ControllerComponent) GetSignal

func (cc *ControllerComponent) GetSignal() runtime.Reading

GetSignal returns the signal's last reading.

func (*ControllerComponent) IsActuator

func (*ControllerComponent) IsActuator() bool

IsActuator implements runtime.Component.

func (*ControllerComponent) Name

func (cc *ControllerComponent) Name() string

Name implements runtime.Component.

func (*ControllerComponent) ShortDescription

func (cc *ControllerComponent) ShortDescription() string

ShortDescription implements runtime.Component.

func (*ControllerComponent) Type

Type implements runtime.Component.

type ControllerStateReadAPI

type ControllerStateReadAPI interface {
	GetSignal() runtime.Reading
	GetSetpoint() runtime.Reading
	GetControlVariable() runtime.Reading
	GetControllerOutput() runtime.Reading
}

ControllerStateReadAPI is the interface to the Controller state.

type GradientController

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

GradientController describes gradient values.

func (*GradientController) ComputeOutput

func (g *GradientController) ComputeOutput(signal, setpoint, controlVariable runtime.Reading, controllerStateReadAPI ControllerStateReadAPI, tickInfo runtime.TickInfo) (runtime.Reading, error)

ComputeOutput based on previous and current signal reading.

func (*GradientController) MaintainOutput

func (g *GradientController) MaintainOutput(prevSetpoint, currentSetpoint runtime.Reading, _ ControllerStateReadAPI, tickInfo runtime.TickInfo) error

MaintainOutput - Gradient Controller is stateless, so a bump is inevitable.

func (*GradientController) WindOutput

func (g *GradientController) WindOutput(currentOutput, targetOutput runtime.Reading, _ ControllerStateReadAPI, tickInfo runtime.TickInfo) (runtime.Reading, error)

WindOutput - Gradient Controller relies on ControllerComponent to store the last output, returning targetOutput should wind the output.

Jump to

Keyboard shortcuts

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