cim-builder 0.1.0a1__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.
- cim_builder-0.1.0a1.dist-info/METADATA +47 -0
- cim_builder-0.1.0a1.dist-info/RECORD +102 -0
- cim_builder-0.1.0a1.dist-info/WHEEL +4 -0
- cim_builder-0.1.0a1.dist-info/licenses/LICENSE +28 -0
- cimbuilder/__init__.py +0 -0
- cimbuilder/core/sort_terminals.py +43 -0
- cimbuilder/core/tap_steps.py +24 -0
- cimbuilder/feeder_builder/aggregate_feeder.py +182 -0
- cimbuilder/network.py +61 -0
- cimbuilder/object_builder/__init__.py +203 -0
- cimbuilder/object_builder/base/__init__.py +13 -0
- cimbuilder/object_builder/base/base_quantities.py +71 -0
- cimbuilder/object_builder/conducting_asset_info.py +40 -0
- cimbuilder/object_builder/container/__init__.py +15 -0
- cimbuilder/object_builder/container/feeder.py +49 -0
- cimbuilder/object_builder/container/substation.py +38 -0
- cimbuilder/object_builder/container/voltage_level.py +88 -0
- cimbuilder/object_builder/control/__init__.py +9 -0
- cimbuilder/object_builder/control/regulating_control.py +64 -0
- cimbuilder/object_builder/deprecated/create_houses.py +780 -0
- cimbuilder/object_builder/generator/__init__.py +14 -0
- cimbuilder/object_builder/generator/asynchronous_machine.py +41 -0
- cimbuilder/object_builder/generator/rotating_machine.py +114 -0
- cimbuilder/object_builder/generator/synchronous_machine.py +84 -0
- cimbuilder/object_builder/inverter/__init__.py +36 -0
- cimbuilder/object_builder/inverter/battery_info.py +40 -0
- cimbuilder/object_builder/inverter/inverter_info.py +72 -0
- cimbuilder/object_builder/inverter/power_electronics_connection.py +139 -0
- cimbuilder/object_builder/inverter/power_electronics_connection_phase.py +50 -0
- cimbuilder/object_builder/inverter/power_electronics_unit.py +125 -0
- cimbuilder/object_builder/inverter/solar_panel_info.py +40 -0
- cimbuilder/object_builder/limit/__init__.py +8 -0
- cimbuilder/object_builder/limit/operational_limit_set.py +272 -0
- cimbuilder/object_builder/line/__init__.py +36 -0
- cimbuilder/object_builder/line/ac_line_segment.py +202 -0
- cimbuilder/object_builder/line/ac_line_segment_phase.py +54 -0
- cimbuilder/object_builder/line/cable_info.py +61 -0
- cimbuilder/object_builder/line/concentric_neutral_cable_info.py +41 -0
- cimbuilder/object_builder/line/conductor_distance_spacing.py +76 -0
- cimbuilder/object_builder/line/overhead_wire_info.py +11 -0
- cimbuilder/object_builder/line/per_length_impedance.py +200 -0
- cimbuilder/object_builder/line/series_compensator.py +109 -0
- cimbuilder/object_builder/line/wire_configuration.py +108 -0
- cimbuilder/object_builder/line/wire_info.py +97 -0
- cimbuilder/object_builder/line/xy_wire_spacing.py +68 -0
- cimbuilder/object_builder/load/__init__.py +14 -0
- cimbuilder/object_builder/load/energy_consumer.py +149 -0
- cimbuilder/object_builder/load/energy_consumer_phase.py +74 -0
- cimbuilder/object_builder/load/load_response_characteristic.py +54 -0
- cimbuilder/object_builder/measurement/__init__.py +11 -0
- cimbuilder/object_builder/measurement/analog.py +131 -0
- cimbuilder/object_builder/measurement/discrete.py +45 -0
- cimbuilder/object_builder/measurement/measurement.py +190 -0
- cimbuilder/object_builder/object_builder.py +100 -0
- cimbuilder/object_builder/protection/__init__.py +9 -0
- cimbuilder/object_builder/protection/under_frequency_protection_function_block.py +54 -0
- cimbuilder/object_builder/shunt/__init__.py +12 -0
- cimbuilder/object_builder/shunt/linear_shunt_compensator.py +211 -0
- cimbuilder/object_builder/shunt/linear_shunt_compensator_phase.py +89 -0
- cimbuilder/object_builder/source/__init__.py +7 -0
- cimbuilder/object_builder/source/energy_source.py +150 -0
- cimbuilder/object_builder/switch/__init__.py +38 -0
- cimbuilder/object_builder/switch/protected_switch.py +94 -0
- cimbuilder/object_builder/switch/switch.py +179 -0
- cimbuilder/object_builder/switch/switch_info.py +51 -0
- cimbuilder/object_builder/switch/switch_phase.py +65 -0
- cimbuilder/object_builder/topology/__init__.py +17 -0
- cimbuilder/object_builder/topology/connectivity_node.py +52 -0
- cimbuilder/object_builder/topology/connector.py +117 -0
- cimbuilder/object_builder/topology/topological_node.py +33 -0
- cimbuilder/object_builder/transformer/__init__.py +69 -0
- cimbuilder/object_builder/transformer/cooling_info.py +29 -0
- cimbuilder/object_builder/transformer/phase_tap_changer.py +18 -0
- cimbuilder/object_builder/transformer/phase_tap_changer_asymmetrical.py +54 -0
- cimbuilder/object_builder/transformer/phase_tap_changer_linear.py +48 -0
- cimbuilder/object_builder/transformer/phase_tap_changer_non_linear.py +49 -0
- cimbuilder/object_builder/transformer/phase_tap_changer_symmetrical.py +17 -0
- cimbuilder/object_builder/transformer/phase_tap_changer_table.py +55 -0
- cimbuilder/object_builder/transformer/phase_tap_changer_tabular.py +53 -0
- cimbuilder/object_builder/transformer/power_transformer.py +193 -0
- cimbuilder/object_builder/transformer/ratio_tap_changer.py +42 -0
- cimbuilder/object_builder/transformer/series_reactor_info.py +88 -0
- cimbuilder/object_builder/transformer/tap_changer.py +132 -0
- cimbuilder/object_builder/transformer/tap_changer_control.py +79 -0
- cimbuilder/object_builder/transformer/tap_changer_info.py +76 -0
- cimbuilder/object_builder/transformer/transformer_bank.py +386 -0
- cimbuilder/object_builder/transformer/transformer_tank_configuration.py +318 -0
- cimbuilder/object_builder/transformer/voltage_regulator.py +205 -0
- cimbuilder/substation_builder/__init__.py +27 -0
- cimbuilder/substation_builder/breaker_and_a_half.py +68 -0
- cimbuilder/substation_builder/double_bus_double_breaker.py +0 -0
- cimbuilder/substation_builder/double_bus_single_breaker.py +71 -0
- cimbuilder/substation_builder/main_and_transfer.py +54 -0
- cimbuilder/substation_builder/ring_bus.py +58 -0
- cimbuilder/substation_builder/sectionalized_bus.py +50 -0
- cimbuilder/substation_builder/single_bus.py +33 -0
- cimbuilder/substation_builder/substation_builder.py +161 -0
- cimbuilder/utils/__init__.py +2 -0
- cimbuilder/utils/catalog_parser.py +41 -0
- cimbuilder/utils/get_base_impedance.py +0 -0
- cimbuilder/utils/get_base_voltage.py +0 -0
- cimbuilder/utils/get_source_bus.py +37 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: cim-builder
|
|
3
|
+
Version: 0.1.0a1
|
|
4
|
+
Summary: Simplified Dictionaries of CIM data
|
|
5
|
+
Author-email: "A. Anderson" <19935503+AAndersn@users.noreply.github.com>
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Requires-Python: >=3.10
|
|
8
|
+
Requires-Dist: cim-profiles<0.2,>=0.1.0a1
|
|
9
|
+
Requires-Dist: cim-tables>=0.1.a0
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
|
|
12
|
+
# CIM-Builder
|
|
13
|
+
|
|
14
|
+
CIM-Builder is a new python library developed under the Grid Atlas and MAPLE LEAF projects for creating CIM models "from scratch" with no pre-existing model files. This is a significantly different capability than all other tooling, which requires a source file from which to start, such as OpenDSS, PSSE, or GIS data. The library currently inlcudes three main functionalities:
|
|
15
|
+
|
|
16
|
+
1) automatic creation of new node-breaker substations in CIM based on interactive API calls.
|
|
17
|
+
|
|
18
|
+
2) automatic insertion of existing distribution feeders in CIM into new node-breaker substations.
|
|
19
|
+
|
|
20
|
+
3) automatic insertion of new aggregate feeder data in existing CIM transmission models.
|
|
21
|
+
|
|
22
|
+
The library contains a set of classes for each type of common substation, which each contain two methods. The first is `add_feeder`, which automatically adds the specified distribution feeder to the substation and creates the chain of switching equipment between the sourcebus of the feeder and the correct breaker or airgap switch in the substation. The second is `add_branch`, which enables automated addition of transmission branches, transformers, and shunt equipment to the substation bus.
|
|
23
|
+
|
|
24
|
+
The classes supported within the first version of CIM-Builder are
|
|
25
|
+
|
|
26
|
+
* `SingleBusSubstation`
|
|
27
|
+
* `MainAndTransferSubstation`
|
|
28
|
+
* `RingBusSubstation`
|
|
29
|
+
* `DoubleBusSingleBreakerSubstation`
|
|
30
|
+
* `BreakerAndHalfSubstation`
|
|
31
|
+
|
|
32
|
+
When instantiated, these classes create a new CIMantic Graphs `DistributedArea` or `NodeBreakerModel` graph model with all CIM objects associated with the default bus configuration for that substation. Distribution feeders can then be added to the substation by instantiating each feeder as a new CIMantic Graphs `FeederModel`. The python library then builds the set of CIM associations to map the feeder to the substation and create all CIM objects for the breaker, airgap switches, and junctions.
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
## Attribution and Disclaimer
|
|
37
|
+
|
|
38
|
+
This software was created under a project sponsored by the U.S. Department of Energy’s Office of Electricity, an agency of the United States Government. Neither the United States Government nor the United States Department of Energy, nor Battelle, nor any of their employees, nor any jurisdiction or organization that has cooperated in the development of these materials, makes any warranty, express or implied, or assumes any legal liability or responsibility for the accuracy, completeness, or usefulness or any information, apparatus, product, software, or process disclosed, or represents that its use would not infringe privately owned rights.
|
|
39
|
+
|
|
40
|
+
Reference herein to any specific commercial product, process, or service by trade name, trademark, manufacturer, or otherwise does not necessarily constitute or imply its endorsement, recommendation, or favoring by the United States Government or any agency thereof, or Battelle Memorial Institute. The views and opinions of authors expressed herein do not necessarily state or reflect those of the United States Government or any agency thereof.
|
|
41
|
+
|
|
42
|
+
PACIFIC NORTHWEST NATIONAL LABORATORY
|
|
43
|
+
operated by
|
|
44
|
+
BATTELLE
|
|
45
|
+
for the
|
|
46
|
+
UNITED STATES DEPARTMENT OF ENERGY
|
|
47
|
+
under Contract DE-AC05-76RL01830
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
cimbuilder/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
cimbuilder/network.py,sha256=-dWgNaAr3-wiUIdenX8_nQQbEFKfOYxBdOraNxxVLos,2594
|
|
3
|
+
cimbuilder/core/sort_terminals.py,sha256=WB1EPvmSYB8f15P12Wu10-sTlYZ27_8xKXpj7-YDNBQ,1478
|
|
4
|
+
cimbuilder/core/tap_steps.py,sha256=rxOzo_wDKl0NA0xtMeRswlP4re7zhphX6bjl5_0JRJs,1224
|
|
5
|
+
cimbuilder/feeder_builder/aggregate_feeder.py,sha256=ucBRZ7ppYnwkSlBzi8smwLil7jvBvtb9HDyR9EzJV9Q,7461
|
|
6
|
+
cimbuilder/object_builder/__init__.py,sha256=TRwsJcpvXltEBLWC70Nsn_A3Eyvw3ozbuAgF4yYb3Zs,5908
|
|
7
|
+
cimbuilder/object_builder/conducting_asset_info.py,sha256=7DqGtvfnnPwhZENZesos2EW24V0xHoIwQDxPqnEQnpo,1685
|
|
8
|
+
cimbuilder/object_builder/object_builder.py,sha256=8yXcv7fOsG6DzZM8qmsPUUeYMYLARiOPoxRWq_Jzflw,4370
|
|
9
|
+
cimbuilder/object_builder/base/__init__.py,sha256=R2lwj9edW2GB4rFgelYi_ze_8872iBHK4FIvD4o-XxA,285
|
|
10
|
+
cimbuilder/object_builder/base/base_quantities.py,sha256=Q543LF0aFB5eO7tBAW119-gvnxg3DN3aAPYKNp8hOm0,2430
|
|
11
|
+
cimbuilder/object_builder/container/__init__.py,sha256=qXOh45J-ZAIsLS7MBCqRy7uVAJWHtgW7Oq_rEHd-UKA,437
|
|
12
|
+
cimbuilder/object_builder/container/feeder.py,sha256=45Sajpms7TuBn1Qo_iS_YhWN-kebUAcNpgNQiihdZiM,1825
|
|
13
|
+
cimbuilder/object_builder/container/substation.py,sha256=cjBj6CtB6aW-DAJEx0du2pb3WC4fKb_ekkYaHmfOe4g,1232
|
|
14
|
+
cimbuilder/object_builder/container/voltage_level.py,sha256=jVO9Lr8zIt68alEhnqjzENztaNvYomJDBcYmU9uwKPk,2998
|
|
15
|
+
cimbuilder/object_builder/control/__init__.py,sha256=CIFA1pSA6XNcILo1KqhbYPIYMKDGj_2qasRjhZHs0C8,182
|
|
16
|
+
cimbuilder/object_builder/control/regulating_control.py,sha256=tOUqL34Wd-nZ0p4-69sSni9sIkT-BdmQx7Lq3g-zuz4,2898
|
|
17
|
+
cimbuilder/object_builder/deprecated/create_houses.py,sha256=OPKfTQxOBR4AMbwCoHjKO1cEWcxP9Y-32BISaGc0SX8,33968
|
|
18
|
+
cimbuilder/object_builder/generator/__init__.py,sha256=ZEKTjx4gWKpJbBSMvSOzCtUQXYYuFEixUu8IBoeEGOI,453
|
|
19
|
+
cimbuilder/object_builder/generator/asynchronous_machine.py,sha256=yXPLIQfeGHMLB9vWXKTDIsuai7BObAv515DBHc5GSoc,1143
|
|
20
|
+
cimbuilder/object_builder/generator/rotating_machine.py,sha256=E4X8BP9VIYYYWIGWw9BXh3Z-nUfcBjgCAjzhodcJSdw,4202
|
|
21
|
+
cimbuilder/object_builder/generator/synchronous_machine.py,sha256=oJeralFiOd-TTT8EV_v9Wn7I9ZXUsTQSMKHSfYx4JGI,3081
|
|
22
|
+
cimbuilder/object_builder/inverter/__init__.py,sha256=Z5AMAmVhZh8uqCf4_Cmfj21gvr2qR68b6HVeeANKviA,1271
|
|
23
|
+
cimbuilder/object_builder/inverter/battery_info.py,sha256=etbgd4y2uDqAmzKVve40GaKJzpCxdo7lfDW-6Vh0BI8,1816
|
|
24
|
+
cimbuilder/object_builder/inverter/inverter_info.py,sha256=Sdbc5FZQku0ElF2qU67zeCOpCDZtDwhLVPp8jBUbSbA,3028
|
|
25
|
+
cimbuilder/object_builder/inverter/power_electronics_connection.py,sha256=0mNL8CgsXSp30Yv6cmW92Ptzu0PJtPp_yBAR-YoE5ME,5378
|
|
26
|
+
cimbuilder/object_builder/inverter/power_electronics_connection_phase.py,sha256=AQZ9g32xcM7mcGxiNus3Uxszg5BDfcIe-XDqon-o4Mo,1910
|
|
27
|
+
cimbuilder/object_builder/inverter/power_electronics_unit.py,sha256=avV4DI6V9-TyuxONXo8xFlBQrVXeQ7M1YzqwNhkXz9U,4454
|
|
28
|
+
cimbuilder/object_builder/inverter/solar_panel_info.py,sha256=bL7rmSuvtboX78vyX2JIUdcD8sqnNj_kbnPg_lc9sZY,2015
|
|
29
|
+
cimbuilder/object_builder/limit/__init__.py,sha256=7trIwrjywG6HMhoRzyE7bOxYzwIQcERFwXG0wU2xg4Q,185
|
|
30
|
+
cimbuilder/object_builder/limit/operational_limit_set.py,sha256=WWM-ZYXA242mskhtZX5MfhxdgCD0uKmb5q5GcDVlDpA,10967
|
|
31
|
+
cimbuilder/object_builder/line/__init__.py,sha256=5y_BhCccNLo9ZVrRh0Imq9Cy6c2Nz7LTnYtmlwrcleg,1462
|
|
32
|
+
cimbuilder/object_builder/line/ac_line_segment.py,sha256=JFK9dYuxGoeSnhAOAwua-KbEFqJWvD3WbIJ996L03m4,8137
|
|
33
|
+
cimbuilder/object_builder/line/ac_line_segment_phase.py,sha256=84s9Zk9k8F1Tp7rAJSwM3-26EHTO3u7vtooDxrHlmcM,1919
|
|
34
|
+
cimbuilder/object_builder/line/cable_info.py,sha256=UXGWQyX8_0BD59SZ6AMblekpdIpshOOLaKTjaUb-SpA,2968
|
|
35
|
+
cimbuilder/object_builder/line/concentric_neutral_cable_info.py,sha256=O3slrJKL6eVKvzvTrM48JpenhhkZnnqPchTOwi3QUr4,2068
|
|
36
|
+
cimbuilder/object_builder/line/conductor_distance_spacing.py,sha256=s9ms9gLL1N8C86oJTsJdRzYIUY_yYwZrWzwNlJFmYug,3139
|
|
37
|
+
cimbuilder/object_builder/line/overhead_wire_info.py,sha256=mgKuIsOx5VHADEG7NfeRQjvdpGslGhoq1KgXWV3-s40,443
|
|
38
|
+
cimbuilder/object_builder/line/per_length_impedance.py,sha256=oFBE3dJWIrMg6C0H74l_G5DoTQBTTFGvfdRoIgmjL9E,8306
|
|
39
|
+
cimbuilder/object_builder/line/series_compensator.py,sha256=0eqnOBS5B8MseSI1D_O366sROe85Fw-Zl2eDOlfRcFs,4386
|
|
40
|
+
cimbuilder/object_builder/line/wire_configuration.py,sha256=WfEMbfC9jnkGnzrXTlNFtqC2daweyzMc11_SuBvRFQ8,4433
|
|
41
|
+
cimbuilder/object_builder/line/wire_info.py,sha256=LNZHdI4H_mmPvW-SomaqK_KyWvn9QXMBuMxADhj0ZlI,5199
|
|
42
|
+
cimbuilder/object_builder/line/xy_wire_spacing.py,sha256=6Cj0mt96nqnmjXpX1LiNnKbFfk8dtauwxSPN-v7y6ZE,2690
|
|
43
|
+
cimbuilder/object_builder/load/__init__.py,sha256=NMYZ-o70eEMxIfkqK4s0Y3gxItgyt3P8QlRZk1U9qtE,455
|
|
44
|
+
cimbuilder/object_builder/load/energy_consumer.py,sha256=098B23LQeJeU5Jc43T_rpcuiQo3V2UH-02rfQ7nR4M8,6317
|
|
45
|
+
cimbuilder/object_builder/load/energy_consumer_phase.py,sha256=kFXJPe5Aa7slFV4BgSVRzwOQQbZ8WEISJO7d06hVvAU,2946
|
|
46
|
+
cimbuilder/object_builder/load/load_response_characteristic.py,sha256=YTL1WEXlADjvcXxfvBqf5dI5-7y_xXRR1dTzFVSkjDw,2974
|
|
47
|
+
cimbuilder/object_builder/measurement/__init__.py,sha256=4mQB5opshJyBczaWwCAeyOOtZnA6E-0SjXmn-SpInBY,341
|
|
48
|
+
cimbuilder/object_builder/measurement/analog.py,sha256=jjUWJ_Q1ku9DJPHt-C8THdw8IcIwhtpK7aB__q8Q1lw,6673
|
|
49
|
+
cimbuilder/object_builder/measurement/discrete.py,sha256=mv4rRe9zlQNFBNYgqLgC67voPpCvAr9HJpjmR0FTivY,2066
|
|
50
|
+
cimbuilder/object_builder/measurement/measurement.py,sha256=VtUQNLhKXa2GYiCLj7sPVDWL5HP-qkGAoRUhIOvNLSA,7913
|
|
51
|
+
cimbuilder/object_builder/protection/__init__.py,sha256=mJiUcujhaHQnPSxjZWIQ_ug_ekYV0T95vQuqDa3cJc0,240
|
|
52
|
+
cimbuilder/object_builder/protection/under_frequency_protection_function_block.py,sha256=zq-bhyhYWgn82weXoFGbXKGuQZBqVAK7Wfscc8UBkkc,2157
|
|
53
|
+
cimbuilder/object_builder/shunt/__init__.py,sha256=OlVDPJ4DXbT_6ir1XlV66pKNb-2LreQFIWtecKKLApQ,355
|
|
54
|
+
cimbuilder/object_builder/shunt/linear_shunt_compensator.py,sha256=JzcqN7vCblQCLHJfh1yHFPdYIlj4scYR6gRsFNvZDUM,9030
|
|
55
|
+
cimbuilder/object_builder/shunt/linear_shunt_compensator_phase.py,sha256=HwYl5ciMKsz5ABKFs_EweR0w8w25Yt7g5d06bIW9veo,3776
|
|
56
|
+
cimbuilder/object_builder/source/__init__.py,sha256=b2A6dvM0T7wzp-p9T9_BqYj0y73tVOvtO1QpvFjvQds,176
|
|
57
|
+
cimbuilder/object_builder/source/energy_source.py,sha256=ArJYB6l4a4_3TuSxDnYejMQ7SN0TVRDNpuqMCH8_Hb8,6532
|
|
58
|
+
cimbuilder/object_builder/switch/__init__.py,sha256=EJAJhs0jCwqirDKgOXPB2O5ylhypsLrqVkhGk8R7zTk,1038
|
|
59
|
+
cimbuilder/object_builder/switch/protected_switch.py,sha256=cPYKkZmSUPJp3xmT-lBD2iuR1CW3yOejbrAkD5O6HcA,4040
|
|
60
|
+
cimbuilder/object_builder/switch/switch.py,sha256=HPGz_-a5IW1VDe6XNDHxQgdeX4fkbKbx1HxVo9PIzDo,6707
|
|
61
|
+
cimbuilder/object_builder/switch/switch_info.py,sha256=JVA6DmSB86Dw0fPGvf8hNKCO58qtG2Iyv2T8li13-io,2640
|
|
62
|
+
cimbuilder/object_builder/switch/switch_phase.py,sha256=clpgz2mSCirM7-PS5OJp-b4ayPMxQmamVSLqSTBM6rU,2337
|
|
63
|
+
cimbuilder/object_builder/topology/__init__.py,sha256=7BEy6ywW3PcmDPqUQa0YQSqPOn284y0ahfaSyGHm8JE,494
|
|
64
|
+
cimbuilder/object_builder/topology/connectivity_node.py,sha256=HN4AeeAfECkmRJLCLXVoz5SUg1iG-hHyasJeHDeTHIA,1965
|
|
65
|
+
cimbuilder/object_builder/topology/connector.py,sha256=IFEmd93smJ-sKPnIeSXAw9K-PWSAtGIib-H5Eto7ErY,3718
|
|
66
|
+
cimbuilder/object_builder/topology/topological_node.py,sha256=_1aQxqv4KPzCHHwczpScerJ40tQugPbXJI3wZhXQdnQ,1053
|
|
67
|
+
cimbuilder/object_builder/transformer/__init__.py,sha256=DieepRf8ZCFx4B9HbAo6xJGF76vFtW6ewKPQwdSrqx4,2498
|
|
68
|
+
cimbuilder/object_builder/transformer/cooling_info.py,sha256=Vk73DE1_OuqJ0jlu148Cz1MSont3cRsPcynWarQetoE,983
|
|
69
|
+
cimbuilder/object_builder/transformer/phase_tap_changer.py,sha256=0tcFbAgAnAPgoynPbzHlzQ2x-0Kqnm3uK2uj3B9uBBM,849
|
|
70
|
+
cimbuilder/object_builder/transformer/phase_tap_changer_asymmetrical.py,sha256=sSMxT5Us5XTX3OCSM-NiQC-gL6tGlwo4FWPEJ6pwY6E,2303
|
|
71
|
+
cimbuilder/object_builder/transformer/phase_tap_changer_linear.py,sha256=7RFhzNHciAdYcYLy37NKBMucrmzNgq6KRtN7hzIuCjE,1938
|
|
72
|
+
cimbuilder/object_builder/transformer/phase_tap_changer_non_linear.py,sha256=IoDvCbcNv-LcAmSRdBXPpES28iLZHkm9p5Tmzch77lY,2055
|
|
73
|
+
cimbuilder/object_builder/transformer/phase_tap_changer_symmetrical.py,sha256=K365KuzntBp-ArBSL7JLJ_EoqNNWZQ6ozMk8PJQl6vM,802
|
|
74
|
+
cimbuilder/object_builder/transformer/phase_tap_changer_table.py,sha256=yAOaYr42V2TgkK3xH9Nqk66ZTG-VvQ0j0OWSUL6QEB0,2396
|
|
75
|
+
cimbuilder/object_builder/transformer/phase_tap_changer_tabular.py,sha256=LKjbYeTsIjqIwmVrAn3dqhNtx2F1jJxOuNUN_-3eVgs,2032
|
|
76
|
+
cimbuilder/object_builder/transformer/power_transformer.py,sha256=7XwinfHz3wTH42VqUs-Emo61WcWG3Gk8lJ6LGDOdNvY,9073
|
|
77
|
+
cimbuilder/object_builder/transformer/ratio_tap_changer.py,sha256=lYGhjcanZBAA_wondpsvTY6jfTEX5jKminiV86ejuq8,1661
|
|
78
|
+
cimbuilder/object_builder/transformer/series_reactor_info.py,sha256=Y8lvqaBmZo1Kx-M6aoidQA8ydjx-5oxK9ML3Myyqtqw,4694
|
|
79
|
+
cimbuilder/object_builder/transformer/tap_changer.py,sha256=qaO0ESG35xQftRYsnshhPdYM9HXT40mrSxc7kQMl-qE,5377
|
|
80
|
+
cimbuilder/object_builder/transformer/tap_changer_control.py,sha256=SaoNvUF8JhgFbsbhI5fLhcnF_o2ddpRlv6UprfhVP0Q,3664
|
|
81
|
+
cimbuilder/object_builder/transformer/tap_changer_info.py,sha256=j9uy6Ij2uuX5c6_-f_WWHU_xChZM7SoYW7ymF60EIPA,4101
|
|
82
|
+
cimbuilder/object_builder/transformer/transformer_bank.py,sha256=xW1tBqevuNueMWKOXj2kxYDivg8nsOmsj6FnpYz3QbA,18961
|
|
83
|
+
cimbuilder/object_builder/transformer/transformer_tank_configuration.py,sha256=DWKvBGBlrObAKoPXTUhgThuAhcdp1xOVBneV8T4GKo0,16510
|
|
84
|
+
cimbuilder/object_builder/transformer/voltage_regulator.py,sha256=LVXuslAcTqR1omAgWmyyHDSL1iCH1reTI4DawgzOvrU,9155
|
|
85
|
+
cimbuilder/substation_builder/__init__.py,sha256=a6rqepyYoAoUYOGIJQT6gqYOSjdytTQk6MGpV298paU,980
|
|
86
|
+
cimbuilder/substation_builder/breaker_and_a_half.py,sha256=TUZkvMZDWXH2uCWxWc93mI61vQECokROkVjjqWNlZOU,3104
|
|
87
|
+
cimbuilder/substation_builder/double_bus_double_breaker.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
88
|
+
cimbuilder/substation_builder/double_bus_single_breaker.py,sha256=RP5IsEiUAik8f7l0SzOki_72X9i0YFL_CWWtQuQt9Ck,3089
|
|
89
|
+
cimbuilder/substation_builder/main_and_transfer.py,sha256=sp4N7Ommnjz7fA2V2sbhrIs4bkLPnpMrRsHFW7ahJ4k,2538
|
|
90
|
+
cimbuilder/substation_builder/ring_bus.py,sha256=dEGBpOmgp1OWRYS5Dil7lv5P_9dmoQaSYpDarGy_i0c,2344
|
|
91
|
+
cimbuilder/substation_builder/sectionalized_bus.py,sha256=y4LZ9ry82wko7WbV-UuoBn5d1QOGRzW95z9rdxYINLg,2178
|
|
92
|
+
cimbuilder/substation_builder/single_bus.py,sha256=mFV2f6Rn1WEIWLuEwYTkpNTADExm6_jCq0p58f4VJ3s,1427
|
|
93
|
+
cimbuilder/substation_builder/substation_builder.py,sha256=pDSLEmVD3FMg2gsi-FY1raUkNoMHQlojkSpdHqV4ukY,6892
|
|
94
|
+
cimbuilder/utils/__init__.py,sha256=p3UF0XwvOvYwDh1ns76-5Ws9PZMcKV_TGoqkcqWkA9M,118
|
|
95
|
+
cimbuilder/utils/catalog_parser.py,sha256=WDuY2manrHTVJEXuz-l9Nlr_aq6MUxTxtKq_Rms-iN0,1310
|
|
96
|
+
cimbuilder/utils/get_base_impedance.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
97
|
+
cimbuilder/utils/get_base_voltage.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
98
|
+
cimbuilder/utils/get_source_bus.py,sha256=Tiu437RSKHcN_vrHHtObOD5zPWqvJHw9RP6OQCrMPq4,1368
|
|
99
|
+
cim_builder-0.1.0a1.dist-info/METADATA,sha256=JxvsCYi2cOc4AjCp2zvms6lbi8bDIyDFBj8EWHU6BD8,3490
|
|
100
|
+
cim_builder-0.1.0a1.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
101
|
+
cim_builder-0.1.0a1.dist-info/licenses/LICENSE,sha256=ZAj043yV9iKU9AgjCU0lr9yWTHsq6aMkNh6WG_saHus,1501
|
|
102
|
+
cim_builder-0.1.0a1.dist-info/RECORD,,
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024, PNNL-CIM-Tools
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
9
|
+
list of conditions and the following disclaimer.
|
|
10
|
+
|
|
11
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
12
|
+
this list of conditions and the following disclaimer in the documentation
|
|
13
|
+
and/or other materials provided with the distribution.
|
|
14
|
+
|
|
15
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
16
|
+
contributors may be used to endorse or promote products derived from
|
|
17
|
+
this software without specific prior written permission.
|
|
18
|
+
|
|
19
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
20
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
21
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
22
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
23
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
24
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
25
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
26
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
27
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
28
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
cimbuilder/__init__.py
ADDED
|
File without changes
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import cimprofiles.cim18.cim18v17.connectivity_unbalanced as CN
|
|
2
|
+
import sys
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def sort_terminals_by_sequence(equipment: CN.ConductingEquipment):
|
|
6
|
+
terminals_by_sequence = {
|
|
7
|
+
terminal.sequenceNumber: terminal for terminal in equipment.Terminals
|
|
8
|
+
}
|
|
9
|
+
n = len(equipment.Terminals)
|
|
10
|
+
if set(terminals_by_sequence) != set(range(1, n + 1)):
|
|
11
|
+
raise ValueError(
|
|
12
|
+
f"{equipment.mRID!r}: existing terminals need continuous sequenceNumbers from 1 to {n}, "
|
|
13
|
+
f"got {[terminal.sequenceNumber for terminal in equipment.Terminals]}"
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
terminals = [terminals_by_sequence[i] for i in range(1, n + 1)]
|
|
17
|
+
return terminals
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def sort_terminals_by_node(
|
|
21
|
+
equipment: CN.ConductingEquipment,
|
|
22
|
+
node: str | CN.ConnectivityNode | CN.TopologicalNode,
|
|
23
|
+
) -> CN.Terminal | None:
|
|
24
|
+
"""Finds and returns the terminal of a piece of equipment connected to a specific node."""
|
|
25
|
+
|
|
26
|
+
# Extract the mRID string if an object was passed
|
|
27
|
+
if not isinstance(node, str):
|
|
28
|
+
if hasattr(node, "mRID"):
|
|
29
|
+
node = node.mRID # type:ignore
|
|
30
|
+
else:
|
|
31
|
+
raise TypeError(
|
|
32
|
+
f"{node} must be a string mRID, ConnectivityNode, or TopologicalNode"
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
# Find and return the matching terminal
|
|
36
|
+
for terminal in equipment.Terminals:
|
|
37
|
+
if (
|
|
38
|
+
terminal.ConnectivityNode is not None
|
|
39
|
+
and terminal.ConnectivityNode.mRID == node
|
|
40
|
+
):
|
|
41
|
+
return terminal
|
|
42
|
+
|
|
43
|
+
return None
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
def tap_steps_from_boost_buck(
|
|
2
|
+
number_of_taps: int, max_boost_pct: float, max_buck_pct: float
|
|
3
|
+
) -> tuple[int, int, float]:
|
|
4
|
+
"""
|
|
5
|
+
Converts a regulator's total tap count and +-range (CYME NumberOfTaps, MaximumBoost,
|
|
6
|
+
MaximumBuck; GDM total_taps, max_tap_pu, min_tap_pu converted to percent) into
|
|
7
|
+
TapChangerInfo's highStep/lowStep/stepVoltageIncrement.
|
|
8
|
+
|
|
9
|
+
Splits the taps evenly across boost and buck: 32 taps at +-10% -> (16, -16, 0.625).
|
|
10
|
+
Returns (highStep, lowStep, stepVoltageIncrement).
|
|
11
|
+
"""
|
|
12
|
+
if number_of_taps % 2 != 0:
|
|
13
|
+
raise ValueError(f"number_of_taps must be even (split across boost and buck), got {number_of_taps}")
|
|
14
|
+
half_taps = number_of_taps // 2
|
|
15
|
+
high_step = half_taps
|
|
16
|
+
low_step = -half_taps
|
|
17
|
+
step_voltage_increment = max_boost_pct / half_taps
|
|
18
|
+
if step_voltage_increment != max_buck_pct / half_taps:
|
|
19
|
+
raise ValueError(
|
|
20
|
+
f"boost {max_boost_pct}% and buck {max_buck_pct}% give different step sizes over "
|
|
21
|
+
f"{half_taps} steps each - this regulator is not symmetrical, pass highStep/lowStep/"
|
|
22
|
+
f"stepVoltageIncrement to TapChangerInfoBuilder directly instead"
|
|
23
|
+
)
|
|
24
|
+
return high_step, low_step, step_voltage_increment
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
"""
|
|
2
|
+
An aggregate feeder: one breaker, one aggregate load and aggregate behind-the-meter (BTM) and
|
|
3
|
+
front-of-the-meter (FTM) inverters standing in for a whole distribution feeder in a transmission
|
|
4
|
+
model, with the feeder-head measurements a UFLS study reads.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import cimprofiles.cim18.cim18v17 as cim
|
|
8
|
+
import cimprofiles.cim18.cim18v17.connectivity_unbalanced as CN
|
|
9
|
+
from cimgraph.models import GraphModel
|
|
10
|
+
from cimtables.units import Qty
|
|
11
|
+
|
|
12
|
+
from cimbuilder.object_builder import (
|
|
13
|
+
AnalogBuilder,
|
|
14
|
+
BreakerBuilder,
|
|
15
|
+
ConnectivityNodeBuilder,
|
|
16
|
+
DiscreteBuilder,
|
|
17
|
+
EnergyConsumerBuilder,
|
|
18
|
+
FeederBuilder,
|
|
19
|
+
PhotoVoltaicUnitBuilder,
|
|
20
|
+
PowerElectronicsConnectionBuilder,
|
|
21
|
+
PowerElectronicsWindUnitBuilder,
|
|
22
|
+
)
|
|
23
|
+
from cimbuilder.object_builder.measurement.analog import THREE_PHASE_ACTIVE_POWER
|
|
24
|
+
from cimbuilder.object_builder.measurement.discrete import switch_position
|
|
25
|
+
from cimbuilder.object_builder.measurement.measurement import (
|
|
26
|
+
MeasurementBuilder,
|
|
27
|
+
MeasurementKind,
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
mRID = str
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def new_aggregate_feeder(
|
|
34
|
+
network: GraphModel,
|
|
35
|
+
*,
|
|
36
|
+
mRID: str,
|
|
37
|
+
name: str | None = None,
|
|
38
|
+
breaker_name: str | None = None,
|
|
39
|
+
NormalEnergizingSubstation: mRID,
|
|
40
|
+
node: mRID,
|
|
41
|
+
BaseVoltage: mRID,
|
|
42
|
+
load_p: float | Qty = 0.0,
|
|
43
|
+
load_q: float | Qty = 0.0,
|
|
44
|
+
btm_pv_p: float | Qty = 0.0,
|
|
45
|
+
btm_wind_p: float | Qty = 0.0,
|
|
46
|
+
ftm_pv_p: float | Qty = 0.0,
|
|
47
|
+
ftm_wind_p: float | Qty = 0.0,
|
|
48
|
+
) -> tuple[CN.Feeder, CN.EnergyConsumer, CN.Breaker]:
|
|
49
|
+
"""
|
|
50
|
+
Adds an aggregate feeder below node, returning the Feeder, its aggregate load and head breaker.
|
|
51
|
+
Child mRIDs are prefixed by the feeder mRID, e.g. <mRID>_brk, <mRID>_load.
|
|
52
|
+
* mRID: string identifier of the Feeder
|
|
53
|
+
* name: human-readable name of the Feeder, used as prefix of the measurement names; default mRID
|
|
54
|
+
* breaker_name: human-readable name of the head breaker; default <name>_brk
|
|
55
|
+
* NormalEnergizingSubstation: mRID of the Substation feeding this feeder
|
|
56
|
+
* node: mRID of the existing substation ConnectivityNode the head breaker connects to
|
|
57
|
+
* BaseVoltage: mRID string of the BaseVoltage of the feeder
|
|
58
|
+
* load_p, load_q: total load, float in W/VAr or Qty('MW')/Qty('MVAr')
|
|
59
|
+
* btm_pv_p, btm_wind_p: total behind-the-meter PV and wind, float in W or Qty('MW')
|
|
60
|
+
* ftm_pv_p, ftm_wind_p: total front-of-the-meter PV and wind, float in W or Qty('MW')
|
|
61
|
+
"""
|
|
62
|
+
name = name or mRID
|
|
63
|
+
|
|
64
|
+
feeder_builder = FeederBuilder(network, network.container)
|
|
65
|
+
feeder: CN.Feeder = feeder_builder.create(mRID=mRID, name=name) # type: ignore
|
|
66
|
+
|
|
67
|
+
node_builder = ConnectivityNodeBuilder(network, feeder)
|
|
68
|
+
feeder_node = node_builder.create(mRID=f"{mRID}_node_1", name=f"{name}_node_1")
|
|
69
|
+
node_builder.add_connectivity(feeder_node, BaseVoltage=BaseVoltage) # type: ignore
|
|
70
|
+
|
|
71
|
+
breaker_builder = BreakerBuilder(network, feeder)
|
|
72
|
+
breaker: CN.Breaker = breaker_builder.create(
|
|
73
|
+
mRID=f"{mRID}_brk", name=breaker_name or f"{name}_brk"
|
|
74
|
+
) # type: ignore
|
|
75
|
+
_, breaker_terminals, _ = breaker_builder.add_connectivity(
|
|
76
|
+
breaker, node1=node, node2=feeder_node.mRID, BaseVoltage=BaseVoltage # type: ignore
|
|
77
|
+
)
|
|
78
|
+
head_terminal = breaker_terminals[1]
|
|
79
|
+
feeder_builder.add_connectivity(
|
|
80
|
+
feeder,
|
|
81
|
+
NormalEnergizingSubstation=NormalEnergizingSubstation,
|
|
82
|
+
NormalHeadTerminal=head_terminal.mRID,
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
load_builder = EnergyConsumerBuilder(network, feeder)
|
|
86
|
+
load: CN.EnergyConsumer = load_builder.create(mRID=f"{mRID}_load", name=f"{name}_aggr_load") # type: ignore
|
|
87
|
+
_, load_terminal, _ = load_builder.add_connectivity(
|
|
88
|
+
load, node=feeder_node.mRID, aggregate=True, BaseVoltage=BaseVoltage # type: ignore
|
|
89
|
+
)
|
|
90
|
+
load_builder.add_ssh(load, p=load_p, q=load_q)
|
|
91
|
+
|
|
92
|
+
btm_inverter, btm_terminal = _add_aggregate_inverter(
|
|
93
|
+
network, feeder, mRID=f"{mRID}_btm", name=f"{name}_aggr_btm", node=feeder_node.mRID,
|
|
94
|
+
BaseVoltage=BaseVoltage, pv_p=btm_pv_p, wind_p=btm_wind_p,
|
|
95
|
+
)
|
|
96
|
+
ftm_inverter, ftm_terminal = _add_aggregate_inverter(
|
|
97
|
+
network, feeder, mRID=f"{mRID}_ftm", name=f"{name}_aggr_ftm", node=feeder_node.mRID,
|
|
98
|
+
BaseVoltage=BaseVoltage, pv_p=ftm_pv_p, wind_p=ftm_wind_p,
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
# Feeder-head measurements, named as the GridAPPS-D UFLS application expects
|
|
102
|
+
discrete_builder = DiscreteBuilder(network, feeder)
|
|
103
|
+
analog_builder = AnalogBuilder(network, feeder)
|
|
104
|
+
_add_measurement(
|
|
105
|
+
discrete_builder, switch_position("XCBR"), mRID=f"{mRID}_brk_pos",
|
|
106
|
+
name=f"Pos_{name}", resource=breaker, terminal=head_terminal,
|
|
107
|
+
)
|
|
108
|
+
for suffix, label, resource, terminal in [
|
|
109
|
+
("net_load", "NetLoad(MW)", breaker, head_terminal),
|
|
110
|
+
("excess_generation", "ExcessGeneration(MW)", breaker, head_terminal),
|
|
111
|
+
("total_generation", "TotalGeneration(MW)", breaker, head_terminal),
|
|
112
|
+
("gross_load", "GrossLoad(MW)", load, load_terminal),
|
|
113
|
+
("btm_generation", "BTMGeneration(MW)", btm_inverter, btm_terminal),
|
|
114
|
+
("ftm_generation", "FTMGeneration(MW)", ftm_inverter, ftm_terminal),
|
|
115
|
+
]:
|
|
116
|
+
_add_measurement(
|
|
117
|
+
analog_builder, THREE_PHASE_ACTIVE_POWER, mRID=f"{mRID}_{suffix}",
|
|
118
|
+
name=f"{label}_{name}", resource=resource, terminal=terminal,
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
return feeder, load, breaker
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
def _add_aggregate_inverter(
|
|
125
|
+
network: GraphModel,
|
|
126
|
+
feeder: CN.Feeder,
|
|
127
|
+
*,
|
|
128
|
+
mRID: str,
|
|
129
|
+
name: str,
|
|
130
|
+
node: mRID,
|
|
131
|
+
BaseVoltage: mRID,
|
|
132
|
+
pv_p: float | Qty,
|
|
133
|
+
wind_p: float | Qty,
|
|
134
|
+
) -> tuple[CN.PowerElectronicsConnection, CN.Terminal]:
|
|
135
|
+
"""An aggregate inverter with a PV unit, and a wind unit if wind_p is not zero"""
|
|
136
|
+
inverter_builder = PowerElectronicsConnectionBuilder(network, feeder)
|
|
137
|
+
inverter: CN.PowerElectronicsConnection = inverter_builder.create(mRID=mRID, name=name) # type: ignore
|
|
138
|
+
_, terminal, _ = inverter_builder.add_connectivity(
|
|
139
|
+
inverter, node=node, aggregate=True, BaseVoltage=BaseVoltage
|
|
140
|
+
)
|
|
141
|
+
inverter_builder.add_ssh(inverter, p=_watts(pv_p) + _watts(wind_p), q=0.0)
|
|
142
|
+
|
|
143
|
+
pv_builder = PhotoVoltaicUnitBuilder(network, feeder)
|
|
144
|
+
pv_unit = pv_builder.create(mRID=f"{mRID}_pv", name=f"{name}_pv")
|
|
145
|
+
pv_builder.add_electrical(
|
|
146
|
+
pv_unit, minP=0.0, maxP=pv_p, aggregate=True, PowerElectronicsConnection=mRID # type: ignore
|
|
147
|
+
)
|
|
148
|
+
if _watts(wind_p) != 0:
|
|
149
|
+
wind_builder = PowerElectronicsWindUnitBuilder(network, feeder)
|
|
150
|
+
wind_unit = wind_builder.create(mRID=f"{mRID}_wind", name=f"{name}_wind")
|
|
151
|
+
wind_builder.add_electrical(
|
|
152
|
+
wind_unit, minP=0.0, maxP=wind_p, aggregate=True, PowerElectronicsConnection=mRID # type: ignore
|
|
153
|
+
)
|
|
154
|
+
return inverter, terminal
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
def _add_measurement(
|
|
158
|
+
builder: MeasurementBuilder,
|
|
159
|
+
kind: MeasurementKind,
|
|
160
|
+
*,
|
|
161
|
+
mRID: str,
|
|
162
|
+
name: str,
|
|
163
|
+
resource: CN.PowerSystemResource,
|
|
164
|
+
terminal: CN.Terminal,
|
|
165
|
+
) -> None:
|
|
166
|
+
"""One three-phase (ABC) measurement of kind, with the IEC 61850 name as description"""
|
|
167
|
+
measurement = builder.create(mRID=mRID, name=name, description=kind.iec61850_name(None))
|
|
168
|
+
builder.add_measurement(
|
|
169
|
+
measurement, # type: ignore
|
|
170
|
+
measurementType=kind.measurementType,
|
|
171
|
+
PowerSystemResource=resource.mRID,
|
|
172
|
+
Terminal=terminal.mRID,
|
|
173
|
+
phases="ABC",
|
|
174
|
+
unitSymbol=kind.unitSymbol,
|
|
175
|
+
)
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
def _watts(power: float | Qty) -> float:
|
|
179
|
+
"""power in W, a float is already W"""
|
|
180
|
+
if isinstance(power, Qty):
|
|
181
|
+
return float(cim.ActivePower(power.value, power.unit).to("W"))
|
|
182
|
+
return float(power)
|
cimbuilder/network.py
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"""The network shell every builder writes into, built from scratch with no source file."""
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
|
|
5
|
+
import cimprofiles.cim18.cim18v17 as cim
|
|
6
|
+
from cimgraph.core import set_model_scope
|
|
7
|
+
from cimgraph.core.env_vars import get_cim_profile
|
|
8
|
+
from cimgraph.models import FeederModel
|
|
9
|
+
from cimprofiles.identity import as_uuid, normalize_identifier, seeded_uuid
|
|
10
|
+
from cimtables import graph_write
|
|
11
|
+
from cimtables.units import Qty
|
|
12
|
+
|
|
13
|
+
from cimbuilder.object_builder.base import BaseFrequencyBuilder
|
|
14
|
+
|
|
15
|
+
mRID = str
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def rehash_mrid(class_name: str, token: str) -> str:
|
|
19
|
+
"""
|
|
20
|
+
Returns an mRID safe to use verbatim: a source GUID reseeded as a new UUID scoped to the
|
|
21
|
+
current Authority + Model + class, so the same GUID reused across source objects or models
|
|
22
|
+
does not collide. A non-GUID token (e.g. a DSS name) is returned unchanged, since Identity
|
|
23
|
+
seeds its UUID from the mRID anyway.
|
|
24
|
+
* class_name: the CIM class the mRID is for, e.g. "EnergyConsumer"
|
|
25
|
+
* token: the source key, e.g. a GDM uuid or any native identifier
|
|
26
|
+
"""
|
|
27
|
+
if as_uuid(token) is None:
|
|
28
|
+
return token
|
|
29
|
+
return str(seeded_uuid(class_name, mRID=normalize_identifier(token)))
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def new_feeder_model(
|
|
33
|
+
*,
|
|
34
|
+
authority: str,
|
|
35
|
+
model: str,
|
|
36
|
+
Feeder: mRID,
|
|
37
|
+
name: str | None = None,
|
|
38
|
+
frequency: float | Qty = 60,
|
|
39
|
+
) -> FeederModel:
|
|
40
|
+
"""
|
|
41
|
+
Creates an empty cim18v17 FeederModel, the same setup cimtables.load_model does for a .cimtbl file
|
|
42
|
+
* authority: model authority URI, seeds every UUID (e.g. https://github.com/NREL-Distribution-Suites/grid-data-models)
|
|
43
|
+
* model: model name, unique per model under the authority (e.g. the GDM system name)
|
|
44
|
+
* Feeder: mRID of the model's Feeder, e.g. fdr_<name>. With several feeders it is the graph's
|
|
45
|
+
container only, add the others with FeederBuilder and give each piece of equipment its own EquipmentContainer
|
|
46
|
+
* name: human-readable name of the Feeder
|
|
47
|
+
* frequency: system frequency of the BaseFrequency base_freq, float in Hz or Qty('Hz')
|
|
48
|
+
Sets the process-wide CIM profile and model scope, so call it before creating any object
|
|
49
|
+
"""
|
|
50
|
+
os.environ["CIMG_CIM_PROFILE"] = "cim18v17"
|
|
51
|
+
get_cim_profile.cache_clear()
|
|
52
|
+
set_model_scope(authority, model)
|
|
53
|
+
|
|
54
|
+
feeder = cim.Feeder(mRID=Feeder, name=name)
|
|
55
|
+
network = FeederModel(container=feeder, connection=None, distributed=False)
|
|
56
|
+
# FeederModel does not add its own container to the graph
|
|
57
|
+
graph_write.add_to_graph(network, feeder)
|
|
58
|
+
BaseFrequencyBuilder(network=network, container=feeder).create(
|
|
59
|
+
mRID="base_freq", frequency=frequency
|
|
60
|
+
)
|
|
61
|
+
return network
|