Initial repo setup - toml configuration and basic python argument interpretation
This commit is contained in:
parent
1c84720761
commit
dc90b0b947
6
.vscode/settings.json
vendored
Normal file
6
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"[python]": {
|
||||||
|
"editor.defaultFormatter": "ms-python.autopep8"
|
||||||
|
},
|
||||||
|
"python.formatting.provider": "none"
|
||||||
|
}
|
51
main.py
Normal file
51
main.py
Normal file
@ -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!")
|
||||||
|
|
19
setup.toml
Normal file
19
setup.toml
Normal file
@ -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
|
Loading…
Reference in New Issue
Block a user