Question External Tanks

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,872
Reaction score
2,847
Points
203
Location
Dallas, TX
ok. Lets me see if I have this right:

Since there are 4 spaces for tank. I need 4 shadow tanks. so make 4 propellant resource for the shadow tanks.

How does one move the fuel from the shadows in the main?
Wouldn't you have to do this equally or a shift would occur?

So if a tank is attached then add fuel into shadow tank 1 which feeds into the main tank, right.
"
Make the "fuel tank vessel" with one standard propellant resource (config file should do it). every post step, you synchronize the level of the shadow tank in the eagle (which is just a copy of the tank in the fuel tank vessel) to the fuel tank vessels propellant resource (Same propellant mass in both tanks). Repeat this for all attached tanks and their shadow tanks in the Eagle."
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,769
Reaction score
2,527
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
Depends on how YOU want it, you need to implement it. You could refuel the main tank from all tanks equally, by calculating how much fuel you need to transfer every timestep and then divide this amount by the number of tanks. Or select the tanks you want manually, for example draining a tank faster to have only empty and almost full tanks after landing, for swapping more tanks during the stop without wasting fuel.

Important is doing this with SetPropellantMass() in Prestep.

PS: As far as I see it, the Eagle can carry 8 external fuel tanks, 2 per pod.
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,872
Reaction score
2,847
Points
203
Location
Dallas, TX
Ok. We are going with 4, 1 per leg pod. It is for the RCS engines and Hover and not main as they are Nuclear.

The red tank that goes in the leg pod is a UCGO vessel.


some code:
H:
Code:
const double MAX_FUEL = 6000.0;
const double MAX_CHEMICALFUEL = 0.0;

PROPELLANT_HANDLE ph_main;
PROPELLANT_HANDLE ph_shadow1;
PROPELLANT_HANDLE ph_shadow2;
PROPELLANT_HANDLE ph_shadow3;
PROPELLANT_HANDLE ph_shadow4;
PROPELLANT_HANDLE ph_mainchemical;//this is the combo of all shadow

cpp
Code:
	ph_main=CreatePropellantResource(MAX_FUEL);
	ph_mainchemical=CreatePropellantResource(0);
	ph_shadow1=CreatePropellantResource(shadow1);
	ph_shadow2=CreatePropellantResource(shadow2);
	ph_shadow3=CreatePropellantResource(shadow3);
	ph_shadow4=CreatePropellantResource(shadow4);
...

		th_main[i] = CreateThruster (_V(0,0,0), _V(0,0,1), MAX_MAIN_THRUST, ph_main, ISP_FUS);//1 of the 4 main


		th_hover[i] = CreateThruster (_V(0,0,0), _V(0,1,0), MAX_HOVER_THRUST, ph_mainchemical, ISP_QUI);


void EAGLEFUEL::clbkPostStep(double simt, double simdt, double mjd)
// if attached then add fuel
if (GetAttachmentStatus(FUEL1))(shadow1=(shadow1+5000));
if (GetAttachmentStatus(FUEL2))(shadow2=(shadow2+5000));
if (GetAttachmentStatus(FUEL3))(shadow3=(shadow3+5000));
if (GetAttachmentStatus(FUEL4))(shadow4=(shadow4+5000));

So when I run it using Fuel MFD I get :


6 tanks but even though a tank is attached it only shows fuel in 1
 
Last edited:

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,872
Reaction score
2,847
Points
203
Location
Dallas, TX
Not sure why no fuel is in the shadow tanks. I think I need to add all the shadow tanks into ph_mainchemical. But not sure how to change the level in the separate tank.
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,769
Reaction score
2,527
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
Because you increase in poststep the maximum amount of fuel possible in the tanks, not the actual amount of fuel.
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,872
Reaction score
2,847
Points
203
Location
Dallas, TX
Because you increase in poststep the maximum amount of fuel possible in the tanks, not the actual amount of fuel.

But shouldn't there be fuel in the shadow tank since a tank is attached. Then I guess I moved fuel from it into the mainchemical tank
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,769
Reaction score
2,527
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
But shouldn't there be fuel in the shadow tank since a tank is attached. Then I guess I moved fuel from it into the mainchemical tank

No, because you didn't set it to have fuel inside, you actually created it with ZERO propellant mass as maximum. Remember: Attachments do almost nothing. For example not automatically duplicating propellant masses.

Also, you just increase the variable with which you defined the propellant mass, but did not change the actual propellant resource by calling the SetMaxPropellantMass function.
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,872
Reaction score
2,847
Points
203
Location
Dallas, TX
No, because you didn't set it to have fuel inside, you actually created it with ZERO propellant mass as maximum. Remember: Attachments do almost nothing. For example not automatically duplicating propellant masses.

Also, you just increase the variable with which you defined the propellant mass, but did not change the actual propellant resource by calling the SetMaxPropellantMass function.


Thanks

so if change this:
Code:
ph_mainchemical=CreatePropellantResource(3000);
that will set the max to 3000

SetMaxPropellantMass
So do I need to do this for the shadow tanks?

wouldn't this shadow3 be 5000 since a tank is attached to Fuel3 and shadow3 is the amount of propellant in shadow3
Code:
ph_shadow3=CreatePropellantResource(shadow3);
if (GetAttachmentStatus(FUEL3))(shadow3=(shadow3+5000));
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,769
Reaction score
2,527
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
Well, I would operate differently there:

  • I initialize all shadow tank handles with NULL
  • I create the tanks in Post-Creation or on attaching, when I know the parameters of the external tank
  • Before saving the orbiter default parameters in clbkSaveState, I would temporarily erase the tanks so they don't appear in the saved state, and recreate them again (in case it is just a Quicksave)
  • When detaching an external tank, I would delete the shadow tank as well and set its handle to NULL again.
  • Instead of just adding a constant mass to the vehicle when something is attached, I would set the propellant mass of the shadow tank to the propellant mass of the external tank vessel

Has the advantage that the scenario file is not showing the duplicates and it crashes when your logic is wrong, instead of just letting you have extra fuel.
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,872
Reaction score
2,847
Points
203
Location
Dallas, TX
Well, I would operate differently there:

  • I initialize all shadow tank handles with NULL
  • I create the tanks in Post-Creation or on attaching, when I know the parameters of the external tank
  • Before saving the orbiter default parameters in clbkSaveState, I would temporarily erase the tanks so they don't appear in the saved state, and recreate them again (in case it is just a Quicksave)
  • When detaching an external tank, I would delete the shadow tank as well and set its handle to NULL again.
  • Instead of just adding a constant mass to the vehicle when something is attached, I would set the propellant mass of the shadow tank to the propellant mass of the external tank vessel

Has the advantage that the scenario file is not showing the duplicates and it crashes when your logic is wrong, instead of just letting you have extra fuel.

OK. The external tank propellant tank mass would be 5000. That is why it adds 5000.

So how can I change/read the external tank propellant mass. So if attached it fuels a shadow tank and the external tank propellant level goes down.
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,769
Reaction score
2,527
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
OK. The external tank propellant tank mass would be 5000. That is why it adds 5000.

So how can I change/read the external tank propellant mass.

Use the Orbiter API functions. ;)

Same for the other tasks, like setting the fuel mass in the external tank to the current fuel mass of the shadow tank in poststep.
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,872
Reaction score
2,847
Points
203
Location
Dallas, TX
ok thanks. So would I need to see what vessels are in the scenario and then read/change the level?
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,769
Reaction score
2,527
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
ok thanks. So would I need to see what vessels are in the scenario and then read/change the level?

No, you simply take the OBJHANDLE that you get as return value from "GetAttachmentStatus()".
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,872
Reaction score
2,847
Points
203
Location
Dallas, TX
No, you simply take the OBJHANDLE that you get as return value from "GetAttachmentStatus()".
ok. So once I get that then I get the propellent level and add it into a shaod tank, right? And subtract it from the external tank vessel, right?

It is getting complex already so most like dump all the fuel into the shadow tank into the main chemical tank.
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,769
Reaction score
2,527
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
ok. So once I get that then I get the propellent level and add it into a shaod tank, right? And subtract it from the external tank vessel, right?

It is getting complex already so most like dump all the fuel into the shadow tank into the main chemical tank.

Don't add - set. The shadow tank represents the mass of the fuel of the attached external tank on your vessel, since the attached vessel has no mass in orbiter anymore - it exists mostly only visually.
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,872
Reaction score
2,847
Points
203
Location
Dallas, TX
So if the mass of the external tank is 5000 then if attached then set the mass of the shadow tank and the main tank, right?
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,769
Reaction score
2,527
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
So if the mass of the external tank is 5000 then if attached then set the mass of the shadow tank and the main tank, right?

Only of the shadow tank. The main tank is independent. You refill the main tank if intended by pumping fuel from the external tanks to the main tank, ideally inside your prestep and not by something like FuelMFD.
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,872
Reaction score
2,847
Points
203
Location
Dallas, TX
I think that is what I want to do. Is just dump all the fuel from the external tank into the shadow tank. And then straight into the main tank. It seems I could just go from external tank to main tank though. So if external tank has 5000 and attached add 5000 to the current level of propellant.


I guess also since the tank is a cfg or UCGO cargo. There is no a way to id the tank as being full or empty.
 
Last edited:

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,769
Reaction score
2,527
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
I think you don't yet understand what I mean: You don't transfer fuel from external vessel to shadow tank. you copy the propellant mass of the external tank vessel. Once attached, the external tank will behave as if it isn't really there, you can only see it. It has no mass.

All the fuel inside it masses nothing.

so, you create the shadow tanks in your vessel. Each shadow tank can hold as much fuel as the external vessel fuel tank can hold and contains as much fuel as the external fuel tank vessel holds.

During attaching, you copy the fuel mass from the external vessel to your main vessel.


During flight, in every timestep (you consume fuel from the external tank), you draw from the shadow tank ( so the mass of the vessel is correct) and set the propellant mass in the external fuel tank vessel (so the external fuel tank has always the correct fuel mass, despite it having no mass at all for now).
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,872
Reaction score
2,847
Points
203
Location
Dallas, TX
Thanks, I am trying to understand.

So a vessel with no tanks would have 0 propellant mass. Each tank 's propeelant mass is 5000.

So if I attach 1 tank I need to copy the propellant mass of the tank to a shadow tank. So now a shadow tank has a mass of 5000, right

How does the fuel get from the shadow tanks to the main tank?

Then every timestep set the mass of external tank to that of the shadow tank.
 
Top