Documentation
¶
Overview ¶
Implements simple PID based power controller.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrProgramAlreadyRunning = errors.New("program already running") ErrNoProgramRunning = errors.New("no program running") )
Functions ¶
This section is empty.
Types ¶
type ControlEngine ¶
type ControlEngine struct {
// contains filtered or unexported fields
}
func NewEngine ¶
func NewEngine(config *types.ExecutorConfig, storage *storage.ProgramStorage) *ControlEngine
func (*ControlEngine) CurrentStatus ¶
func (engine *ControlEngine) CurrentStatus() *types.ExecutionStatus
func (*ControlEngine) StartEngine ¶
func (engine *ControlEngine) StartEngine(program *types.Program) error
func (*ControlEngine) StopEngine ¶
func (engine *ControlEngine) StopEngine() error
type PidController ¶
type PidController struct { Config *types.PidSettings State PidControllerState }
func NewPidController ¶
func NewPidController(config *types.PidSettings) *PidController
func (*PidController) Reset ¶
func (c *PidController) Reset()
type PidControllerState ¶
type PidControllerState struct { CurrentError float64 CurrentErrorIntegral float64 CurrentErrorDerivative float64 PreviousUpdate int64 }
PidControllerState holds mutable state for a PidController.
type PowerCommand ¶
type PowerCommand struct { Command PowerStatus `json:"command"` Percent uint8 `json:"percent,omitempty"` }
type PowerController ¶
type PowerController struct { PidController *PidController ConstantPower uint8 TargetTemperature float64 MaxDelta float64 }
func NewPowerController ¶
func NewPowerController(targetTemperature float64, settings *types.PowerPidSettings, defaultPidSettings *types.PidSettings) *PowerController
New power controller with the given configuration and settings. If the Power is set to non zero value, the PID settings are ignored.
type PowerResponse ¶
type PowerResponse struct { Status PowerStatus `json:"status"` Percent int `json:"percent,omitempty"` }
type PowerStatus ¶
type PowerStatus string
const ( PowerOn PowerStatus = "On" PowerOff PowerStatus = "Off" )
type PowerStatusResponse ¶
type PowerStatusResponse struct {
Data map[string]PowerResponse `json:"data"`
}
Click to show internal directories.
Click to hide internal directories.