Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class E6B
- {
- private double d; //desired course in dr
- private double va; //speed in knots
- private double w; //wind direction in degrees
- private double vw; //wind speed in knots
- public E6B( double pd, double pva, double pw, double pvw)
- {
- d = pd;
- va = pva;
- w = pw;
- vw = pvw;
- }
- //accsessor
- public double getD(){ return d; }
- public double getVa(){ return va; }
- public double getW(){ return w; }
- public double getVw(){ return vw; }
- public double windCorrectionAngle()
- {
- double dr = Math.toRadians( d );
- double wr = Math.toRadians( w );
- double rv = 0;
- rv = Math.asin(vw * Math.sin(wr - dr) / va);
- return Math.toDegrees( rv );
- }
- public double groundSpeed()
- {
- double dr = Math.toRadians( d );
- double wr = Math.toRadians( w );
- double gsv = 0;
- gsv = Math.sqrt( va + vw - 2*va * Math.cos (d - w + -5 ) );
- return Math.toDegrees( gsv );
- }
- public double windCorrectionAngleDegrees()
- {
- double dr = Math.toRadians( d );
- double wr = Math.toRadians( w );
- double wcad = 0;
- wcad = 180 / 3.14 * Math.sin(vw / va * Math.sin( 3.14 * ( w - d )/ 180));
- return Math.toDegrees( wcad );
- }
- public double trueGroundSpeed()
- {
- double dr = Math.toRadians( d );
- double wr = Math.toRadians( w );
- double tgs = 0;
- tgs = Math.sqrt( va + vw - 2 * va * vw * Math.cos( 3.14 * ( d - w + -5 ) / 180 ));
- return Math.toDegrees( tgs );
- }
- public static void main (String[]args)
- {
- E6B e6b = new E6B( 360, 120, 270, 10 );
- System.out.println( " Wind Correction Angle: " + Math.round( e6b.windCorrectionAngle() ) );
- System.out.println( " Ground Speed: " + Math.round( e6b.groundSpeed() ) );
- System.out.println( " Wind Correction Angle in Degrees: " + Math.round( e6b.windCorrectionAngleDegrees() ) );
- System.out.println( " True Ground Speed: " + Math.round( e6b.trueGroundSpeed() ) );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement