psr-factory 4.1.0b10__py3-none-win_amd64.whl → 4.1.0b12__py3-none-win_amd64.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.
Binary file
@@ -9,11 +9,12 @@ def get_case_path() -> str:
9
9
  return os.path.join(os.path.splitext(os.path.basename(__file__))[0], "")
10
10
 
11
11
 
12
- def create_sddp_sample_case01() -> psr.factory.Study:
12
+ def create_case01(legacy: bool) -> psr.factory.Study:
13
13
  blocks = 1
14
+ model = "SDDP" if not legacy else "SDDP17"
14
15
  # Create a study object and define its basic settings.
15
16
  study = psr.factory.create_study({
16
- "Models": ["SDDP", ], # Default model: SDDP
17
+ "Models": [model, ], # Default model: SDDP
17
18
  "Blocks": blocks, # Default number of blocks: 1
18
19
  "StageType": 2, # Weekly: 1 (default), Monthly: 2
19
20
  })
@@ -103,7 +104,7 @@ def create_sddp_sample_case01() -> psr.factory.Study:
103
104
  study.add(fuel2)
104
105
 
105
106
  # Create all thermal plants.
106
- plant1 = psr.factory.create("ThermalPlant", study.context)
107
+ plant1 = study.create("ThermalPlant")
107
108
  plant1.code = 1
108
109
  plant1.name = "Thermal 1"
109
110
  # Set plant's properties
@@ -124,11 +125,7 @@ def create_sddp_sample_case01() -> psr.factory.Study:
124
125
  "RefSystem": system,
125
126
  }
126
127
  plant1.from_dict(t_params)
127
- for i in range(5):
128
- pcopy = copy.copy(plant1)
129
- pcopy.code = i + 1
130
- study.add(pcopy)
131
-
128
+ study.add(plant1)
132
129
 
133
130
  # Use Python copy's module copy function to create
134
131
  # a copy of an object.
@@ -158,11 +155,10 @@ def create_sddp_sample_case01() -> psr.factory.Study:
158
155
 
159
156
 
160
157
  if __name__ == "__main__":
161
-
162
158
  case_path = get_case_path()
163
159
  os.makedirs(case_path, exist_ok=True)
164
160
  print("Creating example case... ", end="")
165
- study = create_sddp_sample_case01()
161
+ study = create_case01(False)
166
162
  print(" OK.")
167
163
  print("Saving example case in \"{}\"... ".format(case_path), end="")
168
164
  study.save(case_path)
@@ -0,0 +1,242 @@
1
+ """Creates SDDP 12 stages Case21 example."""
2
+ import copy
3
+ import os
4
+
5
+ import psr.factory
6
+
7
+
8
+ def get_case_path() -> str:
9
+ return os.path.join(os.path.splitext(os.path.basename(__file__))[0], "")
10
+
11
+
12
+ def create_case21(legacy: bool) -> psr.factory.Study:
13
+ # Create a study object and define its basic settings.
14
+ blocks = 1
15
+ model = "SDDP" if not legacy else "SDDP17"
16
+ # A context defines the dimensions of the study and the meaning of
17
+ # its stages. You can only share or copy data from one study to another
18
+ # if they share the same context.
19
+ context = psr.factory.get_new_context()
20
+ context.set("Models", [model, ]) # Default model: Sddp
21
+ context.set("Blocks", blocks) # Default number of blocks: 3
22
+ context.set("StageType", 2) # Weekly: 1, Monthly: 2 (default)
23
+
24
+ study = psr.factory.create_study(context)
25
+ study.set("Description", "SDDP")
26
+ study.set("InitialYear", 2016)
27
+ study.set("InitialStage", 1)
28
+ study.set("NumberOfStages", 12)
29
+ study.set("NumberOfSeries", 1)
30
+
31
+ # Study options
32
+ study.set("Type", 2)
33
+ study.set("InitialYearOfHydrology", 2016)
34
+ study.set("NumberOfSystems", 1)
35
+ study.set("AggregateInTheOperationPolicy", 1)
36
+ study.set("DeficitSegment", [100.0, 0.0, 0.0, 0.0])
37
+ study.set("DeficitCost", [1000.0, 0.0, 0.0, 0.0])
38
+ study.set("UMON", "$")
39
+
40
+ # Study duration
41
+ study.set("FixedDurationOfBlocks(1)", 100.0)
42
+
43
+ # By default, a study comes with one system.
44
+ system = study.get("System")[0]
45
+ system.code = 1
46
+ system.id = "s1"
47
+ system.name = "S1"
48
+ # System's currency
49
+ system.set("SystemCurrency", "$")
50
+ # It's not required to add an existing object to the study.
51
+
52
+ # Set study to run with this unique system
53
+ study.set("CodesOfPowerSystems", [1, ])
54
+
55
+ # Create a demand segment - it's required to add at least
56
+ # inelastic segment to a demand object.
57
+ segment = psr.factory.create("DemandSegment", context)
58
+ # Set demand and cost data.
59
+ segment.set_at("EnergyPerBlock(:)", "01/2016", 11.7)
60
+ segment.set_at("EnergyPerBlock(:)", "02/2016", 10.8)
61
+ segment.set_at("EnergyPerBlock(:)", "03/2016", 12.5)
62
+ segment.set_at("EnergyPerBlock(:)", "04/2016", 13.7)
63
+ segment.set_at("EnergyPerBlock(:)", "05/2016", 14.6)
64
+ segment.set_at("EnergyPerBlock(:)", "06/2016", 14.8)
65
+ segment.set_at("EnergyPerBlock(:)", "07/2016", 15.8)
66
+ segment.set_at("EnergyPerBlock(:)", "08/2016", 16.2)
67
+ segment.set_at("EnergyPerBlock(:)", "09/2016", 15.3)
68
+ segment.set_at("EnergyPerBlock(:)", "10/2016", 14.5)
69
+ segment.set_at("EnergyPerBlock(:)", "11/2016", 12.9)
70
+ segment.set_at("EnergyPerBlock(:)", "12/2016", 12.5)
71
+
72
+ segment.set_at("PricePerBlock(:)", "01/2016", 0.0)
73
+ # Add segment to the study.
74
+ study.add(segment)
75
+
76
+ # Create a system demand.
77
+ demand = psr.factory.create("Demand", context)
78
+ demand.code = 1
79
+ demand.name = "S1"
80
+ # Associate it with the only system in the case.
81
+ demand.set("RefSystem", system)
82
+ # Add segment to the demand.
83
+ demand.set("RefSegments", [segment, ])
84
+ # Add demand to the study.
85
+ study.add(demand)
86
+
87
+ # Create all fuels - Thermal plants requires them.
88
+ fuel1 = psr.factory.create("Fuel", context)
89
+ fuel1.code = 1
90
+ fuel1.name = "C1"
91
+ fuel1.set("Unit", "MWh")
92
+ fuel1.set("Price", 8.0)
93
+ fuel1.set("RefSystem", system)
94
+ study.add(fuel1)
95
+
96
+ fuel2 = psr.factory.create("Fuel", context)
97
+ fuel2.code = 2
98
+ fuel2.name = "C2"
99
+ fuel2.set("Unit", "MWh")
100
+ fuel2.set("Price", 12.0)
101
+ fuel2.set("RefSystem", system)
102
+ study.add(fuel2)
103
+
104
+ fuel3 = psr.factory.create("Fuel", context)
105
+ fuel3.code = 3
106
+ fuel3.name = "C3"
107
+ fuel3.set("Unit", "MWh")
108
+ fuel3.set("Price", 14.4)
109
+ fuel3.set("RefSystem", system)
110
+ study.add(fuel3)
111
+
112
+ # Create all thermal plants.
113
+ plant1 = psr.factory.create("ThermalPlant", context)
114
+ plant1.code = 1
115
+ plant1.name = "T1"
116
+ # Set plant's properties
117
+ plant1.set("MaximumGenerationCapacity", 12.0)
118
+ plant1.set("InstalledCapacity", 12.0)
119
+ plant1.set("ThermalType", 0) # Standard operation mode.
120
+ plant1.set("Type", 0) # It's an existing plant.
121
+ plant1.set("NumberOfGeneratingUnits", 1)
122
+ plant1.set("NumberOfAlternativeFuels", 0) # No alternative fuels
123
+ plant1.set("CodeOfAlternativeFuels(:)", 0)
124
+ plant1.set("O&MCost", 0.0)
125
+ plant1.set("FuelTransportationCost", 0.0)
126
+ plant1.set("SpecificConsumptionSegment(1)", 100.0)
127
+ plant1.set("SpecificConsumptionSegment(2:3)", 0.0)
128
+ plant1.set("SpecificConsumption(1:3,1)", 1.0)
129
+ plant1.set("Co2EmissionCoefficient", 1.0)
130
+ # It's required to associate a thermal plant to a fuel.
131
+ plant1.set("RefFuels", [fuel1, ])
132
+ plant1.set("RefSystem", system)
133
+ # These references are optional and can be set as None.
134
+ plant1.set("RefGasNode", None)
135
+ study.add(plant1)
136
+
137
+ plant2 = psr.factory.create("ThermalPlant", context)
138
+ plant2.code = 2
139
+ plant2.name = "T2"
140
+ plant2.set("MaximumGenerationCapacity", 8.0)
141
+ plant2.set("InstalledCapacity", 8.0)
142
+ plant2.set("ThermalType", 0)
143
+ plant2.set("Type", 0)
144
+ plant2.set("NumberOfGeneratingUnits", 1)
145
+ plant2.set("NumberOfAlternativeFuels", 0)
146
+ plant2.set("CodeOfAlternativeFuels(:)", 0)
147
+ plant2.set("O&MCost", 0.0)
148
+ plant2.set("FuelTransportationCost", 0.0)
149
+ plant2.set("SpecificConsumptionSegment(1)", 100.0)
150
+ plant2.set("SpecificConsumptionSegment(2:3)", 0.0)
151
+ plant2.set("SpecificConsumption(1:3,1)", 1.0)
152
+ plant2.set("Co2EmissionCoefficient", 1.0)
153
+ plant2.set("RefFuels", [fuel2, ])
154
+ plant2.set("RefSystem", system)
155
+ study.add(plant2)
156
+
157
+ plant3 = plant2.clone()
158
+ plant3.code = 3
159
+ plant3.name = "T3"
160
+ plant3.set("MaximumGenerationCapacity", 4.0)
161
+ plant3.set("InstalledCapacity", 4.0)
162
+ plant3.set("RefFuels", [fuel3, ])
163
+ plant3.set("RefSystem", system)
164
+ study.add(plant3)
165
+
166
+ # Define gauging station for hydro plants inflows
167
+ station1 = psr.factory.create("HydroStation", context)
168
+ station1.code = 1
169
+ station1.name = "Estacion 1"
170
+
171
+ station2 = psr.factory.create("HydroStation", context)
172
+ station2.code = 2
173
+ station2.name = "Estacion 2"
174
+
175
+ for year in (2014, 2015, 2016):
176
+ station1.set_at("Inflow", f"01/{year}", 13.5)
177
+ station1.set_at("Inflow", f"02/{year}", 40.7)
178
+ station1.set_at("Inflow", f"03/{year}", 28.8)
179
+ station1.set_at("Inflow", f"04/{year}", 25.6)
180
+ station1.set_at("Inflow", f"05/{year}", 23.8)
181
+ station1.set_at("Inflow", f"06/{year}", 27.8)
182
+ station1.set_at("Inflow", f"07/{year}", 28.8)
183
+ station1.set_at("Inflow", f"08/{year}", 18.8)
184
+ station1.set_at("Inflow", f"09/{year}", 18.2)
185
+ station1.set_at("Inflow", f"10/{year}", 29.6)
186
+ station1.set_at("Inflow", f"11/{year}", 17.7)
187
+ station1.set_at("Inflow", f"12/{year}", 26.3)
188
+
189
+ for month in range(1, 12 + 1):
190
+ station2.set_at("Vazao", f"{month:02d}/{year}", 0.0)
191
+
192
+ study.add(station1)
193
+ study.add(station2)
194
+
195
+ # Define hydroplants
196
+ hydro1 = psr.factory.create("HydroPlant", context)
197
+ hydro1.code = 1
198
+ hydro1.name = "H1"
199
+ hydro1.set("Type", 0)
200
+ hydro1.set("NumberOfUnits", 1)
201
+ hydro1.set("InstalledCapacity", 5.5)
202
+ hydro1.set("MaximumTurbinedOutflow", 55.0)
203
+ hydro1.set("MeanProductionCoefficient", 0.1)
204
+ hydro1.set("MinimumStorage", 0.0)
205
+ hydro1.set("MaximumStorage", 50.0)
206
+ hydro1.set("InitialCondition", 0.2)
207
+ hydro1.set("RefSystem", system)
208
+ hydro1.set("RefStation", station1)
209
+ study.add(hydro1)
210
+
211
+ hydro2 = hydro1.clone()
212
+ hydro2.code = 2
213
+ hydro2.name = "H2"
214
+ hydro2.set("MaximumStorage", 0.0)
215
+ hydro2.set("InitialCondition", 1.0)
216
+ hydro2.set("RefSystem", system)
217
+ hydro2.set("RefStation", station2)
218
+ study.add(hydro2)
219
+
220
+ # Connect hydro plants
221
+ connection_spill = psr.factory.create("HydroPlantConnection", context)
222
+ connection_spill.set("IsVertimento", 1)
223
+ connection_spill.set("RefPlants", [hydro1, hydro2])
224
+ study.add(connection_spill)
225
+
226
+ connection_turb = psr.factory.create("HydroPlantConnection", context)
227
+ connection_turb.set("IsTurbinamento", 1)
228
+ connection_turb.set("RefPlants", [hydro1, hydro2])
229
+ study.add(connection_turb)
230
+
231
+ return study
232
+
233
+
234
+ if __name__ == "__main__":
235
+ case_path = get_case_path()
236
+ os.makedirs(case_path, exist_ok=True)
237
+ print("Creating example case... ", end="")
238
+ study = create_case21(False)
239
+ print(" OK.")
240
+ print("Saving example case in \"{}\"... ".format(case_path), end="")
241
+ study.save(case_path)
242
+ print(" OK.")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: psr-factory
3
- Version: 4.1.0b10
3
+ Version: 4.1.0b12
4
4
  Summary: PSR database management module.
5
5
  Author-email: "PSR Inc." <psrfactory@psr-inc.com>
6
6
  License-Expression: MIT
@@ -24,7 +24,7 @@ Description-Content-Type: text/markdown
24
24
  License-File: LICENSE.txt
25
25
  Dynamic: license-file
26
26
 
27
- PSR Factory (version 4.1.0b10)
27
+ PSR Factory (version 4.1.0b12)
28
28
  ============================
29
29
 
30
30
  Factory is a library that helps to manage SDDP cases.
@@ -45,7 +45,7 @@ pip install psr-factory
45
45
  Or, if the package directly from the wheel (whl) file:
46
46
 
47
47
  ```bash
48
- pip install psr_factory-4.1.0b10-py3-none-win_amd64.whl
48
+ pip install psr_factory-4.1.0b12-py3-none-win_amd64.whl
49
49
  ```
50
50
 
51
51
  Factory will be available to all Python scripts in your system after importing it:
@@ -2,24 +2,25 @@ psr/apps/__init__.py,sha256=frSq1WIy5vIdU21xJIGX7U3XoAZRj0pcQmFb-R00b7I,228
2
2
  psr/apps/apps.py,sha256=8jVxTFZ73KFk_PbY-8rZDD8HBONdCjt-jzsDJyu2P50,6921
3
3
  psr/apps/version.py,sha256=vs459L6JsatAkUxna7BNG-vMCaXpO1Ye8c1bmkEx4U4,194
4
4
  psr/cloud/__init__.py,sha256=inZMwG7O9Fca9hg1BhqYObOYtTTJOkpuTIuXnkHJZkI,246
5
- psr/cloud/cloud.py,sha256=ZP2gRmm2OzreWE6xvp7pDpceYeU_X8-DusH34M6xTx0,43669
6
- psr/cloud/data.py,sha256=3zWh1qnBNFfI8K3N8jZKqDnzHWMQ5llc_wwGMZ4FtKs,3548
5
+ psr/cloud/cloud.py,sha256=XOtTr6AoxZSNrWXzvM3Ia2BfMjThLn3FVF_7LM4BtME,57585
6
+ psr/cloud/data.py,sha256=nQVpCZhHlHI0HOpqsNhBpotLO37ha5Fl9txWABDnFwQ,4008
7
7
  psr/cloud/desktop.py,sha256=JFroCMEFV1Nz3has74n7OVrGCg2lS7Ev5bcjdw2hRxY,2980
8
8
  psr/cloud/log.py,sha256=Dvhz1enIWlFWeaRK7JAAuZVPfODgoEIRNcHEmbEliyQ,1366
9
9
  psr/cloud/status.py,sha256=vcI4B9S6wCt9maT5NNrVwYaEgGIvy6kkC1UVpJjYbtw,3607
10
10
  psr/cloud/tempfile.py,sha256=1IOeye0eKWnmBynK5K5FMWiTaEVhn4GbQ8_y0THEva0,3893
11
11
  psr/cloud/version.py,sha256=RG2RB_TfKD_2sF3BR3PpbFPEmlXkWUJOgqpsnMmcVsc,192
12
- psr/cloud/xml.py,sha256=dmBh4iRieORCctm1obz1EGA2QN-KkZlH5_dQfBud-AI,1847
13
- psr/factory/__init__.py,sha256=3IuHvbSNQtfVOkCgi4Dh3YrbBpgn5OH8-mrH4JU5l0s,219
14
- psr/factory/api.py,sha256=StGPIDNkWcDLIlbwAm9arok3netOqr1fFXZNeX1GNUA,98497
15
- psr/factory/factory.dll,sha256=qiwYjYrm1_klZ7N3XTDeW-FBQWh5bXsKxt9mVR0aw-o,12964120
16
- psr/factory/factory.pmd,sha256=Fe1cedVdYb6h8hEJTC0u1qz53JmZnTIOK1GmJuUNo2g,230965
17
- psr/factory/factory.pmk,sha256=zYyK8QEMa-J2r_kvYuRiqVzGLqMAiav_DP6h7-2wtX8,570074
12
+ psr/cloud/xml.py,sha256=ac2lyflOQm8khPvJn0zmI26I4sfUDY6A_OTsxzbMQEs,1896
13
+ psr/factory/__init__.py,sha256=HNNVl6Rl2MZnfodAZFBM6ZH7qOVD9vrpQNpom_cXALM,219
14
+ psr/factory/api.py,sha256=N5153ZJmZjzLQ0AvRZnSlTu6UmHBQqbYw0UQ69sZHkE,98705
15
+ psr/factory/factory.dll,sha256=Xi0W6KyNvWhLfbaZziLOjnLxG7wgGg7LFZZ0PEcWEUA,12969744
16
+ psr/factory/factory.pmd,sha256=BntBOXSJ1Uf2rZ9HIM-yaHT1F9erAm8zOxHYssUCZCo,242440
17
+ psr/factory/factory.pmk,sha256=3xDhU0fpUz6dSn29E8GkXEmCOSadnq7cJPcNPbEyFfI,579203
18
18
  psr/factory/factorylib.py,sha256=xnhCFTo4DpU0e5oHtIWMmc-kk6ThtNAUI3cxpDXrBKE,27497
19
- psr/factory/libcurl-x64.dll,sha256=6MVf69XKZf-LWdjiCj9rv_bykkU9uSxA4BUC8uRBk1g,5317904
19
+ psr/factory/libcurl-x64.dll,sha256=smw29I-r8m5zrvILQqP_T3HY2m67YBW8k6duQvbV0mA,5317904
20
20
  psr/factory/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
21
21
  psr/factory/samples/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
22
- psr/factory/samples/sddp_1_stage_case01.py,sha256=7-HsTZLISQXWyez-MAi6U6cw-83-fj223C-ci54jfi0,5109
22
+ psr/factory/samples/sddp_case01.py,sha256=jo71p9NN7dtRqMT76TEbD4S4Lut7p4ejbpu6SoSwg0Y,5034
23
+ psr/factory/samples/sddp_case21.py,sha256=-9Wk2ntjIC1-PrQDXDcnWUjV0OF9Xi_IREFb2pUWSi4,8797
23
24
  psr/factory/samples/sddp_sample_case01.py,sha256=49C7w86EQT5IuguaNvt7mz7OqbVRhov5c3zb7_l12FE,4994
24
25
  psr/factory/samples/sddp_sample_case21.py,sha256=La9I6PcyEUCXDJMB0Mtn98Pl2V0RGPMEHAhGpboPvU8,8757
25
26
  psr/psrfcommon/__init__.py,sha256=WXR560XQllIjtFpWd0jiJEbUAQIyh5-6lwj-42_J95c,200
@@ -28,8 +29,8 @@ psr/psrfcommon/tempfile.py,sha256=5S13wa2DCLYTUdwbLm_KMBRnDRJ0WDlu8GO2BmZoNdg,39
28
29
  psr/runner/__init__.py,sha256=kI9HDX-B_LMQJUHHylFHas2rNpWfNNa0pZXoIvX_Alw,230
29
30
  psr/runner/runner.py,sha256=xmo8YtrVvR4wzTHmnEeWxZzBQb9oRgg3bK_sPAGBcko,26599
30
31
  psr/runner/version.py,sha256=mch2Y8anSXGMn9w72Z78PhSRhOyn55EwaoLAYhY4McE,194
31
- psr_factory-4.1.0b10.dist-info/licenses/LICENSE.txt,sha256=N6mqZK2Ft3iXGHj-by_MHC_dJo9qwn0URjakEPys3H4,1089
32
- psr_factory-4.1.0b10.dist-info/METADATA,sha256=J6xav8iS4WuFmukp5fvEaxPoUYWZshxodXwpR8THzM4,2429
33
- psr_factory-4.1.0b10.dist-info/WHEEL,sha256=ZjXRCNaQ9YSypEK2TE0LRB0sy2OVXSszb4Sx1XjM99k,97
34
- psr_factory-4.1.0b10.dist-info/top_level.txt,sha256=Jb393O96WQk3b5D1gMcrZBLKJJgZpzNjTPoldUi00ck,4
35
- psr_factory-4.1.0b10.dist-info/RECORD,,
32
+ psr_factory-4.1.0b12.dist-info/licenses/LICENSE.txt,sha256=N6mqZK2Ft3iXGHj-by_MHC_dJo9qwn0URjakEPys3H4,1089
33
+ psr_factory-4.1.0b12.dist-info/METADATA,sha256=T9n8MRvmsZH5CUY9htEmNEL4iEupy9QoRkuyQmBwS4g,2429
34
+ psr_factory-4.1.0b12.dist-info/WHEEL,sha256=ZjXRCNaQ9YSypEK2TE0LRB0sy2OVXSszb4Sx1XjM99k,97
35
+ psr_factory-4.1.0b12.dist-info/top_level.txt,sha256=Jb393O96WQk3b5D1gMcrZBLKJJgZpzNjTPoldUi00ck,4
36
+ psr_factory-4.1.0b12.dist-info/RECORD,,