psr-factory 5.0.0b1__py3-none-win_amd64.whl → 5.0.0b3__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.
- psr/cloud/aws.py +256 -0
- psr/cloud/cloud.py +45 -14
- psr/cloud/data.py +18 -1
- psr/cloud/version.py +1 -1
- psr/cloud/xml.py +2 -0
- psr/factory/__init__.py +1 -1
- psr/factory/factory.dll +0 -0
- psr/factory/factory.pmd +159 -39
- psr/factory/factory.pmk +34 -52
- psr/factory/libcurl-x64.dll +0 -0
- psr/factory/samples/sddp_sample_case01.py +164 -0
- psr/factory/samples/sddp_sample_case21.py +241 -0
- psr/runner/runner.py +30 -30
- {psr_factory-5.0.0b1.dist-info → psr_factory-5.0.0b3.dist-info}/METADATA +8 -3
- {psr_factory-5.0.0b1.dist-info → psr_factory-5.0.0b3.dist-info}/RECORD +18 -15
- {psr_factory-5.0.0b1.dist-info → psr_factory-5.0.0b3.dist-info}/WHEEL +0 -0
- {psr_factory-5.0.0b1.dist-info → psr_factory-5.0.0b3.dist-info}/licenses/LICENSE.txt +0 -0
- {psr_factory-5.0.0b1.dist-info → psr_factory-5.0.0b3.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,164 @@
|
|
1
|
+
"""Creates SDDP 1 stage Case01 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_sddp_sample_case01() -> psr.factory.Study:
|
13
|
+
blocks = 1
|
14
|
+
# Create a study object and define its basic settings.
|
15
|
+
study = psr.factory.create_study({
|
16
|
+
"Models": ["SDDP", ], # Default model: SDDP
|
17
|
+
"Blocks": blocks, # Default number of blocks: 1
|
18
|
+
"StageType": 2, # Weekly: 1 (default), Monthly: 2
|
19
|
+
})
|
20
|
+
study.from_dict({
|
21
|
+
"Description": "Caso ejemplo - DT - 1 etapa - 1 bloque",
|
22
|
+
"InitialYear": 2013,
|
23
|
+
"InitialStage": 1,
|
24
|
+
"NumberOfStages": 1,
|
25
|
+
"NumberOfSeries": 1,
|
26
|
+
})
|
27
|
+
|
28
|
+
# Study options
|
29
|
+
study.from_dict({
|
30
|
+
"Type": 2,
|
31
|
+
"InitialYearOfHydrology": 1996,
|
32
|
+
"NumberOfSystems": 1,
|
33
|
+
"AggregateInTheOperationPolicy": 0,
|
34
|
+
"UMON": "$",
|
35
|
+
"LoadSheddingInBuses": 0,
|
36
|
+
"MonitoringOfCircuitLimits": 0,
|
37
|
+
"HourlyRepresentation": 0,
|
38
|
+
"MaximumNumberOfIterations": 10,
|
39
|
+
"MinimumOutflowPenaltyHm3": 5000.0,
|
40
|
+
"DeficitSegment": [100.0, 0.0, 0.0, 0.0],
|
41
|
+
"DeficitCost": [500.0, 0.0, 0.0, 0.0],
|
42
|
+
"FutureCostStage": 4,
|
43
|
+
"FutureCostYear": 1998,
|
44
|
+
})
|
45
|
+
|
46
|
+
# Study duration
|
47
|
+
study.set("FixedDurationOfBlocks(1)", 100.0)
|
48
|
+
|
49
|
+
# By default, a study comes with one system.
|
50
|
+
system = study.get("System")[0]
|
51
|
+
system.code = 1
|
52
|
+
system.id = "s1"
|
53
|
+
system.name = "System 1"
|
54
|
+
# System's currency
|
55
|
+
system.set("SystemCurrency", "$")
|
56
|
+
# It's not required to add an existing object to the study.
|
57
|
+
|
58
|
+
# Set study to run with this unique system
|
59
|
+
study.set("CodesOfPowerSystems", [1, ])
|
60
|
+
|
61
|
+
# Create a demand segment - it's required to add at least
|
62
|
+
# an inelastic segment to a demand object.
|
63
|
+
segment = psr.factory.create("DemandSegment", study.context)
|
64
|
+
# Set demand and cost data.
|
65
|
+
segment.set_at("EnergyPerBlock(:)", "01/2013", 8.928)
|
66
|
+
# Add segment to the study.
|
67
|
+
study.add(segment)
|
68
|
+
|
69
|
+
# Create a system demand.
|
70
|
+
demand = psr.factory.create("Demand", study.context)
|
71
|
+
demand.code = 1
|
72
|
+
demand.name = "System 1"
|
73
|
+
# Associate it with the only system in the case.
|
74
|
+
demand.set("RefSystem", system)
|
75
|
+
# Associate the demand with its segments.
|
76
|
+
demand.set("RefSegments", [segment, ])
|
77
|
+
# Add demand to the study.
|
78
|
+
study.add(demand)
|
79
|
+
|
80
|
+
# Create all fuels - Thermal plants requires then.
|
81
|
+
fuel1 = psr.factory.create("Fuel", study.context)
|
82
|
+
fuel1.code = 1
|
83
|
+
fuel1.name = "Fuel 1"
|
84
|
+
fuel1.from_dict({
|
85
|
+
"Unit": "UC",
|
86
|
+
"UE": "MWh",
|
87
|
+
"Price": 0.8,
|
88
|
+
"EmissionFactor": 0.0,
|
89
|
+
"RefSystem": system,
|
90
|
+
})
|
91
|
+
study.add(fuel1)
|
92
|
+
|
93
|
+
fuel2 = psr.factory.create("Fuel", study.context)
|
94
|
+
fuel2.code = 2
|
95
|
+
fuel2.name = "Fuel 2"
|
96
|
+
fuel2.from_dict({
|
97
|
+
"Unit": "UC",
|
98
|
+
"UE": "MWh",
|
99
|
+
"Price": 1.2,
|
100
|
+
"EmissionFactor": 0.0,
|
101
|
+
"RefSystem": system,
|
102
|
+
})
|
103
|
+
study.add(fuel2)
|
104
|
+
|
105
|
+
# Create all thermal plants.
|
106
|
+
plant1 = psr.factory.create("ThermalPlant", study.context)
|
107
|
+
plant1.code = 1
|
108
|
+
plant1.name = "Thermal 1"
|
109
|
+
# Set plant's properties
|
110
|
+
t_params = {
|
111
|
+
"MaximumGenerationCapacity": 10.0,
|
112
|
+
"InstalledCapacity": 10.0,
|
113
|
+
"ThermalType": 0,
|
114
|
+
"Type": 0,
|
115
|
+
"NumberOfGeneratingUnits": 1,
|
116
|
+
"NumberOfAlternativeFuels": 0,
|
117
|
+
"CodeOfAlternativeFuels(:)": 0,
|
118
|
+
"O&MCost": 0.0,
|
119
|
+
"FuelTransportationCost": 0.0,
|
120
|
+
"SpecificConsumptionSegment(1)": 100.0,
|
121
|
+
"SpecificConsumptionSegment(2:3)": 0.0,
|
122
|
+
"SpecificConsumption(1:3,1)": 10.0,
|
123
|
+
"RefFuels": [fuel1, ],
|
124
|
+
"RefSystem": system,
|
125
|
+
}
|
126
|
+
plant1.from_dict(t_params)
|
127
|
+
|
128
|
+
# Use Python copy's module copy function to create
|
129
|
+
# a copy of an object.
|
130
|
+
plant2 = copy.copy(plant1)
|
131
|
+
plant2.code = 2
|
132
|
+
plant2.name = "Thermal 2"
|
133
|
+
plant2.set("MaximumGenerationCapacity", 5.0)
|
134
|
+
plant2.set("InstalledCapacity", 5.0)
|
135
|
+
plant2.set("SpecificConsumption(1:3,1)", 15.0)
|
136
|
+
plant2.set("RefFuels", [fuel1, ])
|
137
|
+
plant2.set("RefSystem", system)
|
138
|
+
study.add(plant2)
|
139
|
+
|
140
|
+
plant3 = plant2.clone()
|
141
|
+
plant3.code = 3
|
142
|
+
plant3.name = "Thermal 3"
|
143
|
+
plant3.from_dict({
|
144
|
+
"MaximumGenerationCapacity": 20.0,
|
145
|
+
"InstalledCapacity": 20.0,
|
146
|
+
"SpecificConsumption(1:3,1)": 12.5,
|
147
|
+
"RefFuels": [fuel2, ],
|
148
|
+
"RefSystem": system,
|
149
|
+
})
|
150
|
+
study.add(plant3)
|
151
|
+
|
152
|
+
return study
|
153
|
+
|
154
|
+
|
155
|
+
if __name__ == "__main__":
|
156
|
+
|
157
|
+
case_path = get_case_path()
|
158
|
+
os.makedirs(case_path, exist_ok=True)
|
159
|
+
print("Creating example case... ", end="")
|
160
|
+
study = create_sddp_sample_case01()
|
161
|
+
print(" OK.")
|
162
|
+
print("Saving example case in \"{}\"... ".format(case_path), end="")
|
163
|
+
study.save(case_path)
|
164
|
+
print(" OK.")
|
@@ -0,0 +1,241 @@
|
|
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_sddp_sample_case21() -> psr.factory.Study:
|
13
|
+
# Create a study object and define its basic settings.
|
14
|
+
blocks = 1
|
15
|
+
# A context defines the dimensions of the study and the meaning of
|
16
|
+
# its stages. You can only share or copy data from one study to another
|
17
|
+
# if they share the same context.
|
18
|
+
context = psr.factory.get_new_context()
|
19
|
+
context.set("Models", ["SDDP", ]) # Default model: Sddp
|
20
|
+
context.set("Blocks", blocks) # Default number of blocks: 3
|
21
|
+
context.set("StageType", 2) # Weekly: 1, Monthly: 2 (default)
|
22
|
+
|
23
|
+
study = psr.factory.create_study(context)
|
24
|
+
study.set("Description", "SDDP")
|
25
|
+
study.set("InitialYear", 2016)
|
26
|
+
study.set("InitialStage", 1)
|
27
|
+
study.set("NumberOfStages", 12)
|
28
|
+
study.set("NumberOfSeries", 1)
|
29
|
+
|
30
|
+
# Study options
|
31
|
+
study.set("Type", 2)
|
32
|
+
study.set("InitialYearOfHydrology", 2016)
|
33
|
+
study.set("NumberOfSystems", 1)
|
34
|
+
study.set("AggregateInTheOperationPolicy", 1)
|
35
|
+
study.set("DeficitSegment", [100.0, 0.0, 0.0, 0.0])
|
36
|
+
study.set("DeficitCost", [1000.0, 0.0, 0.0, 0.0])
|
37
|
+
study.set("UMON", "$")
|
38
|
+
|
39
|
+
# Study duration
|
40
|
+
study.set("FixedDurationOfBlocks(1)", 100.0)
|
41
|
+
|
42
|
+
# By default, a study comes with one system.
|
43
|
+
system = study.get("System")[0]
|
44
|
+
system.code = 1
|
45
|
+
system.id = "s1"
|
46
|
+
system.name = "S1"
|
47
|
+
# System's currency
|
48
|
+
system.set("SystemCurrency", "$")
|
49
|
+
# It's not required to add an existing object to the study.
|
50
|
+
|
51
|
+
# Set study to run with this unique system
|
52
|
+
study.set("CodesOfPowerSystems", [1, ])
|
53
|
+
|
54
|
+
# Create a demand segment - it's required to add at least
|
55
|
+
# inelastic segment to a demand object.
|
56
|
+
segment = psr.factory.create("DemandSegment", context)
|
57
|
+
# Set demand and cost data.
|
58
|
+
segment.set_at("EnergyPerBlock(:)", "01/2016", 11.7)
|
59
|
+
segment.set_at("EnergyPerBlock(:)", "02/2016", 10.8)
|
60
|
+
segment.set_at("EnergyPerBlock(:)", "03/2016", 12.5)
|
61
|
+
segment.set_at("EnergyPerBlock(:)", "04/2016", 13.7)
|
62
|
+
segment.set_at("EnergyPerBlock(:)", "05/2016", 14.6)
|
63
|
+
segment.set_at("EnergyPerBlock(:)", "06/2016", 14.8)
|
64
|
+
segment.set_at("EnergyPerBlock(:)", "07/2016", 15.8)
|
65
|
+
segment.set_at("EnergyPerBlock(:)", "08/2016", 16.2)
|
66
|
+
segment.set_at("EnergyPerBlock(:)", "09/2016", 15.3)
|
67
|
+
segment.set_at("EnergyPerBlock(:)", "10/2016", 14.5)
|
68
|
+
segment.set_at("EnergyPerBlock(:)", "11/2016", 12.9)
|
69
|
+
segment.set_at("EnergyPerBlock(:)", "12/2016", 12.5)
|
70
|
+
|
71
|
+
segment.set_at("PricePerBlock(:)", "01/2016", 0.0)
|
72
|
+
# Add segment to the study.
|
73
|
+
study.add(segment)
|
74
|
+
|
75
|
+
# Create a system demand.
|
76
|
+
demand = psr.factory.create("Demand", context)
|
77
|
+
demand.code = 1
|
78
|
+
demand.name = "S1"
|
79
|
+
# Associate it with the only system in the case.
|
80
|
+
demand.set("RefSystem", system)
|
81
|
+
# Add segment to the demand.
|
82
|
+
demand.set("RefSegments", [segment, ])
|
83
|
+
# Add demand to the study.
|
84
|
+
study.add(demand)
|
85
|
+
|
86
|
+
# Create all fuels - Thermal plants requires them.
|
87
|
+
fuel1 = psr.factory.create("Fuel", context)
|
88
|
+
fuel1.code = 1
|
89
|
+
fuel1.name = "C1"
|
90
|
+
fuel1.set("Unit", "MWh")
|
91
|
+
fuel1.set("Price", 8.0)
|
92
|
+
fuel1.set("RefSystem", system)
|
93
|
+
study.add(fuel1)
|
94
|
+
|
95
|
+
fuel2 = psr.factory.create("Fuel", context)
|
96
|
+
fuel2.code = 2
|
97
|
+
fuel2.name = "C2"
|
98
|
+
fuel2.set("Unit", "MWh")
|
99
|
+
fuel2.set("Price", 12.0)
|
100
|
+
fuel2.set("RefSystem", system)
|
101
|
+
study.add(fuel2)
|
102
|
+
|
103
|
+
fuel3 = psr.factory.create("Fuel", context)
|
104
|
+
fuel3.code = 3
|
105
|
+
fuel3.name = "C3"
|
106
|
+
fuel3.set("Unit", "MWh")
|
107
|
+
fuel3.set("Price", 14.4)
|
108
|
+
fuel3.set("RefSystem", system)
|
109
|
+
study.add(fuel3)
|
110
|
+
|
111
|
+
# Create all thermal plants.
|
112
|
+
plant1 = psr.factory.create("ThermalPlant", context)
|
113
|
+
plant1.code = 1
|
114
|
+
plant1.name = "T1"
|
115
|
+
# Set plant's properties
|
116
|
+
plant1.set("MaximumGenerationCapacity", 12.0)
|
117
|
+
plant1.set("InstalledCapacity", 12.0)
|
118
|
+
plant1.set("ThermalType", 0) # Standard operation mode.
|
119
|
+
plant1.set("Type", 0) # It's an existing plant.
|
120
|
+
plant1.set("NumberOfGeneratingUnits", 1)
|
121
|
+
plant1.set("NumberOfAlternativeFuels", 0) # No alternative fuels
|
122
|
+
plant1.set("CodeOfAlternativeFuels(:)", 0)
|
123
|
+
plant1.set("O&MCost", 0.0)
|
124
|
+
plant1.set("FuelTransportationCost", 0.0)
|
125
|
+
plant1.set("SpecificConsumptionSegment(1)", 100.0)
|
126
|
+
plant1.set("SpecificConsumptionSegment(2:3)", 0.0)
|
127
|
+
plant1.set("SpecificConsumption(1:3,1)", 1.0)
|
128
|
+
plant1.set("Co2EmissionCoefficient", 1.0)
|
129
|
+
# It's required to associate a thermal plant to a fuel.
|
130
|
+
plant1.set("RefFuels", [fuel1, ])
|
131
|
+
plant1.set("RefSystem", system)
|
132
|
+
# These references are optional and can be set as None.
|
133
|
+
plant1.set("RefGasNode", None)
|
134
|
+
study.add(plant1)
|
135
|
+
|
136
|
+
plant2 = psr.factory.create("ThermalPlant", context)
|
137
|
+
plant2.code = 2
|
138
|
+
plant2.name = "T2"
|
139
|
+
plant2.set("MaximumGenerationCapacity", 8.0)
|
140
|
+
plant2.set("InstalledCapacity", 8.0)
|
141
|
+
plant2.set("ThermalType", 0)
|
142
|
+
plant2.set("Type", 0)
|
143
|
+
plant2.set("NumberOfGeneratingUnits", 1)
|
144
|
+
plant2.set("NumberOfAlternativeFuels", 0)
|
145
|
+
plant2.set("CodeOfAlternativeFuels(:)", 0)
|
146
|
+
plant2.set("O&MCost", 0.0)
|
147
|
+
plant2.set("FuelTransportationCost", 0.0)
|
148
|
+
plant2.set("SpecificConsumptionSegment(1)", 100.0)
|
149
|
+
plant2.set("SpecificConsumptionSegment(2:3)", 0.0)
|
150
|
+
plant2.set("SpecificConsumption(1:3,1)", 1.0)
|
151
|
+
plant2.set("Co2EmissionCoefficient", 1.0)
|
152
|
+
plant2.set("RefFuels", [fuel2, ])
|
153
|
+
plant2.set("RefSystem", system)
|
154
|
+
study.add(plant2)
|
155
|
+
|
156
|
+
plant3 = plant2.clone()
|
157
|
+
plant3.code = 3
|
158
|
+
plant3.name = "T3"
|
159
|
+
plant3.set("MaximumGenerationCapacity", 4.0)
|
160
|
+
plant3.set("InstalledCapacity", 4.0)
|
161
|
+
plant3.set("RefFuels", [fuel3, ])
|
162
|
+
plant3.set("RefSystem", system)
|
163
|
+
study.add(plant3)
|
164
|
+
|
165
|
+
# Define gauging station for hydro plants inflows
|
166
|
+
station1 = psr.factory.create("HydroStation", context)
|
167
|
+
station1.code = 1
|
168
|
+
station1.name = "Estacion 1"
|
169
|
+
|
170
|
+
station2 = psr.factory.create("HydroStation", context)
|
171
|
+
station2.code = 2
|
172
|
+
station2.name = "Estacion 2"
|
173
|
+
|
174
|
+
for year in (2014, 2015, 2016):
|
175
|
+
station1.set_at("Inflow", f"01/{year}", 13.5)
|
176
|
+
station1.set_at("Inflow", f"02/{year}", 40.7)
|
177
|
+
station1.set_at("Inflow", f"03/{year}", 28.8)
|
178
|
+
station1.set_at("Inflow", f"04/{year}", 25.6)
|
179
|
+
station1.set_at("Inflow", f"05/{year}", 23.8)
|
180
|
+
station1.set_at("Inflow", f"06/{year}", 27.8)
|
181
|
+
station1.set_at("Inflow", f"07/{year}", 28.8)
|
182
|
+
station1.set_at("Inflow", f"08/{year}", 18.8)
|
183
|
+
station1.set_at("Inflow", f"09/{year}", 18.2)
|
184
|
+
station1.set_at("Inflow", f"10/{year}", 29.6)
|
185
|
+
station1.set_at("Inflow", f"11/{year}", 17.7)
|
186
|
+
station1.set_at("Inflow", f"12/{year}", 26.3)
|
187
|
+
|
188
|
+
for month in range(1, 12 + 1):
|
189
|
+
station2.set_at("Vazao", f"{month:02d}/{year}", 0.0)
|
190
|
+
|
191
|
+
study.add(station1)
|
192
|
+
study.add(station2)
|
193
|
+
|
194
|
+
# Define hydroplants
|
195
|
+
hydro1 = psr.factory.create("HydroPlant", context)
|
196
|
+
hydro1.code = 1
|
197
|
+
hydro1.name = "H1"
|
198
|
+
hydro1.set("Type", 0)
|
199
|
+
hydro1.set("NumberOfUnits", 1)
|
200
|
+
hydro1.set("InstalledCapacity", 5.5)
|
201
|
+
hydro1.set("MaximumTurbinedOutflow", 55.0)
|
202
|
+
hydro1.set("MeanProductionCoefficient", 0.1)
|
203
|
+
hydro1.set("MinimumStorage", 0.0)
|
204
|
+
hydro1.set("MaximumStorage", 50.0)
|
205
|
+
hydro1.set("InitialCondition", 0.2)
|
206
|
+
hydro1.set("RefSystem", system)
|
207
|
+
hydro1.set("RefStation", station1)
|
208
|
+
study.add(hydro1)
|
209
|
+
|
210
|
+
hydro2 = hydro1.clone()
|
211
|
+
hydro2.code = 2
|
212
|
+
hydro2.name = "H2"
|
213
|
+
hydro2.set("MaximumStorage", 0.0)
|
214
|
+
hydro2.set("InitialCondition", 1.0)
|
215
|
+
hydro2.set("RefSystem", system)
|
216
|
+
hydro2.set("RefStation", station2)
|
217
|
+
study.add(hydro2)
|
218
|
+
|
219
|
+
# Connect hydro plants
|
220
|
+
connection_spill = psr.factory.create("HydroPlantConnection", context)
|
221
|
+
connection_spill.set("IsVertimento", 1)
|
222
|
+
connection_spill.set("RefPlants", [hydro1, hydro2])
|
223
|
+
study.add(connection_spill)
|
224
|
+
|
225
|
+
connection_turb = psr.factory.create("HydroPlantConnection", context)
|
226
|
+
connection_turb.set("IsTurbinamento", 1)
|
227
|
+
connection_turb.set("RefPlants", [hydro1, hydro2])
|
228
|
+
study.add(connection_turb)
|
229
|
+
|
230
|
+
return study
|
231
|
+
|
232
|
+
|
233
|
+
if __name__ == "__main__":
|
234
|
+
case_path = get_case_path()
|
235
|
+
os.makedirs(case_path, exist_ok=True)
|
236
|
+
print("Creating example case... ", end="")
|
237
|
+
study = create_sddp_sample_case21()
|
238
|
+
print(" OK.")
|
239
|
+
print("Saving example case in \"{}\"... ".format(case_path), end="")
|
240
|
+
study.save(case_path)
|
241
|
+
print(" OK.")
|
psr/runner/runner.py
CHANGED
@@ -135,8 +135,9 @@ def run_sddp(case_path: Union[str, pathlib.Path], sddp_path: Union[str, pathlib.
|
|
135
135
|
exec_mode = kwargs.get("_mode", None)
|
136
136
|
mpi_path = kwargs.get("mpi_path", __default_mpi_path)
|
137
137
|
|
138
|
+
sddp_path_full = _get_sddp_executable_parent_path(sddp_path)
|
138
139
|
# Append last / if missing.
|
139
|
-
|
140
|
+
case_path_last_slash = os.path.join(os.path.abspath(case_path), "")
|
140
141
|
|
141
142
|
mode_arg = exec_mode if exec_mode is not None else ""
|
142
143
|
# Disable parallel run in check mode.
|
@@ -144,14 +145,6 @@ def run_sddp(case_path: Union[str, pathlib.Path], sddp_path: Union[str, pathlib.
|
|
144
145
|
|
145
146
|
major, minor, patch, tag = _get_semver_version(get_sddp_version(sddp_path))
|
146
147
|
|
147
|
-
if os.name == 'nt':
|
148
|
-
if major >= 18:
|
149
|
-
sddp_path_full = os.path.join(sddp_path, r"sddp\Oper")
|
150
|
-
else:
|
151
|
-
sddp_path_full = os.path.join(sddp_path, "Oper")
|
152
|
-
|
153
|
-
else:
|
154
|
-
sddp_path_full = sddp_path
|
155
148
|
with change_cwd(sddp_path_full):
|
156
149
|
# Write MPI settings if required
|
157
150
|
if parallel_run and cluster_settings is not None:
|
@@ -160,18 +153,22 @@ def run_sddp(case_path: Union[str, pathlib.Path], sddp_path: Union[str, pathlib.
|
|
160
153
|
|
161
154
|
if parallel_run:
|
162
155
|
if os.name == 'nt':
|
163
|
-
|
156
|
+
if major <= 17:
|
157
|
+
cmd = f'sddpar.exe --path="{sddp_path_full}" --mpipath="{mpi_path}" --pathdata="{case_path_last_slash}" {extra_args}'
|
158
|
+
else:
|
159
|
+
cmd = f'sddpar.exe --path="{sddp_path_full}" --mpipath="{mpi_path}" --pathdata="{case_path}" {extra_args}'
|
164
160
|
else:
|
165
161
|
# 17.3 and before uses one type of args, newer uses another
|
166
162
|
if (major == 17 and minor <= 3) or major < 17:
|
167
|
-
cmd = f'./sddpar --path="{
|
163
|
+
cmd = f'./sddpar --path="{case_path_last_slash}" --mpipath="{mpi_path}" --habilitarhidra=1 {extra_args}'
|
168
164
|
else:
|
169
|
-
cmd = f'./sddpar --path="{sddp_path}" --mpipath="{mpi_path}" --habilitarhidra=1 --pathdata="{
|
165
|
+
cmd = f'./sddpar --path="{sddp_path}" --mpipath="{mpi_path}" --habilitarhidra=1 --pathdata="{case_path_last_slash}" {extra_args}'
|
166
|
+
|
170
167
|
else:
|
171
168
|
if os.name == 'nt':
|
172
|
-
cmd = f'sddp.exe {mode_arg} -path "{
|
169
|
+
cmd = f'sddp.exe {mode_arg} -path "{case_path_last_slash}" {extra_args}'
|
173
170
|
else:
|
174
|
-
cmd = f'./sddp {mode_arg} -path "{
|
171
|
+
cmd = f'./sddp {mode_arg} -path "{case_path_last_slash}" {extra_args}'
|
175
172
|
|
176
173
|
if os.name != "nt":
|
177
174
|
os.environ["LD_LIBRARY_PATH"] = os.path.abspath(sddp_path_full)
|
@@ -193,16 +190,19 @@ def run_sddp_convert_fcf(case_path: Union[str, pathlib.Path], sddp_path: Union[s
|
|
193
190
|
# TODO: generated file use \t as separator, has an empty column and its name depends on study stage type.
|
194
191
|
run_sddp(case_path, sddp_path, **kwargs)
|
195
192
|
|
193
|
+
def _get_sddp_executable_parent_path(sddp_path: Union[str, pathlib.Path]) -> str:
|
194
|
+
if os.name == 'nt':
|
195
|
+
model_path = os.path.join(sddp_path, "models", "sddp")
|
196
|
+
if os.path.exists(model_path):
|
197
|
+
return model_path
|
198
|
+
else:
|
199
|
+
return os.path.join(sddp_path, "Oper")
|
200
|
+
return sddp_path
|
201
|
+
|
196
202
|
|
197
203
|
def get_sddp_version(sddp_path: Union[str, pathlib.Path]) -> str:
|
198
204
|
sddp_path = str(sddp_path)
|
199
|
-
|
200
|
-
if os.name == 'nt' and "18" in sddp_path:
|
201
|
-
sddp_path_full = os.path.join(sddp_path, "sddp/Oper")
|
202
|
-
elif os.name == 'nt':
|
203
|
-
sddp_path_full = os.path.join(sddp_path, "Oper")
|
204
|
-
else:
|
205
|
-
sddp_path_full = sddp_path
|
205
|
+
sddp_path_full = _get_sddp_executable_parent_path(sddp_path)
|
206
206
|
if os.name == 'nt':
|
207
207
|
command = [os.path.join(sddp_path_full, "sddp.exe"), "ver"]
|
208
208
|
else:
|
@@ -278,12 +278,7 @@ def run_optgen_cleanup(case_path: Union[str, pathlib.Path], optgen_path: Union[s
|
|
278
278
|
kwargs["_mode"] = "clean"
|
279
279
|
run_optgen(case_path, optgen_path, sddp_path, **kwargs)
|
280
280
|
|
281
|
-
|
282
|
-
def run_psrio(case_path: Union[str, pathlib.Path], sddp_path: Union[str, pathlib.Path], **kwargs):
|
283
|
-
if os.name != 'nt':
|
284
|
-
raise NotImplementedError("Running PSRIO is only available on Windows")
|
285
|
-
case_path = str(case_path)
|
286
|
-
sddp_path = str(sddp_path)
|
281
|
+
def run_psrio(case_path, sddp_path: str, **kwargs):
|
287
282
|
recipe_script = kwargs.get('r', kwargs.get('recipes', False))
|
288
283
|
output_path = kwargs.get('o', kwargs.get('output', False))
|
289
284
|
|
@@ -313,9 +308,14 @@ def run_psrio(case_path: Union[str, pathlib.Path], sddp_path: Union[str, pathlib
|
|
313
308
|
if recipe_script:
|
314
309
|
cmd += f' -r "{recipe_script}"'
|
315
310
|
|
316
|
-
|
317
|
-
|
318
|
-
|
311
|
+
if isinstance(case_path, str):
|
312
|
+
cmd += f' "{case_path}"'
|
313
|
+
else:
|
314
|
+
case_paths = list(case_path)
|
315
|
+
for path in case_paths:
|
316
|
+
cmd += f' "{path}"'
|
317
|
+
|
318
|
+
_exec_cmd(cmd, **kwargs)
|
319
319
|
|
320
320
|
def run_nwsddp(input_case_path: Union[str, pathlib.Path], output_case_path: Union[str, pathlib.Path], nwsddp_app_path: Union[str, pathlib.Path], mdc_file_path: Optional[Union[str, pathlib.Path]] = None, **kwargs):
|
321
321
|
if os.name != 'nt':
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: psr-factory
|
3
|
-
Version: 5.0.
|
3
|
+
Version: 5.0.0b3
|
4
4
|
Summary: PSR database management module.
|
5
5
|
Author-email: "PSR Inc." <psrfactory@psr-inc.com>
|
6
6
|
License-Expression: MIT
|
@@ -22,9 +22,14 @@ Classifier: Operating System :: POSIX :: Linux
|
|
22
22
|
Requires-Python: >=3.9
|
23
23
|
Description-Content-Type: text/markdown
|
24
24
|
License-File: LICENSE.txt
|
25
|
+
Requires-Dist: zeep
|
26
|
+
Requires-Dist: filelock
|
27
|
+
Requires-Dist: pefile
|
28
|
+
Requires-Dist: boto3
|
29
|
+
Requires-Dist: botocore
|
25
30
|
Dynamic: license-file
|
26
31
|
|
27
|
-
PSR Factory (version 5.0.
|
32
|
+
PSR Factory (version 5.0.0b3)
|
28
33
|
============================
|
29
34
|
|
30
35
|
Factory is a library that helps to manage SDDP cases.
|
@@ -45,7 +50,7 @@ pip install psr-factory
|
|
45
50
|
Or, if the package directly from the wheel (whl) file:
|
46
51
|
|
47
52
|
```bash
|
48
|
-
pip install psr_factory-5.0.
|
53
|
+
pip install psr_factory-5.0.0b3-py3-none-win_amd64.whl
|
49
54
|
```
|
50
55
|
|
51
56
|
Factory will be available to all Python scripts in your system after importing it:
|
@@ -2,33 +2,36 @@ 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/
|
6
|
-
psr/cloud/
|
5
|
+
psr/cloud/aws.py,sha256=ro8kBNVxpGDXgZ5haceqX-MAD-0F5KFDJJ4M6rRvwS8,9915
|
6
|
+
psr/cloud/cloud.py,sha256=9Z342IJ-PVkiETyO5ksCDTgpT7CXj6Ec6g2S8fGhgTk,58670
|
7
|
+
psr/cloud/data.py,sha256=nQVpCZhHlHI0HOpqsNhBpotLO37ha5Fl9txWABDnFwQ,4008
|
7
8
|
psr/cloud/desktop.py,sha256=JFroCMEFV1Nz3has74n7OVrGCg2lS7Ev5bcjdw2hRxY,2980
|
8
9
|
psr/cloud/log.py,sha256=Dvhz1enIWlFWeaRK7JAAuZVPfODgoEIRNcHEmbEliyQ,1366
|
9
10
|
psr/cloud/status.py,sha256=vcI4B9S6wCt9maT5NNrVwYaEgGIvy6kkC1UVpJjYbtw,3607
|
10
11
|
psr/cloud/tempfile.py,sha256=1IOeye0eKWnmBynK5K5FMWiTaEVhn4GbQ8_y0THEva0,3893
|
11
|
-
psr/cloud/version.py,sha256=
|
12
|
-
psr/cloud/xml.py,sha256=
|
13
|
-
psr/factory/__init__.py,sha256=
|
12
|
+
psr/cloud/version.py,sha256=Wxm5oXHAe8U9QoQpN5WIlzAhFR9bGfvIITFeq8QPBLw,192
|
13
|
+
psr/cloud/xml.py,sha256=ac2lyflOQm8khPvJn0zmI26I4sfUDY6A_OTsxzbMQEs,1896
|
14
|
+
psr/factory/__init__.py,sha256=0EluoySuofSZkEjHf7CXkaG8L2UefWn50Jo3OeoYRMs,218
|
14
15
|
psr/factory/api.py,sha256=N5153ZJmZjzLQ0AvRZnSlTu6UmHBQqbYw0UQ69sZHkE,98705
|
15
|
-
psr/factory/factory.dll,sha256
|
16
|
-
psr/factory/factory.pmd,sha256=
|
17
|
-
psr/factory/factory.pmk,sha256=
|
16
|
+
psr/factory/factory.dll,sha256=-lr-yNzGhobUYO04IgzKhNihcBKh8qc6-5F9GY8ak-Y,18232656
|
17
|
+
psr/factory/factory.pmd,sha256=gZnS1mnb1iA1XtNA1JfALM9rKdFLFBbwAJHF2_PxKAk,243405
|
18
|
+
psr/factory/factory.pmk,sha256=3xDhU0fpUz6dSn29E8GkXEmCOSadnq7cJPcNPbEyFfI,579203
|
18
19
|
psr/factory/factorylib.py,sha256=xnhCFTo4DpU0e5oHtIWMmc-kk6ThtNAUI3cxpDXrBKE,27497
|
19
|
-
psr/factory/libcurl-x64.dll,sha256=
|
20
|
+
psr/factory/libcurl-x64.dll,sha256=Bx50eR62eK_p8DMmNlfV_mNNfxmEn5n6v78wOCPWGv8,5317968
|
20
21
|
psr/factory/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
21
22
|
psr/factory/samples/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
22
23
|
psr/factory/samples/sddp_case01.py,sha256=jo71p9NN7dtRqMT76TEbD4S4Lut7p4ejbpu6SoSwg0Y,5034
|
23
24
|
psr/factory/samples/sddp_case21.py,sha256=-9Wk2ntjIC1-PrQDXDcnWUjV0OF9Xi_IREFb2pUWSi4,8797
|
25
|
+
psr/factory/samples/sddp_sample_case01.py,sha256=49C7w86EQT5IuguaNvt7mz7OqbVRhov5c3zb7_l12FE,4994
|
26
|
+
psr/factory/samples/sddp_sample_case21.py,sha256=La9I6PcyEUCXDJMB0Mtn98Pl2V0RGPMEHAhGpboPvU8,8757
|
24
27
|
psr/psrfcommon/__init__.py,sha256=WXR560XQllIjtFpWd0jiJEbUAQIyh5-6lwj-42_J95c,200
|
25
28
|
psr/psrfcommon/psrfcommon.py,sha256=NABM5ahvyfSizDC9c0Vu9dVK1pD_vOzIGFHL1oz2E1o,1464
|
26
29
|
psr/psrfcommon/tempfile.py,sha256=5S13wa2DCLYTUdwbLm_KMBRnDRJ0WDlu8GO2BmZoNdg,3939
|
27
30
|
psr/runner/__init__.py,sha256=kI9HDX-B_LMQJUHHylFHas2rNpWfNNa0pZXoIvX_Alw,230
|
28
|
-
psr/runner/runner.py,sha256=
|
31
|
+
psr/runner/runner.py,sha256=xUHGAyw2iCClcpIrmhAadBBsHVwt9ebc4oa0M4uQu8s,26806
|
29
32
|
psr/runner/version.py,sha256=mch2Y8anSXGMn9w72Z78PhSRhOyn55EwaoLAYhY4McE,194
|
30
|
-
psr_factory-5.0.
|
31
|
-
psr_factory-5.0.
|
32
|
-
psr_factory-5.0.
|
33
|
-
psr_factory-5.0.
|
34
|
-
psr_factory-5.0.
|
33
|
+
psr_factory-5.0.0b3.dist-info/licenses/LICENSE.txt,sha256=N6mqZK2Ft3iXGHj-by_MHC_dJo9qwn0URjakEPys3H4,1089
|
34
|
+
psr_factory-5.0.0b3.dist-info/METADATA,sha256=j3kfosSsVtO3PigpS0ofDzsRqfWPT25py0cCQspSMBE,2542
|
35
|
+
psr_factory-5.0.0b3.dist-info/WHEEL,sha256=ZjXRCNaQ9YSypEK2TE0LRB0sy2OVXSszb4Sx1XjM99k,97
|
36
|
+
psr_factory-5.0.0b3.dist-info/top_level.txt,sha256=Jb393O96WQk3b5D1gMcrZBLKJJgZpzNjTPoldUi00ck,4
|
37
|
+
psr_factory-5.0.0b3.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|