7272 self . ensure_not_leaf ( inverter) ?;
7373 self . ensure_on_successors ( inverter, |n| n. is_battery ( ) , "Batteries" ) ?;
7474 }
75- InverterType :: Solar => {
75+ InverterType :: Pv => {
7676 self . ensure_leaf ( inverter) ?;
7777 }
7878 InverterType :: Hybrid => {
@@ -161,22 +161,25 @@ mod tests {
161161 fn test_validate_root ( ) {
162162 let config = ComponentGraphConfig :: default ( ) ;
163163 let components = vec ! [
164- TestComponent :: new( 1 , ComponentCategory :: Grid ) ,
164+ TestComponent :: new( 1 , ComponentCategory :: GridConnectionPoint ) ,
165165 TestComponent :: new( 2 , ComponentCategory :: Meter ) ,
166166 ] ;
167167 let connections = vec ! [ TestConnection :: new( 1 , 2 ) ] ;
168168 assert ! ( ComponentGraph :: try_new( components, connections, config. clone( ) ) . is_ok( ) ) ;
169169
170- let components = vec ! [ TestComponent :: new( 1 , ComponentCategory :: Grid ) ] ;
170+ let components = vec ! [ TestComponent :: new(
171+ 1 ,
172+ ComponentCategory :: GridConnectionPoint ,
173+ ) ] ;
171174 let connections: Vec < TestConnection > = vec ! [ ] ;
172175 assert ! (
173176 ComponentGraph :: try_new( components, connections, config. clone( ) ) . is_err_and( |e| {
174- e == Error :: invalid_graph( "Grid :1 must have at least one successor." )
177+ e == Error :: invalid_graph( "GridConnectionPoint :1 must have at least one successor." )
175178 } ) ,
176179 ) ;
177180
178181 let components = vec ! [
179- TestComponent :: new( 1 , ComponentCategory :: Grid ) ,
182+ TestComponent :: new( 1 , ComponentCategory :: GridConnectionPoint ) ,
180183 TestComponent :: new( 2 , ComponentCategory :: Meter ) ,
181184 TestComponent :: new( 3 , ComponentCategory :: Meter ) ,
182185 ] ;
@@ -188,9 +191,10 @@ mod tests {
188191
189192 assert ! (
190193 ComponentGraph :: try_new( components, connections, config. clone( ) ) . is_err_and( |e| {
191- e == Error :: invalid_graph(
192- "Grid:1 can't have successors with multiple predecessors. Found Meter:3." ,
193- )
194+ e == Error :: invalid_graph( concat!(
195+ "GridConnectionPoint:1 can't have successors with " ,
196+ "multiple predecessors. Found Meter:3."
197+ ) )
194198 } ) ,
195199 ) ;
196200 }
@@ -199,7 +203,7 @@ mod tests {
199203 fn test_validate_meter ( ) {
200204 let config = ComponentGraphConfig :: default ( ) ;
201205 let components = vec ! [
202- TestComponent :: new( 1 , ComponentCategory :: Grid ) ,
206+ TestComponent :: new( 1 , ComponentCategory :: GridConnectionPoint ) ,
203207 TestComponent :: new( 2 , ComponentCategory :: Meter ) ,
204208 TestComponent :: new( 3 , ComponentCategory :: Battery ( BatteryType :: LiIon ) ) ,
205209 ] ;
@@ -217,7 +221,7 @@ r#"InvalidGraph: Multiple validation failures:
217221 fn test_validate_battery_inverter ( ) {
218222 let config = ComponentGraphConfig :: default ( ) ;
219223 let mut components = vec ! [
220- TestComponent :: new( 1 , ComponentCategory :: Grid ) ,
224+ TestComponent :: new( 1 , ComponentCategory :: GridConnectionPoint ) ,
221225 TestComponent :: new( 2 , ComponentCategory :: Meter ) ,
222226 TestComponent :: new( 3 , ComponentCategory :: Inverter ( InverterType :: Battery ) ) ,
223227 TestComponent :: new( 4 , ComponentCategory :: Electrolyzer ) ,
@@ -265,9 +269,9 @@ r#"InvalidGraph: Multiple validation failures:
265269 fn test_validate_pv_inverter ( ) {
266270 let config = ComponentGraphConfig :: default ( ) ;
267271 let mut components = vec ! [
268- TestComponent :: new( 1 , ComponentCategory :: Grid ) ,
272+ TestComponent :: new( 1 , ComponentCategory :: GridConnectionPoint ) ,
269273 TestComponent :: new( 2 , ComponentCategory :: Meter ) ,
270- TestComponent :: new( 3 , ComponentCategory :: Inverter ( InverterType :: Solar ) ) ,
274+ TestComponent :: new( 3 , ComponentCategory :: Inverter ( InverterType :: Pv ) ) ,
271275 TestComponent :: new( 4 , ComponentCategory :: Electrolyzer ) ,
272276 ] ;
273277 let mut connections = vec ! [
@@ -280,7 +284,7 @@ r#"InvalidGraph: Multiple validation failures:
280284 ComponentGraph :: try_new( components. clone( ) , connections. clone( ) , config. clone( ) )
281285 . is_err_and( |e| {
282286 e == Error :: invalid_graph(
283- "SolarInverter :3 can't have any successors. Found Electrolyzer:4." ,
287+ "PvInverter :3 can't have any successors. Found Electrolyzer:4." ,
284288 )
285289 } ) ,
286290 ) ;
@@ -305,7 +309,7 @@ r#"InvalidGraph: Multiple validation failures:
305309 fn test_validate_hybrid_inverter ( ) {
306310 let config = ComponentGraphConfig :: default ( ) ;
307311 let mut components = vec ! [
308- TestComponent :: new( 1 , ComponentCategory :: Grid ) ,
312+ TestComponent :: new( 1 , ComponentCategory :: GridConnectionPoint ) ,
309313 TestComponent :: new( 2 , ComponentCategory :: Meter ) ,
310314 TestComponent :: new( 3 , ComponentCategory :: Inverter ( InverterType :: Hybrid ) ) ,
311315 TestComponent :: new( 4 , ComponentCategory :: Electrolyzer ) ,
@@ -346,7 +350,7 @@ r#"InvalidGraph: Multiple validation failures:
346350 fn test_validate_batteries ( ) {
347351 let config = ComponentGraphConfig :: default ( ) ;
348352 let mut components = vec ! [
349- TestComponent :: new( 1 , ComponentCategory :: Grid ) ,
353+ TestComponent :: new( 1 , ComponentCategory :: GridConnectionPoint ) ,
350354 TestComponent :: new( 2 , ComponentCategory :: Meter ) ,
351355 TestComponent :: new( 3 , ComponentCategory :: Inverter ( InverterType :: Battery ) ) ,
352356 TestComponent :: new( 4 , ComponentCategory :: Battery ( BatteryType :: NaIon ) ) ,
@@ -393,7 +397,7 @@ r#"InvalidGraph: Multiple validation failures:
393397 ) ;
394398
395399 let components = vec ! [
396- TestComponent :: new( 1 , ComponentCategory :: Grid ) ,
400+ TestComponent :: new( 1 , ComponentCategory :: GridConnectionPoint ) ,
397401 TestComponent :: new( 2 , ComponentCategory :: Battery ( BatteryType :: LiIon ) ) ,
398402 ] ;
399403 let connections = vec ! [ TestConnection :: new( 1 , 2 ) ] ;
@@ -402,7 +406,7 @@ r#"InvalidGraph: Multiple validation failures:
402406 ComponentGraph :: try_new( components, connections, config. clone( ) ) . is_err_and( |e| {
403407 e == Error :: invalid_graph( concat!(
404408 "Battery(LiIon):2 can only have predecessors that are " ,
405- "BatteryInverters or HybridInverters. Found Grid :1."
409+ "BatteryInverters or HybridInverters. Found GridConnectionPoint :1."
406410 ) )
407411 } ) ,
408412 ) ;
@@ -412,7 +416,7 @@ r#"InvalidGraph: Multiple validation failures:
412416 fn test_validate_ev_chargers ( ) {
413417 let config = ComponentGraphConfig :: default ( ) ;
414418 let mut components = vec ! [
415- TestComponent :: new( 1 , ComponentCategory :: Grid ) ,
419+ TestComponent :: new( 1 , ComponentCategory :: GridConnectionPoint ) ,
416420 TestComponent :: new( 2 , ComponentCategory :: Meter ) ,
417421 TestComponent :: new( 3 , ComponentCategory :: EvCharger ( EvChargerType :: Dc ) ) ,
418422 TestComponent :: new( 4 , ComponentCategory :: Electrolyzer ) ,
@@ -441,7 +445,7 @@ r#"InvalidGraph: Multiple validation failures:
441445 fn test_validate_chps ( ) {
442446 let config = ComponentGraphConfig :: default ( ) ;
443447 let mut components = vec ! [
444- TestComponent :: new( 1 , ComponentCategory :: Grid ) ,
448+ TestComponent :: new( 1 , ComponentCategory :: GridConnectionPoint ) ,
445449 TestComponent :: new( 2 , ComponentCategory :: Meter ) ,
446450 TestComponent :: new( 3 , ComponentCategory :: Chp ) ,
447451 TestComponent :: new( 4 , ComponentCategory :: Electrolyzer ) ,
0 commit comments