@@ -89,17 +89,17 @@ def test_006_update_multiple_source(self):
8989
9090 def test_007_export (self ):
9191 circuit = PyGridSim ()
92- circuit .update_source ()
93- circuit .add_load_nodes ()
94- circuit .add_lines ([("source" , "load0" )])
92+ circuit .update_source (params = { "kV" : 10 } )
93+ circuit .add_load_nodes (params = { "kV" : 5 , "kW" : 10 , "kvar" : 2 } )
94+ circuit .add_lines ([("source" , "load0" )], params = { "length" : 2 } )
9595 circuit .solve ()
9696 print (circuit .results (["Voltages" , "Losses" ], export_path = "sim.json" ))
9797
9898 def test_008_PVsystem (self ):
9999 circuit = PyGridSim ()
100100 circuit .update_source ()
101101 circuit .add_load_nodes (num = 2 )
102- circuit .add_PVSystem (load_nodes = ["load0" , "load1" ], num_panels = 5 )
102+ circuit .add_PVSystems (load_nodes = ["load0" , "load1" ], num_panels = 5 )
103103 circuit .add_lines ([("source" , "load0" )])
104104 circuit .solve ()
105105 print (circuit .results (["Voltages" , "Losses" ]))
@@ -108,7 +108,7 @@ def test_009_generator(self):
108108 circuit = PyGridSim ()
109109 circuit .update_source ()
110110 circuit .add_load_nodes ()
111- circuit .add_generator (num = 3 , gen_type = "small" )
111+ circuit .add_generators (num = 3 , gen_type = "small" )
112112 circuit .add_lines ([("source" , "load0" ), ("generator0" , "load0" )])
113113 circuit .solve ()
114114 print (circuit .results (["Voltages" , "Losses" ]))
@@ -117,10 +117,10 @@ def test_010_many_sources(self):
117117 circuit = PyGridSim ()
118118 circuit .update_source (source_type = "powerplant" )
119119 circuit .add_load_nodes (num = 3 )
120- circuit .add_PVSystem (load_nodes = ["load1" , "load2" ], num_panels = 10 )
121- circuit .add_generator (num = 3 , gen_type = "small" )
122- circuit .update_source (source_type = "turbine" )
123- circuit .add_generator (num = 4 , gen_type = "large" )
120+ circuit .add_PVSystems (load_nodes = ["load1" , "load2" ], num_panels = 10 )
121+ circuit .add_generators (num = 3 , gen_type = "small" )
122+ circuit .update_source (source_type = "turbine" ) # change to a turbine source midway
123+ circuit .add_generators (num = 4 , gen_type = "large" )
124124 circuit .add_lines ([("source" , "load0" ), ("generator0" , "load0" ), ("generator5" , "source" )])
125125 circuit .solve ()
126126 print (circuit .results (["Voltages" , "Losses" ]))
@@ -148,10 +148,10 @@ def test_011_configs(self):
148148
149149 # GENERATOR CONFIG
150150 # works, because not case sensitive
151- circuit .add_generator (num = 3 , gen_type = "SMALl" )
151+ circuit .add_generators (num = 3 , gen_type = "SMALl" )
152152 # don't want linetype input, just string
153153 with self .assertRaises (Exception ):
154- circuit .add_generator (num = 3 , gen_type = GeneratorType .SMALL )
154+ circuit .add_generators (num = 3 , gen_type = GeneratorType .SMALL )
155155
156156 # SOURCE CONFIG
157157 # works, because not case sensitive
@@ -210,9 +210,9 @@ def test_101_bad_parameter(self):
210210 # add load nodes so we can test pv system erroring
211211 circuit .add_load_nodes (num = 2 , params = {"kV" : 10 , "kW" : 20 , "kvar" : 1 })
212212 with self .assertRaises (KeyError ):
213- circuit .add_generator (num = 4 , params = {"badParam" : 100 })
213+ circuit .add_generators (num = 4 , params = {"badParam" : 100 })
214214 with self .assertRaises (KeyError ):
215- circuit .add_PVSystem (load_nodes = ["load0" ], params = {"badParam" : 100 }, num_panels = 4 )
215+ circuit .add_PVSystems (load_nodes = ["load0" ], params = {"badParam" : 100 }, num_panels = 4 )
216216
217217 def test_102_negative_inputs (self ):
218218 """
@@ -243,3 +243,21 @@ def test_104_non_int_parameters(self):
243243 circuit = PyGridSim ()
244244 with self .assertRaises (TypeError ):
245245 circuit .add_load_nodes (params = {"kV" : "stringInput" })
246+
247+ def test_105_alt_source_parameters (self ):
248+ circuit = PyGridSim ()
249+ circuit .add_load_nodes (num = 5 )
250+ circuit .add_generators (params = {"kV" : 50 , "kW" : 100 })
251+ circuit .add_PVSystems (load_nodes = ["load0" , "load1" ], num_panels = 5 , params = {"kV" : 0.1 })
252+ circuit .solve ()
253+ print (circuit .results (["Voltages" , "Losses" ]))
254+ circuit .clear ()
255+
256+ def test_106_transformer_parameters (self ):
257+ circuit = PyGridSim ()
258+ circuit .add_load_nodes (num = 5 )
259+ circuit .update_source ()
260+ circuit .add_lines ([("source" , "load0" )], params = {"length" : 20 , "XHL" : 5 })
261+ circuit .solve ()
262+ print (circuit .results (["Voltages" , "Losses" ]))
263+ circuit .clear ()
0 commit comments