diff options
author | Aren Babikian <aren.babikian@mail.mcgill.ca> | 2021-01-27 16:34:56 +0100 |
---|---|---|
committer | Aren Babikian <aren.babikian@mail.mcgill.ca> | 2021-01-27 16:34:56 +0100 |
commit | 6cca80c2f350550ac62828eb0ff5f9327ad44474 (patch) | |
tree | 82ad110c97bc438c4ccbea8602047f027bf2fbd4 | |
parent | Improve crossingScenario queries + small ease-of-use adjustments (diff) | |
download | VIATRA-Generator-6cca80c2f350550ac62828eb0ff5f9327ad44474.tar.gz VIATRA-Generator-6cca80c2f350550ac62828eb0ff5f9327ad44474.tar.zst VIATRA-Generator-6cca80c2f350550ac62828eb0ff5f9327ad44474.zip |
make generated plane smaller, easier to understand
3 files changed, 16 insertions, 15 deletions
diff --git a/Domains/crossingScenario/inputs/cSinit4x4.xmi b/Domains/crossingScenario/inputs/cSinit4x4.xmi index d0dc5705..08cde1e8 100644 --- a/Domains/crossingScenario/inputs/cSinit4x4.xmi +++ b/Domains/crossingScenario/inputs/cSinit4x4.xmi | |||
@@ -5,8 +5,8 @@ | |||
5 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | 5 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
6 | xmlns:crossingScenario="http://www.example.com/crossingScenario" | 6 | xmlns:crossingScenario="http://www.example.com/crossingScenario" |
7 | xsi:schemaLocation="http://www.example.com/crossingScenario ../model/crossingScenario.ecore" | 7 | xsi:schemaLocation="http://www.example.com/crossingScenario ../model/crossingScenario.ecore" |
8 | xSize="100.0" | 8 | xSize="30.0" |
9 | ySize="100.0" | 9 | ySize="30.0" |
10 | maxTime="60.0" | 10 | maxTime="60.0" |
11 | maxXSpeed="100.0" | 11 | maxXSpeed="100.0" |
12 | maxYSpeed="100.0"> | 12 | maxYSpeed="100.0"> |
@@ -14,18 +14,18 @@ | |||
14 | <actors xsi:type="crossingScenario:Vehicle"/> | 14 | <actors xsi:type="crossingScenario:Vehicle"/> |
15 | <lanes xsi:type="crossingScenario:Lane_Horizontal"/> | 15 | <lanes xsi:type="crossingScenario:Lane_Horizontal"/> |
16 | <lanes xsi:type="crossingScenario:Lane_Horizontal" | 16 | <lanes xsi:type="crossingScenario:Lane_Horizontal" |
17 | referenceCoord="5.0"/> | 17 | referenceCoord="3.0"/> |
18 | <lanes xsi:type="crossingScenario:Lane_Horizontal" | 18 | <lanes xsi:type="crossingScenario:Lane_Horizontal" |
19 | referenceCoord="10.0"/> | 19 | referenceCoord="6.0"/> |
20 | <lanes xsi:type="crossingScenario:Lane_Horizontal" | 20 | <lanes xsi:type="crossingScenario:Lane_Horizontal" |
21 | referenceCoord="15.0"/> | 21 | referenceCoord="9.0"/> |
22 | <lanes xsi:type="crossingScenario:Lane_Vertical"/> | 22 | <lanes xsi:type="crossingScenario:Lane_Vertical"/> |
23 | <lanes xsi:type="crossingScenario:Lane_Vertical" | 23 | <lanes xsi:type="crossingScenario:Lane_Vertical" |
24 | referenceCoord="5.0"/> | 24 | referenceCoord="3.0"/> |
25 | <lanes xsi:type="crossingScenario:Lane_Vertical" | 25 | <lanes xsi:type="crossingScenario:Lane_Vertical" |
26 | referenceCoord="10.0"/> | 26 | referenceCoord="6.0"/> |
27 | <lanes xsi:type="crossingScenario:Lane_Vertical" | 27 | <lanes xsi:type="crossingScenario:Lane_Vertical" |
28 | referenceCoord="15.0"/> | 28 | referenceCoord="9.0"/> |
29 | <relations | 29 | <relations |
30 | xsi:type="crossingScenario:CollisionExists" | 30 | xsi:type="crossingScenario:CollisionExists" |
31 | target="//@actors.0" | 31 | target="//@actors.0" |
diff --git a/Domains/crossingScenario/queries/crossingScenarioQueries.vql b/Domains/crossingScenario/queries/crossingScenarioQueries.vql index 8eabfd05..32348399 100644 --- a/Domains/crossingScenario/queries/crossingScenarioQueries.vql +++ b/Domains/crossingScenario/queries/crossingScenarioQueries.vql | |||
@@ -22,8 +22,8 @@ pattern define_placedOn_actorOnVerticalLane(a : Actor, vl:Lane_Vertical) { | |||
22 | // Lane.numWidth(vl, w); | 22 | // Lane.numWidth(vl, w); |
23 | // check(x >= (r + w)); | 23 | // check(x >= (r + w)); |
24 | 24 | ||
25 | //<<<<NEW>>>>: lanes all have width=5 | 25 | //<<<<NEW>>>>: lanes all have width=3 |
26 | check(x >= (r + 5.0)); | 26 | check(x >= (r + 3.0)); |
27 | } | 27 | } |
28 | 28 | ||
29 | @Constraint(severity = "error", key = {a}, message = "this defines the placedOn relation for vertical lanes") | 29 | @Constraint(severity = "error", key = {a}, message = "this defines the placedOn relation for vertical lanes") |
@@ -40,8 +40,8 @@ pattern define_placedOn_actorOnHorizLane(a : Actor, hl:Lane_Horizontal) { | |||
40 | // Lane.numWidth(hl, w); | 40 | // Lane.numWidth(hl, w); |
41 | // check(y >= (r + w)); | 41 | // check(y >= (r + w)); |
42 | 42 | ||
43 | //<<NEW>> | 43 | //<<NEW>>: lanes all have width=3 |
44 | check(y >= (r + 5.0)); | 44 | check(y >= (r + 3.0)); |
45 | 45 | ||
46 | } | 46 | } |
47 | 47 | ||
@@ -197,7 +197,7 @@ pattern define_actor_vehicleWidth(v:Vehicle) { | |||
197 | Vehicle.placedOn(v, lane); | 197 | Vehicle.placedOn(v, lane); |
198 | Lane_Vertical(lane); | 198 | Lane_Vertical(lane); |
199 | Vehicle.width(v, w); | 199 | Vehicle.width(v, w); |
200 | check(w != 1.0); | 200 | check(w != 2.0); |
201 | } or { | 201 | } or { |
202 | Vehicle.placedOn(v, lane); | 202 | Vehicle.placedOn(v, lane); |
203 | Lane_Horizontal(lane); | 203 | Lane_Horizontal(lane); |
@@ -216,7 +216,7 @@ pattern define_actor_vehicleLength(v:Vehicle) { | |||
216 | Vehicle.placedOn(v, lane); | 216 | Vehicle.placedOn(v, lane); |
217 | Lane_Horizontal(lane); | 217 | Lane_Horizontal(lane); |
218 | Vehicle.length(v, l); | 218 | Vehicle.length(v, l); |
219 | check(l != 1.0); | 219 | check(l != 2.0); |
220 | } | 220 | } |
221 | 221 | ||
222 | ///////---------------- | 222 | ///////---------------- |
diff --git a/Domains/crossingScenario/src/crossingScenario/run/DrawScenario.java b/Domains/crossingScenario/src/crossingScenario/run/DrawScenario.java index daf294f4..cce2b3f2 100644 --- a/Domains/crossingScenario/src/crossingScenario/run/DrawScenario.java +++ b/Domains/crossingScenario/src/crossingScenario/run/DrawScenario.java | |||
@@ -28,6 +28,7 @@ import crossingScenario.Relation; | |||
28 | import crossingScenario.VisionBlocked; | 28 | import crossingScenario.VisionBlocked; |
29 | 29 | ||
30 | public class DrawScenario { | 30 | public class DrawScenario { |
31 | final static int WIDTH = 3; | ||
31 | public static final int SIZE = 1000; | 32 | public static final int SIZE = 1000; |
32 | 33 | ||
33 | public static void main(String[] args) throws IOException { | 34 | public static void main(String[] args) throws IOException { |
@@ -77,7 +78,7 @@ public class DrawScenario { | |||
77 | g.drawLine(-xSize/2, 0, xSize/2, 0); | 78 | g.drawLine(-xSize/2, 0, xSize/2, 0); |
78 | g.drawLine(0, -ySize/2, 0, ySize/2); | 79 | g.drawLine(0, -ySize/2, 0, ySize/2); |
79 | for (Lane l : cs.getLanes()) { | 80 | for (Lane l : cs.getLanes()) { |
80 | int ref = (int) ((l.getReferenceCoord() +5)* multiplier); | 81 | int ref = (int) ((l.getReferenceCoord() +WIDTH)* multiplier); |
81 | if (l instanceof Lane_Horizontal) { | 82 | if (l instanceof Lane_Horizontal) { |
82 | g.drawLine(-xSize/2, ref, xSize/2, ref); | 83 | g.drawLine(-xSize/2, ref, xSize/2, ref); |
83 | } | 84 | } |