control_loop

package
v0.0.0-...-8b25b9d Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultPidConfig = PidControlLoopDefaults{
		P: 0.3,
		I: 0.02,
		D: 0.005,
	}
)

Functions

This section is empty.

Types

type ControlLoop

type ControlLoop interface {
	// Cycle advances the control loop to the next step and returns the new pwm value.
	// Note: multiple calls to Loop may not result in the same output, as
	// the control loop may take time into account or have other stateful properties.
	Cycle(target int, current int) int
}

ControlLoop defines how a FanController approaches the target value of its curve.

type DirectControlLoop

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

DirectControlLoop is a very simple control that directly applies the given target pwm. It can also be used to gracefully approach the target by utilizing the "maxPwmChangePerCycle" property.

func NewDirectControlLoop

func NewDirectControlLoop(

	maxPwmChangePerCycle *int,
) *DirectControlLoop

NewDirectControlLoop creates a DirectControlLoop, which is a very simple control that directly applies the given target pwm. It can also be used to gracefully approach the target by utilizing the "maxPwmChangePerCycle" property.

func (*DirectControlLoop) Cycle

func (l *DirectControlLoop) Cycle(target int, current int) int

type PidControlLoop

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

PidControlLoop is a PidLoop based control loop implementation.

func NewPidControlLoop

func NewPidControlLoop(
	p float64,
	i float64,
	d float64,
) *PidControlLoop

NewPidControlLoop creates a PidControlLoop, which uses a PID loop to approach the target.

func (*PidControlLoop) Cycle

func (l *PidControlLoop) Cycle(target int, current int) int

type PidControlLoopDefaults

type PidControlLoopDefaults struct {
	P float64
	I float64
	D float64
}

Jump to

Keyboard shortcuts

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