model

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: Apache-2.0 Imports: 9 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 model reads Chargerfiles. A Chargerfile declares one model: a kind of charger that many chargers can be instantiated from.

Index

Constants

View Source
const (
	OnEvFullStop    = "stop"
	OnEvFullSuspend = "suspend"

	StartOnTap  = "tap"
	StartOnPlug = "plug"
)

Behavior settings accepted in a Chargerfile.

View Source
const (
	DefaultVoltage = 230
	DefaultPhases  = 3
)

The electrical supply assumed when a Chargerfile does not say.

View Source
const OCPP16 = "1.6"

OCPP16 is the one OCPP version a charger can speak for now, and the default. It is OCPP 1.6 with JSON over WebSocket, also written 1.6J.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connector

type Connector struct {
	ID       int
	Type     string
	MaxPower Power
}

Connector is a numbered outlet on a charger.

type Model

type Model struct {
	Vendor   string
	Name     string
	Firmware string
	// OCPP is the OCPP version the charger speaks. Empty means the default.
	OCPP       string
	Connectors []Connector
	// Config holds the default values of OCPP configuration keys.
	Config   map[string]string
	OnEvFull string // OnEvFullStop or OnEvFullSuspend
	StartOn  string // StartOnTap or StartOnPlug
	StartTag string // idTag used when StartOn is StartOnPlug
	// DataTransfer lists the vendor IDs whose DataTransfer requests from the
	// CSMS the charger accepts.
	DataTransfer []string
	// Voltage and Phases turn a limit a charging profile gives in amps into
	// power: amps x Voltage x Phases. Zero means the default.
	Voltage float64
	Phases  int
}

Model is a kind of charger, as declared by one Chargerfile.

func Load

func Load(path string) (*Model, error)

Load reads and validates the Chargerfile at path.

func Parse

func Parse(data []byte) (*Model, error)

Parse reads and validates the contents of a Chargerfile. When the file has several problems, the returned error lists all of them.

func (*Model) OCPPVersion added in v0.1.1

func (m *Model) OCPPVersion() string

OCPPVersion returns the OCPP version the charger speaks.

func (*Model) Supply

func (m *Model) Supply() (voltage float64, phases int)

Supply returns the voltage and the number of phases of the charger's supply.

type Power

type Power float64

Power is an amount of electrical power in watts.

func ParsePower

func ParsePower(s string) (Power, error)

ParsePower reads a power value such as "50kW", "7.4 kW" or "3600W".

func (Power) String

func (p Power) String() string

Jump to

Keyboard shortcuts

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