state

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2026 License: MIT Imports: 4 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

View Source
const CurrentVersion = 1

Variables

This section is empty.

Functions

func GetPath

func GetPath() string

func Save

func Save(state *AppState) error

func SaveTo

func SaveTo(state *AppState, path string) error

Types

type AppState

type AppState struct {
	Version         int              `json:"version"`
	NextSimulatorID int              `json:"next_simulator_id"`
	NextSiteID      int              `json:"next_site_id"`
	Simulators      []SimulatorState `json:"simulators"`
	Sites           []SiteState      `json:"sites"`
}

func DefaultState

func DefaultState() *AppState

func Load

func Load() (*AppState, error)

func LoadFrom

func LoadFrom(path string) (*AppState, error)

type AutomationState

type AutomationState struct {
	Enabled        bool    `json:"enabled"`
	TimeMultiplier float64 `json:"time_multiplier"`
	Scenario       string  `json:"scenario"`
	SimulatedTime  string  `json:"simulated_time"`
}

type PhaseFactors

type PhaseFactors struct {
	L1 float64 `json:"l1"`
	L2 float64 `json:"l2"`
	L3 float64 `json:"l3"`
}

type PhaseFuses

type PhaseFuses struct {
	L1 bool `json:"l1"`
	L2 bool `json:"l2"`
	L3 bool `json:"l3"`
}

type PhaseLoads

type PhaseLoads struct {
	L1 float64 `json:"l1"`
	L2 float64 `json:"l2"`
	L3 float64 `json:"l3"`
}

type SimulatorState

type SimulatorState struct {
	ID                 int             `json:"id"`
	Serial             string          `json:"serial"`
	Protocol           string          `json:"protocol"`
	Category           string          `json:"category"`
	SlaveID            uint8           `json:"slave_id"`
	Port               int             `json:"port"`
	Running            bool            `json:"running"`
	SiteID             int             `json:"site_id"`
	DeviceOn           bool            `json:"device_on"`
	BatteryCapacityKWh float64         `json:"battery_capacity_kwh"`
	Profile            string          `json:"profile"`
	OCPPURL            string          `json:"ocpp_url"`
	Automation         AutomationState `json:"automation"`
}

type SiteState

type SiteState struct {
	ID             int          `json:"id"`
	Name           string       `json:"name"`
	MeterID        int          `json:"meter_id"`
	MeterIDs       []int        `json:"meter_ids"`
	SimulatorIDs   []int        `json:"simulator_ids"`
	BaseLoadW      float64      `json:"base_load_w"`
	Enabled        bool         `json:"enabled"`
	FuseSize       int          `json:"fuse_size"`
	FuseProfile    string       `json:"fuse_profile"`
	PhaseFactors   PhaseFactors `json:"phase_factors"`
	FuseBlown      PhaseFuses   `json:"fuse_blown"`
	BoundMeter     bool         `json:"bound_meter"`
	SimulatedTime  string       `json:"simulated_time"`
	TimeMultiplier float64      `json:"time_multiplier"`
	SimRunning     bool         `json:"sim_running"`
	Scenario       string       `json:"scenario"`
	PhaseLoads     PhaseLoads   `json:"phase_loads"`
	LoadScenario   string       `json:"load_scenario"`
	LoadLinked     bool         `json:"load_linked"`
	P1Mode         string       `json:"p1_mode"`
}

Jump to

Keyboard shortcuts

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