System.emam 1.9 KB
Newer Older
Alexander David Hellwig's avatar
Alexander David Hellwig committed
1
2
package ba;
import ba.intersection.IntersectionController;
3
import ba.util.RelToAbsTrajectory;
4
import ba.util.CommQuality;
5
import ba.vehicle.VelocityController;
6
import ba.collisionDetection.CollisionDetection;
7
//component System<N1 n = 2,N1 x = 1,N1 m = 5,N1 m1 = 4,N1 m2 = 10>{
Alexander David Hellwig's avatar
Alexander David Hellwig committed
8
component System{
9
10
    //Intersection ports
    ports in Q(0s : 10s) cutoffTimeIn,
11
          in B isActiveIn,
12
          in Q^{3,5} absTrajectory[2];
Alexander David Hellwig's avatar
Alexander David Hellwig committed
13

14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
    //Collision detection ports
    ports in Q(0m : 10000000m)^{2,4} hullsIn[2],
          out B collisionOut;

    //Vehicle ports
    ports in Q(0m/s^2 : 100m/s^2) maxAccel[2],
          in Q(0m/s : 60m/s) maxVel[2],
          in Q(0s : 10s) deltaTime[2],
          in Q(0s : 60s) holdTime[2],
          in B resetVel[2],
          in B slowDown[2],
          out Q(0m/s : 60m/s) curVel[2];

    instance IntersectionController intersectionController;
    instance CollisionDetection collisionDetection;
    instance CommQuality<B> stopCommQuality[2];
30
    instance VelocityController(3.0) velocityController[2];
31
32
33


    //Intersection
Alexander David Hellwig's avatar
Alexander David Hellwig committed
34
35
    connect cutoffTimeIn -> intersectionController.cutoffTime;
    connect isActiveIn -> intersectionController.isActive;
36
    connect absTrajectory[:] -> intersectionController.trajectoryIn[:];
Alexander David Hellwig's avatar
Alexander David Hellwig committed
37

38
39
40
    //Collision detection
    connect hullsIn[:] -> collisionDetection.hulls[:];
    connect collisionDetection.collision -> collisionOut;
41
42
43
44
45

    //Vehicles
    connect maxAccel[:] -> velocityController[:].maxAccelIn;
    connect maxVel[:] -> velocityController[:].maxVelIn;
    connect deltaTime[:] -> velocityController[:].deltaTimeIn;
46
    connect holdTime[:] -> velocityController[:].holdTimeIn;
47
48
49
    connect resetVel[:] -> velocityController[:].resetVelIn;
    connect velocityController[:].curVelOut -> curVel[:];

50
    //Communication Quality
51
52
    connect intersectionController.stop[:] -> stopCommQuality[:].in1;
    connect stopCommQuality[:].out1 -> velocityController[:].slowDownIn;
Alexander David Hellwig's avatar
Alexander David Hellwig committed
53
}