See site in english Voir le site en francais
Website skin:
home  download  forum  link  contact

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

Author Topic: Help disbaling auto-refuel?  (Read 2099 times)

0 Members and 1 Guest are viewing this topic.

Offline EtherDragon

  • Jr. Member
  • **
  • Posts: 44
  • Karma: 0
10 January 2007, 00:49:04
Dan, in your excelent DG-III and (upcomming) IV addons you've disabled Orbiter's tendancy to automatically refuel
the ship when it lands on a landing pad.

Could you share how you did that in your code? I've been struggling with it forever!


~EtherDragon

Offline DanSteph

  • Administrator
  • Legend
  • *****
  • Posts: 15407
  • Karma: 256
  • Hein, quoi !?
    • FsPassengers
Reply #1 - 10 January 2007, 02:45:21
Complicated workaround dated from dgII .... Did you searched in SDK perhaps there is a new parameters "don't refuel on ground?"

...searched just yet, seem not, well, let start...

how it work:
We keep always a save of our current level in tank, if on ground tank level
increase in a strange manner it's because "someone" (orbiter refuel)
changed them so we set back our tank with saved value.

First we need a set of value in our class:

double dMainPropellantMass;
double dOldMainPropellantMass;
double dRcsPropellantMass;
double dOldRcsPropellantMass;
BOOL FirstTimeStepInitDone


in setclassclap initialise your value NOTE: ***Always*** initialise your value in setclasscap even if you think
it's useless you'll thanks me when you'll have several thousand lines. By intitialising *all* values you take a good
habit and ensure you'll never forget one wich is an uggly cause of misterious bugs.. Anyway it's a very bad programming habit to let value undefined at start of sim (or any prog for what it matter).

I use structure to keep my vessel data hence the "Data."

Data.dMainPropellantMass=0;
Data.dOldMainPropellantMass=0;
Data.dRcsPropellantMass=0;
Data.dOldRcsPropellantMass=0;
FirstTimeStepInitDone=FALSE



Now all in timestep at the very start ,( I'll put an image of next step because it look more clear,
this prevent you to copy/past but at least you'll understand better how it work)




Now about questions:

Why "+10.0f" ?: because we can refuel ourself the tank, we don't want that workaround function detect that
and we don't care if we have a difference of 9kg in the rare case if the tank was 9kg below full,
nobody will detect that difference.

Why don't you test RCS level?: probably RCS full while main tank empty is a *very* rare case, never had a
bug report about that (but you can do it if you want) and I optimize every line of code I can (the test run every
frame below 50 meters) ;)

Hope it help ?

Dan



Message modifié ( 10-01-2007 03:07 )


Offline DanSteph

  • Administrator
  • Legend
  • *****
  • Posts: 15407
  • Karma: 256
  • Hein, quoi !?
    • FsPassengers
Reply #2 - 10 January 2007, 03:10:35
Edit: there is a bug in my "code" (was typed only for you)

SetPropellantMass (ph_main,Data.dMainPropellantMass);

Of course we set back with our saved value so:

SetPropellantMass (ph_main,Data.dOldMainPropellantMass);

Dan


Offline EtherDragon

  • Jr. Member
  • **
  • Posts: 44
  • Karma: 0
Reply #3 - 10 January 2007, 05:58:00
Thanks! I thought it was something like that.


~EtherDragon

Offline DanSteph

  • Administrator
  • Legend
  • *****
  • Posts: 15407
  • Karma: 256
  • Hein, quoi !?
    • FsPassengers
Reply #4 - 10 January 2007, 06:10:15
You welcome,

Dan



Message modifié ( 10-01-2007 06:15 )


Offline jer11

  • Sr. Member
  • ****
  • Posts: 273
  • Karma: 0
Reply #5 - 11 January 2007, 04:39:37
Dan, Im sorry for repeating the post :( ;) i will never do it again ;)

« Last Edit: 11 January 2007, 04:39:37 by jer11 »


Age 13