This repository has been archived by the owner on Mar 7, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
traintest.himaude
91 lines (64 loc) · 1.85 KB
/
traintest.himaude
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
(homod UTILS is
pr FLOAT .
op segmentLength : -> Float .
op accRate : -> Float .
op brakingRate : -> Float .
op maxSpeed : -> Float .
op stoppedSpeed : -> Float .
eq segmentLength = 1000.0 . --- meters
eq accRate = 1.0 . --- m/s^2
eq brakingRate = -1.0 . --- m/s^2
eq maxSpeed = 27.7 . --- m/s 100 km/h
eq stoppedSpeed = 0.0 . --- m/s
endhom) --- END UTILS
***################################
(homod CLASS-DEF is
inc HYBRID-LIB .
inc UTILS .
--- Train status type
sort TrainStatus .
ops constant stopped accelerating braking : -> TrainStatus [ctor] .
--- Track status type
sort TrackStatus .
ops free occupied : -> TrackStatus [ctor] .
***================================
class Segment | length : Float .
subclass Segment < PhysicalEntity .
***================================
class Train | trainStatus : TrainStatus,
length : Float,
acc : Float .
subclass Train < PhysicalEntity .
***================================
class Translation .
subclass Translation < PhysicalInteraction .
endhom) --- END CLASS-DEF
***################################
(homod INIT-TRAIN is
inc CLASS-DEF .
op sm : -> Oid .
op cs1 : -> GlobalSystem .
op zzDataCol : -> Oid .
ops train segment translation : -> Oid .
eq cs1 = {
< train : Train | effort : 0.0,
effT : 0.0,
effP : 0.0,
edb : no >
< segment : Segment | effort : 0.0,
effT : 0.0,
effP : 0.0,
edb : no >
< translation : Translation | flow : 0.0,
entity1 : train,
entity2 : segment,
floT1 : 0.0, floT2 : 0.0, floT3 : 0.0,
edb : no,
contDyn : component >
< zzDataCol : DataCollector | source : (train), time : 0.0, result : "", dataShown : effort >
} .
endhom)
***################################
***(hrew cs1 in time <= 1 using euler stepsize 100.0 discreteswitch nonaccurate .)
***################################
eof .