up to date
This commit is contained in:
@@ -5,7 +5,7 @@ import os
|
||||
import sys
|
||||
import time
|
||||
import utils
|
||||
|
||||
import argparse
|
||||
import proto.flyformatioln_pb2 as flyformatioln_pb2
|
||||
import logging
|
||||
from utils.protoJson_delayClientA_PUB import Json_msg
|
||||
@@ -41,9 +41,22 @@ def on_publish(self, userdata, mid):
|
||||
|
||||
if __name__ == '__main__':
|
||||
time.sleep(0.25)
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("-q", "--qos", type=int, help="qos")
|
||||
parser.add_argument("-p", "--port", type=int, help="port")
|
||||
parser.add_argument("-f", "--format", type=str, help="format")
|
||||
args = parser.parse_args()
|
||||
# Read Config
|
||||
FilePath = os.path.join(os.path.dirname(__file__),"utils","mqttConfig_delayA_PUB.yml")
|
||||
cfg = utils.Read_delayA_PUB_Config(FilePath)
|
||||
|
||||
if args.qos != None:
|
||||
cfg.qos = args.qos
|
||||
if args.port != None:
|
||||
cfg.port = args.port
|
||||
if args.format != None:
|
||||
cfg.msg_format = args.format
|
||||
# Mqtt
|
||||
client = utils.MQTTClient(cfg.MQTTClientNamePub)
|
||||
pubFun = None
|
||||
|
||||
@@ -9,7 +9,7 @@ import logging
|
||||
import utils
|
||||
from utils.protoJson_delayClientA_SUB import Json_msg
|
||||
from utils.protoJson_delayClientA_SUB import Proto_msg
|
||||
|
||||
import argparse
|
||||
|
||||
def init_dataFormat(cfg:utils.Read_delayB_SUB_Config):
|
||||
if cfg.msg_format == "Proto":
|
||||
@@ -35,11 +35,22 @@ def on_publish(self, userdata, mid):
|
||||
pass
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("-q", "--qos", type=int, help="qos")
|
||||
parser.add_argument("-p", "--port", type=int, help="port")
|
||||
parser.add_argument("-f", "--format", type=str, help="format")
|
||||
args = parser.parse_args()
|
||||
# Read Config
|
||||
FilePath = os.path.join(os.path.dirname(__file__),"utils","mqttConfig_delayA_SUB.yml")
|
||||
cfg = utils.Read_delayA_SUB_Config(FilePath)
|
||||
client = utils.MQTTClient(cfg.MQTTClientNameSub)
|
||||
|
||||
|
||||
if args.qos != None:
|
||||
cfg.qos = args.qos
|
||||
if args.port != None:
|
||||
cfg.port = args.port
|
||||
if args.format != None:
|
||||
cfg.msg_format = args.format
|
||||
|
||||
init_dataFormat(cfg)
|
||||
# set log
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
import paho.mqtt.client as mqtt
|
||||
import os
|
||||
import sys
|
||||
import argparse
|
||||
import utils
|
||||
import proto.flight_information_pb2 as flight_information_pb2
|
||||
import proto.flyformatioln_pb2 as flyformatioln_pb2
|
||||
@@ -44,11 +45,25 @@ def on_publish(self, userdata, mid):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("-q", "--qos", type=int, help="qos")
|
||||
parser.add_argument("-p", "--port", type=int, help="port")
|
||||
parser.add_argument("-f", "--format", type=str, help="format")
|
||||
args = parser.parse_args()
|
||||
|
||||
# Read Config
|
||||
FilePath = os.path.join(os.path.dirname(__file__),"utils","mqttConfig_delayB_SUB.yml")
|
||||
cfg = utils.Read_delayB_SUB_Config(FilePath)
|
||||
|
||||
if args.qos != None:
|
||||
cfg.qos = args.qos
|
||||
if args.port != None:
|
||||
cfg.port = args.port
|
||||
if args.format != None:
|
||||
cfg.msg_format = args.format
|
||||
|
||||
|
||||
client = utils.MQTTClient(cfg.MQTTClientNameSub)
|
||||
|
||||
# Mqtt
|
||||
client = utils.MQTTClient(cfg.MQTTClientNameSub)
|
||||
client.on_connect = on_connect
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
from pathlib import Path
|
||||
|
||||
# Get the path to the directory to traverse
|
||||
directory = Path.cwd()
|
||||
Protodir = []
|
||||
Jsondir = []
|
||||
# Iterate over the files and directories in the directory tree
|
||||
for path in directory.glob('**/*.log'):
|
||||
if "Proto" in str(path):
|
||||
Protodir.append(path)
|
||||
elif "Json" in str(path):
|
||||
Jsondir.append(path)
|
||||
print(Protodir)
|
||||
@@ -15,8 +15,9 @@ def checkNumberofLines(df):
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("-q", "--qos", type=int, default=0, help="qos", required=True)
|
||||
parser.add_argument("-b", "--broker", type=str, default="{}", help="Broker", required=True)
|
||||
parser.add_argument("-b", "--broker", type=str, default="HiveMQ", help="Broker", required=True)
|
||||
args = parser.parse_args()
|
||||
|
||||
|
||||
# read in the log file
|
||||
df_Proto_delayA_PUB = pd.read_csv(f"{args.broker}/qos{args.qos}/ProtodelayA_PUB.log", delim_whitespace=True, header=None, names=["count", "time"])
|
||||
@@ -47,8 +48,8 @@ if __name__ == "__main__":
|
||||
avg_Json = np.average(array_Json)
|
||||
|
||||
fig = plt.figure()
|
||||
plt.plot(array_Proto, color="blue", label=f"Proto: {avg_Proto}")
|
||||
plt.plot(array_Json, color="red", label=f"Json: {avg_Json}")
|
||||
# plt.plot(array_Proto, color="blue", label=f"Proto: {avg_Proto}")
|
||||
plt.plot(array_Json, color="red", label=f"qos0: {avg_Json}")
|
||||
plt.legend()
|
||||
plt.xlabel("Number of messages")
|
||||
plt.ylabel("Delay (s)")
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
python delayClientA_PUB.py -q 0 -p 1884 -f Json
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
MQTT:
|
||||
msg_format: Proto
|
||||
# msg_format: Json
|
||||
qos: 1
|
||||
# msg_format: Proto
|
||||
msg_format: Json
|
||||
qos: 0
|
||||
MQTTClientNamePub: delayA_PUB
|
||||
host: 192.168.50.117
|
||||
port: 1883
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
MQTT:
|
||||
msg_format: Proto
|
||||
# msg_format: Json
|
||||
qos: 1
|
||||
# msg_format: Proto
|
||||
msg_format: Json
|
||||
qos: 0
|
||||
MQTTClientNameSub: delayA_SUB
|
||||
host: 192.168.50.117
|
||||
port: 1883
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
MQTT:
|
||||
msg_format: Proto
|
||||
# msg_format: Json
|
||||
qos: 1
|
||||
# msg_format: Proto
|
||||
msg_format: Json
|
||||
qos: 0
|
||||
MQTTClientNameSub: delayB_SUB
|
||||
host: 192.168.50.117
|
||||
port: 1883
|
||||
|
||||
Reference in New Issue
Block a user