simulate

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: MIT Imports: 12 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

Overview

Package simulate provides fake device sources for "pvmon simulate": a small, deterministic household model whose values are encoded through the real profiles, so the whole pipeline runs as with real devices (spec 13).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Probe

Probe is an app.ProbeFactory that simulates the probed device like a running one.

func Setup

func Setup(name string) ([]byte, error)

Setup returns the YAML of a setup or an error listing the known ones.

func Setups

func Setups() map[string]string

Setups returns the built-in simulation setups (reference setups of spec 1). All of them write to ./data/simulate.db so real data is never touched.

func Sources

Sources is an app.SourceFactory that simulates every device of a connection.

Types

type Powers

type Powers struct {
	// W; battery + = discharging, grid + = import. House is the whole house load,
	// Backup the part of it on the inverter's backup output.
	PV, Battery, Grid, House, Backup, Wallbox, HeatPump float64
}

Powers are the instantaneous powers of the household by role.

func PowersAt

func PowersAt(t time.Time) Powers

PowersAt returns the household powers at local time t.

type Source

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

Source simulates one device: every block of its profile follows the household model.

func NewSource

func NewSource(s *site.Site, d *site.Device, clock util.Clock, loc *time.Location) *Source

NewSource builds the simulated device. It encodes only the blocks its meters use (plus their dependencies), all blocks when it has no meter.

func (*Source) Fetch

func (s *Source) Fetch(context.Context) (profile.Sample, error)

Fetch returns the encoded device data at the current time.

Jump to

Keyboard shortcuts

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