generator

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: MIT Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Type   string
	Config map[string]interface{}
}

Config is the generator configuration from a profile

type Constant

type Constant struct {
	Value float64
}

Constant generator returns a fixed value

func NewConstant

func NewConstant(config map[string]interface{}) *Constant

func (*Constant) Generate

func (c *Constant) Generate(t time.Time) float64

type Daynight

type Daynight struct {
	PeakPower   float64
	SunriseHour float64
	SunsetHour  float64
	Noise       float64
}

Daynight generator simulates solar production curve

func NewDaynight

func NewDaynight(config map[string]interface{}) *Daynight

func (*Daynight) Generate

func (d *Daynight) Generate(t time.Time) float64

type Generator

type Generator interface {
	Generate(t time.Time) float64
}

Generator produces values based on simulated time

func New

func New(cfg Config) Generator

New creates a generator from configuration

type Manager

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

Manager manages multiple generators

func NewManager

func NewManager() *Manager

func (*Manager) Generate

func (m *Manager) Generate(t time.Time) map[string]float64

func (*Manager) Get

func (m *Manager) Get(name string) Generator

func (*Manager) LoadFromConfig

func (m *Manager) LoadFromConfig(configs map[string]Config)

LoadFromConfig creates generators from profile configuration

func (*Manager) Set

func (m *Manager) Set(name string, gen Generator)

type RandomWalk

type RandomWalk struct {
	Min      float64
	Max      float64
	StepSize float64
	// contains filtered or unexported fields
}

RandomWalk generator produces a random walk pattern

func NewRandomWalk

func NewRandomWalk(config map[string]interface{}) *RandomWalk

func (*RandomWalk) Generate

func (r *RandomWalk) Generate(t time.Time) float64

type Schedule

type Schedule struct {
	BaseLoad float64
	Slots    []ScheduleSlot
}

Schedule generator returns values based on time-of-day schedule

func NewSchedule

func NewSchedule(config map[string]interface{}) *Schedule

func (*Schedule) Generate

func (s *Schedule) Generate(t time.Time) float64

type ScheduleSlot

type ScheduleSlot struct {
	HourStart float64
	HourEnd   float64
	Load      float64
}

type Sine

type Sine struct {
	Amplitude float64
	Offset    float64
	PeriodHrs float64
	PhaseHrs  float64
}

Sine generator produces a sinusoidal pattern

func NewSine

func NewSine(config map[string]interface{}) *Sine

func (*Sine) Generate

func (s *Sine) Generate(t time.Time) float64

Jump to

Keyboard shortcuts

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