updated arq percent calculation

This commit is contained in:
DJ2LS 2021-08-23 18:28:58 +02:00 committed by GitHub
parent b073f1192f
commit 5be3ecb4b8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 4 deletions

View file

@ -57,6 +57,8 @@ def arq_data_received(data_in):
logging.debug("ARQ_N_ARQ_FRAMES_PER_DATA_FRAME: " + str(static.ARQ_N_ARQ_FRAMES_PER_DATA_FRAME))
logging.debug("----------------------------------------------------------------")
helpers.calculate_transfer_rate()
arq_percent_burst = int((static.ARQ_N_FRAME / static.ARQ_N_RX_FRAMES_PER_BURSTS) * 100)
arq_percent_frame = int(((static.ARQ_RX_N_CURRENT_ARQ_FRAME) / static.ARQ_N_ARQ_FRAMES_PER_DATA_FRAME) * 100)
@ -309,6 +311,7 @@ def arq_transmit(data_out):
for static.TX_N_RETRIES in range(static.TX_N_MAX_RETRIES):
if static.ARQ_N_SENT_FRAMES + 1 <= static.TX_BUFFER_SIZE:
helpers.calculate_transfer_rate()
logging.log(24, "ARQ | TX | M:" + str(static.ARQ_DATA_CHANNEL_MODE) + " | F:[" + str(static.ARQ_N_SENT_FRAMES + 1) + "-" + str(static.ARQ_N_SENT_FRAMES + static.ARQ_TX_N_FRAMES_PER_BURST) + "] | T:[" + str(static.ARQ_N_SENT_FRAMES) + "/" + str(static.TX_BUFFER_SIZE) + "] [" + str(int(static.ARQ_N_SENT_FRAMES / (static.TX_BUFFER_SIZE) * 100)).zfill(3) + "%] | A:[" + str(static.TX_N_RETRIES + 1) + "/" + str(static.TX_N_MAX_RETRIES) + "]")
# lets refresh all timers and ack states before sending a new frame

View file

@ -131,7 +131,8 @@ def arq_reset_frame_machine():
def calculate_transfer_rate():
arq_tx_n_total_arq_frames = int.from_bytes(static.ARQ_TX_N_TOTAL_ARQ_FRAMES, "big")
#arq_tx_n_total_arq_frames = int.from_bytes(static.ARQ_TX_N_TOTAL_ARQ_FRAMES, "big")
arq_tx_n_total_arq_frames = static.ARQ_TX_N_TOTAL_ARQ_FRAMES
arq_n_arq_frames_per_data_frame = static.ARQ_N_ARQ_FRAMES_PER_DATA_FRAME
arq_rx_n_current_arq_frame = static.ARQ_N_ARQ_FRAMES_PER_DATA_FRAME
@ -162,14 +163,15 @@ def calculate_transfer_rate():
if arq_tx_n_total_arq_frames > 0:
static.ARQ_TRANSMISSION_PERCENT = int.from_bytes(bytes(arq_rx_n_current_arq_frame), "big") / arq_tx_n_total_arq_frames
static.ARQ_TRANSMISSION_PERCENT = int(int.from_bytes(bytes(arq_rx_n_current_arq_frame), "big") / arq_tx_n_total_arq_frames) * 100
elif arq_n_arq_frames_per_data_frame > 0:
static.ARQ_TRANSMISSION_PERCENT = arq_rx_n_current_arq_frame / arq_n_arq_frames_per_data_frame
static.ARQ_TRANSMISSION_PERCENT = int(arq_rx_n_current_arq_frame / arq_n_arq_frames_per_data_frame) * 100
else:
print("keine ahnung warum das so ist")
static.ARQ_TRANSMISSION_PERCENT = 0.0
return [static.ARQ_BITS_PER_SECOND, static.ARQ_BYTES_PER_MINUTE, static.ARQ_BITS_PER_SECOND_BURST, static.ARQ_BYTES_PER_MINUTE_BURST]