Generator only work for one time

Hello orekit community,

When I tried to generate the simulated measurements using the org.orekit.estimation.measurements.generation.Generator class, I find a weird phenomenon that the generator can only work for one time. Once I tried to run the generator for the second time, it would come to a deadlock keep running forever.

Here is part of my code (using Matlab)

    % for the first tracklet
    generator1 = Generator();
    localSat = generator1.addPropagator(targetSatelliteAll(1).propagator);
    remoteSat1 = generator1.addPropagator(observeSatelliteAll(1).propagator);
    interSatellitesRangeBuilder1 = InterSatellitesRangeBuilder([], localSat, remoteSat1, 0, 0, 1);
    selector1 = FixedStepSelector(timeStep, []);
    selector1.selectDates(initialDate, finalDate) 
    scheduler1 = ContinuousScheduler(interSatellitesRangeBuilder1, selector);
    measurements1 = generator1.generate(initialDate, finalDate);

    % for the second tracklet
    generator2 = Generator(); 
    remoteSat2 = generator2.addPropagator(observeSatelliteAll(2).propagator);
    interSatellitesRangeBuilder2 = InterSatellitesRangeBuilder([], localSat, remoteSat2, 0, 0, 1);
    selector2 = FixedStepSelector(timeStep, []);
    scheduler2 = ContinuousScheduler(interSatellitesRangeBuilder2, selector2);
    measurements2 = generator2.generate(initialDate, finalDate);

In this code, measurements1 for the first tracklet can be generated successfully, but the second tecklet (measurements2) met a deadlock. I can’t understand why because generator1 and generator2 are totally different.

In fact, if I tried to run ‘generator1.generate(initialDate, finalDate)’ for the second time, it comes to a deadlock, too.

Why the geneartor can only work for one time? I’m confused of it. Do you have any idea?

Thank you very much for any help.

Xuefeng Tao.

Hi @taoxuefeng11,

I’m not sure but could it be related to this issue with the PropagatorsParallelizer?
If yes, the issue was solved and will be available in version 12.

This topic seems similar to the issue I am having today.

I am trying to create an instance of org.orekit.estimation.measurements.generation.Generator and then call the .generate(start, end) function twice in a row. Is there a reason I wouldn’t be able to call .generate(start,end) a second time? My code seems to work the first time I call generator.generate(start,end) and then to hang the second time I call it.

Thank you,

Yes, the generator currently works only once.
This is probably due to the fact when the generate method is called, it adds some internal step handlers (either directly at each propagator level or globally at the parallelizer level). so when run a second time, I guess the first step handlers are still there and wreak havoc.

Could you open an issue so we handle this? We could perhaps remove the limitation by clearing properly the handlers at the end of generation. If we can’t do this (but I m confident we could) we should at least mention it in documentation.