Jump to content
Sign in to follow this  
spokes2112

ENGINE_WORKING_TIME

Recommended Posts

The return value from the ENGINE_WORKING_TIME token has me stumped. It is supposed to be seconds but it seems not to be. Any insights?This for FS9.Fred

Share this post


Link to post
Share on other sites

Hi,Only know:(A:GENERAL ENG ELAPSED TIME, ) Jan"Beatus ille qui procul negotiis..."

Share this post


Link to post
Share on other sites
Guest jimcooper1

Just made a little gauge to test ENGINE_WORKING_TIME and it does indeed count in SECONDS.FLOAT64 FSAPI engine_string_cb( PELEMENT_STRING pelement ){ wsprintf(pelement->string, "%d", (UINT32)pelement->source_var[0].var_value.n); return 0; }MAKE_STRING( engine_string, NULL, NULL, IMAGE_USE_ERASE | IMAGE_USE_TRANSPARENCY | IMAGE_USE_BRIGHT , 0, 50,5, 80,60, 3, ENGINE_WORKING_TIME, MODULE_VAR_NONE, MODULE_VAR_NONE, RGB(239,181,0), RGB(0,0,0), RGB(92,92,92), GAUGE_tuc_att_DEFAULT, GAUGE_WEIGHT_tuc_att, GAUGE_CHARSET_tuc_att, 0, DT_RIGHT | DT_VCENTER | DT_SINGLELINE, NULL, engine_string_cb)PELEMENT_HEADER engine_string_list[]={ &engine_string.header, NULL};Post your code so we can debug it for youregardsjim

Share this post


Link to post
Share on other sites

Thanks Jim,My code is essentially the same as yours and if you check it out against a clock you will probably find, as I do, that it is not counting seconds but is slow by about 1/2.If I multiply it by 2 it is close enough for my purpose (Hobbs meter) but it does not appear to be as advertised so I was just wondering if I was handling the return wrong.For Jan,execute_calculator_code("(A:GENERAL ENG ELAPSED TIME:1,seconds)",&val,NULL,NULL); gives identical results tas above.Fred

Share this post


Link to post
Share on other sites

Hobbs counters measure "tenths" of hours, not seconds. It is possible that's the reason for the discrepancy you're seeing...


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Share this post


Link to post
Share on other sites
Guest jimcooper1

Fred you're correct. Watching the counter without reference it did seem like seconds. However by comparing it with actual simulator elapsed time I found it was out by a factor of 2.35Can't think of a logical explanation.RegardsJim

Share this post


Link to post
Share on other sites

I noticed the same, and I was just wondering if the engine time was running at a speed that was depending on the engine power.It seemed to me that this timer was running slower when the engine was on idle than when it was on full thrust.What do you think?Eric

Share this post


Link to post
Share on other sites

Yes but this is not yet a Hobbs. I am simply looking at the return which is supposed to be seconds but is not.Fred

Share this post


Link to post
Share on other sites

I think you are correct Eric. The more the throttle is opened the faster the engine timeer counts. It would be interesting to know if anyone has actually made a working Hobbs without using file I/O but this ENGINE_WORKING_TIME token seems useless.

Share this post


Link to post
Share on other sites

Gentlemen, Has the term TBO come up? Me not a "C, C++, C#" type programmer. Could it be engine wear? As you'all said the output came back at higher throttle levels the variable was also higher. Could this be the one one many have been looking for? "too much throttle" = too much damage? there have been damage; A:(read, XML), vars sitting around for awhile (FS02), without it seems, a "firing" var. Guess we have to make 'em ourselves. Unless.... Damage sits inside the .air file. ( I would put $$$ on that ) Ron F. care to inquire? As for a working HOBBS without I/O, sorry, can't be be done, ever..Unless, HAL gets over his cold.Regards,Roman


20AUG21_Avsim_Sig.png?dl=1  FS RTWR   SHRS F-111   JoinFS   Little Navmap 
 

 

Share this post


Link to post
Share on other sites

I have found that the following code works well to display the Hobbs time.((A:GENERAL ENG ELAPSED TIME:1, hours) )%!04.1f!It does actually display the time as 02.4, that is the comparison I had with the counter on the Default Cessna 182.Eberhard------------------------------------Eberhard Haberkornhttp://www.focusthink.com/~weather-maker/betatester.jpghttp://www.focusthink.com/~weather-maker/proudsupporter.jpg

Share this post


Link to post
Share on other sites

That variable (as in the Cessna) returns Tach Time and not actual engine hours. Tach Time varies according to engine throttle settings and is not actual running time.When you rent a plane you pay by Hobbs Time (usually) but maintanance is done by Tach Time. If your rental is by Tach Time then you can reduce your costs by keeping the engine revs down.The solution to my original problem was to use CLOCK_TOTAL_SECONDS with an external file to keep track of total time.Fred

Share this post


Link to post
Share on other sites

>The solution to my original problem was to use>CLOCK_TOTAL_SECONDS with an external file to keep track of>total time.Some folks have asked me why I program my own hobbs code (in C) and maintain my own data file... That is precisely why!if ( TURB_ENGINE_1_CORRECTED_N1var.var_value.n > 10 || TURB_ENGINE_2_CORRECTED_N1var.var_value.n > 10 ) { // if six minutes have accumulated, increment tenths digit // and reset accumulator latches if ( minutes == 6 ) { latch = 1 ; start = 1 ; } if ( seconds < 0 && start == 2 ) { seconds = 0 ; start = 1 ; } // capture a starting seconds count and set accumulator latch// to begin measuring elapsed seconds if ( start == 1 ) { initialize_time = CLOCK_TOTAL_SECONDSvar.var_value.n ; start = 2 ; } if ( start == 2 ) { seconds = CLOCK_TOTAL_SECONDSvar.var_value.n - initialize_time ; } else { seconds = 0 ; } if ( start == 2 ) { minutes = ( seconds - fmod(seconds,60.0) ) / 60 ; } else { minutes = 0 ; } // if 60 seconds have elapsed, increment total_time by 0.1// (tenth hour) and reset the accumulator latch if ( start == 2 && minutes == 6 && latch == 1 ) { total_time = total_time + .1 ; latch = 0 ; } } // if both engines are idle, display accumulated timeelse { total_time = total_time ; }


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Share this post


Link to post
Share on other sites

I program everything in C with the rare exception of using XML for knocking something together for a quick test. XML's limitations and illegibility are the reasons.Anyway, here is how I did the Hobbs.In an invisible VC gauge my variable 'hobbs_seconds' is initially read from the file then, if there is voltage and oil pressure, updated with each tick of CLOCK_TOTAL_SECONDS. When the VC gauge is killed 'hobbs_data' is written back to the file.Then in the MAKE_MOVING macros in the Hobbs gauge, as any digit rolls from 9 to 0 the next highest digit rolls with it to it's next value.case PANEL_SERVICE_PRE_DRAW: runtime_hrs = hobbs_seconds/3600; // hours tenths = fmod(runtime_hrs*10,10); // tenths if(tenths > 9.0) //rolling 9->0 add the decimal ones = (fmod(runtime_hrs,10) - fmod(runtime_hrs,1)) + (tenths-UINT32(tenths)); else // only use the integer ones = fmod(runtime_hrs,10) - fmod(runtime_hrs,1); if(ones > 9.0) // add ones decimal tens = ((fmod(runtime_hrs,100) - fmod(runtime_hrs,10))/10) + (ones-UINT32(ones)); else tens = (fmod(runtime_hrs,100) - fmod(runtime_hrs,10))/10; if(tens > 9.0) // add 10s decimal hundreds = ((fmod(runtime_hrs,1000) - fmod(runtime_hrs,100))/100) + (tens-UINT32(tens)); else hundreds = (fmod(runtime_hrs,1000) - fmod(runtime_hrs,100))/100; if(hundreds > 9.0) // add 100s decimal thousands = (fmod(runtime_hrs,10000)-fmod(runtime_hrs,1000))/1000) + (hundreds-UINT32(hundreds)); else thousands = (fmod(runtime_hrs,10000) - fmod(runtime_hrs,1000))/1000;break;Sorry about some of the lines wrappingFred

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...