}
public void printInfo() {
- //System.out.println("\n\nThe number of aircrafts:"+noAircrafts);
- //System.out.println("The aircrafts are:");
+ System.out.println("\n\nThe number of aircrafts:"+noAircrafts);
+ System.out.println("The aircrafts are:");
for( int i = 0; i < aircrafts.size(); ++i ) {
Aircraft aAux=(Aircraft) aircrafts.elementAt(i);
- //System.out.println(aAux);
+ System.out.println(aAux);
}
}
Point4d point1=(Point4d) p1.elementAt(pos);
Point4d point2=(Point4d) p2.elementAt(pos);
if (isConflict(point1,point2)) {
- //System.out.println(point1+" "+point2);
+ System.out.println(point1+" "+point2);
found=true;
conflictPoint=point1;
}
public /*static*/ void doIteration() {
time=initialTime+currIteration*d2.getStatic().iterationStep();
currIteration++;
- //System.out.println("In doIteration!");
- //System.out.println("Time:"+time);
+ System.out.println("In doIteration!");
+ System.out.println("Time:"+time);
cList.clear();
d2.getTrajectorySynthesizer().updateTrajectory(time,aAux);
}
- //System.out.println("Does it get here? (after the trajectory update)");
+ System.out.println("Does it get here? (after the trajectory update)");
for (i=0;i<n;i++)
for (j=i+1;j<n;j++) {
}
public static void main(String arg[]) {
+ System.out.println("D2 - Application started");
+
D2 d2 = new D2();
d2.rw=new ReadWrite( d2 );
count++;
if( count % 10000 == 0 ) {
- System.out.println( "iteration "+count );
+ //System.out.println( "iteration "+count );
}
- if( count == 40000 ) {
+ if( count == 1000 ) {
break;
}
}
}
public /*static*/ void printInfo() {
- //System.out.println("\n\nThe number of fixes:"+_noFixes);
- //System.out.println("The fixes are:");
+ System.out.println("\n\nThe number of fixes:"+_noFixes);
+ System.out.println("The fixes are:");
for( int i = 0; i < _fixes.size(); ++i ) {
Fix bAux=(Fix) _fixes.elementAt( i );
- //System.out.println(bAux);
+ System.out.println(bAux);
}
}
t=new Track(pos, vel);
nameFix=st.nextToken();
fAux=getFlight(id);
- //System.out.println(id+" Flight id: "+fAux.flightID);
+ System.out.println(id+" Flight id: "+fAux.flightID);
fAux.setTrack(t);
- //System.out.println("Setting current fix ...");
+ System.out.println("Setting current fix ...");
fAux.fPlan.setCurrentFix(nameFix);
- //System.out.println("Sent flight "+
- //fAux.flightID+
- // "; position: "+
- // fAux.track.pos);
+ System.out.println("Sent flight "+
+ fAux.flightID+
+ "; position: "+
+ fAux.track.pos);
d2.getTrajectorySynthesizer().updateTrajectory(time, fAux);
fAux.traject.printInfo();
}
}
public /*static*/ void printInfo() {
- //System.out.println("\n\nThe number of flights:"+noFlights);
- //System.out.println("The flights are:");
+ System.out.println("\n\nThe number of flights:"+noFlights);
+ System.out.println("The flights are:");
for( int i = 0; i < f.size(); ++i ) {
Flight fAux=(Flight) f.elementAt(i);
- //System.out.println(fAux);
+ System.out.println(fAux);
}
}
}
public void setCurrentFix(String nameFix) {
int i=r.getIndexOf(nameFix);
- //System.out.println("name of the fix: "+nameFix+" index:"+i);
+ System.out.println("name of the fix: "+nameFix+" index:"+i);
r.setCurrent(i);
}
}
}
public void executeMessage() {
- //System.out.println("Executing message of type "+type);
+ System.out.println("Executing message of type "+type);
//static messages
if (type.compareTo("SET_MAP_SIZE")==0) {
- //System.out.println("Setting the map size...");
+ System.out.println("Setting the map size...");
d2.getStatic().setMapSize(parameters);
}
else if (type.compareTo("SET_ITERATION_STEP")==0) {
- //System.out.println("Setting the iteration step...");
+ System.out.println("Setting the iteration step...");
d2.getStatic().setIterationStep(parameters);
}
else if (type.compareTo("SET_NO_OF_ITERATIONS")==0) {
- //System.out.println("Setting the no. of iterations...");
+ System.out.println("Setting the no. of iterations...");
d2.getStatic().setNumberOfIterations(parameters);
}
else if (type.compareTo("SET_CYLINDER")==0) {
- //System.out.println("Setting the cylinder of safety/unsafety...");
+ System.out.println("Setting the cylinder of safety/unsafety...");
d2.getStatic().setCylinder(parameters);
}
else if (type.compareTo("ADD_FIX")==0) {
- //System.out.println("Adding a new fix...");
+ System.out.println("Adding a new fix...");
d2.getFixList().addFix(parameters);
}
else if (type.compareTo("REMOVE_FIX")==0) {
- //System.out.println("Removing a fix...");
+ System.out.println("Removing a fix...");
d2.getFixList().removeFix(parameters);
}
else if (type.compareTo("ADD_AIRCRAFT")==0) {
- //System.out.println("Adding an aircraft...");
+ System.out.println("Adding an aircraft...");
d2.getAircraftList().addAircraft(parameters);
}
else if (type.compareTo("REMOVE_AIRCRAFT")==0) {
- //System.out.println("Removing an aircraft...");
+ System.out.println("Removing an aircraft...");
d2.getAircraftList().removeAircraft(parameters);
}
d2.getAlgorithm().setInitialTime(time);
if (type.compareTo("ADD_FLIGHT_PLAN")==0) {
- //System.out.println("Adding flight plan...");
+ System.out.println("Adding flight plan...");
d2.getFlightList().addFlightPlan(time,parameters);
}
else if (type.compareTo("REMOVE_FLIGHT_PLAN")==0) {
- //System.out.println("Removing flight plan...");
+ System.out.println("Removing flight plan...");
d2.getFlightList().removeFlightPlan(time,parameters);
}
else if (type.compareTo("AMEND_FLIGHT_INFO")==0) {
- //System.out.println("Amending flight info...");
+ System.out.println("Amending flight info...");
d2.getFlightList().amendFlightInfo(time,parameters);
}
else if (type.compareTo("AMEND_FLIGHT_PLAN")==0) {
- //System.out.println("Amending flight plan...");
+ System.out.println("Amending flight plan...");
d2.getFlightList().amendFlightPlan(time,parameters);
}
else if (type.compareTo("SENDING_AIRCRAFT")==0) {
- //System.out.println("Sending aircraft data...");
+ System.out.println("Sending aircraft data...");
d2.getFlightList().sendingAircraft(time,parameters);
}
}
if (line.equals(""))
return false;
- //System.out.println("I'm reading line "+line);
+ System.out.println("I'm reading line "+line);
// treating comments
if ((line.charAt(0)=='/')&&(line.charAt(1)=='/'))
}
public void executeAll() {
- //System.out.println("executeAll: we have "+messages.size()+" messages.");
+ System.out.println("executeAll: we have "+messages.size()+" messages.");
while(hasNext())
next().executeMessage();
d2.getStatic().printInfo();
d2.getFixList().printInfo();
d2.getAircraftList().printInfo();
d2.getFlightList().printInfo();
- //System.out.println("Messages executed\n\n\n\n\n");
+ System.out.println("Messages executed\n\n\n\n\n");
}
}
break;
}
- //System.out.println("Input data read.");
+ System.out.println("Input data read.");
+ System.out.println("Data set read");
}
public void write() {
// this is a test procedure
public /*static*/ void printInfo() {
- //System.out.println("\n\nStatic Data:");
- //System.out.println("Width:"+_width+" Height:"+_height);
- //System.out.println("Radius of safety/unsafety:"+_radius);
- //System.out.println("Distance of safety/unsafety:"+_distance);
- //System.out.println("Iteration step:"+_iterationStep+" No. of Iterations:"+_noIterations);
+ System.out.println("\n\nStatic Data:");
+ System.out.println("Width:"+_width+" Height:"+_height);
+ System.out.println("Radius of safety/unsafety:"+_radius);
+ System.out.println("Distance of safety/unsafety:"+_distance);
+ System.out.println("Iteration step:"+_iterationStep+" No. of Iterations:"+_noIterations);
}
}
}
public void printInfo() {
- //System.out.println("track: "+pos+"||"+vel);
+ System.out.println("track: "+pos+"||"+vel);
}
}
}
public void printInfo() {
- //System.out.println("New trajectory: ");
+ System.out.println("New trajectory: ");
for (int i=0 ; i<noPoints ; i++) {
- //System.out.println(getPointAt(i));
+ System.out.println(getPointAt(i));
}
}
}
}
public /*static*/ Trajectory updateTrajectory (double time, Flight flight) {
- //System.out.println("Updating trajectory for "+flight.flightID);
+ System.out.println("Updating trajectory for "+flight.flightID);
int i;
setInitialParameters(flight);
- //System.out.println("Starting position: "+currentPos);
+ System.out.println("Starting position: "+currentPos);
if (currentPos.outOfRange()) {
traject.setNoPoints(1);
traject.setPoint(0, currentPos);
for (i=0 ; (!currentPos.outOfRange()) && (i<limit()) ; i++) {
getTrajectoryPoint(flight, time+i*d2.getStatic().iterationStep());
if (i==0) {
- //System.out.println("current position: "+currentPos);
+ System.out.println("current position: "+currentPos);
traject.distToDest=horizTotalDist;
traject.nextFixIndex=nextFix;
traject.nextFix=(currentPos.outOfRange())? null : flight.fPlan.r.getFixAt(nextFix);
traject.setPoint(i, (Point4d) currentPos);
}
traject.setNoPoints(--i);
- //System.out.println(traject.noPoints);
+ System.out.println(traject.noPoints);
traject.timeToDest=(i>0)? traject.getPointAt(i-1).time+timeF:time+timeF;
}
flight.traject=traject;
- //System.out.println("Finished updating trajectory ...");
+ System.out.println("Finished updating trajectory ...");
return traject;
}
if ((distance>horizTotalDist)&&(horizTotalDist>0)) {
timeF=(accel<=0)?(horizTotalDist/hSpeed):
(-hSpeed+Math.sqrt(hSpeed*hSpeed+2*accel*horizTotalDist))/accel;
- //System.out.println("TIMEF= "+timeF);
+ System.out.println("TIMEF= "+timeF);
}
horizTotalDist-=distance;
changeToTrialRoute(position, fixIndex);
trajectoryDiff(position.time);
conflictsDiff(position.time);
- //System.out.println("old route:"+oldFlight.fPlan.r);
- //System.out.println("new route:"+trialFlight.fPlan.r);
+ System.out.println("old route:"+oldFlight.fPlan.r);
+ System.out.println("new route:"+trialFlight.fPlan.r);
trialFlight.trialStatus=-1;
}
public void trajectoryDiff (double time) {
trialFlight.updateTrajectory(time);
oldFlight.updateTrajectory(time);
- //System.out.println("Flight "+trialFlight.flightID+":");
+ System.out.println("Flight "+trialFlight.flightID+":");
distDiff=oldFlight.traject.distanceToDestination()-
trialFlight.traject.distanceToDestination();
timeDiff=oldFlight.traject.timeToDestination(time)-
trialFlight.traject.timeToDestination(time);
if (timeDiff<0) { timeDiff=0; }
- //System.out.println("Time difference: "+timeDiff);
- //System.out.println("Distance difference: "+distDiff);
+ System.out.println("Time difference: "+timeDiff);
+ System.out.println("Distance difference: "+distDiff);
}
public void conflictsDiff(double time) {
int i, j;
oldConflicts=d2.getAlgorithm().getConflictsWith(time,oldFlight);
newConflicts=d2.getAlgorithm().getConflictsWith(time,trialFlight);
- //System.out.println("Flight "+trialFlight.flightID+":");
- //System.out.println("Conflicts for the old flight:");
- //System.out.println(oldConflicts);
- //System.out.println("Conflicts for the trial flight:");
- //System.out.println(newConflicts);
+ System.out.println("Flight "+trialFlight.flightID+":");
+ System.out.println("Conflicts for the old flight:");
+ System.out.println(oldConflicts);
+ System.out.println("Conflicts for the trial flight:");
+ System.out.println(newConflicts);
noNew=0;
for (i=0 ; i<newConflicts.noConflicts ; i++) {
Conflict conflict=newConflicts.conflictAt(i);
SOURCE_FILES=*.java
BUILDSCRIPT=~/research/Robust/src/buildscript
-BSFLAGS= -debug -nooptimize -mainclass $(MAIN_CLASS) -justanalyze -ownership -ownallocdepth 1 -ownwritedots final -enable-assertions
+BSFLAGS= -debug -nooptimize -mainclass $(MAIN_CLASS) #-justanalyze -ownership -ownallocdepth 1 -ownwritedots final -enable-assertions
all: $(PROGRAM).bin
rm -f *.dot
rm -f *.png
rm -f aliases.txt
+ rm -f output.txt
+
if (type.compareTo("ADD_FLIGHT_PLAN")==0)
{
- System.out.println("Adding flight plane...");
+ System.out.println("Adding flight plan...");
FlightList.addFlightPlan(time,parameters);
}
if (type.compareTo("REMOVE_FLIGHT_PLAN")==0)
public static void executeAll()
{
- System.out.println("executeAll: we have "+messages.size()+" messages.");
+ System.out.println("executeAll: we have "+messages.size()+" messages.");
while (hasNext())
next().executeMessage();
Static.printInfo();
--- /dev/null
+all: run
+
+run: D2.class
+ java D2 > output.txt
+
+D2.class: D2.java
+ javac D2.java
+
+clean:
+ rm -f *.class
+ rm -f *~
+ rm -f output.txt