Documentation
¶
Overview ¶
Communication Network Emulator for NASA RETHi project, based on Time-Sensitive Networking.
Index ¶
Constants ¶
View Source
const ( PKT_BUF_LEN = 8096 PORT_NUM_SUBSYS = 8 PORT_NUM_SWITCH = 8 QUEUE_NUM_SWITCH = 8 QUEUE_LEN_SWITCH = 8096 SAVE_STATS_PERIOD = 10 // in seconds UPLOAD_STATS_PERIOD = 3 // in seconds WSLOG_HEARTBEAT = -1 WSLOG_MSG = 0 WSLOG_STAT = 1 WSLOG_PKT_TX = 2 FAULT_FAILURE = "Failure" FAULT_SLOW = "Slow" FAULT_OVERFLOW = "Overflow" FAULT_FLOODING = "Flooding" FAULT_MIS_ROUTING = "Mis-routing" )
View Source
const ( PACKET_TYPE_CTRL = 0x00 PACKET_TYPE_DATA = 0x01 )
Variables ¶
View Source
var ( SpeedWireless float64 = 300000000 // m/s DistanceWireless float64 = 57968000000 // meter 54500000000-401300000000 BandwidthWireless float64 = 2048 // bps, 500~32000, ref: https://mars.nasa.gov/msl/mission/communications/ SpeedWire float64 = 231000000 // .77c DistanceWire float64 = 30 // meter BandwidthWire float64 = 1073741824 // 1Gbps PacketLossRate float64 = 0 // percenttge )
default values
View Source
var ( ASN = 0 // Absolute Slot Number for TSN schedule NEW_SLOT_SIGNAL chan int // for slot increment of TSN schedule execution HYPER_PERIOD = 100 SLOT_DURATION time.Duration = 100 // us, interval of ASN incremental ANIMATION_ENABLED = false // enable animation on the frontend CONSOLE_ENABLED = false // enable console log on the frontend DELAY_ENABLED = false // enable real delay (wall clock) FRER_ENABLED = false // enable 802.1CB FRER protocol REROUTE_ENABLED = false // enable rerouting upon switch failure TAS_ENABLED = false // enable 802.1Qbv schedule SAVE_STATS = false // save packet stats into db DUP_ELI_ENABLED = false // enable du JITTER_BASE = 0 // base (mean) value of the random jitter WSLog = make(chan Log, 65536) // websocket logging channel SUBSYS_MAP = map[string]uint8{ "GCC": 0, "HMS": 1, "STR": 2, "SPL": 11, "ECLSS": 5, "PWR": 3, "AGT": 6, "IE": 8, "DTB": 9, "EXT": 7, "COORD": 10, } SequenceNumber int32 = 0 // packet sequence number UID = 0 // packet UID Subsystems []*Subsys Switches []*Switch Links []*Link ActiveTopoTag = "" )
View Source
var UIDIncMutex sync.Mutex // for packet UID increment
Functions ¶
Types ¶
type Link ¶
type Link struct {
PacketLossRate float64 // percentage
Bandwidth float64 // in Mbps
Speed float64 // m/s
Distance float64 // in meter
// for mars-earth
HardcodedDelay float64
Failed bool
// contains filtered or unexported fields
}
Emulate ethernet cables, connect two ports, no direction
type Node ¶
type Node interface {
Name() string
OutPort() *Port // return an idle outcoming port for connecting
InPort() *Port // return an idle incoming port for connecting
Start()
}
switch or subsys
type Packet ¶
type Packet struct {
// protocol use
Src uint8 `json:"src"`
Dst uint8 `json:"dst"`
MessageType uint8 `json:"message_type"`
Priority uint8 `json:"priority"`
Version uint8 `json:"version"`
Reserved uint8 `json:"reserved"`
PhysicalTime uint32 `json:"physical_time"`
SimulinkTime uint32 `json:"simulink_time"`
Sequence uint16 `json:"sequence"`
Length uint16 `json:"length"`
Payload []byte `json:"-"`
// internal use
IsSim bool
RawBytes []byte
Delay float64
Path []string
UID int // for animation
Seq int32 // for 802.1CB-FRER
RxTimestamp int64
TxTimestamp int64
DupID int
}
type RoutingEntry ¶
type StatsDelay ¶
type Subsys ¶
type Subsys struct {
Priority int // will overwrite priority in packets
RoutingTable map[string][]RoutingEntry
SeqRecoverHistory map[int32]bool // for frer
SeqRecoverHistoryMutex sync.Mutex
// contains filtered or unexported fields
}
Subsys is the virtual node that represents a subsystem, it communicates with outside real subsystem and pass packets to TSN switches
func (*Subsys) CreateFlow ¶
create a simulated internal packet flow
type Switch ¶
type Switch struct {
GCL [PORT_NUM_SWITCH][]TimeWindow // portid:schedule
Neighbors []string
Faults map[string]Fault
SeqRecoverHistory map[int32]bool
SeqRecoverHistoryMutex sync.Mutex
RoutingTable map[string][]RoutingEntry
// contains filtered or unexported fields
}
Switch simulates MIMOMQ TSN switch
type TimeWindow ¶
type TimeWindow struct {
Queue int `json:"queue"`
}
type TopoGraph ¶
type TopoGraph struct {
Nodes []*TopologyGraphNode
}
for routing table generation
var (
Graph *TopoGraph
)
func (*TopoGraph) FindAllPaths ¶
FindAllPaths returns all paths from src to dst
type TopologyData ¶
type TopologyData struct {
Tag string `json:"tag"`
Nodes []TopologyNode `json:"nodes"`
Edges [][2]string `json:"edges"`
}
for en/decode
type TopologyGraphNode ¶
type TopologyGraphNode struct {
// contains filtered or unexported fields
}
type TopologyNode ¶
for en/decode
Click to show internal directories.
Click to hide internal directories.
