Commit 83b95077 authored by Alexander David Hellwig's avatar Alexander David Hellwig
Browse files

Model: cleanup of ConflictComputer

parent 9f587868
......@@ -3,14 +3,13 @@ import ba.intersection.IntersectionController;
import ba.util.RelToAbsTrajectory;
import ba.util.CommQuality;
import ba.vehicle.VelocityController;
//component System<N1 n = 2,N1 x = 1,N1 m = 5,N1 m1 = 4,N1 m2 = 10>{
component System{
//Intersection
instance IntersectionController intersectionController;
ports in Q cutoffTimeIn,
in B isActiveIn,
in Q^{3,20} absTrajectory[2];
in Q^{3,5} absTrajectory[2];
connect cutoffTimeIn -> intersectionController.cutoffTime;
connect isActiveIn -> intersectionController.isActive;
......
......@@ -10,22 +10,12 @@ component ConflictComputer<N1 n = 2,N1 x = 1,N1 m = 5, N1 m1 = 4,N1 m2 = 10>{
port in Q cutoffTimeIn;
port out B conflictOut[x];
instance MatrixSingleSetCompare<3,m,2,x> singleSetCompare;
instance MatrixSingleSetCompare<3,m,n,x> singleSetCompare;
instance TrajectoryCompare<m,m1,m2> trajectoryCompare[x];
instance CollisionToConflict collisionToConflict[x];
connect trajectory[:] -> singleSetCompare.setIn[:];
connect singleSetCompare.listOut1[:] -> trajectoryCompare[:].trajectory1;
connect singleSetCompare.listOut2[:] -> trajectoryCompare[:].trajectory2;
connect trajectoryCompare[:].collision -> collisionToConflict[:].collisionIn;
connect singleSetCompare.listOut1[:] -> collisionToConflict[:].trajectoryIn1;
connect singleSetCompare.listOut2[:] -> collisionToConflict[:].trajectoryIn2;
connect cutoffTimeIn -> collisionToConflict[:].timeCutoff;
connect trajectoryCompare[:].collision -> collisionToConflict[:].collisionIn;
connect trajectoryCompare[:].index1 -> collisionToConflict[:].indexIn1;
connect trajectoryCompare[:].index2 -> collisionToConflict[:].indexIn2;
connect trajectoryCompare[:].colPos -> collisionToConflict[:].colPosIn;
connect collisionToConflict[:].conflict -> conflictOut[:];
connect cutoffTimeIn -> trajectoryCompare[:].cutoffTime;
connect trajectoryCompare[:].conflict -> conflictOut[:];
}
package ba.intersection;
//component IntersectionController<N1 n = 2,N1 x = 1,N1 m = 5>{
component IntersectionController{
port in Q^{3,5} trajectoryIn[2];
//TODO: x = (n-1)n/2
//TODO: m1 = m - 1, m2 = m1(m1+1)/2
component IntersectionController<N1 n = 2,N1 x = 1,N1 m = 5,N1 m1 = 4,N1 m2 = 10>{
//component IntersectionController{
port in Q^{3,m} trajectoryIn[n];
port in Q cutoffTime;
port in B isActive;
port out B stop[2];
port out B stop[n];
instance ConflictToStopLookup<2,1> conflictToStopLookup;
instance ConflictComputer<2,1,5,4,10> conflictComputer;
instance ConflictToStopConverter<2,1,5> conflictToStopConverter;
instance ConflictToStopLookup<n,x> conflictToStopLookup;
instance ConflictComputer<n,x,m,m1,m2> conflictComputer;
instance ConflictToStopConverter<n,x,m> conflictToStopConverter;
connect trajectoryIn[:] -> conflictComputer.trajectory[:];
connect cutoffTime -> conflictComputer.cutoffTimeIn;
......
......@@ -7,17 +7,15 @@ import ba.util.MatrixDualSetCompare;
component TrajectoryCompare<N1 m = 5, N1 m1 = 4, N1 m2 = 10>{
ports in Q^{3,m} trajectory1,
in Q^{3,m} trajectory2,
out B collision,
out Z index1,
out Z index2,
out Q^{2,1} colPos;
in Q cutoffTime,
out B conflict;
instance MatrixDualSetCompare<4,1,m1,m2> dualSetCompare;
instance TrajectoryToLine trajectoryToLine1;
instance TrajectoryToLine trajectoryToLine2;
instance LineIntersection lineIntersection[m2];
instance LineInterToIndex lineInterToIndex;
instance CollisionToConflict collisionToConflict;
connect trajectory1 -> trajectoryToLine1.trajectoryIn;
connect trajectory2 -> trajectoryToLine2.trajectoryIn;
......@@ -25,14 +23,14 @@ component TrajectoryCompare<N1 m = 5, N1 m1 = 4, N1 m2 = 10>{
connect lineIntersection[:].intersects -> lineInterToIndex.collisionIn[:];
connect lineIntersection[:].point -> lineInterToIndex.pointsIn[:];
connect lineInterToIndex.collisionOut -> collision;
connect lineInterToIndex.index1 -> index1;
connect lineInterToIndex.index2 -> index2;
connect lineInterToIndex.pos -> colPos;
//compare 4 lines to 4 other lines without permutations with same index
//4*5/2 = 10
connect lineInterToIndex.collisionOut -> collisionToConflict.collisionIn;
connect lineInterToIndex.index1 -> collisionToConflict.indexIn1;
connect lineInterToIndex.index2 -> collisionToConflict.indexIn2;
connect lineInterToIndex.pos -> collisionToConflict.colPosIn;
connect trajectory1 -> collisionToConflict.trajectoryIn1;
connect trajectory2 -> collisionToConflict.trajectoryIn2;
connect cutoffTime -> collisionToConflict.timeCutoff;
connect collisionToConflict.conflict -> conflict;
connect trajectoryToLine1.lineOut[:] -> dualSetCompare.setIn1[:];
connect trajectoryToLine2.lineOut[:] -> dualSetCompare.setIn2[:];
......
package ba.util;
//TODO: n2 = n(n+1)/2
//TODO: EMAM2CPP
component MatrixDualSetCompare<N1 rows = 3,N1 cols = 3,N1 n = 5, N2 n2 = 15>{
//TODO: remove once EMAM2CPP supports matrix generics
component MatrixDualSetCompare<N1 rows = 4,N1 cols = 1,N1 n = 4, N2 n2 = 10>{
ports in Q^{rows,cols} setIn1[n],
in Q^{rows,cols} setIn2[n],
out Q^{rows,cols} listOut1[n2],
......
package ba.util;
//TODO: x has to be (n-1)n/2
//TODO: remove once EMAM2Cpp works with matrix generics
component MatrixSingleSetCompare<N1 rows = 3,N1 cols = 3, N1 n =2,N1 x = 1>{
component MatrixSingleSetCompare<N1 rows = 3,N1 cols = 5, N1 n = 2,N1 x = 1>{
ports in Q^{rows,cols} setIn[n],
out Q^{rows,cols} listOut1[x],
out Q^{rows,cols} listOut2[x];
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment