sim

package
v0.18.1 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventSimulationStart ProgramEventType = "simulation.start"
	EventSimulationStop  ProgramEventType = "simulation.stop"
	EventCall            APIEventType     = "call"
	EventResponse        APIEventType     = "response"
	EventSignal          APIEventType     = "signal"
	EventPropertySet     APIEventType     = "property.set"
	EventPropertyChanged APIEventType     = "property.changed"
)

Variables

View Source
var ApiEventEmitter = make(chan APIEvent)
View Source
var ErrorEventEmitter = make(chan ErrorEvent)
View Source
var ProgramEventEmitter = make(chan ProgramEvent)

Functions

func NewServer

func NewServer() *server

Types

type APIEvent

type APIEvent struct {
	Type   APIEventType   `json:"type"`
	Symbol string         `json:"symbol"`
	Params []any          `json:"params"`
	Props  map[string]any `json:"props"`
	Error  error          `json:"error"`
}

type APIEventType

type APIEventType string

type ErrorEvent

type ErrorEvent struct {
	Error   error  `json:"error"`
	Message string `json:"message"`
}

type ProgramEvent

type ProgramEvent struct {
	Type    APIEventType `json:"type"`
	Message string       `json:"message"`
}

type ProgramEventType

type ProgramEventType string

type Simulation

type Simulation struct {
	*core.MultiEngine
	// contains filtered or unexported fields
}

Simulate runs one or more simulation scenarios. To unload a scenario call the Stop operation with the scenario name. To stop all scenarios call the StopAll operation. A scenario can simulation properties, operations and signals using static values or scripted behavior. The scripted behavior can be either triggered by a call or by a script entry All results are send out via the event channel.

func NewSimulation

func NewSimulation() *Simulation

func (*Simulation) LoadScenario added in v0.6.0

func (s *Simulation) LoadScenario(source string, doc *spec.ScenarioDoc) error

func (*Simulation) LoadScript added in v0.6.0

func (s *Simulation) LoadScript(source string, script string) error

func (*Simulation) Stop added in v0.8.0

func (s *Simulation) Stop()

func (*Simulation) UnloadScenario added in v0.8.0

func (s *Simulation) UnloadScenario(source string) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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