Skip to content

Commit 535278b

Browse files
committed
add type checking
1 parent 941e153 commit 535278b

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed
106 Bytes
Binary file not shown.

pygridsim/core.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def __init__(self):
2222
altdss.ClearAll()
2323
altdss('new circuit.MyCircuit')
2424

25-
def add_load_nodes(self, load_type: str = "house", params = {}, num = 1):
25+
def add_load_nodes(self, load_type: str = "house", params = {}, num: int = 1):
2626
"""
2727
When the user wants to manually add nodes, or make nodes with varying parameters.
2828
@@ -55,7 +55,7 @@ def update_source(self, source_type: str = "turbine", params = {}):
5555
"""
5656
return make_source_node(params, source_type)
5757

58-
def add_PVSystem(self, load_nodes, params = {}, num_panels = 1):
58+
def add_PVSystem(self, load_nodes: list[str], params = {}, num_panels: int = 1):
5959
"""
6060
Specify a list of load nodes to add a PVsystem ("solar panel") to.
6161
@@ -74,7 +74,7 @@ def add_PVSystem(self, load_nodes, params = {}, num_panels = 1):
7474
self.num_pv += 1
7575
return PV_nodes
7676

77-
def add_generator(self, num, gen_type: GeneratorType = GeneratorType.SMALL, params = {}):
77+
def add_generator(self, num: int = 1, gen_type: GeneratorType = GeneratorType.SMALL, params = {}):
7878
"""
7979
Specify parameters for a generator to add to the circuit
8080
@@ -92,7 +92,7 @@ def add_generator(self, num, gen_type: GeneratorType = GeneratorType.SMALL, para
9292
return generators
9393

9494

95-
def add_lines(self, connections, line_type: str = "lv", params = {}, transformer = True):
95+
def add_lines(self, connections: list[tuple], line_type: str = "lv", params = {}, transformer: bool = True):
9696
"""
9797
Specify all lines that the user wants to add. If redundant lines, doesn't add anything
9898
@@ -104,7 +104,7 @@ def add_lines(self, connections, line_type: str = "lv", params = {}, transformer
104104
make_line(src, dst, line_type, self.num_lines, params, transformer)
105105
self.num_lines += 1
106106

107-
def view_load_nodes(self, indices = []):
107+
def view_load_nodes(self, indices: list = []):
108108
"""
109109
View load nodes (what their parameters are) at the given indices.
110110
@@ -151,7 +151,7 @@ def solve(self):
151151
"""
152152
altdss.Solution.Solve()
153153

154-
def results(self, queries, export_path = ""):
154+
def results(self, queries: list[str], export_path = ""):
155155
"""
156156
Allow the user to query for many results at once instead of learning how to manually query
157157

sim.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"Voltages": {
3-
"source": 2077.428822659733,
4-
"load0": 217.52249209519556
3+
"source": 1391.2908459682467,
4+
"load0": 202.6090367072441
55
},
66
"Losses": {
7-
"Active Power Loss": 284917.58902059204,
8-
"Reactive Power Loss": 592389.8824783975
7+
"Active Power Loss": 78708.71838388889,
8+
"Reactive Power Loss": 163597.67777927459
99
}
1010
}
0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)