zepben.ewb 1.0.0b9__py3-none-any.whl → 1.1.0b1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. zepben/ewb/auth/client/zepben_token_fetcher.py +62 -42
  2. zepben/ewb/database/sqlite/common/base_cim_reader.py +7 -7
  3. zepben/ewb/database/sqlite/common/base_database_writer.py +2 -2
  4. zepben/ewb/database/sqlite/network/network_cim_reader.py +20 -20
  5. zepben/ewb/database/sqlite/network/network_database_reader.py +4 -2
  6. zepben/ewb/database/sqlite/tables/iec61968/common/table_documents.py +5 -5
  7. zepben/ewb/database/sqlite/tables/iec61968/common/table_street_addresses.py +1 -1
  8. zepben/ewb/database/sqlite/tables/iec61968/infiec61968/infassets/table_poles.py +1 -1
  9. zepben/ewb/database/sqlite/tables/iec61970/base/core/table_identified_objects.py +3 -3
  10. zepben/ewb/database/sqlite/tables/iec61970/base/core/table_power_system_resources.py +1 -1
  11. zepben/ewb/database/sqlite/tables/iec61970/base/meas/table_analogs.py +1 -1
  12. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_energy_consumers.py +1 -1
  13. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_energy_sources.py +1 -1
  14. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_regulating_cond_eq.py +1 -1
  15. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_shunt_compensators.py +1 -1
  16. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_tap_changers.py +1 -1
  17. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_transformer_ends.py +1 -1
  18. zepben/ewb/model/cim/iec61968/common/document.py +5 -5
  19. zepben/ewb/model/cim/iec61968/common/street_address.py +2 -2
  20. zepben/ewb/model/cim/iec61968/common/street_detail.py +8 -7
  21. zepben/ewb/model/cim/iec61968/infiec61968/infassets/pole.py +1 -1
  22. zepben/ewb/model/cim/iec61968/metering/meter.py +4 -2
  23. zepben/ewb/model/cim/iec61968/metering/usage_point.py +1 -1
  24. zepben/ewb/model/cim/iec61970/base/core/curve.py +2 -1
  25. zepben/ewb/model/cim/iec61970/base/core/identified_object.py +8 -3
  26. zepben/ewb/model/cim/iec61970/base/core/name_type.py +2 -2
  27. zepben/ewb/model/cim/iec61970/base/core/power_system_resource.py +2 -2
  28. zepben/ewb/model/cim/iec61970/base/meas/analog.py +3 -1
  29. zepben/ewb/model/cim/iec61970/base/wires/energy_consumer.py +1 -1
  30. zepben/ewb/model/cim/iec61970/base/wires/energy_source.py +1 -1
  31. zepben/ewb/model/cim/iec61970/base/wires/regulating_cond_eq.py +1 -1
  32. zepben/ewb/model/cim/iec61970/base/wires/shunt_compensator.py +1 -1
  33. zepben/ewb/model/cim/iec61970/base/wires/synchronous_machine.py +1 -1
  34. zepben/ewb/model/cim/iec61970/base/wires/tap_changer.py +1 -1
  35. zepben/ewb/model/cim/iec61970/base/wires/transformer_end.py +1 -1
  36. zepben/ewb/model/cim/iec61970/base/wires/transformer_star_impedance.py +4 -4
  37. zepben/ewb/services/common/translator/base_cim2proto.py +21 -9
  38. zepben/ewb/services/common/translator/base_proto2cim.py +13 -8
  39. zepben/ewb/services/customer/translator/customer_cim2proto.py +10 -10
  40. zepben/ewb/services/customer/translator/customer_proto2cim.py +9 -9
  41. zepben/ewb/services/diagram/translator/diagram_cim2proto.py +8 -8
  42. zepben/ewb/services/diagram/translator/diagram_proto2cim.py +8 -8
  43. zepben/ewb/services/network/tracing/phases/phase_inferrer.py +2 -2
  44. zepben/ewb/services/network/translator/network_cim2proto.py +451 -322
  45. zepben/ewb/services/network/translator/network_proto2cim.py +305 -287
  46. {zepben_ewb-1.0.0b9.dist-info → zepben_ewb-1.1.0b1.dist-info}/METADATA +4 -6
  47. {zepben_ewb-1.0.0b9.dist-info → zepben_ewb-1.1.0b1.dist-info}/RECORD +50 -50
  48. {zepben_ewb-1.0.0b9.dist-info → zepben_ewb-1.1.0b1.dist-info}/WHEEL +0 -0
  49. {zepben_ewb-1.0.0b9.dist-info → zepben_ewb-1.1.0b1.dist-info}/licenses/LICENSE +0 -0
  50. {zepben_ewb-1.0.0b9.dist-info → zepben_ewb-1.1.0b1.dist-info}/top_level.txt +0 -0
@@ -301,7 +301,7 @@ from zepben.ewb.model.cim.iec61970.base.wires.tap_changer_control import *
301
301
  from zepben.ewb.model.cim.iec61970.base.wires.transformer_end import *
302
302
  from zepben.ewb.model.cim.iec61970.base.wires.transformer_star_impedance import *
303
303
  from zepben.ewb.model.cim.iec61970.infiec61970.feeder.circuit import *
304
- from zepben.ewb.services.common.translator.base_cim2proto import identified_object_to_pb, organisation_role_to_pb, document_to_pb, bind_to_pb
304
+ from zepben.ewb.services.common.translator.base_cim2proto import identified_object_to_pb, organisation_role_to_pb, document_to_pb, bind_to_pb, set_or_null
305
305
  from zepben.ewb.services.common.translator.util import mrid_or_empty, from_nullable_int, from_nullable_float, from_nullable_long, from_nullable_uint, \
306
306
  nullable_bool_settings
307
307
  # noinspection PyProtectedMember
@@ -328,9 +328,11 @@ class CimTranslationException(Exception):
328
328
  def relay_info_to_pb(cim: RelayInfo) -> PBRelayInfo:
329
329
  return PBRelayInfo(
330
330
  ai=asset_info_to_pb(cim),
331
- curveSetting=cim.curve_setting,
332
- **nullable_bool_settings("recloseFast", cim.reclose_fast),
333
- recloseDelays=cim.reclose_delays
331
+ recloseDelays=cim.reclose_delays,
332
+ **set_or_null(
333
+ curveSetting=cim.curve_setting,
334
+ recloseFast=cim.reclose_fast,
335
+ )
334
336
  )
335
337
 
336
338
 
@@ -349,7 +351,9 @@ def pan_demand_response_function_to_pb(cim: PanDemandResponseFunction) -> PBPanD
349
351
  return PBPanDemandResponseFunction(
350
352
  edf=end_device_function_to_pb(cim),
351
353
  kind=_map_end_device_function_kind.to_pb(cim.kind),
352
- appliance=from_nullable_int(cim._appliance_bitmask)
354
+ **set_or_null(
355
+ appliance=cim._appliance_bitmask
356
+ )
353
357
  )
354
358
 
355
359
 
@@ -403,32 +407,36 @@ def ev_charging_unit(cim: EvChargingUnit) -> PBEvChargingUnit:
403
407
  def distance_relay_to_pb(cim: DistanceRelay) -> PBDistanceRelay:
404
408
  return PBDistanceRelay(
405
409
  prf=protection_relay_function_to_pb(cim, True),
406
- backwardBlind=from_nullable_float(cim.backward_blind),
407
- backwardReach=from_nullable_float(cim.backward_reach),
408
- backwardReactance=from_nullable_float(cim.backward_reactance),
409
- forwardBlind=from_nullable_float(cim.forward_blind),
410
- forwardReach=from_nullable_float(cim.forward_reach),
411
- forwardReactance=from_nullable_float(cim.forward_reactance),
412
- operationPhaseAngle1=from_nullable_float(cim.operation_phase_angle1),
413
- operationPhaseAngle2=from_nullable_float(cim.operation_phase_angle2),
414
- operationPhaseAngle3=from_nullable_float(cim.operation_phase_angle3)
410
+ **set_or_null(
411
+ backwardBlind=cim.backward_blind,
412
+ backwardReach=cim.backward_reach,
413
+ backwardReactance=cim.backward_reactance,
414
+ forwardBlind=cim.forward_blind,
415
+ forwardReach=cim.forward_reach,
416
+ forwardReactance=cim.forward_reactance,
417
+ operationPhaseAngle1=cim.operation_phase_angle1,
418
+ operationPhaseAngle2=cim.operation_phase_angle2,
419
+ operationPhaseAngle3=cim.operation_phase_angle3,
420
+ )
415
421
  )
416
422
 
417
423
 
418
424
  def protection_relay_function_to_pb(cim: ProtectionRelayFunction, include_asset_info: bool = False) -> PBProtectionRelayFunction:
419
425
  return PBProtectionRelayFunction(
420
426
  psr=power_system_resource_to_pb(cim, include_asset_info),
421
- model=cim.model,
422
- **nullable_bool_settings("reclosing", cim.reclosing),
423
427
  timeLimits=cim.time_limits,
424
428
  thresholds=[relay_setting_to_pb(rs) for rs in cim.thresholds],
425
- relayDelayTime=from_nullable_float(cim.relay_delay_time),
426
429
  protectionKind=_map_protection_kind.to_pb(cim.protection_kind),
427
430
  protectedSwitchMRIDs=[str(io.mrid) for io in cim.protected_switches],
428
- **nullable_bool_settings("directable", cim.directable),
429
431
  powerDirection=_map_power_direction_kind.to_pb(cim.power_direction),
430
432
  sensorMRIDs=[str(io.mrid) for io in cim.sensors],
431
433
  schemeMRIDs=[str(io.mrid) for io in cim.schemes],
434
+ **set_or_null(
435
+ model=cim.model,
436
+ reclosing=cim.reclosing,
437
+ relayDelayTime=cim.relay_delay_time,
438
+ directable=cim.directable,
439
+ )
432
440
  )
433
441
 
434
442
 
@@ -436,8 +444,8 @@ def protection_relay_function_to_pb(cim: ProtectionRelayFunction, include_asset_
436
444
  def protection_relay_scheme_to_pb(cim: ProtectionRelayScheme) -> PBProtectionRelayScheme:
437
445
  return PBProtectionRelayScheme(
438
446
  io=identified_object_to_pb(cim),
447
+ functionMRIDs=[str(io.mrid) for io in cim.functions],
439
448
  systemMRID=mrid_or_empty(cim.system),
440
- functionMRIDs=[str(io.mrid) for io in cim.functions]
441
449
  )
442
450
 
443
451
 
@@ -452,9 +460,11 @@ def protection_relay_system_to_pb(cim: ProtectionRelaySystem) -> PBProtectionRel
452
460
 
453
461
  def relay_setting_to_pb(cim: RelaySetting) -> PBRelaySetting:
454
462
  return PBRelaySetting(
455
- name=cim.name,
456
463
  unitSymbol=_map_unit_symbol.to_pb(cim.unit_symbol),
457
- value=from_nullable_float(cim.value)
464
+ value=from_nullable_float(cim.value),
465
+ **set_or_null(
466
+ name=cim.name,
467
+ )
458
468
  )
459
469
 
460
470
 
@@ -479,10 +489,12 @@ def battery_control_to_pb(cim: BatteryControl) -> PBBatteryControl:
479
489
 
480
490
  return PBBatteryControl(
481
491
  rc=regulating_control_to_pb(cim),
482
- chargingRate=from_nullable_float(cim.charging_rate),
483
- dischargingRate=from_nullable_float(cim.discharging_rate),
484
- reservePercent=from_nullable_float(cim.reserve_percent),
485
- controlMode=_map_battery_control_mode.to_pb(cim.control_mode)
492
+ controlMode=_map_battery_control_mode.to_pb(cim.control_mode),
493
+ **set_or_null(
494
+ chargingRate=cim.charging_rate,
495
+ dischargingRate=cim.discharging_rate,
496
+ reservePercent=cim.reserve_percent,
497
+ )
486
498
  )
487
499
 
488
500
 
@@ -499,11 +511,13 @@ def cable_info_to_pb(cim: CableInfo) -> PBCableInfo:
499
511
  def no_load_test_to_pb(cim: NoLoadTest) -> PBNoLoadTest:
500
512
  return PBNoLoadTest(
501
513
  tt=transformer_test_to_pb(cim),
502
- energisedEndVoltage=from_nullable_int(cim.energised_end_voltage),
503
- excitingCurrent=from_nullable_float(cim.exciting_current),
504
- excitingCurrentZero=from_nullable_float(cim.exciting_current_zero),
505
- loss=from_nullable_int(cim.loss),
506
- lossZero=from_nullable_int(cim.loss_zero),
514
+ **set_or_null(
515
+ energisedEndVoltage=cim.energised_end_voltage,
516
+ excitingCurrent=cim.exciting_current,
517
+ excitingCurrentZero=cim.exciting_current_zero,
518
+ loss=cim.loss,
519
+ lossZero=cim.loss_zero,
520
+ )
507
521
  )
508
522
 
509
523
 
@@ -511,11 +525,13 @@ def no_load_test_to_pb(cim: NoLoadTest) -> PBNoLoadTest:
511
525
  def open_circuit_test_to_pb(cim: OpenCircuitTest) -> PBOpenCircuitTest:
512
526
  return PBOpenCircuitTest(
513
527
  tt=transformer_test_to_pb(cim),
514
- energisedEndStep=from_nullable_int(cim.energised_end_step),
515
- energisedEndVoltage=from_nullable_int(cim.energised_end_voltage),
516
- openEndStep=from_nullable_int(cim.open_end_step),
517
- openEndVoltage=from_nullable_int(cim.open_end_voltage),
518
- phaseShift=from_nullable_float(cim.phase_shift),
528
+ **set_or_null(
529
+ energisedEndStep=cim.energised_end_step,
530
+ energisedEndVoltage=cim.energised_end_voltage,
531
+ openEndStep=cim.open_end_step,
532
+ openEndVoltage=cim.open_end_voltage,
533
+ phaseShift=cim.phase_shift,
534
+ )
519
535
  )
520
536
 
521
537
 
@@ -536,16 +552,18 @@ def power_transformer_info_to_pb(cim: PowerTransformerInfo) -> PBPowerTransforme
536
552
  def short_circuit_test_to_pb(cim: ShortCircuitTest) -> PBShortCircuitTest:
537
553
  return PBShortCircuitTest(
538
554
  tt=transformer_test_to_pb(cim),
539
- current=from_nullable_float(cim.current),
540
- energisedEndStep=from_nullable_int(cim.energised_end_step),
541
- groundedEndStep=from_nullable_int(cim.grounded_end_step),
542
- leakageImpedance=from_nullable_float(cim.leakage_impedance),
543
- leakageImpedanceZero=from_nullable_float(cim.leakage_impedance_zero),
544
- loss=from_nullable_int(cim.loss),
545
- lossZero=from_nullable_int(cim.loss_zero),
546
- power=from_nullable_int(cim.power),
547
- voltage=from_nullable_float(cim.voltage),
548
- voltageOhmicPart=from_nullable_float(cim.voltage_ohmic_part),
555
+ **set_or_null(
556
+ current=cim.current,
557
+ energisedEndStep=cim.energised_end_step,
558
+ groundedEndStep=cim.grounded_end_step,
559
+ leakageImpedance=cim.leakage_impedance,
560
+ leakageImpedanceZero=cim.leakage_impedance_zero,
561
+ loss=cim.loss,
562
+ lossZero=cim.loss_zero,
563
+ power=cim.power,
564
+ voltage=cim.voltage,
565
+ voltageOhmicPart=cim.voltage_ohmic_part,
566
+ )
549
567
  )
550
568
 
551
569
 
@@ -553,10 +571,12 @@ def short_circuit_test_to_pb(cim: ShortCircuitTest) -> PBShortCircuitTest:
553
571
  def shunt_compensator_info_to_pb(cim: ShuntCompensatorInfo) -> PBShuntCompensatorInfo:
554
572
  return PBShuntCompensatorInfo(
555
573
  ai=asset_info_to_pb(cim),
556
- maxPowerLoss=from_nullable_int(cim.max_power_loss),
557
- ratedCurrent=from_nullable_int(cim.rated_current),
558
- ratedReactivePower=from_nullable_int(cim.rated_reactive_power),
559
- ratedVoltage=from_nullable_int(cim.rated_voltage),
574
+ **set_or_null(
575
+ maxPowerLoss=cim.max_power_loss,
576
+ ratedCurrent=cim.rated_current,
577
+ ratedReactivePower=cim.rated_reactive_power,
578
+ ratedVoltage=cim.rated_voltage,
579
+ )
560
580
  )
561
581
 
562
582
 
@@ -564,7 +584,9 @@ def shunt_compensator_info_to_pb(cim: ShuntCompensatorInfo) -> PBShuntCompensato
564
584
  def switch_info_to_pb(cim: SwitchInfo) -> PBSwitchInfo:
565
585
  return PBSwitchInfo(
566
586
  ai=asset_info_to_pb(cim),
567
- ratedInterruptingTime=from_nullable_float(cim.rated_interrupting_time)
587
+ **set_or_null(
588
+ ratedInterruptingTime=cim.rated_interrupting_time
589
+ )
568
590
  )
569
591
 
570
592
 
@@ -573,14 +595,7 @@ def transformer_end_info_to_pb(cim: TransformerEndInfo) -> PBTransformerEndInfo:
573
595
  return PBTransformerEndInfo(
574
596
  ai=asset_info_to_pb(cim),
575
597
  connectionKind=_map_winding_connection.to_pb(cim.connection_kind),
576
- emergencyS=from_nullable_int(cim.emergency_s),
577
- endNumber=from_nullable_int(cim.end_number),
578
- insulationU=from_nullable_int(cim.insulation_u),
579
- phaseAngleClock=from_nullable_int(cim.phase_angle_clock),
580
- r=from_nullable_float(cim.r),
581
- ratedS=from_nullable_int(cim.rated_s),
582
- ratedU=from_nullable_int(cim.rated_u),
583
- shortTermS=from_nullable_int(cim.short_term_s),
598
+ endNumber=cim.end_number,
584
599
  transformerTankInfoMRID=mrid_or_empty(cim.transformer_tank_info),
585
600
  transformerStarImpedanceMRID=mrid_or_empty(cim.transformer_star_impedance),
586
601
  energisedEndNoLoadTestsMRID=mrid_or_empty(cim.energised_end_no_load_tests),
@@ -588,6 +603,15 @@ def transformer_end_info_to_pb(cim: TransformerEndInfo) -> PBTransformerEndInfo:
588
603
  groundedEndShortCircuitTestsMRID=mrid_or_empty(cim.grounded_end_short_circuit_tests),
589
604
  openEndOpenCircuitTestsMRID=mrid_or_empty(cim.open_end_open_circuit_tests),
590
605
  energisedEndOpenCircuitTestsMRID=mrid_or_empty(cim.energised_end_open_circuit_tests),
606
+ **set_or_null(
607
+ emergencyS=cim.emergency_s,
608
+ insulationU=cim.insulation_u,
609
+ phaseAngleClock=cim.phase_angle_clock,
610
+ r=cim.r,
611
+ ratedS=cim.rated_s,
612
+ ratedU=cim.rated_u,
613
+ shortTermS=cim.short_term_s,
614
+ )
591
615
  )
592
616
 
593
617
 
@@ -603,8 +627,10 @@ def transformer_tank_info_to_pb(cim: TransformerTankInfo) -> PBTransformerTankIn
603
627
  def transformer_test_to_pb(cim: TransformerTest) -> PBTransformerTest:
604
628
  return PBTransformerTest(
605
629
  io=identified_object_to_pb(cim),
606
- basePower=from_nullable_int(cim.base_power),
607
- temperature=from_nullable_float(cim.temperature),
630
+ **set_or_null(
631
+ basePower=cim.base_power,
632
+ temperature=cim.temperature,
633
+ )
608
634
  )
609
635
 
610
636
 
@@ -612,8 +638,10 @@ def transformer_test_to_pb(cim: TransformerTest) -> PBTransformerTest:
612
638
  def wire_info_to_pb(cim: WireInfo) -> PBWireInfo:
613
639
  return PBWireInfo(
614
640
  ai=asset_info_to_pb(cim),
615
- ratedCurrent=from_nullable_int(cim.rated_current),
616
- material=_map_wire_material_kind.to_pb(cim.material)
641
+ material=_map_wire_material_kind.to_pb(cim.material),
642
+ **set_or_null(
643
+ ratedCurrent=cim.rated_current,
644
+ )
617
645
  )
618
646
 
619
647
 
@@ -626,7 +654,7 @@ def asset_to_pb(cim: Asset) -> PBAsset:
626
654
  io=identified_object_to_pb(cim),
627
655
  locationMRID=cim.location.mrid if cim.location else None,
628
656
  organisationRoleMRIDs=[str(io.mrid) for io in cim.organisation_roles],
629
- powerSystemResourceMRIDs=[str(io.mrid) for io in cim.power_system_resources]
657
+ powerSystemResourceMRIDs=[str(io.mrid) for io in cim.power_system_resources],
630
658
  )
631
659
 
632
660
 
@@ -663,8 +691,10 @@ def streetlight_to_pb(cim: Streetlight) -> PBStreetlight:
663
691
  return PBStreetlight(
664
692
  at=asset_to_pb(cim),
665
693
  poleMRID=mrid_or_empty(cim.pole),
666
- lightRating=from_nullable_uint(cim.light_rating),
667
- lampKind=_map_streetlight_lamp_kind.to_pb(cim.lamp_kind)
694
+ lampKind=_map_streetlight_lamp_kind.to_pb(cim.lamp_kind),
695
+ **set_or_null(
696
+ lightRating=cim.light_rating,
697
+ )
668
698
  )
669
699
 
670
700
 
@@ -686,32 +716,44 @@ def location_to_pb(cim: Location) -> PBLocation:
686
716
 
687
717
 
688
718
  def position_point_to_pb(cim: PositionPoint) -> PBPositionPoint:
689
- return PBPositionPoint(xPosition=cim.x_position, yPosition=cim.y_position)
719
+ return PBPositionPoint(
720
+ xPosition=cim.x_position,
721
+ yPosition=cim.y_position
722
+ )
690
723
 
691
724
 
692
725
  def street_address_to_pb(cim: StreetAddress) -> PBStreetAddress:
693
726
  return PBStreetAddress(
694
- postalCode=cim.postal_code,
695
727
  townDetail=_get_or_none(town_detail_to_pb, cim.town_detail),
696
- poBox=cim.po_box,
697
- streetDetail=_get_or_none(street_detail_to_pb, cim.street_detail)
728
+ streetDetail=_get_or_none(street_detail_to_pb, cim.street_detail),
729
+ **set_or_null(
730
+ postalCode=cim.postal_code,
731
+ poBox=cim.po_box,
732
+ )
698
733
  )
699
734
 
700
735
 
701
736
  def street_detail_to_pb(cim: StreetDetail) -> PBStreetDetail:
702
737
  return PBStreetDetail(
703
- buildingName=cim.building_name,
704
- floorIdentification=cim.floor_identification,
705
- name=cim.name,
706
- number=cim.number,
707
- suiteNumber=cim.suite_number,
708
- type=cim.type,
709
- displayAddress=cim.display_address
738
+ **set_or_null(
739
+ buildingName=cim.building_name,
740
+ floorIdentification=cim.floor_identification,
741
+ name=cim.name,
742
+ number=cim.number,
743
+ suiteNumber=cim.suite_number,
744
+ type=cim.type,
745
+ displayAddress=cim.display_address
746
+ )
710
747
  )
711
748
 
712
749
 
713
750
  def town_detail_to_pb(cim: TownDetail) -> PBTownDetail:
714
- return PBTownDetail(name=cim.name, stateOrProvince=cim.state_or_province)
751
+ return PBTownDetail(
752
+ **set_or_null(
753
+ name=cim.name,
754
+ stateOrProvince=cim.state_or_province
755
+ )
756
+ )
715
757
 
716
758
 
717
759
  #####################################
@@ -722,18 +764,20 @@ def town_detail_to_pb(cim: TownDetail) -> PBTownDetail:
722
764
  def current_transformer_info_to_pb(cim: CurrentTransformerInfo) -> PBCurrentTransformerInfo:
723
765
  return PBCurrentTransformerInfo(
724
766
  ai=asset_info_to_pb(cim),
725
- accuracyClass=cim.accuracy_class,
726
- accuracyLimit=from_nullable_float(cim.accuracy_limit),
727
- coreCount=from_nullable_int(cim.core_count),
728
- ctClass=cim.ct_class,
729
- kneePointVoltage=from_nullable_int(cim.knee_point_voltage),
730
767
  maxRatio=_get_or_none(ratio_to_pb, cim.max_ratio),
731
768
  nominalRatio=_get_or_none(ratio_to_pb, cim.nominal_ratio),
732
- primaryRatio=from_nullable_float(cim.primary_ratio),
733
- ratedCurrent=from_nullable_int(cim.rated_current),
734
- secondaryFlsRating=from_nullable_int(cim.secondary_fls_rating),
735
- secondaryRatio=from_nullable_float(cim.secondary_ratio),
736
- usage=cim.usage
769
+ **set_or_null(
770
+ accuracyClass=cim.accuracy_class,
771
+ accuracyLimit=cim.accuracy_limit,
772
+ coreCount=cim.core_count,
773
+ ctClass=cim.ct_class,
774
+ kneePointVoltage=cim.knee_point_voltage,
775
+ primaryRatio=cim.primary_ratio,
776
+ ratedCurrent=cim.rated_current,
777
+ secondaryFlsRating=cim.secondary_fls_rating,
778
+ secondaryRatio=cim.secondary_ratio,
779
+ usage=cim.usage,
780
+ )
737
781
  )
738
782
 
739
783
 
@@ -741,12 +785,15 @@ def current_transformer_info_to_pb(cim: CurrentTransformerInfo) -> PBCurrentTran
741
785
  def potential_transformer_info_to_pb(cim: PotentialTransformerInfo) -> PBPotentialTransformerInfo:
742
786
  return PBPotentialTransformerInfo(
743
787
  ai=asset_info_to_pb(cim),
744
- accuracyClass=cim.accuracy_class,
745
788
  nominalRatio=_get_or_none(ratio_to_pb, cim.nominal_ratio),
746
- primaryRatio=from_nullable_float(cim.primary_ratio),
747
- ptClass=cim.pt_class,
748
- ratedVoltage=from_nullable_int(cim.rated_voltage),
749
- secondaryRatio=from_nullable_float(cim.secondary_ratio)
789
+ **set_or_null(
790
+ accuracyClass=cim.accuracy_class,
791
+ primaryRatio=cim.primary_ratio,
792
+ ptClass=cim.pt_class,
793
+ ratedVoltage=cim.rated_voltage,
794
+ secondaryRatio=cim.secondary_ratio,
795
+
796
+ )
750
797
  )
751
798
 
752
799
 
@@ -759,7 +806,9 @@ def pole_to_pb(cim: Pole) -> PBPole:
759
806
  return PBPole(
760
807
  st=structure_to_pb(cim),
761
808
  streetlightMRIDs=[str(io.mrid) for io in cim.streetlights],
762
- classification=cim.classification
809
+ **set_or_null(
810
+ classification=cim.classification,
811
+ )
763
812
  )
764
813
 
765
814
 
@@ -786,7 +835,7 @@ def end_device_to_pb(cim: EndDevice) -> PBEndDevice:
786
835
  usagePointMRIDs=[str(io.mrid) for io in cim.usage_points],
787
836
  endDeviceFunctionMRIDs=[str(io.mrid) for io in cim.functions],
788
837
  customerMRID=cim.customer_mrid,
789
- serviceLocationMRID=mrid_or_empty(cim.service_location)
838
+ serviceLocationMRID=mrid_or_empty(cim.service_location),
790
839
  )
791
840
 
792
841
 
@@ -798,7 +847,9 @@ def end_device_function_to_pb(cim: EndDeviceFunction) -> PBEndDeviceFunction:
798
847
  """
799
848
  return PBEndDeviceFunction(
800
849
  af=asset_function_to_pb(cim),
801
- **nullable_bool_settings("enabled", cim.enabled)
850
+ **set_or_null(
851
+ enabled=cim.enabled,
852
+ )
802
853
  )
803
854
 
804
855
 
@@ -814,11 +865,13 @@ def usage_point_to_pb(cim: UsagePoint) -> PBUsagePoint:
814
865
  usagePointLocationMRID=mrid_or_empty(cim.usage_point_location),
815
866
  equipmentMRIDs=[str(io.mrid) for io in cim.equipment],
816
867
  endDeviceMRIDs=[str(io.mrid) for io in cim.end_devices],
817
- isVirtual=cim.is_virtual,
818
- connectionCategory=cim.connection_category,
819
- ratedPower=from_nullable_int(cim.rated_power),
820
- approvedInverterCapacity=from_nullable_int(cim.approved_inverter_capacity),
821
- phaseCode=_map_phase_code.to_pb(cim.phase_code)
868
+ phaseCode=_map_phase_code.to_pb(cim.phase_code),
869
+ **set_or_null(
870
+ isVirtual=cim.is_virtual,
871
+ connectionCategory=cim.connection_category,
872
+ ratedPower=cim.rated_power,
873
+ approvedInverterCapacity=cim.approved_inverter_capacity,
874
+ ),
822
875
  )
823
876
 
824
877
 
@@ -846,7 +899,9 @@ def auxiliary_equipment_to_pb(cim: AuxiliaryEquipment, include_asset_info: bool
846
899
  def current_transformer_to_pb(cim: CurrentTransformer) -> PBCurrentTransformer:
847
900
  return PBCurrentTransformer(
848
901
  sn=sensor_to_pb(cim, True),
849
- coreBurden=from_nullable_int(cim.core_burden)
902
+ **set_or_null(
903
+ coreBurden=cim.core_burden,
904
+ )
850
905
  )
851
906
 
852
907
 
@@ -914,8 +969,10 @@ def curve_data_to_pb(cim: CurveData) -> PBCurveData:
914
969
  return PBCurveData(
915
970
  xValue=cim.x_value,
916
971
  y1Value=cim.y1_value,
917
- y2Value=from_nullable_float(cim.y2_value),
918
- y3Value=from_nullable_float(cim.y3_value)
972
+ **set_or_null(
973
+ y2Value=cim.y2_value,
974
+ y3Value=cim.y3_value
975
+ )
919
976
  )
920
977
 
921
978
 
@@ -932,7 +989,7 @@ def equipment_to_pb(cim: Equipment, include_asset_info: bool = False) -> PBEquip
932
989
  usagePointMRIDs=[str(io.mrid) for io in cim.usage_points],
933
990
  operationalRestrictionMRIDs=[str(io.mrid) for io in cim.operational_restrictions],
934
991
  currentContainerMRIDs=[str(io.mrid) for io in cim.current_containers],
935
- commissionedDate=ts
992
+ commissionedDate=ts,
936
993
  )
937
994
 
938
995
 
@@ -1012,22 +1069,24 @@ def terminal_to_pb(cim: Terminal) -> PBTerminal:
1012
1069
  def equivalent_branch_to_pb(cim: EquivalentBranch) -> PBEquivalentBranch:
1013
1070
  return PBEquivalentBranch(
1014
1071
  ee=equivalent_equipment_to_pb(cim),
1015
- negativeR12=from_nullable_float(cim.negative_r12),
1016
- negativeR21=from_nullable_float(cim.negative_r21),
1017
- negativeX12=from_nullable_float(cim.negative_x12),
1018
- negativeX21=from_nullable_float(cim.negative_x21),
1019
- positiveR12=from_nullable_float(cim.positive_r12),
1020
- positiveR21=from_nullable_float(cim.positive_r21),
1021
- positiveX12=from_nullable_float(cim.positive_x12),
1022
- positiveX21=from_nullable_float(cim.positive_x21),
1023
- r=from_nullable_float(cim.r),
1024
- r21=from_nullable_float(cim.r21),
1025
- x=from_nullable_float(cim.x),
1026
- x21=from_nullable_float(cim.x21),
1027
- zeroR12=from_nullable_float(cim.zero_r12),
1028
- zeroR21=from_nullable_float(cim.zero_r21),
1029
- zeroX12=from_nullable_float(cim.zero_x12),
1030
- zeroX21=from_nullable_float(cim.zero_x21),
1072
+ **set_or_null(
1073
+ negativeR12=cim.negative_r12,
1074
+ negativeR21=cim.negative_r21,
1075
+ negativeX12=cim.negative_x12,
1076
+ negativeX21=cim.negative_x21,
1077
+ positiveR12=cim.positive_r12,
1078
+ positiveR21=cim.positive_r21,
1079
+ positiveX12=cim.positive_x12,
1080
+ positiveX21=cim.positive_x21,
1081
+ r=cim.r,
1082
+ r21=cim.r21,
1083
+ x=cim.x,
1084
+ x21=cim.x21,
1085
+ zeroR12=cim.zero_r12,
1086
+ zeroR21=cim.zero_r21,
1087
+ zeroX12=cim.zero_x12,
1088
+ zeroX21=cim.zero_x21,
1089
+ )
1031
1090
  )
1032
1091
 
1033
1092
 
@@ -1049,9 +1108,11 @@ def battery_unit_to_pb(cim: BatteryUnit) -> PBBatteryUnit:
1049
1108
  return PBBatteryUnit(
1050
1109
  peu=power_electronics_unit_to_pb(cim),
1051
1110
  batteryControlMRIDs=[str(io.mrid) for io in cim.controls],
1052
- ratedE=from_nullable_long(cim.rated_e),
1053
- storedE=from_nullable_long(cim.stored_e),
1054
- batteryState=_map_battery_state_kind.to_pb(cim.battery_state)
1111
+ batteryState=_map_battery_state_kind.to_pb(cim.battery_state),
1112
+ **set_or_null(
1113
+ ratedE=cim.rated_e,
1114
+ storedE=cim.stored_e,
1115
+ )
1055
1116
  )
1056
1117
 
1057
1118
 
@@ -1063,9 +1124,11 @@ def photo_voltaic_unit_to_pb(cim: PhotoVoltaicUnit) -> PBPhotoVoltaicUnit:
1063
1124
  def power_electronics_unit_to_pb(cim: PowerElectronicsUnit) -> PBPowerElectronicsUnit:
1064
1125
  return PBPowerElectronicsUnit(
1065
1126
  eq=equipment_to_pb(cim),
1066
- maxP=from_nullable_int(cim.max_p),
1067
- minP=from_nullable_int(cim.min_p),
1068
- powerElectronicsConnectionMRID=mrid_or_empty(cim.power_electronics_connection)
1127
+ powerElectronicsConnectionMRID=mrid_or_empty(cim.power_electronics_connection),
1128
+ **set_or_null(
1129
+ maxP=cim.max_p,
1130
+ minP=cim.min_p,
1131
+ )
1069
1132
  )
1070
1133
 
1071
1134
 
@@ -1087,7 +1150,9 @@ def accumulator_to_pb(cim: Accumulator) -> PBAccumulator:
1087
1150
  def analog_to_pb(cim: Analog) -> PBAnalog:
1088
1151
  return PBAnalog(
1089
1152
  measurement=measurement_to_pb(cim),
1090
- positiveFlowIn=cim.positive_flow_in
1153
+ **set_or_null(
1154
+ positiveFlowIn=cim.positive_flow_in
1155
+ )
1091
1156
  )
1092
1157
 
1093
1158
 
@@ -1128,9 +1193,11 @@ def measurement_to_pb(cim: Measurement) -> PBMeasurement:
1128
1193
  def current_relay_to_pb(cim: CurrentRelay) -> PBCurrentRelay:
1129
1194
  return PBCurrentRelay(
1130
1195
  prf=protection_relay_function_to_pb(cim, True),
1131
- currentLimit1=from_nullable_float(cim.current_limit_1),
1132
- **nullable_bool_settings("inverseTimeFlag", cim.inverse_time_flag),
1133
- timeDelay1=from_nullable_float(cim.time_delay_1),
1196
+ **set_or_null(
1197
+ currentLimit1=cim.current_limit_1,
1198
+ inverseTimeFlag=cim.inverse_time_flag,
1199
+ timeDelay1=cim.time_delay_1,
1200
+ )
1134
1201
  )
1135
1202
 
1136
1203
 
@@ -1181,7 +1248,9 @@ def ac_line_segment_to_pb(cim: AcLineSegment) -> PBAcLineSegment:
1181
1248
  def breaker_to_pb(cim: Breaker) -> PBBreaker:
1182
1249
  return PBBreaker(
1183
1250
  sw=protected_switch_to_pb(cim),
1184
- inTransitTime=from_nullable_float(cim.in_transit_time)
1251
+ **set_or_null(
1252
+ inTransitTime=cim.in_transit_time,
1253
+ )
1185
1254
  )
1186
1255
 
1187
1256
 
@@ -1194,17 +1263,21 @@ def busbar_section_to_pb(cim: BusbarSection) -> PBBusbarSection:
1194
1263
  def clamp_to_pb(cim: Clamp) -> PBClamp:
1195
1264
  return PBClamp(
1196
1265
  ce=conducting_equipment_to_pb(cim),
1197
- lengthFromTerminal1=from_nullable_float(cim.length_from_terminal_1),
1198
- acLineSegmentMRID=mrid_or_empty(cim.ac_line_segment)
1266
+ acLineSegmentMRID=mrid_or_empty(cim.ac_line_segment),
1267
+ **set_or_null(
1268
+ lengthFromTerminal1=cim.length_from_terminal_1,
1269
+ )
1199
1270
  )
1200
1271
 
1201
1272
 
1202
1273
  def conductor_to_pb(cim: Conductor) -> PBConductor:
1203
1274
  return PBConductor(
1204
1275
  ce=conducting_equipment_to_pb(cim, True),
1205
- length=from_nullable_float(cim.length),
1206
- designTemperature=from_nullable_int(cim.design_temperature),
1207
- designRating=from_nullable_float(cim.design_rating)
1276
+ **set_or_null(
1277
+ length=cim.length,
1278
+ designTemperature=cim.design_temperature,
1279
+ designRating=cim.design_rating,
1280
+ )
1208
1281
  )
1209
1282
 
1210
1283
 
@@ -1216,8 +1289,10 @@ def connector_to_pb(cim: Connector) -> PBConnector:
1216
1289
  def cut_to_pb(cim: Cut) -> PBCut:
1217
1290
  return PBCut(
1218
1291
  sw=switch_to_pb(cim),
1219
- lengthFromTerminal1=from_nullable_float(cim.length_from_terminal_1),
1220
- acLineSegmentMRID=mrid_or_empty(cim.ac_line_segment)
1292
+ acLineSegmentMRID=mrid_or_empty(cim.ac_line_segment),
1293
+ **set_or_null(
1294
+ lengthFromTerminal1=cim.length_from_terminal_1,
1295
+ )
1221
1296
  )
1222
1297
 
1223
1298
 
@@ -1229,7 +1304,9 @@ def disconnector_to_pb(cim: Disconnector) -> PBDisconnector:
1229
1304
  def earth_fault_compensator_to_pb(cim: EarthFaultCompensator) -> PBEarthFaultCompensator:
1230
1305
  return PBEarthFaultCompensator(
1231
1306
  ce=conducting_equipment_to_pb(cim),
1232
- r=from_nullable_float(cim.r)
1307
+ **set_or_null(
1308
+ r=cim.r
1309
+ )
1233
1310
  )
1234
1311
 
1235
1312
 
@@ -1242,13 +1319,15 @@ def energy_consumer_to_pb(cim: EnergyConsumer) -> PBEnergyConsumer:
1242
1319
  return PBEnergyConsumer(
1243
1320
  ec=energy_connection_to_pb(cim),
1244
1321
  energyConsumerPhasesMRIDs=[str(io.mrid) for io in cim.phases],
1245
- customerCount=from_nullable_int(cim.customer_count),
1246
- grounded=cim.grounded,
1247
1322
  phaseConnection=_map_phase_shunt_connection_kind.to_pb(cim.phase_connection),
1248
- p=from_nullable_float(cim.p),
1249
- pFixed=from_nullable_float(cim.p_fixed),
1250
- q=from_nullable_float(cim.q),
1251
- qFixed=from_nullable_float(cim.q_fixed)
1323
+ **set_or_null(
1324
+ p=cim.p,
1325
+ pFixed=cim.p_fixed,
1326
+ q=cim.q,
1327
+ qFixed=cim.q_fixed,
1328
+ customerCount=cim.customer_count,
1329
+ grounded=cim.grounded,
1330
+ )
1252
1331
  )
1253
1332
 
1254
1333
 
@@ -1258,10 +1337,12 @@ def energy_consumer_phase_to_pb(cim: EnergyConsumerPhase) -> PBEnergyConsumerPha
1258
1337
  psr=power_system_resource_to_pb(cim),
1259
1338
  energyConsumerMRID=mrid_or_empty(cim.energy_consumer),
1260
1339
  phase=_map_single_phase_kind.to_pb(cim.phase),
1261
- p=from_nullable_float(cim.p),
1262
- pFixed=from_nullable_float(cim.p_fixed),
1263
- q=from_nullable_float(cim.q),
1264
- qFixed=from_nullable_float(cim.q_fixed)
1340
+ **set_or_null(
1341
+ p=cim.p,
1342
+ pFixed=cim.p_fixed,
1343
+ q=cim.q,
1344
+ qFixed=cim.q_fixed,
1345
+ )
1265
1346
  )
1266
1347
 
1267
1348
 
@@ -1270,31 +1351,33 @@ def energy_source_to_pb(cim: EnergySource) -> PBEnergySource:
1270
1351
  return PBEnergySource(
1271
1352
  ec=energy_connection_to_pb(cim),
1272
1353
  energySourcePhasesMRIDs=[str(io.mrid) for io in cim.phases],
1273
- activePower=from_nullable_float(cim.active_power),
1274
- reactivePower=from_nullable_float(cim.reactive_power),
1275
- voltageAngle=from_nullable_float(cim.voltage_angle),
1276
- voltageMagnitude=from_nullable_float(cim.voltage_magnitude),
1277
- r=from_nullable_float(cim.r),
1278
- x=from_nullable_float(cim.x),
1279
- pMax=from_nullable_float(cim.p_max),
1280
- pMin=from_nullable_float(cim.p_min),
1281
- r0=from_nullable_float(cim.r0),
1282
- rn=from_nullable_float(cim.rn),
1283
- x0=from_nullable_float(cim.x0),
1284
- xn=from_nullable_float(cim.xn),
1285
- isExternalGrid=cim.is_external_grid,
1286
- rMin=from_nullable_float(cim.r_min),
1287
- rnMin=from_nullable_float(cim.rn_min),
1288
- r0Min=from_nullable_float(cim.r0_min),
1289
- xMin=from_nullable_float(cim.x_min),
1290
- xnMin=from_nullable_float(cim.xn_min),
1291
- x0Min=from_nullable_float(cim.x0_min),
1292
- rMax=from_nullable_float(cim.r_max),
1293
- rnMax=from_nullable_float(cim.rn_max),
1294
- r0Max=from_nullable_float(cim.r0_max),
1295
- xMax=from_nullable_float(cim.x_max),
1296
- xnMax=from_nullable_float(cim.xn_max),
1297
- x0Max=from_nullable_float(cim.x0_max)
1354
+ **set_or_null(
1355
+ activePower=cim.active_power,
1356
+ reactivePower=cim.reactive_power,
1357
+ voltageAngle=cim.voltage_angle,
1358
+ voltageMagnitude=cim.voltage_magnitude,
1359
+ r=cim.r,
1360
+ x=cim.x,
1361
+ pMax=cim.p_max,
1362
+ pMin=cim.p_min,
1363
+ r0=cim.r0,
1364
+ rn=cim.rn,
1365
+ x0=cim.x0,
1366
+ xn=cim.xn,
1367
+ isExternalGrid=cim.is_external_grid,
1368
+ rMin=cim.r_min,
1369
+ rnMin=cim.rn_min,
1370
+ r0Min=cim.r0_min,
1371
+ xMin=cim.x_min,
1372
+ xnMin=cim.xn_min,
1373
+ x0Min=cim.x0_min,
1374
+ rMax=cim.r_max,
1375
+ rnMax=cim.rn_max,
1376
+ r0Max=cim.r0_max,
1377
+ xMax=cim.x_max,
1378
+ xnMax=cim.xn_max,
1379
+ x0Max=cim.x0_max,
1380
+ )
1298
1381
  )
1299
1382
 
1300
1383
 
@@ -1333,7 +1416,9 @@ def ground_disconnector_to_pb(cim: GroundDisconnector) -> PBGroundDisconnector:
1333
1416
  def grounding_impedance_to_pb(cim: GroundingImpedance) -> PBGroundingImpedance:
1334
1417
  return PBGroundingImpedance(
1335
1418
  efc=earth_fault_compensator_to_pb(cim),
1336
- x=from_nullable_float(cim.x)
1419
+ **set_or_null(
1420
+ x=cim.x,
1421
+ )
1337
1422
  )
1338
1423
 
1339
1424
 
@@ -1355,10 +1440,12 @@ def line_to_pb(cim: Line) -> PBLine:
1355
1440
  def linear_shunt_compensator_to_pb(cim: LinearShuntCompensator) -> PBLinearShuntCompensator:
1356
1441
  return PBLinearShuntCompensator(
1357
1442
  sc=shunt_compensator_to_pb(cim),
1358
- b0PerSection=from_nullable_float(cim.b0_per_section),
1359
- bPerSection=from_nullable_float(cim.b_per_section),
1360
- g0PerSection=from_nullable_float(cim.g0_per_section),
1361
- gPerSection=from_nullable_float(cim.g_per_section)
1443
+ **set_or_null(
1444
+ b0PerSection=cim.b0_per_section,
1445
+ bPerSection=cim.b_per_section,
1446
+ g0PerSection=cim.g0_per_section,
1447
+ gPerSection=cim.g_per_section,
1448
+ )
1362
1449
  )
1363
1450
 
1364
1451
 
@@ -1392,14 +1479,16 @@ def per_length_phase_impedance_to_pb(cim: PerLengthPhaseImpedance) -> PBPerLengt
1392
1479
  def per_length_sequence_impedance_to_pb(cim: PerLengthSequenceImpedance) -> PBPerLengthSequenceImpedance:
1393
1480
  return PBPerLengthSequenceImpedance(
1394
1481
  pli=per_length_impedance_to_pb(cim),
1395
- r=from_nullable_float(cim.r),
1396
- x=from_nullable_float(cim.x),
1397
- r0=from_nullable_float(cim.r0),
1398
- x0=from_nullable_float(cim.x0),
1399
- bch=from_nullable_float(cim.bch),
1400
- gch=from_nullable_float(cim.gch),
1401
- b0ch=from_nullable_float(cim.b0ch),
1402
- g0ch=from_nullable_float(cim.g0ch)
1482
+ **set_or_null(
1483
+ r=cim.r,
1484
+ x=cim.x,
1485
+ r0=cim.r0,
1486
+ x0=cim.x0,
1487
+ bch=cim.bch,
1488
+ gch=cim.gch,
1489
+ b0ch=cim.b0ch,
1490
+ g0ch=cim.g0ch,
1491
+ )
1403
1492
  )
1404
1493
 
1405
1494
 
@@ -1407,7 +1496,9 @@ def per_length_sequence_impedance_to_pb(cim: PerLengthSequenceImpedance) -> PBPe
1407
1496
  def petersen_coil_to_pb(cim: PetersenCoil) -> PBPetersenCoil:
1408
1497
  return PBPetersenCoil(
1409
1498
  efc=earth_fault_compensator_to_pb(cim),
1410
- xGroundNominal=from_nullable_float(cim.x_ground_nominal)
1499
+ **set_or_null(
1500
+ xGroundNominal=cim.x_ground_nominal
1501
+ )
1411
1502
  )
1412
1503
 
1413
1504
 
@@ -1420,10 +1511,12 @@ def phase_impedance_data_to_pb(cim: PhaseImpedanceData) -> PBPhaseImpedanceData:
1420
1511
  return PBPhaseImpedanceData(
1421
1512
  fromPhase=_map_single_phase_kind.to_pb(cim.from_phase),
1422
1513
  toPhase=_map_single_phase_kind.to_pb(cim.to_phase),
1423
- b=from_nullable_float(cim.b),
1424
- g=from_nullable_float(cim.g),
1425
- r=from_nullable_float(cim.r),
1426
- x=from_nullable_float(cim.x),
1514
+ **set_or_null(
1515
+ b=cim.b,
1516
+ g=cim.g,
1517
+ r=cim.r,
1518
+ x=cim.x,
1519
+ )
1427
1520
  )
1428
1521
 
1429
1522
 
@@ -1433,37 +1526,39 @@ def power_electronics_connection_to_pb(cim: PowerElectronicsConnection) -> PBPow
1433
1526
  rce=regulating_cond_eq_to_pb(cim),
1434
1527
  powerElectronicsUnitMRIDs=[str(io.mrid) for io in cim.units],
1435
1528
  powerElectronicsConnectionPhaseMRIDs=[str(io.mrid) for io in cim.phases],
1436
- maxIFault=from_nullable_int(cim.max_i_fault),
1437
- maxQ=from_nullable_float(cim.max_q),
1438
- minQ=from_nullable_float(cim.min_q),
1439
- p=from_nullable_float(cim.p),
1440
- q=from_nullable_float(cim.q),
1441
- ratedS=from_nullable_int(cim.rated_s),
1442
- ratedU=from_nullable_int(cim.rated_u),
1443
- inverterStandard=cim.inverter_standard,
1444
- sustainOpOvervoltLimit=from_nullable_int(cim.sustain_op_overvolt_limit),
1445
- stopAtOverFreq=from_nullable_float(cim.stop_at_over_freq),
1446
- stopAtUnderFreq=from_nullable_float(cim.stop_at_under_freq),
1447
- **nullable_bool_settings("invVoltWattRespMode", cim.inv_volt_watt_resp_mode),
1448
- invWattRespV1=from_nullable_int(cim.inv_watt_resp_v1),
1449
- invWattRespV2=from_nullable_int(cim.inv_watt_resp_v2),
1450
- invWattRespV3=from_nullable_int(cim.inv_watt_resp_v3),
1451
- invWattRespV4=from_nullable_int(cim.inv_watt_resp_v4),
1452
- invWattRespPAtV1=from_nullable_float(cim.inv_watt_resp_p_at_v1),
1453
- invWattRespPAtV2=from_nullable_float(cim.inv_watt_resp_p_at_v2),
1454
- invWattRespPAtV3=from_nullable_float(cim.inv_watt_resp_p_at_v3),
1455
- invWattRespPAtV4=from_nullable_float(cim.inv_watt_resp_p_at_v4),
1456
- **nullable_bool_settings("invVoltVarRespMode", cim.inv_volt_var_resp_mode),
1457
- invVarRespV1=from_nullable_int(cim.inv_var_resp_v1),
1458
- invVarRespV2=from_nullable_int(cim.inv_var_resp_v2),
1459
- invVarRespV3=from_nullable_int(cim.inv_var_resp_v3),
1460
- invVarRespV4=from_nullable_int(cim.inv_var_resp_v4),
1461
- invVarRespQAtV1=from_nullable_float(cim.inv_var_resp_q_at_v1),
1462
- invVarRespQAtV2=from_nullable_float(cim.inv_var_resp_q_at_v2),
1463
- invVarRespQAtV3=from_nullable_float(cim.inv_var_resp_q_at_v3),
1464
- invVarRespQAtV4=from_nullable_float(cim.inv_var_resp_q_at_v4),
1465
- **nullable_bool_settings("invReactivePowerMode", cim.inv_reactive_power_mode),
1466
- invFixReactivePower=from_nullable_float(cim.inv_fix_reactive_power)
1529
+ **set_or_null(
1530
+ maxIFault=cim.max_i_fault,
1531
+ maxQ=cim.max_q,
1532
+ minQ=cim.min_q,
1533
+ p=cim.p,
1534
+ q=cim.q,
1535
+ ratedS=cim.rated_s,
1536
+ ratedU=cim.rated_u,
1537
+ inverterStandard=cim.inverter_standard,
1538
+ sustainOpOvervoltLimit=cim.sustain_op_overvolt_limit,
1539
+ stopAtOverFreq=cim.stop_at_over_freq,
1540
+ stopAtUnderFreq=cim.stop_at_under_freq,
1541
+ invVoltWattRespMode=cim.inv_volt_watt_resp_mode,
1542
+ invWattRespV1=cim.inv_watt_resp_v1,
1543
+ invWattRespV2=cim.inv_watt_resp_v2,
1544
+ invWattRespV3=cim.inv_watt_resp_v3,
1545
+ invWattRespV4=cim.inv_watt_resp_v4,
1546
+ invWattRespPAtV1=cim.inv_watt_resp_p_at_v1,
1547
+ invWattRespPAtV2=cim.inv_watt_resp_p_at_v2,
1548
+ invWattRespPAtV3=cim.inv_watt_resp_p_at_v3,
1549
+ invWattRespPAtV4=cim.inv_watt_resp_p_at_v4,
1550
+ invVoltVarRespMode=cim.inv_volt_var_resp_mode,
1551
+ invVarRespV1=cim.inv_var_resp_v1,
1552
+ invVarRespV2=cim.inv_var_resp_v2,
1553
+ invVarRespV3=cim.inv_var_resp_v3,
1554
+ invVarRespV4=cim.inv_var_resp_v4,
1555
+ invVarRespQAtV1=cim.inv_var_resp_q_at_v1,
1556
+ invVarRespQAtV2=cim.inv_var_resp_q_at_v2,
1557
+ invVarRespQAtV3=cim.inv_var_resp_q_at_v3,
1558
+ invVarRespQAtV4=cim.inv_var_resp_q_at_v4,
1559
+ invReactivePowerMode=cim.inv_reactive_power_mode,
1560
+ invFixReactivePower=cim.inv_fix_reactive_power,
1561
+ )
1467
1562
  )
1468
1563
 
1469
1564
 
@@ -1472,9 +1567,11 @@ def power_electronics_connection_phase_to_pb(cim: PowerElectronicsConnectionPhas
1472
1567
  return PBPowerElectronicsConnectionPhase(
1473
1568
  psr=power_system_resource_to_pb(cim),
1474
1569
  powerElectronicsConnectionMRID=mrid_or_empty(cim.power_electronics_connection),
1475
- p=from_nullable_float(cim.p),
1476
- q=from_nullable_float(cim.q),
1477
- phase=_map_single_phase_kind.to_pb(cim.phase)
1570
+ phase=_map_single_phase_kind.to_pb(cim.phase),
1571
+ **set_or_null(
1572
+ p=cim.p,
1573
+ q=cim.q,
1574
+ )
1478
1575
  )
1479
1576
 
1480
1577
 
@@ -1484,9 +1581,11 @@ def power_transformer_to_pb(cim: PowerTransformer) -> PBPowerTransformer:
1484
1581
  ce=conducting_equipment_to_pb(cim, True),
1485
1582
  powerTransformerEndMRIDs=[str(io.mrid) for io in cim.ends],
1486
1583
  vectorGroup=_map_vector_group.to_pb(cim.vector_group),
1487
- transformerUtilisation=from_nullable_float(cim.transformer_utilisation),
1488
1584
  constructionKind=_map_transformer_construction_kind.to_pb(cim.construction_kind),
1489
- function=_map_transformer_function_kind.to_pb(cim.function)
1585
+ function=_map_transformer_function_kind.to_pb(cim.function),
1586
+ **set_or_null(
1587
+ transformerUtilisation=cim.transformer_utilisation,
1588
+ )
1490
1589
  )
1491
1590
 
1492
1591
 
@@ -1495,27 +1594,31 @@ def power_transformer_end_to_pb(cim: PowerTransformerEnd) -> PBPowerTransformerE
1495
1594
  return PBPowerTransformerEnd(
1496
1595
  te=transformer_end_to_pb(cim),
1497
1596
  powerTransformerMRID=mrid_or_empty(cim.power_transformer),
1498
- ratedS=from_nullable_int(cim.rated_s),
1499
- ratedU=from_nullable_int(cim.rated_u),
1500
- r=from_nullable_float(cim.r),
1501
- r0=from_nullable_float(cim.r0),
1502
- x=from_nullable_float(cim.x),
1503
- x0=from_nullable_float(cim.x0),
1504
1597
  connectionKind=_map_winding_connection.to_pb(cim.connection_kind),
1505
- b=from_nullable_float(cim.b),
1506
- b0=from_nullable_float(cim.b0),
1507
- g=from_nullable_float(cim.g),
1508
- g0=from_nullable_float(cim.g0),
1509
- phaseAngleClock=from_nullable_int(cim.phase_angle_clock),
1510
- ratings=[transformer_end_rated_s_to_pb(it) for it in cim.s_ratings]
1598
+ ratings=[transformer_end_rated_s_to_pb(it) for it in cim.s_ratings],
1599
+ **set_or_null(
1600
+ ratedS=cim.rated_s,
1601
+ ratedU=cim.rated_u,
1602
+ r=cim.r,
1603
+ r0=cim.r0,
1604
+ x=cim.x,
1605
+ x0=cim.x0,
1606
+ b=cim.b,
1607
+ b0=cim.b0,
1608
+ g=cim.g,
1609
+ g0=cim.g0,
1610
+ phaseAngleClock=cim.phase_angle_clock,
1611
+ )
1511
1612
  )
1512
1613
 
1513
1614
 
1514
1615
  def protected_switch_to_pb(cim: ProtectedSwitch) -> PBProtectedSwitch:
1515
1616
  return PBProtectedSwitch(
1516
1617
  sw=switch_to_pb(cim),
1517
- breakingCapacity=from_nullable_int(cim.breaking_capacity),
1518
- relayFunctionMRIDs=[str(io.mrid) for io in cim.relay_functions]
1618
+ relayFunctionMRIDs=[str(io.mrid) for io in cim.relay_functions],
1619
+ **set_or_null(
1620
+ breakingCapacity=cim.breaking_capacity,
1621
+ )
1519
1622
  )
1520
1623
 
1521
1624
 
@@ -1524,7 +1627,9 @@ def ratio_tap_changer_to_pb(cim: RatioTapChanger) -> PBRatioTapChanger:
1524
1627
  return PBRatioTapChanger(
1525
1628
  tc=tap_changer_to_pb(cim),
1526
1629
  transformerEndMRID=mrid_or_empty(cim.transformer_end),
1527
- stepVoltageIncrement=from_nullable_float(cim.step_voltage_increment)
1630
+ **set_or_null(
1631
+ stepVoltageIncrement=cim.step_voltage_increment,
1632
+ )
1528
1633
  )
1529
1634
 
1530
1635
 
@@ -1541,8 +1646,10 @@ def recloser_to_pb(cim: Recloser) -> PBRecloser:
1541
1646
  def regulating_cond_eq_to_pb(cim: RegulatingCondEq, include_asset_info=False) -> PBRegulatingCondEq:
1542
1647
  return PBRegulatingCondEq(
1543
1648
  ec=energy_connection_to_pb(cim, include_asset_info),
1544
- controlEnabled=cim.control_enabled,
1545
- regulatingControlMRID=mrid_or_empty(cim.regulating_control)
1649
+ regulatingControlMRID=mrid_or_empty(cim.regulating_control),
1650
+ **set_or_null(
1651
+ controlEnabled=cim.control_enabled,
1652
+ )
1546
1653
  )
1547
1654
 
1548
1655
 
@@ -1554,30 +1661,34 @@ def regulating_control_to_pb(cim: RegulatingControl) -> PBRegulatingControl:
1554
1661
  """
1555
1662
  return PBRegulatingControl(
1556
1663
  psr=power_system_resource_to_pb(cim),
1557
- **nullable_bool_settings("discrete", cim.discrete),
1558
1664
  mode=_map_regulating_control_mode_kind.to_pb(cim.mode),
1559
1665
  monitoredPhase=_map_phase_code.to_pb(cim.monitored_phase),
1560
- targetDeadband=from_nullable_float(cim.target_deadband),
1561
- targetValue=from_nullable_float(cim.target_value),
1562
- **nullable_bool_settings("enabled", cim.enabled),
1563
- maxAllowedTargetValue=from_nullable_float(cim.max_allowed_target_value),
1564
- minAllowedTargetValue=from_nullable_float(cim.min_allowed_target_value),
1565
- ratedCurrent=from_nullable_float(cim.rated_current),
1566
1666
  terminalMRID=mrid_or_empty(cim.terminal),
1567
- ctPrimary=from_nullable_float(cim.ct_primary),
1568
- minTargetDeadband=from_nullable_float(cim.min_target_deadband),
1569
- regulatingCondEqMRIDs=[str(io.mrid) for io in cim.regulating_conducting_equipment]
1667
+ regulatingCondEqMRIDs=[str(io.mrid) for io in cim.regulating_conducting_equipment],
1668
+ **set_or_null(
1669
+ discrete=cim.discrete,
1670
+ targetDeadband=cim.target_deadband,
1671
+ targetValue=cim.target_value,
1672
+ enabled=cim.enabled,
1673
+ maxAllowedTargetValue=cim.max_allowed_target_value,
1674
+ minAllowedTargetValue=cim.min_allowed_target_value,
1675
+ ratedCurrent=cim.rated_current,
1676
+ ctPrimary=cim.ct_primary,
1677
+ minTargetDeadband=cim.min_target_deadband,
1678
+ )
1570
1679
  )
1571
1680
 
1572
1681
 
1573
1682
  def rotating_machine_to_pb(cim: RotatingMachine) -> PBRotatingMachine:
1574
1683
  return PBRotatingMachine(
1575
1684
  rce=regulating_cond_eq_to_pb(cim, True),
1576
- ratedPowerFactor=from_nullable_float(cim.rated_power_factor),
1577
- ratedS=from_nullable_float(cim.rated_s),
1578
- ratedU=from_nullable_int(cim.rated_u),
1579
- p=from_nullable_float(cim.p),
1580
- q=from_nullable_float(cim.q)
1685
+ **set_or_null(
1686
+ ratedPowerFactor=cim.rated_power_factor,
1687
+ ratedS=cim.rated_s,
1688
+ ratedU=cim.rated_u,
1689
+ p=cim.p,
1690
+ q=cim.q,
1691
+ )
1581
1692
  )
1582
1693
 
1583
1694
 
@@ -1585,22 +1696,26 @@ def rotating_machine_to_pb(cim: RotatingMachine) -> PBRotatingMachine:
1585
1696
  def series_compensator_to_pb(cim: SeriesCompensator) -> PBSeriesCompensator:
1586
1697
  return PBSeriesCompensator(
1587
1698
  ce=conducting_equipment_to_pb(cim, True),
1588
- r=from_nullable_float(cim.r),
1589
- r0=from_nullable_float(cim.r0),
1590
- x=from_nullable_float(cim.x),
1591
- x0=from_nullable_float(cim.x0),
1592
- varistorRatedCurrent=from_nullable_int(cim.varistor_rated_current),
1593
- varistorVoltageThreshold=from_nullable_int(cim.varistor_voltage_threshold),
1699
+ **set_or_null(
1700
+ r=cim.r,
1701
+ r0=cim.r0,
1702
+ x=cim.x,
1703
+ x0=cim.x0,
1704
+ varistorRatedCurrent=cim.varistor_rated_current,
1705
+ varistorVoltageThreshold=cim.varistor_voltage_threshold,
1706
+ )
1594
1707
  )
1595
1708
 
1596
1709
 
1597
1710
  def shunt_compensator_to_pb(cim: ShuntCompensator) -> PBShuntCompensator:
1598
1711
  return PBShuntCompensator(
1599
1712
  rce=regulating_cond_eq_to_pb(cim, True),
1600
- sections=from_nullable_float(cim.sections),
1601
- grounded=cim.grounded,
1602
- nomU=from_nullable_int(cim.nom_u),
1603
- phaseConnection=_map_phase_shunt_connection_kind.to_pb(cim.phase_connection)
1713
+ phaseConnection=_map_phase_shunt_connection_kind.to_pb(cim.phase_connection),
1714
+ **set_or_null(
1715
+ sections=cim.sections,
1716
+ grounded=cim.grounded,
1717
+ nomU=cim.nom_u,
1718
+ )
1604
1719
  )
1605
1720
 
1606
1721
 
@@ -1613,20 +1728,24 @@ def static_var_compensator_to_pb(cim: StaticVarCompensator) -> PBStaticVarCompen
1613
1728
  """
1614
1729
  return PBStaticVarCompensator(
1615
1730
  rce=regulating_cond_eq_to_pb(cim),
1616
- capacitiveRating=from_nullable_float(cim.capacitive_rating),
1617
- inductiveRating=from_nullable_float(cim.inductive_rating),
1618
- q=from_nullable_float(cim.q),
1619
1731
  svcControlMode=_map_svc_control_mode.to_pb(cim.svc_control_mode),
1620
- voltageSetPoint=from_nullable_int(cim.voltage_set_point)
1732
+ **set_or_null(
1733
+ capacitiveRating=cim.capacitive_rating,
1734
+ inductiveRating=cim.inductive_rating,
1735
+ q=cim.q,
1736
+ voltageSetPoint=cim.voltage_set_point,
1737
+ )
1621
1738
  )
1622
1739
 
1623
1740
 
1624
1741
  def switch_to_pb(cim: Switch) -> PBSwitch:
1625
1742
  return PBSwitch(
1626
1743
  ce=conducting_equipment_to_pb(cim, True),
1627
- ratedCurrent=from_nullable_float(cim.rated_current),
1628
1744
  normalOpen=cim.get_normal_state() != 0,
1629
- open=cim.get_state() != 0
1745
+ open=cim.get_state() != 0,
1746
+ **set_or_null(
1747
+ ratedCurrent=cim.rated_current,
1748
+ )
1630
1749
  )
1631
1750
 
1632
1751
 
@@ -1636,41 +1755,45 @@ def synchronous_machine_to_pb(cim: SynchronousMachine) -> PBSynchronousMachine:
1636
1755
  rm=rotating_machine_to_pb(cim),
1637
1756
 
1638
1757
  reactiveCapabilityCurveMRIDs=[str(it.mrid) for it in cim.curves],
1639
- baseQ=from_nullable_float(cim.base_q),
1640
- condenserP=from_nullable_int(cim.condenser_p),
1641
- earthing=cim.earthing,
1642
- earthingStarPointR=from_nullable_float(cim.earthing_star_point_r),
1643
- earthingStarPointX=from_nullable_float(cim.earthing_star_point_x),
1644
- ikk=from_nullable_float(cim.ikk),
1645
- maxQ=from_nullable_float(cim.max_q),
1646
- maxU=from_nullable_int(cim.max_u),
1647
- minQ=from_nullable_float(cim.min_q),
1648
- minU=from_nullable_int(cim.min_u),
1649
- mu=from_nullable_float(cim.mu),
1650
- r=from_nullable_float(cim.r),
1651
- r0=from_nullable_float(cim.r0),
1652
- r2=from_nullable_float(cim.r2),
1653
- satDirectSubtransX=from_nullable_float(cim.sat_direct_subtrans_x),
1654
- satDirectSyncX=from_nullable_float(cim.sat_direct_sync_x),
1655
- satDirectTransX=from_nullable_float(cim.sat_direct_trans_x),
1656
- x0=from_nullable_float(cim.x0),
1657
- x2=from_nullable_float(cim.x2),
1658
1758
  type=_map_synchronous_machine_kind.to_pb(cim.type),
1659
- operatingMode=_map_synchronous_machine_kind.to_pb(cim.operating_mode)
1759
+ operatingMode=_map_synchronous_machine_kind.to_pb(cim.operating_mode),
1760
+ **set_or_null(
1761
+ baseQ=cim.base_q,
1762
+ condenserP=cim.condenser_p,
1763
+ earthing=cim.earthing,
1764
+ earthingStarPointR=cim.earthing_star_point_r,
1765
+ earthingStarPointX=cim.earthing_star_point_x,
1766
+ ikk=cim.ikk,
1767
+ maxQ=cim.max_q,
1768
+ maxU=cim.max_u,
1769
+ minQ=cim.min_q,
1770
+ minU=cim.min_u,
1771
+ mu=cim.mu,
1772
+ r=cim.r,
1773
+ r0=cim.r0,
1774
+ r2=cim.r2,
1775
+ satDirectSubtransX=cim.sat_direct_subtrans_x,
1776
+ satDirectSyncX=cim.sat_direct_sync_x,
1777
+ satDirectTransX=cim.sat_direct_trans_x,
1778
+ x0=cim.x0,
1779
+ x2=cim.x2,
1780
+ )
1660
1781
  )
1661
1782
 
1662
1783
 
1663
1784
  def tap_changer_to_pb(cim: TapChanger) -> PBTapChanger:
1664
1785
  return PBTapChanger(
1665
1786
  psr=power_system_resource_to_pb(cim),
1666
- highStep=from_nullable_int(cim.high_step),
1667
- lowStep=from_nullable_int(cim.low_step),
1668
- step=from_nullable_float(cim.step),
1669
- neutralStep=from_nullable_int(cim.neutral_step),
1670
- neutralU=from_nullable_int(cim.neutral_u),
1671
- normalStep=from_nullable_int(cim.normal_step),
1672
- controlEnabled=cim.control_enabled,
1673
- tapChangerControlMRID=mrid_or_empty(cim.tap_changer_control)
1787
+ tapChangerControlMRID=mrid_or_empty(cim.tap_changer_control),
1788
+ **set_or_null(
1789
+ highStep=cim.high_step,
1790
+ lowStep=cim.low_step,
1791
+ step=cim.step,
1792
+ neutralStep=cim.neutral_step,
1793
+ neutralU=cim.neutral_u,
1794
+ normalStep=cim.normal_step,
1795
+ controlEnabled=cim.control_enabled,
1796
+ )
1674
1797
  )
1675
1798
 
1676
1799
 
@@ -1678,15 +1801,17 @@ def tap_changer_to_pb(cim: TapChanger) -> PBTapChanger:
1678
1801
  def tap_changer_control_to_pb(cim: TapChangerControl) -> PBTapChangerControl:
1679
1802
  return PBTapChangerControl(
1680
1803
  rc=regulating_control_to_pb(cim),
1681
- limitVoltage=from_nullable_int(cim.limit_voltage),
1682
- **nullable_bool_settings("lineDropCompensation", cim.line_drop_compensation),
1683
- lineDropR=from_nullable_float(cim.line_drop_r),
1684
- lineDropX=from_nullable_float(cim.line_drop_x),
1685
- reverseLineDropR=from_nullable_float(cim.reverse_line_drop_r),
1686
- reverseLineDropX=from_nullable_float(cim.reverse_line_drop_x),
1687
- **nullable_bool_settings("forwardLDCBlocking", cim.forward_ldc_blocking),
1688
- timeDelay=from_nullable_float(cim.time_delay),
1689
- **nullable_bool_settings("coGenerationEnabled", cim.co_generation_enabled)
1804
+ **set_or_null(
1805
+ limitVoltage=cim.limit_voltage,
1806
+ lineDropCompensation=cim.line_drop_compensation,
1807
+ lineDropR=cim.line_drop_r,
1808
+ lineDropX=cim.line_drop_x,
1809
+ reverseLineDropR=cim.reverse_line_drop_r,
1810
+ reverseLineDropX=cim.reverse_line_drop_x,
1811
+ forwardLDCBlocking=cim.forward_ldc_blocking,
1812
+ timeDelay=cim.time_delay,
1813
+ coGenerationEnabled=cim.co_generation_enabled
1814
+ )
1690
1815
  )
1691
1816
 
1692
1817
 
@@ -1698,16 +1823,18 @@ def transformer_end_to_pb(cim: TransformerEnd) -> PBTransformerEnd:
1698
1823
  ratioTapChangerMRID=mrid_or_empty(cim.ratio_tap_changer),
1699
1824
  starImpedanceMRID=mrid_or_empty(cim.star_impedance),
1700
1825
  endNumber=cim.end_number,
1701
- grounded=cim.grounded,
1702
- rGround=from_nullable_float(cim.r_ground),
1703
- xGround=from_nullable_float(cim.x_ground)
1826
+ **set_or_null(
1827
+ grounded=cim.grounded,
1828
+ rGround=cim.r_ground,
1829
+ xGround=cim.x_ground,
1830
+ )
1704
1831
  )
1705
1832
 
1706
1833
 
1707
1834
  def transformer_end_rated_s_to_pb(cim: TransformerEndRatedS) -> PBTransformerEndRatedS:
1708
1835
  return PBTransformerEndRatedS(
1836
+ coolingType=_map_transformer_cooling_type.to_pb(cim.cooling_type),
1709
1837
  ratedS=cim.rated_s,
1710
- coolingType=_map_transformer_cooling_type.to_pb(cim.cooling_type)
1711
1838
  )
1712
1839
 
1713
1840
 
@@ -1715,11 +1842,13 @@ def transformer_end_rated_s_to_pb(cim: TransformerEndRatedS) -> PBTransformerEnd
1715
1842
  def transformer_star_impedance_to_pb(cim: TransformerStarImpedance) -> PBTransformerStarImpedance:
1716
1843
  return PBTransformerStarImpedance(
1717
1844
  io=identified_object_to_pb(cim),
1718
- r=cim.r if cim.r else 0.0,
1719
- r0=cim.r0 if cim.r0 else 0.0,
1720
- x=cim.x if cim.x else 0.0,
1721
- x0=cim.x0 if cim.x0 else 0.0,
1722
- transformerEndInfoMRID=mrid_or_empty(cim.transformer_end_info)
1845
+ transformerEndInfoMRID=mrid_or_empty(cim.transformer_end_info),
1846
+ **set_or_null(
1847
+ r=cim.r,
1848
+ r0=cim.r0,
1849
+ x=cim.x,
1850
+ x0=cim.x0
1851
+ )
1723
1852
  )
1724
1853
 
1725
1854