Issue with Datedetector and maneuvers

Hi everyone,

I am implementing a station-keeping program that applies thrust every 5 days (as an example) using a low-thrust model, stopping when a predefined altitude is reached. I am encountering an error with the date detector, which serves as my starting detector for the maneuvers. When I check the number of dates in the detector, I see 32 dates, but the thrust is only triggered 16 times (as shown in the graph). A part of the script is available below, along with the graph of the results. Essentially, the maneuver is triggered every 10 days instead of every 5.


Let me know if you’d like further assistance with the technical aspects!


    def getSMABasedManeuverTriggers():
        date_list=[]
        current_date=initial_date
        sma_start_detector=DateDetector(current_date).withHandler(ContinueOnEvent())

        while current_date.compareTo(Mission_End_Date)<0:
            current_date=current_date.shiftedBy(86400*time)
            sma_start_detector.addEventDate(current_date)
            date_list.append(current_date)
            
        print(sma_start_detector.getDates().size()) 
        print(len(date_list)+1)
        eventsLogger_begin = EventsLogger()
        ev_logs_begin = eventsLogger_begin.monitorDetector(sma_start_detector)
        
            
        sma_stop_detector = SMA_f_Detector(sma_threshold_finite_burns).withMaxCheck(float(600))
        eventsLogger_end = EventsLogger()
        ev_logs_end = eventsLogger_end.monitorDetector(sma_stop_detector)
        ev_logs_end = EventSlopeFilter(ev_logs_end, FilterType.TRIGGER_ONLY_DECREASING_EVENTS) 
            
        # Define mission duration detector
        mission_duration_detector = BooleanDetector.notCombine(MissionDurationDetector(Mission_End_Date).withMaxCheck(float(100)))
        mission_duration_detector = AbstractDetector.cast_(mission_duration_detector)
        # Combine detectors: Only execute SMA maneuvers if within mission duration
        #combined_start_detector = BooleanDetector.andCombine([NegateDetector(sma_start_detector), mission_duration_detector])
        return sma_start_detector,sma_stop_detector,ev_logs_begin, ev_logs_end,eventsLogger_begin,eventsLogger_end, ActualStartStopTriggerEvents(AbstractDetector.cast_(sma_start_detector), AbstractDetector.cast_(sma_stop_detector))

If I remember correctly, when you use several dates in date detector, for continuity reason they trigger alternately increasing and decreasing events. Could you look in this direction?

Hi Luc, thanks for the tip. I tried to force the detector to detect only increasing events with sma_start_detector1 = EventSlopeFilter(sma_start_detector, FilterType.TRIGGER_ONLY_INCREASING_EVENTS), but in this case, I get only a quarter of the triggers. I don’t see how I can force the DateDetector to trigger on increasing or decreasing events without alternating.
Should I implement a custom date detector or is there any parameters I am not seeing.

Thanks for you help

Hi @HugoBocc,

Did you manage to solve your issue?
If not, how do you implement Maneuver objects? Are you using a StartStopEventsTrigger?
If yes, as @luc said you will have some issues with the date detector g function becoming crossing zero towards negative values one out of two times.
The only trick I’m thinking of that could make it work is to add fictitious dates every 2.5 days to force the detector to trigger a positive event every 5 days…

Hope this helps,
Maxime

Hi maxime, I haven’t been able to solve this issue for now, I tried many tricks but nothing worked. Indeed I am using startStopEventTrigger. I’ll try you solution be seems to be unconsistent if I change some initial parameters isn’t it ? THanks for you help

Hi Hugo,
Yes, it is not a very clean solution. It was a quick one to see if it would fix your issue.
I think a better solution would be to define a lower bound for the altitude that would trigger the maneuver.
I was looking for a recent thread on the forum about this topic but then I realized you were the one to open it… so I guess you won’t be interested in this solution either.

Hi Maxime,

You’re right; I already have this lower bound trigger solution coded and working, but I was looking to diversify the possible triggers. I will keep digging to see if I can find another solution. Thanks for your help anyway !

Hi Hugo

If I understand the problem correctly, you could use a bunch of DateDetector (with a single AbsoluteDate) inside a Boolean OR one for the start and add a Negate for the stop ones. A bit tedious I admit.

Cheers,
Romain.