Commit 4c88328a authored by Alexander David Hellwig's avatar Alexander David Hellwig
Browse files

Model: added adaptable Parameters + flattened generics

parent c4f4aa88
......@@ -234,6 +234,24 @@ public class GenerationTest extends AbstractSymtabTest {
content = content.replace("Col<int> counter=Col<int>(1);" , "Col<int> counter=Col<int>(n);");
content = content.replace("colvec tmpLine;","colvec tmpLine = colvec(4);");
// content = content.replace("sqrt","std::sqrt");
if(f.getName().equals("ba_system_collisionDetection_multiOr.h")){
content = content.replace("10","1");
}
// if(f.getName().equals("ba_system_collisionDetection_rectIntersection_1__dualSetCompare.h")){
// String fixedGenerics = "const int n = 4;\nconst int n2 = 10;\n";
// content = content.replace("const int cols = 1;","const int cols = 1;\n" + fixedGenerics);
// }
if(f.getName().equals("ba_system_collisionDetection_rectIntersection_1__dualSetCompare.h")){
content = content.replace("rows = 4","rows = 2");
content = content.replace("cols = 1","cols = 4");
content = content.replace("n = 4","n = 2");
content = content.replace("n2 = 10","n2 = 1");
}
Files.write(path, content.getBytes(charset));
}
}
......
......@@ -3,7 +3,7 @@ import ba.intersection.IntersectionController;
import ba.util.RelToAbsTrajectory;
import ba.util.CommQuality;
import ba.vehicle.VelocityController;
import ba.collisionDetection.CollisionDetection;
import ba.collisionDetection.CollisionDetectionGeneric;
//component System<N1 n = 2,N1 x = 1,N1 m = 5,N1 m1 = 4,N1 m2 = 10>{
component System{
//Intersection ports
......@@ -25,7 +25,7 @@ component System{
out Q(0m/s : 60m/s) curVel[2];
instance IntersectionController intersectionController;
instance CollisionDetection collisionDetection;
instance CollisionDetectionGeneric collisionDetection;
instance CommQuality<B> stopCommQuality[2];
instance VelocityController(3.0) velocityController[2];
......
......@@ -3,14 +3,14 @@ import ba.util.RectIntersection;
import ba.util.SingleSetCompareMatrix;
import ba.util.MultiOr;
component CollisionDetection<N1 n = 2,N1 x = 1>{
component CollisionDetectionGeneric<N1 n = 2,N1 x = 1>{
//component CollisionDetection{
ports in Q^{2,4} hulls[n],
out B collision;
instance SingleSetCompareMatrix<2,4,n,x> singleSetCompare;
instance SingleSetCompareMatrix<2,4,2,1> singleSetCompare;
instance RectIntersection rectIntersection[x];
instance MultiOr<x> multiOr;
instance MultiOr<1> multiOr;
connect hulls[:] -> singleSetCompare.setIn[:];
......
......@@ -2,16 +2,16 @@ package ba.intersection;
import ba.util.SingleSetCompareMatrix;
//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{
ports in Q^{3,m} trajectoryIn[n],
//component IntersectionController<N1 n = 2,N1 x = 1,N1 m = 5,N1 m1 = 4,N1 m2 = 10>{
component IntersectionController{
ports in Q^{3,5} trajectoryIn[2],
in Q(0m : 10m) cutoffTime,
in B isActive,
out B stop[n];
out B stop[2];
instance SingleSetCompareMatrix<3,m,n,x> singleSetCompare;
instance TrajectoryCollision<m,m1,m2> trajectoryCollision[x];
instance CollisionToStop<n,x,m> collisionToStop;
instance SingleSetCompareMatrix<3,5,2,1> singleSetCompare;
instance TrajectoryCollision<5,4,10> trajectoryCollision[1];
instance CollisionToStop<2,1,5> collisionToStop;
connect trajectoryIn[:] -> singleSetCompare.setIn[:];
connect singleSetCompare.outA[:] -> trajectoryCollision[:].trajectoryA;
......
......@@ -12,7 +12,7 @@ component TrajectoryCollision<N1 m = 5, N1 m1 = 4, N1 m2 = 10>{
instance TrajectoryToLines trajectoryToLinesA;
instance TrajectoryToLines trajectoryToLinesB;
instance DualSetCompareMatrix<4,1,m1,m2> dualSetCompare;
instance DualSetCompareMatrix<4,1,4,10> dualSetCompare;
instance LineIntersection lineIntersection[m2];
instance FirstLineIntersection firstLineIntersection;
instance TimeCutoffFilter(2.0) timeCutoffFilter;
......
......@@ -12,41 +12,19 @@ component RectIntersection{
instance RectToLines rectToLines1;
instance RectToLines rectToLines2;
instance DualSetCompareMatrix<2,4,4,10> dualSetCompare;
instance LineIntersection lineIntersection[10];
instance MultiOr<10> multiOr;
connect rect1 -> rectToLines1.rect;
connect rect2 -> rectToLines2.rect;
connect rectToLines1.lineA -> lineIntersection[1].lineA;
connect rectToLines2.lineA -> lineIntersection[1].lineB;
connect rectToLines1.lineA -> lineIntersection[2].lineA;
connect rectToLines2.lineB -> lineIntersection[2].lineB;
connect rectToLines1.lineA -> lineIntersection[3].lineA;
connect rectToLines2.lineC -> lineIntersection[3].lineB;
connect rectToLines1.lineA -> lineIntersection[4].lineA;
connect rectToLines2.lineD -> lineIntersection[4].lineB;
connect rectToLines1.lineB -> lineIntersection[5].lineA;
connect rectToLines2.lineB -> lineIntersection[5].lineB;
connect rectToLines1.lineB -> lineIntersection[6].lineA;
connect rectToLines2.lineC -> lineIntersection[6].lineB;
connect rectToLines1.lineB -> lineIntersection[7].lineA;
connect rectToLines2.lineD -> lineIntersection[7].lineB;
connect rectToLines1.lineC -> lineIntersection[8].lineA;
connect rectToLines2.lineC -> lineIntersection[8].lineB;
connect rectToLines1.lineC -> lineIntersection[9].lineA;
connect rectToLines2.lineD -> lineIntersection[9].lineB;
connect rectToLines1.lines[:] -> dualSetCompare.setInA[:];
connect rectToLines2.lines[:] -> dualSetCompare.setInB[:];
connect rectToLines1.lineD -> lineIntersection[10].lineA;
connect rectToLines2.lineD -> lineIntersection[10].lineB;
connect dualSetCompare.outA[:] -> lineIntersection[:].lineA;
connect dualSetCompare.outB[:] -> lineIntersection[:].lineB;
connect lineIntersection[:].intersects -> multiOr.boolIn[:];
connect multiOr.boolOut -> collision;
......
......@@ -2,11 +2,7 @@ package ba.util;
component RectToLines{
ports in Q^{2,4} rect,
//TODO: as array once issue is resolved
out Q^{4,1} lineA,
out Q^{4,1} lineB,
out Q^{4,1} lineC,
out Q^{4,1} lineD;
out Q^{4,1} lines[4];
implementation Math{
Q^{4,1} tmpLine;
......@@ -23,16 +19,19 @@ component RectToLines{
tmpLine(3,1) = rect(1,j);
tmpLine(4,1) = rect(2,j);
lines(i) = tmpLine;
//TODO: as array once issue is resolved
if i == 1
lineA = tmpLine;
elseif i == 2
lineB = tmpLine;
elseif i == 3
lineC = tmpLine;
elseif i == 4
lineD = tmpLine;
end
//if i == 1
// lineA = tmpLine;
// elseif i == 2
// lineB = tmpLine;
// elseif i == 3
// lineC = tmpLine;
// elseif i == 4
// lineD = tmpLine;
// end
end
}
}
\ No newline at end of file
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