# Trying to understand how to extend PropulsionModel

Hi, I am a total newbie to Orekit, and I only tried very simple things, like simulating a very simple orbit maneuver. Something like:

``````...
final NumericalPropagator propagator = new NumericalPropagator(integrator);
...
final PropulsionModel propulsionModel = new BasicConstantThrustPropulsionModel(thrust, isp,
Vector3D.PLUS_I,
"apogee-engine");
// build maneuver and add it to the propagator as a new force model
propagator.addForceModel(new Maneuver(attitudeOverride, triggers, propulsionModel));
...
propagator.propagate(...)
``````

which does something. However, I am now trying to extend the propulsion model and the simulation with a more realistic one (having in mind e.g. an electric thrust with a battery model, which it discharges by some amount when turned on at a maneuver). Here I am stuck and were unable to find anything understandable online (even in orekit tutorials). My understanding (or thatâ€™s how I imagine it) is that I need to â€śextendâ€ť the propulsionModel with a battery state/capacity (which decreases at each burn) which should then be automatically computed by propagator when calling â€śpropagate()â€ť.

I noticed that in the BasicConstantThrustPropulsionModel some methods take additional input parameters, e.g., `getThrustVector(double[] parameters)` and I have a feeling that these parameters should be related to some â€śuser-defined modelsâ€ť which impact the propulsion (maybe I am completely wrong). Also, I found the class â€śAdditionalDerivativesProviderâ€ť which says that it is used â€śto integrate some problem-specific equations along with classical spacecraft equations of motionâ€ť and it feels that that should be relevant to my issue as well. Here, I donâ€™t understand how you extend this class with own â€śequationsâ€ť such that it would be understood by the propagator.

So my question is, am I on the right track? Is there maybe somewhere a simple example which shows how to extend a spacecraft state by something which evolves and changes during propagation? (further extension, like the battery charges again when the spacecraft is rotated towards the sun is way to far at the moment for me:)).
Thank you a lot.

Hello @pisoir and welcome to the Orekit forum ! Also I apologize for the delay .

What you are trying to do is something pretty interesting and completely doable but begins to be a little tricky as there could several ways to do it. So hereâ€™s how i would do this.

# Managing battery state / power budget

In case you have equations regarding your battery state, this will prove to be very useful. You could even couple your battery state with some thermal equations but letâ€™s stay simple for now . The way it works is that it is a Java interface so you would have to implement your own class regarding the evolution of your battery state. You can take a look at how `MassDepletionDelay` has been implemented (see this link). Also, you may want to use a simpler `AdditionalStateProvider` if you have an analytical estimation of your power budget.

Once you have implemented your class, you will have to add it to your propagator through this method : `propagator.addAdditionalStateProvider(AdditionalStateProvider additionalStateProvider)` (equivalent method exist for â€ś AdditionalStateProviderâ€ť).

Ok so now, when the propagation is running, the `SpacecraftState` that will be given to your `PropulsionModel` will have an â€śadditionalStateDerivativeâ€ť (or an additionalState in case you used â€ś `AdditionalStateProvider`â€ť ) based on the name returned by your implementation of `AdditionalDerivativesProvider`. In short, you will have access to the battery state of your spacecraft.

# Creating your propulsion model

As you noticed, you will need to implement the `ThrustPropulsionModel` interface and somehow link it to your implementation of `AdditionalDerivativesProvider` (or `AdditionalStateProvider`) so that when you thrust, the battery state will take your thrust into accounts.

This is what i thought of on the fly but i hope it will provide you with the elements necessary to do what you want.

Cheers,
Vincent

1 Like