package ch.zhaw.paraglider.physics;


/**
 * 
 * @author Christian Bresch
 * 
 *This Class manages the General Physics of the Simulator.
 * 
 */
public class GeneralPhysics {

	private int WEIGHT_OF_PILOT = 85;
	private int WEIGHT_OF_EQUIPMENT = 20;
	private final double gravitationalForce = 9.81f;
	private static GeneralPhysics instance;
	
	private GeneralPhysics() {
		super();
	}
	
	public static GeneralPhysics getInstance() {
		if(instance == null) {
			instance = new GeneralPhysics();
		}
		
		return instance;
	}
	
	/**
	 * Returns the gravitational force.
	 * @return double
	 */
	public double getFg () {
		return gravitationalForce * (WEIGHT_OF_EQUIPMENT + WEIGHT_OF_PILOT);
	}
	/**
	 * Returns the uplift force.
	 * @return double
	 */
	public double getFa() {
		//TODO: math formula for Fa
		return 0;
	}
	
	/**
	 * Returns the resistance force.
	 * @return double
	 */
	public double getFr() {
		//TODO: math formula for Fr
		return 0;
	}

	public int getWEIGHT_OF_PILOT() {
		return WEIGHT_OF_PILOT;
	}

	public void setWEIGHT_OF_PILOT(int weight) {
		WEIGHT_OF_PILOT = weight;
	}

	public int getWEIGHT_OF_EQUIPMENT() {
		return WEIGHT_OF_EQUIPMENT;
	}

	public void setWEIGHT_OF_EQUIPMENT(int weight) {
		WEIGHT_OF_EQUIPMENT = weight;
	}

}

@@ -242,16 +242,384 @@
 NT = 20;
+%09%0A%09%0A%09private double GLIDE_RATIO = 9;%0A%09private double RESISTANCE_RATIO = 0.6;%0A%09%0A%09/* Air Density in kg/m%5E3 */%0A%09private double AIR_DENSITY = 1.225;%0A%09%0A%09/* Ground speed + head wind in m/s  */%0A%09private double RELATIVE_SPEED = 10;%0A%09%0A%09/* Projected */%0A%09private double PROJECTED_UPSTREAMFLOW_AREA = 6;%0A%09%0A%09/* Projected wing area in m%5E2 */%0A%09private double PROJECTED_WING_AREA = 6;
 %0A%09privat
@@ -1142,36 +1142,43 @@
 %7B%0A%09%09//TODO: 
-math
+doublecheck
  formula
  for Fa%0A%09%09re
@@ -1169,15 +1169,8 @@
 mula
- for Fa
 %0A%09%09r
@@ -1171,26 +1171,109 @@
 la%0A%09%09return 
+(GLIDE_RATIO * AIR_DENSITY * Math.pow(RELATIVE_SPEED, 2) * PROJECTED_WING_AREA)/2.
 0;
+ 
 %0A%09%7D%0A%09%0A%09/**%0A%09
@@ -1368,12 +1368,19 @@
 DO: 
-math
+doublecheck
  for
@@ -1390,26 +1390,276 @@
 a for Fr
-%0A%09%09return 
+ Angestrmte flche%0A%09%09return getDynamicPressure() * PROJECTED_UPSTREAMFLOW_AREA * RESISTANCE_RATIO;%0A%09%7D%0A%09%0A%09/**%0A%09 * Returns the dynamic pressure.%0A%09 * @return double%0A%09 */%0A%09public double getDynamicPressure()%0A%09%7B%0A%09%09return (AIR_DENSITY * Math.pow(RELATIVE_SPEED, 2))/2.
 0;%0A%09%7D%0A%0A%09

Update of physical Model