func Run(source DataSource, sinks []DataSink, success_freq time.Duration, fail_freq time.Duration)
type DataSink interface { // Pass in static system parameters to the visualization. // Should be called exactly once, before any Updates are provided. Init(SystemMetadata) error // Pass in a new SystemState to be added to the visualization. Update(Snapshot) }
type DataSource interface { // Types implementing DataSource should have a Metadata method that // returns SystemMetadata information. Metadata() SystemMetadata // Query the DataSource, returning the oldest unseen data if it's // available, or an error otherwise (e.g. if no new data is available). // This allows for making repeated queries until there's // nothing new to report, at which point the user can wait some amount of // time before trying again. Query() (Snapshot, error) }
Region provides metadata on mutually-exclusive subsets of the full network
type Region struct { Name string `json:"name"` }
Snapshot is the common data structure used for reporting inertia levels at a point in time.
type Snapshot struct { Time time.Time Requirement float64 Total UnitAggregation Categories map[string]*UnitAggregation Regions map[string]*UnitAggregation }
SystemMetadata brings together metadata about different aspects of the system
type SystemMetadata struct { Regions map[string]*Region `json:"regions"` Categories map[string]*UnitCategory `json:"categories"` Units map[string]UnitMetadata }
type SystemState struct { Time time.Time Requirement float64 Units []UnitState System *SystemMetadata }
func (st SystemState) Inertia() (Snapshot, error)
type UnitAggregation struct { Units int `json:"units"` TotalRating float64 `json:"total_rating"` TotalInertia float64 `json:"total_inertia"` }
func (agg *UnitAggregation) AddUnit(h float64, rating float64)
UnitCategory provides metadata for logical groupings of generating units
type UnitCategory struct { Name string `json:"name"` Color string `json:"color"` Order int `json:"order"` }
UnitMetadata provides parameters and classifications for specific generating units
type UnitMetadata struct { Name string Category *UnitCategory Region *Region Rating float64 // in MVA H float64 // in s }
type UnitState struct { UnitMetadata Committed bool }