Documentation ¶
Index ¶
- func NewGradientControllerAndOptions(gradientControllerProto *policylangv1.GradientController, componentIndex int, ...) (runtime.Component, fx.Option, error)
- type Controller
- type ControllerComponent
- func (cc *ControllerComponent) DynamicConfigUpdate(event notifiers.Event, unmarshaller config.Unmarshaller)
- func (cc *ControllerComponent) Execute(inPortReadings runtime.PortToValue, tickInfo runtime.TickInfo) (outPortReadings runtime.PortToValue, err error)
- func (cc *ControllerComponent) GetControlVariable() runtime.Reading
- func (cc *ControllerComponent) GetControllerOutput() runtime.Reading
- func (cc *ControllerComponent) GetSetpoint() runtime.Reading
- func (cc *ControllerComponent) GetSignal() runtime.Reading
- func (cc *ControllerComponent) Name() string
- func (cc *ControllerComponent) Type() runtime.ComponentType
- type ControllerStateReadAPI
- type GradientController
- func (g *GradientController) ComputeOutput(signal, setpoint, controlVariable runtime.Reading, ...) (runtime.Reading, error)
- func (g *GradientController) MaintainOutput(prevSetpoint, currentSetpoint runtime.Reading, _ ControllerStateReadAPI, ...) error
- func (g *GradientController) WindOutput(currentOutput, targetOutput runtime.Reading, _ ControllerStateReadAPI, ...) (runtime.Reading, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewGradientControllerAndOptions ¶
func NewGradientControllerAndOptions( gradientControllerProto *policylangv1.GradientController, componentIndex int, 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, componentIndex int, policyReadAPI iface.Policy, dynamicConfigKey string, defaultConfig *policylangv1.ControllerDynamicConfig, ) *ControllerComponent
NewControllerComponent creates a new ControllerComponent.
func (*ControllerComponent) DynamicConfigUpdate ¶ added in v0.4.0
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.PortToValue, tickInfo runtime.TickInfo) (outPortReadings runtime.PortToValue, 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) Name ¶ added in v0.14.0
func (cc *ControllerComponent) Name() string
Name implements runtime.Component.
func (*ControllerComponent) Type ¶ added in v0.14.0
func (cc *ControllerComponent) Type() runtime.ComponentType
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.