dariol83 / ccsds

Open source Java implementation of publicly available CCSDS standards: SLE, TM/TC, AOS, Space Packets, COP-1, time formats, CFDP, Encapsulation Packets.
Apache License 2.0
96 stars 29 forks source link

TC Frames lost once processed in the FopEngine #7

Closed slux83 closed 3 years ago

slux83 commented 3 years ago

I'm trying to send the same TC packet as fast as possible (in my example 100 TC packets) that they are encoded in TC frames. It seems that once the TC frame is passed to the FOP engine (eu.dariolucia.ccsds.tmtc.cop1.fop.FopEngine#transmit(eu.dariolucia.ccsds.tmtc.datalink.pdu.TcTransferFrame, int)) it gets lost and the Fop Engine only gives back (via callback) a smaller amount of frames

Transmitted to FOP: 100
Frame out from FOP: 61
CLTU sent (SI):     61

Looking at the FOP implementation it seems that this can return "false" in case the frame is not accepted. What is the correct behavior in this case?

dariol83 commented 3 years ago

The issue is caused by a wrong implementation of the transmit(frame, timeout) method. For BD frames, the method unlocks the caller as soon as a REJECT or ACCEPT is received. However, this is not enough to ensure that the next frame will be able to be accepted: in fact, looking at event E21 and E22 of the COP-1 state machine, the next call will fail if the bdOutputFlag is not ready. This flag is linked to event E45, and not to the generation of the ACCEPT response. The code has been modified to keep this into account. A unit test that could reproduce the issue has been added.