Skip to content
View in the app

A better way to browse. Learn more.

The AVSIM Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Just looking for confirmation that SAT and TAT are not broke

Featured Replies

  • Commercial Member

Both of these return zero for me at all altitudes and speeds. I have to assume that I'm not seeing the wood for the trees - would someone be kind enough to point out my error? RANKINE_TO_CELSIUS does work, BTW.

//**************************************************************************// Standard atmospheric temperature//**************************************************************************double getSAT(double temp){	double data=0;	execute_calculator_code("(A:STANDARD ATM TEMPERATURE, rankine)",&data,NULL,NULL);	return(RANKINE_TO_CELSIUS(data));}//---snip---//double temp=0;getSAT(temp);sprintf(pelement->string, "%30s%4.0f","Standard ATM temp (celsius) = ",temp);//**************************************************************************// Total air temperature - air temp at the front of the aircraft with ram pressure//**************************************************************************double getTAT(double temp){	double data=0;	execute_calculator_code("(A:TOTAL AIR TEMPERATURE, celsius)",&data,NULL,NULL);	return data;}//---snip---//double temp=0;getTAT(temp);sprintf(pelement->string, "%27s%4.0f","Total air temp (celsius) = ",temp);

Many thanks.-Dai

  • Commercial Member

Out of curiosity... why are you doing this:

sprintf(pelement->string, "%30s%4.0f","Standard ATM temp (celsius) = ",getSAT(temp));

instead of this:

sprintf(pelement->string, "Standard ATM temp (celsius) = %4.0f",getSAT(temp));

It's less code execution to do the latter, fewer CPU cycles, etc. Also, why are you passing 'temp' as a variable that's unused in the function?

Ed Wilson

Mindstar Aviation
My Playland - I69

  • Author
  • Commercial Member

Simple answer Ed - because I've never known any other way to do it. As for passing 'temp' - in the original code

//**************************************************************************// Standard atmospheric temperature//**************************************************************************double getSAT(double temp){	double data=0;	execute_calculator_code("(A:STANDARD ATM TEMPERATURE, rankine)",&data,NULL,NULL);	return(RANKINE_TO_CELSIUS(data));}//---snip---//double temp=0;getSAT(temp);sprintf(pelement->string, "%30s%4.0f","Standard ATM temp (celsius) = ",temp);

-if I didn't pass in a variable to contain the return, I got a compiler error. Maybe that changes with the way you're suggesting?-Dai

  • Commercial Member

This should compile and work:

double getSAT(){	double data=0;	execute_calculator_code("(A:STANDARD ATM TEMPERATURE, celcius)",&data,NULL,NULL);	return data;}double temp=0;temp = getSAT();sprintf(pelement->string, "Standard ATM temp (celsius) = %4.0f",temp);

Ed Wilson

Mindstar Aviation
My Playland - I69

  • Commercial Member

This also should work:

double getSAT(){	double data=0;	execute_calculator_code("(A:STANDARD ATM TEMPERATURE, celcius)",&data,NULL,NULL);	return data;}sprintf(pelement->string, "Standard ATM temp (celsius) = %4.0f",getSAT());

Ed Wilson

Mindstar Aviation
My Playland - I69

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.