simulation

package
v0.0.0-...-d2dbc3a Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Coordinator

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

func NewCoordinator

func NewCoordinator(devs modeling.Coupled, parent Processor) *Coordinator

func (*Coordinator) Advance

func (receiver *Coordinator) Advance(t uint64)

func (*Coordinator) ComputeOutput

func (receiver *Coordinator) ComputeOutput(t uint64)

func (*Coordinator) GetTN

func (receiver *Coordinator) GetTN() uint64

func (*Coordinator) Init

func (receiver *Coordinator) Init(t uint64)

func (*Coordinator) PutMessage

func (receiver *Coordinator) PutMessage(message modeling.Message, t uint64)

type Processor

type Processor interface {
	Init(t uint64)
	Advance(t uint64)
	ComputeOutput(t uint64)
	PutMessage(message modeling.Message, t uint64)
	GetTN() uint64
}

type ProcessorStub

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

func NewProcessorStub

func NewProcessorStub(endpoint string) *ProcessorStub

func (*ProcessorStub) Advance

func (this *ProcessorStub) Advance(t uint64)

func (*ProcessorStub) ComputeOutput

func (this *ProcessorStub) ComputeOutput(t uint64)

func (*ProcessorStub) GetTN

func (this *ProcessorStub) GetTN() uint64

func (*ProcessorStub) Init

func (this *ProcessorStub) Init(t uint64)

func (*ProcessorStub) PutMessage

func (this *ProcessorStub) PutMessage(message modeling.Message, t uint64)

type Root

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

func NewRoot

func NewRoot(processor Processor) *Root

func (*Root) Advance

func (this *Root) Advance(input *RootTimeArg, output *RootTimeArg) error

func (*Root) ComputeOutput

func (this *Root) ComputeOutput(input *RootTimeArg, ouput *RootTimeArg) error

func (*Root) GetTN

func (this *Root) GetTN(input *RootTimeArg, output *RootTimeArg) error

func (*Root) Init

func (this *Root) Init(input *RootTimeArg, output *RootTimeArg) error

func (*Root) PutMessage

func (this *Root) PutMessage(input *RootMessageArg, output *RootTimeArg) error

func (*Root) RPCSimulate

func (receiver *Root) RPCSimulate(input *RootTimeArg, output *RootTimeArg) error

func (*Root) Serve

func (receiver *Root) Serve(endpoint string)

* 启动服务

func (*Root) Setup

func (receiver *Root) Setup()

func (*Root) Simulate

func (receiver *Root) Simulate(delay time.Duration, stepsCallback func(t uint64))

* 启动仿真

func (*Root) Step

func (receiver *Root) Step() uint64

type RootMessageArg

type RootMessageArg struct {
	Message modeling.Message
	T       uint64
}

type RootTimeArg

type RootTimeArg struct {
	T uint64
}

type Simulator

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

* 模型是抽象的,但是仿真器和协调器是具体,这就能实现,只实现一套调度代码

func NewSimulator

func NewSimulator(atomic modeling.Atomic, parent Processor) *Simulator

func (*Simulator) Advance

func (receiver *Simulator) Advance(t uint64)

func (*Simulator) ComputeOutput

func (receiver *Simulator) ComputeOutput(t uint64)

func (*Simulator) GetTN

func (receiver *Simulator) GetTN() uint64

func (*Simulator) Init

func (receiver *Simulator) Init(t uint64)

func (*Simulator) PutMessage

func (receiver *Simulator) PutMessage(message modeling.Message, t uint64)

Jump to

Keyboard shortcuts

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