micro_traffic_sim 0.1.13

gRPC interface for microscopic traffic simulation via cellular automata
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// 	protoc-gen-go v1.36.11
// 	protoc        v6.33.1
// source: cell.proto

package microtraffic

import (
	protoreflect "google.golang.org/protobuf/reflect/protoreflect"
	protoimpl "google.golang.org/protobuf/runtime/protoimpl"
	reflect "reflect"
	sync "sync"
	unsafe "unsafe"
)

const (
	// Verify that this generated code is sufficiently up-to-date.
	_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
	// Verify that runtime/protoimpl is sufficiently up-to-date.
	_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)

// Zone type aligned with Rust computation core `ZoneType`
// https://docs.rs/micro_traffic_sim_core/0.1.0/micro_traffic_sim_core/grid/zones/enum.ZoneType.html
type ZoneType int32

const (
	ZoneType_ZONE_TYPE_UNDEFINED    ZoneType = 0 // Default uninitialized state
	ZoneType_ZONE_TYPE_BIRTH        ZoneType = 1 // Vehicles spawn here
	ZoneType_ZONE_TYPE_DEATH        ZoneType = 2 // Vehicles despawn here
	ZoneType_ZONE_TYPE_COORDINATION ZoneType = 3 // Junction/intersection cell requiring conflict resolution
	ZoneType_ZONE_TYPE_COMMON       ZoneType = 4 // Regular road segment
	ZoneType_ZONE_TYPE_ISOLATED     ZoneType = 5 // Disconnected cell (reserved)
	ZoneType_ZONE_TYPE_LANE_FOR_BUS ZoneType = 6 // Dedicated bus lane (reserved)
	ZoneType_ZONE_TYPE_TRANSIT      ZoneType = 7 // Transit/relaxation cell (reserved)
	ZoneType_ZONE_TYPE_CROSSWALK    ZoneType = 8 // Pedestrian crossing area (reserved)
)

// Enum value maps for ZoneType.
var (
	ZoneType_name = map[int32]string{
		0: "ZONE_TYPE_UNDEFINED",
		1: "ZONE_TYPE_BIRTH",
		2: "ZONE_TYPE_DEATH",
		3: "ZONE_TYPE_COORDINATION",
		4: "ZONE_TYPE_COMMON",
		5: "ZONE_TYPE_ISOLATED",
		6: "ZONE_TYPE_LANE_FOR_BUS",
		7: "ZONE_TYPE_TRANSIT",
		8: "ZONE_TYPE_CROSSWALK",
	}
	ZoneType_value = map[string]int32{
		"ZONE_TYPE_UNDEFINED":    0,
		"ZONE_TYPE_BIRTH":        1,
		"ZONE_TYPE_DEATH":        2,
		"ZONE_TYPE_COORDINATION": 3,
		"ZONE_TYPE_COMMON":       4,
		"ZONE_TYPE_ISOLATED":     5,
		"ZONE_TYPE_LANE_FOR_BUS": 6,
		"ZONE_TYPE_TRANSIT":      7,
		"ZONE_TYPE_CROSSWALK":    8,
	}
)

func (x ZoneType) Enum() *ZoneType {
	p := new(ZoneType)
	*p = x
	return p
}

func (x ZoneType) String() string {
	return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}

func (ZoneType) Descriptor() protoreflect.EnumDescriptor {
	return file_cell_proto_enumTypes[0].Descriptor()
}

func (ZoneType) Type() protoreflect.EnumType {
	return &file_cell_proto_enumTypes[0]
}

func (x ZoneType) Number() protoreflect.EnumNumber {
	return protoreflect.EnumNumber(x)
}

// Deprecated: Use ZoneType.Descriptor instead.
func (ZoneType) EnumDescriptor() ([]byte, []int) {
	return file_cell_proto_rawDescGZIP(), []int{0}
}

// Cell structure
type Cell struct {
	state protoimpl.MessageState `protogen:"open.v1"`
	// Numeric identifier of the cell
	Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	// Geometry of the cell
	Geom *Point `protobuf:"bytes,2,opt,name=geom,proto3" json:"geom,omitempty"`
	// Zone type
	ZoneType ZoneType `protobuf:"varint,3,opt,name=zone_type,json=zoneType,proto3,enum=micro_traffic_sim.ZoneType" json:"zone_type,omitempty"`
	// Speed limit. Measured in cells per simulation step.
	SpeedLimit int64 `protobuf:"varint,4,opt,name=speed_limit,json=speedLimit,proto3" json:"speed_limit,omitempty"`
	// Left neighbor cell for lane changing
	LeftNode int64 `protobuf:"varint,5,opt,name=left_node,json=leftNode,proto3" json:"left_node,omitempty"`
	// Forward neighbor cell for straight movement
	ForwardNode int64 `protobuf:"varint,6,opt,name=forward_node,json=forwardNode,proto3" json:"forward_node,omitempty"`
	// Right neighbor cell for lane changing
	RightNode int64 `protobuf:"varint,7,opt,name=right_node,json=rightNode,proto3" json:"right_node,omitempty"`
	// Parent meso-graph link id. Could be used to aggregate micro cells back to meso links.
	MesoLinkId    int64 `protobuf:"varint,8,opt,name=meso_link_id,json=mesoLinkId,proto3" json:"meso_link_id,omitempty"`
	unknownFields protoimpl.UnknownFields
	sizeCache     protoimpl.SizeCache
}

func (x *Cell) Reset() {
	*x = Cell{}
	mi := &file_cell_proto_msgTypes[0]
	ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
	ms.StoreMessageInfo(mi)
}

func (x *Cell) String() string {
	return protoimpl.X.MessageStringOf(x)
}

func (*Cell) ProtoMessage() {}

func (x *Cell) ProtoReflect() protoreflect.Message {
	mi := &file_cell_proto_msgTypes[0]
	if x != nil {
		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
		if ms.LoadMessageInfo() == nil {
			ms.StoreMessageInfo(mi)
		}
		return ms
	}
	return mi.MessageOf(x)
}

// Deprecated: Use Cell.ProtoReflect.Descriptor instead.
func (*Cell) Descriptor() ([]byte, []int) {
	return file_cell_proto_rawDescGZIP(), []int{0}
}

func (x *Cell) GetId() int64 {
	if x != nil {
		return x.Id
	}
	return 0
}

func (x *Cell) GetGeom() *Point {
	if x != nil {
		return x.Geom
	}
	return nil
}

func (x *Cell) GetZoneType() ZoneType {
	if x != nil {
		return x.ZoneType
	}
	return ZoneType_ZONE_TYPE_UNDEFINED
}

func (x *Cell) GetSpeedLimit() int64 {
	if x != nil {
		return x.SpeedLimit
	}
	return 0
}

func (x *Cell) GetLeftNode() int64 {
	if x != nil {
		return x.LeftNode
	}
	return 0
}

func (x *Cell) GetForwardNode() int64 {
	if x != nil {
		return x.ForwardNode
	}
	return 0
}

func (x *Cell) GetRightNode() int64 {
	if x != nil {
		return x.RightNode
	}
	return 0
}

func (x *Cell) GetMesoLinkId() int64 {
	if x != nil {
		return x.MesoLinkId
	}
	return 0
}

// Point geometry (x, y)
// In case of SRID = 4326 (which could be set for the whole computational session),
// X refers to longitude, Y refers to latitude.
type Point struct {
	state protoimpl.MessageState `protogen:"open.v1"`
	// X coordinate
	X float64 `protobuf:"fixed64,1,opt,name=x,proto3" json:"x,omitempty"`
	// Y coordinate
	Y             float64 `protobuf:"fixed64,2,opt,name=y,proto3" json:"y,omitempty"`
	unknownFields protoimpl.UnknownFields
	sizeCache     protoimpl.SizeCache
}

func (x *Point) Reset() {
	*x = Point{}
	mi := &file_cell_proto_msgTypes[1]
	ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
	ms.StoreMessageInfo(mi)
}

func (x *Point) String() string {
	return protoimpl.X.MessageStringOf(x)
}

func (*Point) ProtoMessage() {}

func (x *Point) ProtoReflect() protoreflect.Message {
	mi := &file_cell_proto_msgTypes[1]
	if x != nil {
		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
		if ms.LoadMessageInfo() == nil {
			ms.StoreMessageInfo(mi)
		}
		return ms
	}
	return mi.MessageOf(x)
}

// Deprecated: Use Point.ProtoReflect.Descriptor instead.
func (*Point) Descriptor() ([]byte, []int) {
	return file_cell_proto_rawDescGZIP(), []int{1}
}

func (x *Point) GetX() float64 {
	if x != nil {
		return x.X
	}
	return 0
}

func (x *Point) GetY() float64 {
	if x != nil {
		return x.Y
	}
	return 0
}

// Grid cells payload bound to a session
type SessionGrid struct {
	state protoimpl.MessageState `protogen:"open.v1"`
	// Session identifier (UUIDv4)
	SessionId *UUIDv4 `protobuf:"bytes,1,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"`
	// Grid cell data. Maximum number of entities per message is 10000 (server-side limit)
	Data          []*Cell `protobuf:"bytes,2,rep,name=data,proto3" json:"data,omitempty"`
	unknownFields protoimpl.UnknownFields
	sizeCache     protoimpl.SizeCache
}

func (x *SessionGrid) Reset() {
	*x = SessionGrid{}
	mi := &file_cell_proto_msgTypes[2]
	ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
	ms.StoreMessageInfo(mi)
}

func (x *SessionGrid) String() string {
	return protoimpl.X.MessageStringOf(x)
}

func (*SessionGrid) ProtoMessage() {}

func (x *SessionGrid) ProtoReflect() protoreflect.Message {
	mi := &file_cell_proto_msgTypes[2]
	if x != nil {
		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
		if ms.LoadMessageInfo() == nil {
			ms.StoreMessageInfo(mi)
		}
		return ms
	}
	return mi.MessageOf(x)
}

// Deprecated: Use SessionGrid.ProtoReflect.Descriptor instead.
func (*SessionGrid) Descriptor() ([]byte, []int) {
	return file_cell_proto_rawDescGZIP(), []int{2}
}

func (x *SessionGrid) GetSessionId() *UUIDv4 {
	if x != nil {
		return x.SessionId
	}
	return nil
}

func (x *SessionGrid) GetData() []*Cell {
	if x != nil {
		return x.Data
	}
	return nil
}

// Server response for session grid ingest
type SessionGridResponse struct {
	state protoimpl.MessageState `protogen:"open.v1"`
	// Response code (0 = OK)
	Code uint32 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
	// Human-readable message
	Text          string `protobuf:"bytes,2,opt,name=text,proto3" json:"text,omitempty"`
	unknownFields protoimpl.UnknownFields
	sizeCache     protoimpl.SizeCache
}

func (x *SessionGridResponse) Reset() {
	*x = SessionGridResponse{}
	mi := &file_cell_proto_msgTypes[3]
	ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
	ms.StoreMessageInfo(mi)
}

func (x *SessionGridResponse) String() string {
	return protoimpl.X.MessageStringOf(x)
}

func (*SessionGridResponse) ProtoMessage() {}

func (x *SessionGridResponse) ProtoReflect() protoreflect.Message {
	mi := &file_cell_proto_msgTypes[3]
	if x != nil {
		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
		if ms.LoadMessageInfo() == nil {
			ms.StoreMessageInfo(mi)
		}
		return ms
	}
	return mi.MessageOf(x)
}

// Deprecated: Use SessionGridResponse.ProtoReflect.Descriptor instead.
func (*SessionGridResponse) Descriptor() ([]byte, []int) {
	return file_cell_proto_rawDescGZIP(), []int{3}
}

func (x *SessionGridResponse) GetCode() uint32 {
	if x != nil {
		return x.Code
	}
	return 0
}

func (x *SessionGridResponse) GetText() string {
	if x != nil {
		return x.Text
	}
	return ""
}

var File_cell_proto protoreflect.FileDescriptor

const file_cell_proto_rawDesc = "" +
	"\n" +
	"\n" +
	"cell.proto\x12\x11micro_traffic_sim\x1a\n" +
	"uuid.proto\"\xa0\x02\n" +
	"\x04Cell\x12\x0e\n" +
	"\x02id\x18\x01 \x01(\x03R\x02id\x12,\n" +
	"\x04geom\x18\x02 \x01(\v2\x18.micro_traffic_sim.PointR\x04geom\x128\n" +
	"\tzone_type\x18\x03 \x01(\x0e2\x1b.micro_traffic_sim.ZoneTypeR\bzoneType\x12\x1f\n" +
	"\vspeed_limit\x18\x04 \x01(\x03R\n" +
	"speedLimit\x12\x1b\n" +
	"\tleft_node\x18\x05 \x01(\x03R\bleftNode\x12!\n" +
	"\fforward_node\x18\x06 \x01(\x03R\vforwardNode\x12\x1d\n" +
	"\n" +
	"right_node\x18\a \x01(\x03R\trightNode\x12 \n" +
	"\fmeso_link_id\x18\b \x01(\x03R\n" +
	"mesoLinkId\"#\n" +
	"\x05Point\x12\f\n" +
	"\x01x\x18\x01 \x01(\x01R\x01x\x12\f\n" +
	"\x01y\x18\x02 \x01(\x01R\x01y\"t\n" +
	"\vSessionGrid\x128\n" +
	"\n" +
	"session_id\x18\x01 \x01(\v2\x19.micro_traffic_sim.UUIDv4R\tsessionId\x12+\n" +
	"\x04data\x18\x02 \x03(\v2\x17.micro_traffic_sim.CellR\x04data\"=\n" +
	"\x13SessionGridResponse\x12\x12\n" +
	"\x04code\x18\x01 \x01(\rR\x04code\x12\x12\n" +
	"\x04text\x18\x02 \x01(\tR\x04text*\xe3\x01\n" +
	"\bZoneType\x12\x17\n" +
	"\x13ZONE_TYPE_UNDEFINED\x10\x00\x12\x13\n" +
	"\x0fZONE_TYPE_BIRTH\x10\x01\x12\x13\n" +
	"\x0fZONE_TYPE_DEATH\x10\x02\x12\x1a\n" +
	"\x16ZONE_TYPE_COORDINATION\x10\x03\x12\x14\n" +
	"\x10ZONE_TYPE_COMMON\x10\x04\x12\x16\n" +
	"\x12ZONE_TYPE_ISOLATED\x10\x05\x12\x1a\n" +
	"\x16ZONE_TYPE_LANE_FOR_BUS\x10\x06\x12\x15\n" +
	"\x11ZONE_TYPE_TRANSIT\x10\a\x12\x17\n" +
	"\x13ZONE_TYPE_CROSSWALK\x10\bB@Z>github.com/LdDl/micro_traffic_sim_grpc/clients/go;microtrafficb\x06proto3"

var (
	file_cell_proto_rawDescOnce sync.Once
	file_cell_proto_rawDescData []byte
)

func file_cell_proto_rawDescGZIP() []byte {
	file_cell_proto_rawDescOnce.Do(func() {
		file_cell_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_cell_proto_rawDesc), len(file_cell_proto_rawDesc)))
	})
	return file_cell_proto_rawDescData
}

var file_cell_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_cell_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
var file_cell_proto_goTypes = []any{
	(ZoneType)(0),               // 0: micro_traffic_sim.ZoneType
	(*Cell)(nil),                // 1: micro_traffic_sim.Cell
	(*Point)(nil),               // 2: micro_traffic_sim.Point
	(*SessionGrid)(nil),         // 3: micro_traffic_sim.SessionGrid
	(*SessionGridResponse)(nil), // 4: micro_traffic_sim.SessionGridResponse
	(*UUIDv4)(nil),              // 5: micro_traffic_sim.UUIDv4
}
var file_cell_proto_depIdxs = []int32{
	2, // 0: micro_traffic_sim.Cell.geom:type_name -> micro_traffic_sim.Point
	0, // 1: micro_traffic_sim.Cell.zone_type:type_name -> micro_traffic_sim.ZoneType
	5, // 2: micro_traffic_sim.SessionGrid.session_id:type_name -> micro_traffic_sim.UUIDv4
	1, // 3: micro_traffic_sim.SessionGrid.data:type_name -> micro_traffic_sim.Cell
	4, // [4:4] is the sub-list for method output_type
	4, // [4:4] is the sub-list for method input_type
	4, // [4:4] is the sub-list for extension type_name
	4, // [4:4] is the sub-list for extension extendee
	0, // [0:4] is the sub-list for field type_name
}

func init() { file_cell_proto_init() }
func file_cell_proto_init() {
	if File_cell_proto != nil {
		return
	}
	file_uuid_proto_init()
	type x struct{}
	out := protoimpl.TypeBuilder{
		File: protoimpl.DescBuilder{
			GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
			RawDescriptor: unsafe.Slice(unsafe.StringData(file_cell_proto_rawDesc), len(file_cell_proto_rawDesc)),
			NumEnums:      1,
			NumMessages:   4,
			NumExtensions: 0,
			NumServices:   0,
		},
		GoTypes:           file_cell_proto_goTypes,
		DependencyIndexes: file_cell_proto_depIdxs,
		EnumInfos:         file_cell_proto_enumTypes,
		MessageInfos:      file_cell_proto_msgTypes,
	}.Build()
	File_cell_proto = out.File
	file_cell_proto_goTypes = nil
	file_cell_proto_depIdxs = nil
}