Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
visb-visualisation-examples
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
general
stups
visb-visualisation-examples
Commits
b493fddf
Commit
b493fddf
authored
4 years ago
by
Michael Leuschel
Browse files
Options
Downloads
Patches
Plain Diff
also visualize train position in example
parent
be0fdb7a
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
Train/SimpleTrainTrack.mch
+10
-4
10 additions, 4 deletions
Train/SimpleTrainTrack.mch
Train/Track.json
+16
-2
16 additions, 2 deletions
Train/Track.json
Train/Track.svg
+6
-0
6 additions, 0 deletions
Train/Track.svg
with
32 additions
and
6 deletions
Train/SimpleTrainTrack.mch
+
10
−
4
View file @
b493fddf
...
...
@@ -4,7 +4,7 @@ MACHINE TrainTrack
SETS
TTDS = {ttd1,ttd2,ttd3}
CONSTANTS
TrackElementNumber, TRACK, TTD_TrackElements
TrackElementNumber, TRACK, TTD_TrackElements
, train_length
PROPERTIES
TrackElementNumber : NATURAL1
& TRACK = 0..TrackElementNumber
...
...
@@ -13,17 +13,23 @@ PROPERTIES
& TrackElementNumber = 30
& TTD_TrackElements = {ttd1 |-> 0..10 , ttd2 |-> 11..25 , ttd3 |-> 26..30}
& train_length = 2
VARIABLES
occ
occ,
train_rear_end
INVARIANT
occ <: TTDS
INITIALISATION occ := {}
occ <: TTDS &
train_rear_end : TRACK
INITIALISATION occ := {} || train_rear_end := 0
OPERATIONS
TTD_Occupied(ttd) = PRE ttd:TTDS \ occ THEN
occ := occ \/ {ttd}
END;
TTD_Free(ttd) = PRE ttd:occ THEN
occ := occ \ {ttd}
END;
TrainMoveForward = PRE train_rear_end+1:TRACK THEN
train_rear_end := train_rear_end + 1
END
DEFINITIONS
"LibrarySVG.def"; // enable to use the external functions in the VisB json file
...
...
This diff is collapsed.
Click to expand it.
Train/Track.json
+
16
−
2
View file @
b493fddf
...
...
@@ -2,6 +2,13 @@
"svg"
:
"Track.svg"
,
"items"
:[
{
"id"
:
"train_polygon"
,
"attr"
:
"points"
,
"value"
:
"svg_train(train_rear_end, train_length ,100.0/real(TrackElementNumber+1),1.0,3.0)"
,
"comment"
:
"show train position using a slanted polygon"
},
{
"id"
:
"track_polyline"
,
"attr"
:
"points"
,
...
...
@@ -18,13 +25,13 @@
"id"
:
"occupied_ttd_polygon"
,
"attr"
:
"points"
,
"value"
:
"svg_set_polygon(OCC_TE,100.0/real(TrackElementNumber+1),100.0,2.0)"
,
"comment"
:
"show
ticks for TTD Limit
s"
"comment"
:
"show
occupied TTD zone
s"
},
{
"id"
:
"cleared_ttd_polygon"
,
"attr"
:
"points"
,
"value"
:
"svg_set_polygon(FREE_TE,100.0/real(TrackElementNumber+1),100.0,2.0)"
,
"comment"
:
"show
ticks for TTD Limit
s"
"comment"
:
"show
free TTD zone
s"
}
],
"events"
:[
...
...
@@ -41,6 +48,13 @@
"optional"
:
true
,
"hovers"
:
[{
"attr"
:
"stroke"
,
"enter"
:
"black"
,
"leave"
:
"none"
},
{
"attr"
:
"opacity"
,
"enter"
:
"0.5"
,
"leave"
:
"1.0"
}]
},
{
"id"
:
"train_polygon"
,
"event"
:
"TrainMoveForward"
,
"optional"
:
true
,
"hovers"
:
[{
"attr"
:
"fill"
,
"enter"
:
"red"
,
"leave"
:
"lightgray"
},
{
"attr"
:
"stroke-width"
,
"enter"
:
"0.5"
,
"leave"
:
"0.3"
}]
}
]
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Train/Track.svg
+
6
−
0
View file @
b493fddf
...
...
@@ -7,6 +7,12 @@
version=
"1.1"
id=
"svg5154"
>
<polygon
id =
"train_polygon"
points=
"0,0 100,0"
style=
"stroke-width: 0.3"
stroke=
"black"
fill=
"lightgray"
transform=
"translate(10,16.8)"
/>
<polygon
id =
"track_polyline"
points=
"0,0 1,0, 1,1 1,0 50,0 50,1 50,0 100,0"
style=
"stroke-width: 0.3"
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment