-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathmess_with_lid_mock.py
37 lines (29 loc) · 1.15 KB
/
mess_with_lid_mock.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
from incubator.communication.server.rabbitmq import Rabbitmq
from incubator.config.config import config_logger, load_config
from mock_plant.mock_connection import MOCK_G_BOX
import argparse
def send_G_box_config(config, G_box):
with Rabbitmq(**config) as rabbitmq:
rabbitmq.send_message(MOCK_G_BOX, {"G_box": G_box})
if __name__ == "__main__":
def positive_number(string):
value = float(string)
if value <= 0:
raise argparse.ArgumentTypeError("%r is not a positive number" % string)
return value
parser = argparse.ArgumentParser(
description="Enter a number to multiply the Incubator config G_box with."
)
parser.add_argument(
"number",
type=positive_number,
help="Number to multiply the Incubator config G_box with.",
)
args = parser.parse_args()
config_logger("logging.conf")
config = load_config("startup.conf")
new_G_box = (
args.number * config["digital_twin"]["models"]["plant"]["param4"]["G_box"]
)
print(f"Setting G_box to: {new_G_box}")
send_G_box_config(config["rabbitmq"], new_G_box)