-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlaunch.py
More file actions
38 lines (31 loc) · 1.02 KB
/
Copy pathlaunch.py
File metadata and controls
38 lines (31 loc) · 1.02 KB
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
38
import argparse
from datetime import date
__version__ = "0.2"
def positive_int(value) -> int:
ivalue = int(value)
if ivalue <= 0:
raise argparse.ArgumentTypeError(f"{value} is not a positive integer")
return ivalue
def main(time_step: int, debug: bool):
print("|--------------------------------------------")
print(f"| Grid simulator v{__version__}, date = {date.today()}")
print("|")
print(f"| - time_step = {time_step}")
print(f"| - debug = {debug}")
if __name__ == '__main__':
parser = argparse.ArgumentParser(
description="Smartgrid simulation programm."
)
parser.add_argument(
"-timestep",
type=positive_int,
default=1,
help="Set the simulation time step in minutes (default: 1). Must be a positive integer."
)
parser.add_argument(
"--debug",
action="store_true",
help="Enable debug mode (default: False)."
)
args = parser.parse_args()
main(time_step=args.timestep, debug=args.debug)