Displaying the 3 windpatterns as provided in the requirements.

This commit is contained in:
Nidhi Sawhney committed 2012-05-28 22:10:04 +02:00
1 parent 8da0ab4a43
commit bb7c30c474
7 files changed
+167 -37

No files matched your search

@@ -4,15 +4,100 @@ package com.sap.sailing.simulator;
public class WindControlParameters {
/**
* Base wind speed in knots
* Value range 0 to 30
*/
public Double baseSpeed;
public Double baseWindSpeed;
/**
* Base average wind direction in degrees
* Value range 0 to 360 degrees
*/
public Double windBearing;
public Double baseWindBearing;
/**
* Oscillation parameter frequency
* Value range 0 to 60 per hour
*/
public Double frequency;
/**
* Oscillation parameter amplitude
* Value range 0 to 20 degrees
*/
public Double amplitude;
/**
* Oscillation parameter
* Gradient description for left side of the windfield
* Value range 0 to 200% of baseSpeed
*/
public Double leftWindSpeed;
/**
* Oscillation parameter
* Gradient description for middle of the windfield
* Value range 0 to 200% of baseSpeed
*/
public Double middleWindSpeed;
/**
* Oscillation parameter
* Gradient description for right of the windfield
* Value range 0 to 200% of baseSpeed
*/
public Double rightWindSpeed;
/**
* Blast parameter
* probability of blast at a certain location
* Value range 0 to 50%
*/
public Double blastProbability;
/**
* Blast parameter
* Maximum size of the blast, represents how many neighbouring cells it will impact
* Value range 1 to 10
*/
public Double maxBlastSize;
/**
* Blast parameter
* Average blast wind speed
* Value range 0 to 100% of baseWindSpeed
*/
public Double blastWindSpeed;
/**
* Blast parameter
* Variance of blast wind speed
* Value range 0 to 100% of baseWindSpeed
*/
public Double blastWindSpeedVar;
public WindControlParameters() {
setDefaults();
}
public WindControlParameters(double speedInKnots, double bearing) {
baseSpeed = speedInKnots;
windBearing = bearing;
setDefaults();
baseWindSpeed = speedInKnots;
baseWindBearing = bearing;
}
public void setDefaults() {
baseWindSpeed = 0.0;
baseWindBearing = 0.0;
frequency = 0.0;
amplitude = 0.0;
leftWindSpeed = 0.0;
middleWindSpeed = 0.0;
rightWindSpeed = 0.0;
blastProbability = 0.0;
maxBlastSize = 1.0;
blastWindSpeed = 0.0;
blastWindSpeedVar = 0.0;
}
}
@@ -24,9 +24,9 @@ public class WindFieldImpl implements WindField {
@Override
public Wind getWind(TimedPosition coordinates) {
KnotSpeedImpl knotSpeedImpl = new KnotSpeedImpl(windParameters.baseSpeed);
KnotSpeedImpl knotSpeedImpl = new KnotSpeedImpl(windParameters.baseWindSpeed);
double wBearing = windParameters.windBearing *
double wBearing = windParameters.baseWindBearing *
(1 + coordinates.getPosition().getDistance(boundary.getCorners().get("NorthWest")).getMeters()/boundary.getHeight().getMeters());
SpeedWithBearing wspeed = new KilometersPerHourSpeedWithBearingImpl(knotSpeedImpl.getKilometersPerHour(), new DegreeBearingImpl(wBearing));