Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Air Density Calculator
#1
Can an Air Density Calculator be made with QM?

Like this: http://www.longacreracing.com/instructi ... ?instid=24

Found this below in the source code...


<!-- Hide this script from older browsers

function calc_airdensity() {

var temp , pressure , humidity , altitude , spm ;

spm_calc = 0;

temp = eval(document.airdensity_form.Tf.value);

humidity = eval(document.airdensity_form.Rh.value);

pressure = eval(document.airdensity_form.Bp.value);

altitude = eval(document.airdensity_form.Af.value)

Am = altitude * 12 * 2.54 / 100

Tc = (( temp - 32) * 5/9)

Tk = Tc + 273

Bmb = pressure / (29.92 / 1013)

BSmb = 1013 * Math.exp(-Am / 7000)

BSin = BSmb * (29.92 / 1013)

MSkg = 3.884266*10^((7.5*Tc) / (237.7 + Tc))

Mkg = MSkg * humidity / 100

Tvc = ((1 + 1.609 * Mkg) / (1 + Mkg)) * Tc

Es = 6.11 * 10^(7.5 * Tc / (237.7 + Tc))

E = (humidity * Es) / 100

Tdc = ( -430.22 + 237.7 * Math.log(E) ) / (-Math.log(E) + 19.08)

Tdf = Tdc * 9 / 5 + 32

Baro = Bmb * Math.exp(-Am / 7000)

Dad = (Baro * 100) / (Tk * 287)

Dvad = (Baro * 100) / ((Tvc + 273) * 287)

StdDen = 1.22556

Cd1 = Dad / StdDen * 100

Cd2 = Dvad / StdDen * 100

document.airdensity_form.cor_air_den.value = Cd2;

}

// End hiding script from older browsers -->

</script>
#2
Yes, you can convert the script to QM. I can help to convert some parts.
#3
Can you give me a start? Not sure on how to do it. I'm sure ill need a dialog and all but that can be done later. how to convert script?

thanks!
#4
Macro Macro1570
Code:
Copy      Help
;function calc_airdensity() {
;
;var temp , pressure , humidity , altitude , spm ;
;
;spm_calc = 0;
;
;temp = eval(document.airdensity_form.Tf.value);

double temp pressure humidity altitude spm spm_calc
temp=10.5 ;;assign some values to the variables

;...

;Am = altitude * 12 * 2.54 / 100

double Am = altitude * 12 * 2.54 / 100

;...

;convert Math.exp(-Am / 7000) to exp(-Am/7000)
;...
;convert Math.log(E) to log(E)
#5
I'm lost, not even sure what language that is to convert it to QM!
#6
Almost don't need to convert. Just one difference: in that language don't need to declare variables. In QM declare them as double.


Forum Jump:


Users browsing this thread: 2 Guest(s)