From dc90b0b9470f0790e0da5bfef55d7178615cb59b Mon Sep 17 00:00:00 2001 From: Michael Van Ryn Date: Mon, 1 May 2023 10:51:46 -0600 Subject: [PATCH] Initial repo setup - toml configuration and basic python argument interpretation --- .vscode/settings.json | 6 +++++ main.py | 51 +++++++++++++++++++++++++++++++++++++++++++ setup.toml | 19 ++++++++++++++++ 3 files changed, 76 insertions(+) create mode 100644 .vscode/settings.json create mode 100644 main.py create mode 100644 setup.toml diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..65293fd --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,6 @@ +{ + "[python]": { + "editor.defaultFormatter": "ms-python.autopep8" + }, + "python.formatting.provider": "none" +} \ No newline at end of file diff --git a/main.py b/main.py new file mode 100644 index 0000000..6d6c159 --- /dev/null +++ b/main.py @@ -0,0 +1,51 @@ +import toml +import sys + +# ----------------------------- +# Functions +# ----------------------------- + +def print_text(text: str): + print(r'-------------------------------------------------------------------------------------------------------') + print(text) + print(r'-------------------------------------------------------------------------------------------------------') + +def map_tags(): + print("-- Mapping Tags --") + +def query_vtscada(): + print("-- Query VTScada tags --") + +# ----------------------------- +# Main +# ----------------------------- +print(r' _ _ _____ _____ _______ ____ _____ _____ _____ _ _______ ____ ____ _ _____ ') +print(r'| | | |_ _|/ ____|__ __/ __ \| __ \|_ _/ ____| /\ | | |__ __/ __ \ / __ \| | / ____|') +print(r'| |__| | | | | (___ | | | | | | |__) | | || | / \ | | | | | | | | | | | | | (___ ') +print(r'| __ | | | \___ \ | | | | | | _ / | || | / /\ \ | | | | | | | | | | | | \___ \ ') +print(r'| | | |_| |_ ____) | | | | |__| | | \ \ _| || |____ / ____ \| |____ | | | |__| | |__| | |____ ____) |') +print(r'|_| |_|_____|_____/ |_| \____/|_| \_\_____\_____/_/ \_\______| |_| \____/ \____/|______|_____/ ') + +config = toml.load("setup.toml") + +tags_path = config['system']['tags_path'] +system_timezone = config['system']['system_timezone'] +application_user = config['user']['application_user'] +application_pass = config['user']['application_pass'] +real_precision = config['data']['real_precision'] + +if len(sys.argv) == 2: + query_type = sys.argv[1] + + print("") + + if query_type == "VTScada": + print_text('VTScada Data Query') + query_vtscada() + elif query_type == "AVEVA": + print_text('AVEVA Historian - Not Implemented') + elif query_type == "ClearSCADA": + print_text('ClearSCADA - Not Implemetned') +else: + print("Invalid arguments!") + diff --git a/setup.toml b/setup.toml new file mode 100644 index 0000000..7da027d --- /dev/null +++ b/setup.toml @@ -0,0 +1,19 @@ +[system] +tags_path = "input\\tags.csv" + +# Must be a valid Time Zone, ex: +# Canada/Mountain +# Canada/Pacific +system_timezone = "Canada/Saskatchewan" + +[vtscada] +server_name = "scada-pc" +realm_port = "8888" +realm_name = "RESTRealm" + +[user] +application_user = "query" +application_pass = "L3tm31n2reporting" + +[data] +real_precision = 3 # When undefined the spreadsheet, round floating point values to this precision