stepss 3.59__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.
- stepss/__init__.py +66 -0
- stepss/_bundled.py +13 -0
- stepss/cases.py +555 -0
- stepss/extractor.py +750 -0
- stepss/globals.py +154 -0
- stepss/helios.py +836 -0
- stepss/libs/helios_api.h +305 -0
- stepss/libs/lin/libhelios_api.so +0 -0
- stepss/libs/lin/ramses.so +0 -0
- stepss/libs/mac/libhelios_api.dylib +0 -0
- stepss/libs/mac/ramses.so +0 -0
- stepss/libs/ramses.h +41 -0
- stepss/libs/win/helios_api.dll +0 -0
- stepss/libs/win/ramses.dll +0 -0
- stepss/scripts/__init__.py +2 -0
- stepss/scripts/exec.py +38 -0
- stepss/simulator.py +1072 -0
- stepss-3.59.dist-info/METADATA +296 -0
- stepss-3.59.dist-info/RECORD +23 -0
- stepss-3.59.dist-info/WHEEL +5 -0
- stepss-3.59.dist-info/entry_points.txt +2 -0
- stepss-3.59.dist-info/licenses/LICENSE.rst +190 -0
- stepss-3.59.dist-info/top_level.txt +1 -0
stepss/libs/helios_api.h
ADDED
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
/* SPDX-License-Identifier: LicenseRef-STEPSS-Academic-Public-License
|
|
2
|
+
* Copyright (c) 2026 Sustainable Power Systems Laboratory (https://sps-lab.org/)
|
|
3
|
+
* Part of STEPSS-Helios: Modern C++ Power Flow Calculator
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
#pragma once
|
|
7
|
+
|
|
8
|
+
#ifdef __cplusplus
|
|
9
|
+
extern "C" {
|
|
10
|
+
#endif
|
|
11
|
+
|
|
12
|
+
#ifdef _WIN32
|
|
13
|
+
#ifdef HELIOS_API_EXPORTS
|
|
14
|
+
#define HELIOS_API __declspec(dllexport)
|
|
15
|
+
#else
|
|
16
|
+
#define HELIOS_API __declspec(dllimport)
|
|
17
|
+
#endif
|
|
18
|
+
#else
|
|
19
|
+
#define HELIOS_API __attribute__((visibility("default")))
|
|
20
|
+
#endif
|
|
21
|
+
|
|
22
|
+
typedef void* HeliosHandle;
|
|
23
|
+
|
|
24
|
+
/* Maximum buffer size (including NUL) sufficient for any element name
|
|
25
|
+
* returned by the helios_get_*_name functions. */
|
|
26
|
+
#define HELIOS_NAME_MAX 64
|
|
27
|
+
|
|
28
|
+
/* Maximum buffer size (including NUL) sufficient for message-sized
|
|
29
|
+
* strings such as contingency names and violation descriptions. */
|
|
30
|
+
#define HELIOS_TEXT_MAX 256
|
|
31
|
+
|
|
32
|
+
/* Status codes returned by the API. Success is HELIOS_OK (0) or, where
|
|
33
|
+
* documented, a non-negative count. Any negative value is an error and
|
|
34
|
+
* sets the per-handle error string (see helios_get_last_error).
|
|
35
|
+
*
|
|
36
|
+
* HELIOS_OK and HELIOS_NOT_CONVERGED deliberately share their values with
|
|
37
|
+
* the `helios` CLI's process exit status, so a caller can treat the library
|
|
38
|
+
* and the command-line tool interchangeably. Non-convergence covers every
|
|
39
|
+
* outcome where the solve ran but produced no usable answer (max iterations,
|
|
40
|
+
* divergence, singular Jacobian); use helios_get_solver_status to tell them
|
|
41
|
+
* apart. */
|
|
42
|
+
typedef enum HeliosStatus {
|
|
43
|
+
HELIOS_OK = 0,
|
|
44
|
+
HELIOS_NOT_CONVERGED = 2, /* solve ran but did not converge */
|
|
45
|
+
HELIOS_ERROR = -1, /* unspecified error */
|
|
46
|
+
HELIOS_ERR_NULL_ARG = -2, /* NULL handle or required pointer */
|
|
47
|
+
HELIOS_ERR_NOT_FOUND = -3, /* name lookup failed */
|
|
48
|
+
HELIOS_ERR_INDEX = -4, /* index or option id out of range */
|
|
49
|
+
HELIOS_ERR_IO = -5, /* file could not be opened/written */
|
|
50
|
+
HELIOS_ERR_PARSE = -6, /* input file parse error */
|
|
51
|
+
HELIOS_ERR_NO_NETWORK = -7, /* called before helios_load_file */
|
|
52
|
+
HELIOS_ERR_BUFFER_TOO_SMALL = -8 /* caller buffer/array too short */
|
|
53
|
+
} HeliosStatus;
|
|
54
|
+
|
|
55
|
+
/* ---- Lifecycle ---- */
|
|
56
|
+
|
|
57
|
+
HELIOS_API HeliosHandle helios_create(void);
|
|
58
|
+
HELIOS_API void helios_destroy(HeliosHandle h);
|
|
59
|
+
|
|
60
|
+
/* ---- Library information ---- */
|
|
61
|
+
|
|
62
|
+
/* API version of the loaded library. Any output pointer may be NULL. */
|
|
63
|
+
HELIOS_API void helios_get_api_version(int* major, int* minor, int* patch);
|
|
64
|
+
/* Static, never-freed description string: version, compiler, platform. */
|
|
65
|
+
HELIOS_API const char* helios_get_build_info(void);
|
|
66
|
+
|
|
67
|
+
/* ---- Error reporting ----
|
|
68
|
+
* Every failing call stores a human-readable message on the handle;
|
|
69
|
+
* successful calls leave it untouched. The returned pointer is owned by
|
|
70
|
+
* the handle and valid until the next API call on the same handle. */
|
|
71
|
+
|
|
72
|
+
HELIOS_API const char* helios_get_last_error(HeliosHandle h); /* "" if none */
|
|
73
|
+
HELIOS_API void helios_clear_last_error(HeliosHandle h);
|
|
74
|
+
|
|
75
|
+
/* ---- Load and solve ---- */
|
|
76
|
+
|
|
77
|
+
HELIOS_API int helios_load_file(HeliosHandle h, const char* filepath);
|
|
78
|
+
HELIOS_API int helios_solve(HeliosHandle h);
|
|
79
|
+
HELIOS_API int helios_get_convergence_status(HeliosHandle h);
|
|
80
|
+
|
|
81
|
+
/* ---- Solver options ----
|
|
82
|
+
* Options map 1:1 onto the solver parameters read from $PARAM records.
|
|
83
|
+
* helios_load_file overwrites them from the data file, so set options
|
|
84
|
+
* AFTER load and BEFORE solve. Integer-valued options (MAX_ITER, PLIM)
|
|
85
|
+
* are passed as double and truncated. There is no flat-start option:
|
|
86
|
+
* the initial state comes from the data file; use helios_reset() to
|
|
87
|
+
* return to it. */
|
|
88
|
+
|
|
89
|
+
typedef enum HeliosOption {
|
|
90
|
+
HELIOS_OPT_SBASE = 0, /* system base, MVA */
|
|
91
|
+
HELIOS_OPT_TOLAC, /* active power tolerance, MW ($TOLAC) */
|
|
92
|
+
HELIOS_OPT_TOLREAC, /* reactive power tolerance, Mvar ($TOLREAC) */
|
|
93
|
+
HELIOS_OPT_MAX_ITER, /* maximum iterations ($NBITMA) */
|
|
94
|
+
HELIOS_OPT_TH_BLOCK, /* tap-blocking mismatch threshold, MVA ($MISBLOC) */
|
|
95
|
+
HELIOS_OPT_TH_ADJ, /* tap-adjustment mismatch threshold, MVA ($MISADJ) */
|
|
96
|
+
HELIOS_OPT_TH_QLIM, /* Q-limit switching mismatch threshold, MVA ($MISQLIM) */
|
|
97
|
+
HELIOS_OPT_PLIM, /* 0/1 slack P-limit relaxation ($PLIM) */
|
|
98
|
+
HELIOS_OPT_DIVDET /* divergence detection threshold ($DIVDET) */
|
|
99
|
+
} HeliosOption;
|
|
100
|
+
|
|
101
|
+
HELIOS_API int helios_set_option(HeliosHandle h, int option, double value);
|
|
102
|
+
HELIOS_API int helios_get_option(HeliosHandle h, int option, double* value);
|
|
103
|
+
|
|
104
|
+
/* ---- Solve metadata (valid after helios_solve) ---- */
|
|
105
|
+
|
|
106
|
+
/* Iterations used by the last solve, or negative error code. */
|
|
107
|
+
HELIOS_API int helios_get_iteration_count(HeliosHandle h);
|
|
108
|
+
/* Largest remaining mismatches of the last solve. NULL pointers skipped. */
|
|
109
|
+
HELIOS_API int helios_get_max_mismatch(HeliosHandle h, double* mw, double* mvar);
|
|
110
|
+
/* Detailed solver status: 0=NOT_RUN 1=CONVERGED 2=DIVERGED 3=MAX_ITERATIONS
|
|
111
|
+
* 4=SINGULAR, or negative error code. */
|
|
112
|
+
HELIOS_API int helios_get_solver_status(HeliosHandle h);
|
|
113
|
+
|
|
114
|
+
/* ---- Element counts ---- */
|
|
115
|
+
|
|
116
|
+
HELIOS_API int helios_get_bus_count(HeliosHandle h);
|
|
117
|
+
HELIOS_API int helios_get_branch_count(HeliosHandle h);
|
|
118
|
+
HELIOS_API int helios_get_generator_count(HeliosHandle h);
|
|
119
|
+
HELIOS_API int helios_get_svc_count(HeliosHandle h);
|
|
120
|
+
HELIOS_API int helios_get_zone_count(HeliosHandle h);
|
|
121
|
+
HELIOS_API int helios_get_cut_count(HeliosHandle h);
|
|
122
|
+
|
|
123
|
+
/* ---- Names and lookup ----
|
|
124
|
+
* Name getters copy a NUL-terminated string into the caller buffer
|
|
125
|
+
* (HELIOS_NAME_MAX bytes always suffice). Find functions return the
|
|
126
|
+
* element index (>= 0) or HELIOS_ERR_NOT_FOUND. Indices are stable
|
|
127
|
+
* until the next helios_load_file. */
|
|
128
|
+
|
|
129
|
+
HELIOS_API int helios_get_bus_name(HeliosHandle h, int index, char* buf, int buf_size);
|
|
130
|
+
HELIOS_API int helios_get_branch_name(HeliosHandle h, int index, char* buf, int buf_size);
|
|
131
|
+
HELIOS_API int helios_get_generator_name(HeliosHandle h, int index, char* buf, int buf_size);
|
|
132
|
+
HELIOS_API int helios_get_svc_name(HeliosHandle h, int index, char* buf, int buf_size);
|
|
133
|
+
HELIOS_API int helios_get_zone_name(HeliosHandle h, int index, char* buf, int buf_size);
|
|
134
|
+
HELIOS_API int helios_get_cut_name(HeliosHandle h, int index, char* buf, int buf_size);
|
|
135
|
+
|
|
136
|
+
HELIOS_API int helios_find_bus(HeliosHandle h, const char* name);
|
|
137
|
+
HELIOS_API int helios_find_branch(HeliosHandle h, const char* name);
|
|
138
|
+
HELIOS_API int helios_find_generator(HeliosHandle h, const char* name);
|
|
139
|
+
HELIOS_API int helios_find_svc(HeliosHandle h, const char* name);
|
|
140
|
+
HELIOS_API int helios_find_zone(HeliosHandle h, const char* name);
|
|
141
|
+
HELIOS_API int helios_find_cut(HeliosHandle h, const char* name);
|
|
142
|
+
|
|
143
|
+
/* ---- Indexed getters ----
|
|
144
|
+
* All output pointers may be NULL to skip that field. */
|
|
145
|
+
|
|
146
|
+
/* bus_type: 0=PQ 1=PV 2=SLACK 3=ISOLATED */
|
|
147
|
+
HELIOS_API int helios_get_bus_info(HeliosHandle h, int index, double* v_pu,
|
|
148
|
+
double* angle_rad, int* bus_type, double* vnom_kv);
|
|
149
|
+
HELIOS_API int helios_get_bus_load(HeliosHandle h, int index, double* p_mw, double* q_mvar);
|
|
150
|
+
/* b_mvar: voltage-dependent shunt at 1 pu; q_mvar: fixed reactive shunt injection */
|
|
151
|
+
HELIOS_API int helios_get_bus_shunt(HeliosHandle h, int index, double* b_mvar, double* q_mvar);
|
|
152
|
+
/* Zone index of a bus (>= 0), HELIOS_ERR_NOT_FOUND if the bus has no zone. */
|
|
153
|
+
HELIOS_API int helios_get_bus_zone(HeliosHandle h, int bus_index);
|
|
154
|
+
|
|
155
|
+
/* branch type: 1=line -2=fixed trfo -3=LTC 2=switch 3=nrtp; status: 1=closed 0=open */
|
|
156
|
+
HELIOS_API int helios_get_branch_info(HeliosHandle h, int index, int* from_bus,
|
|
157
|
+
int* to_bus, int* status, int* is_transformer,
|
|
158
|
+
double* snom_mva);
|
|
159
|
+
HELIOS_API int helios_get_branch_flow_by_index(HeliosHandle h, int index,
|
|
160
|
+
double* p_from_mw, double* q_from_mvar,
|
|
161
|
+
double* p_to_mw, double* q_to_mvar);
|
|
162
|
+
|
|
163
|
+
HELIOS_API int helios_get_generator_info(HeliosHandle h, int index, int* bus_index,
|
|
164
|
+
int* status, double* p_mw, double* q_mvar,
|
|
165
|
+
double* v_setpoint_pu);
|
|
166
|
+
HELIOS_API int helios_get_generator_limits(HeliosHandle h, int index,
|
|
167
|
+
double* p_min_mw, double* p_max_mw,
|
|
168
|
+
double* q_min_mvar, double* q_max_mvar,
|
|
169
|
+
int* has_p_limits);
|
|
170
|
+
|
|
171
|
+
/* control: -4=voltage control -1=fixed Q 4=at Bmax 5=at Bmin */
|
|
172
|
+
HELIOS_API int helios_get_svc_info(HeliosHandle h, int index, int* bus_index,
|
|
173
|
+
int* status, double* q_mvar,
|
|
174
|
+
double* v_setpoint_pu, int* control);
|
|
175
|
+
|
|
176
|
+
/* Signed total P/Q flow through a cut (sum over member branches). */
|
|
177
|
+
HELIOS_API int helios_get_cut_flow(HeliosHandle h, int index, double* p_mw, double* q_mvar);
|
|
178
|
+
|
|
179
|
+
/* ---- Bulk copy (vectorized access) ----
|
|
180
|
+
* Fill caller-allocated arrays indexed like the element vectors: query
|
|
181
|
+
* the matching *_count first and pass array_len >= count. Any array
|
|
182
|
+
* pointer may be NULL to skip it. Returns HELIOS_ERR_BUFFER_TOO_SMALL
|
|
183
|
+
* if array_len < count. */
|
|
184
|
+
|
|
185
|
+
HELIOS_API int helios_copy_bus_voltages(HeliosHandle h, double* v_pu,
|
|
186
|
+
double* angle_rad, int array_len);
|
|
187
|
+
HELIOS_API int helios_copy_bus_loads(HeliosHandle h, double* p_mw,
|
|
188
|
+
double* q_mvar, int array_len);
|
|
189
|
+
HELIOS_API int helios_copy_branch_flows(HeliosHandle h, double* p_from_mw,
|
|
190
|
+
double* q_from_mvar, double* p_to_mw,
|
|
191
|
+
double* q_to_mvar, int array_len);
|
|
192
|
+
HELIOS_API int helios_copy_branch_status(HeliosHandle h, int* status, int array_len);
|
|
193
|
+
HELIOS_API int helios_copy_generator_outputs(HeliosHandle h, double* p_mw,
|
|
194
|
+
double* q_mvar, int* status, int array_len);
|
|
195
|
+
HELIOS_API int helios_copy_svc_outputs(HeliosHandle h, double* q_mvar,
|
|
196
|
+
int* status, int array_len);
|
|
197
|
+
|
|
198
|
+
/* ---- Network modification ----
|
|
199
|
+
* Modifications accumulate an active-power imbalance that is settled by
|
|
200
|
+
* helios_apply_changes (connectivity check + redispatch onto remaining
|
|
201
|
+
* generators + re-solve, matching the Fortran modify workflow). Calling
|
|
202
|
+
* helios_solve directly instead re-solves WITHOUT redispatch.
|
|
203
|
+
* change_* functions apply DELTAS (increments), not absolute values.
|
|
204
|
+
* Some calls record informational warnings (e.g. "active power limited
|
|
205
|
+
* to maximum") in the last-error string while still returning HELIOS_OK;
|
|
206
|
+
* the return code is authoritative. */
|
|
207
|
+
|
|
208
|
+
HELIOS_API int helios_trip_branch(HeliosHandle h, const char* name);
|
|
209
|
+
HELIOS_API int helios_connect_branch(HeliosHandle h, const char* name);
|
|
210
|
+
HELIOS_API int helios_trip_generator(HeliosHandle h, const char* name);
|
|
211
|
+
HELIOS_API int helios_connect_generator(HeliosHandle h, const char* name);
|
|
212
|
+
HELIOS_API int helios_trip_svc(HeliosHandle h, const char* name);
|
|
213
|
+
HELIOS_API int helios_connect_svc(HeliosHandle h, const char* name);
|
|
214
|
+
|
|
215
|
+
HELIOS_API int helios_set_generator_voltage(HeliosHandle h, const char* name, double v_pu);
|
|
216
|
+
/* Switch a generator to PQ mode with the given reactive output. */
|
|
217
|
+
HELIOS_API int helios_set_generator_pq(HeliosHandle h, const char* name, double q_mvar);
|
|
218
|
+
HELIOS_API int helios_change_generation(HeliosHandle h, const char* gen_name,
|
|
219
|
+
double delta_p_mw);
|
|
220
|
+
HELIOS_API int helios_change_load(HeliosHandle h, const char* bus_name,
|
|
221
|
+
double delta_p_mw, double delta_q_mvar);
|
|
222
|
+
HELIOS_API int helios_change_shunt(HeliosHandle h, const char* bus_name,
|
|
223
|
+
double delta_b_mvar);
|
|
224
|
+
HELIOS_API int helios_change_zone_load(HeliosHandle h, const char* zone,
|
|
225
|
+
double delta_p_mw, double delta_q_mvar);
|
|
226
|
+
HELIOS_API int helios_change_zone_generation(HeliosHandle h, const char* zone,
|
|
227
|
+
double delta_p_mw);
|
|
228
|
+
|
|
229
|
+
/* Connectivity check + redispatch + re-solve. Returns HELIOS_OK,
|
|
230
|
+
* HELIOS_NOT_CONVERGED, or a negative error. Solve metadata getters
|
|
231
|
+
* reflect this solve afterwards; the redispatch summary (if any) is
|
|
232
|
+
* placed in the last-error string as information. */
|
|
233
|
+
HELIOS_API int helios_apply_changes(HeliosHandle h);
|
|
234
|
+
|
|
235
|
+
/* Restore the state saved right after helios_load_file and discard any
|
|
236
|
+
* pending (un-applied) modification imbalance. */
|
|
237
|
+
HELIOS_API int helios_reset(HeliosHandle h);
|
|
238
|
+
|
|
239
|
+
/* ---- File writers ----
|
|
240
|
+
* All writers serialize the CURRENT network state (call after solve).
|
|
241
|
+
* Existing files are overwritten. */
|
|
242
|
+
|
|
243
|
+
/* Re-serialize the network as a data file (DF command). */
|
|
244
|
+
HELIOS_API int helios_write_dump(HeliosHandle h, const char* filepath);
|
|
245
|
+
/* Write the operating-point voltages / LTC data (VT command, LFRESV records). */
|
|
246
|
+
HELIOS_API int helios_write_voltrat(HeliosHandle h, const char* filepath);
|
|
247
|
+
/* Write the operating point and Y-bus as a MATLAB script (S command). */
|
|
248
|
+
HELIOS_API int helios_write_matlab(HeliosHandle h, const char* filepath);
|
|
249
|
+
/* Render an SVG one-line diagram by substituting %X placeholders in a template. */
|
|
250
|
+
HELIOS_API int helios_write_diagram(HeliosHandle h, const char* template_svg,
|
|
251
|
+
const char* output_svg);
|
|
252
|
+
|
|
253
|
+
/* ---- Contingency analysis ----
|
|
254
|
+
* Runners execute each contingency (snapshot -> apply -> redispatch ->
|
|
255
|
+
* solve -> check -> restore); the base network state is unchanged
|
|
256
|
+
* afterwards. Results are stored on the handle until the next run or
|
|
257
|
+
* load. Runners return the number of contingencies executed (>= 0) or
|
|
258
|
+
* a negative error; parser/run warnings are placed in the last-error
|
|
259
|
+
* string as information. Limits: v_min_pu/v_max_pu (voltage band),
|
|
260
|
+
* overload_pct (branch loading threshold in % of Snom), dv_max_pu
|
|
261
|
+
* (max allowed voltage change vs base case; pass 999 to disable). */
|
|
262
|
+
|
|
263
|
+
HELIOS_API int helios_run_contingencies_file(HeliosHandle h, const char* contingency_file,
|
|
264
|
+
double v_min_pu, double v_max_pu,
|
|
265
|
+
double overload_pct, double dv_max_pu);
|
|
266
|
+
/* Auto N-1 over the selected equipment classes (non-zero = include). */
|
|
267
|
+
HELIOS_API int helios_run_contingencies_n1(HeliosHandle h,
|
|
268
|
+
int include_branches, int include_generators,
|
|
269
|
+
int include_svcs,
|
|
270
|
+
double v_min_pu, double v_max_pu,
|
|
271
|
+
double overload_pct, double dv_max_pu);
|
|
272
|
+
|
|
273
|
+
HELIOS_API int helios_get_contingency_count(HeliosHandle h);
|
|
274
|
+
/* Contingency names and violation strings are free text: pass buffers of
|
|
275
|
+
* HELIOS_TEXT_MAX bytes. */
|
|
276
|
+
HELIOS_API int helios_get_contingency_name(HeliosHandle h, int index,
|
|
277
|
+
char* buf, int buf_size);
|
|
278
|
+
/* converged/accepted: 0/1. Any output pointer may be NULL. */
|
|
279
|
+
HELIOS_API int helios_get_contingency_result(HeliosHandle h, int index,
|
|
280
|
+
int* converged, int* accepted,
|
|
281
|
+
double* min_v_pu, double* max_v_pu,
|
|
282
|
+
double* max_loading_pct);
|
|
283
|
+
/* Buses/branch where the extremes occurred; each buffer receives up to
|
|
284
|
+
* buf_size bytes (HELIOS_NAME_MAX suffices). NULL buffers are skipped. */
|
|
285
|
+
HELIOS_API int helios_get_contingency_extremes(HeliosHandle h, int index,
|
|
286
|
+
char* min_v_bus, char* max_v_bus,
|
|
287
|
+
char* max_loading_branch, int buf_size);
|
|
288
|
+
HELIOS_API int helios_get_contingency_violation_count(HeliosHandle h, int index);
|
|
289
|
+
HELIOS_API int helios_get_contingency_violation(HeliosHandle h, int index,
|
|
290
|
+
int viol_index, char* buf, int buf_size);
|
|
291
|
+
|
|
292
|
+
/* ---- Named queries ---- */
|
|
293
|
+
|
|
294
|
+
HELIOS_API int helios_get_bus_voltage(HeliosHandle h, const char* bus_name,
|
|
295
|
+
double* v_pu, double* angle_rad);
|
|
296
|
+
HELIOS_API int helios_get_branch_flow(HeliosHandle h, const char* branch_name,
|
|
297
|
+
double* p_mw, double* q_mvar);
|
|
298
|
+
/* Returns a newline-separated machine-readable summary of all buses.
|
|
299
|
+
* Format: "bus <name> V=<v_pu> angle=<angle_rad> type=<PQ|PV|SLACK|ISOLATED> vnom_kv=<kv>"
|
|
300
|
+
* For formatted display tables, use the TUI or PlainMenu interfaces. */
|
|
301
|
+
HELIOS_API const char* helios_get_output_text(HeliosHandle h);
|
|
302
|
+
|
|
303
|
+
#ifdef __cplusplus
|
|
304
|
+
}
|
|
305
|
+
#endif
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
stepss/libs/ramses.h
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
int ramses(char *cmd, char *out);
|
|
2
|
+
int get_volt_mag(char *bus_name, double *bus_volt);
|
|
3
|
+
int get_volt_pha(char *bus_name, double *bus_pha);
|
|
4
|
+
int get_line_pow(char *line_name, double *p_orig, double *q_orig, double *p_extr, double *q_extr);
|
|
5
|
+
int get_line_cur(char *line_name, double *ix_orig, double *iy_orig, double *ix_extr, double *iy_extr);
|
|
6
|
+
double get_sim_time(void);
|
|
7
|
+
double get_huge_double(void);
|
|
8
|
+
int get_mxprm(void);
|
|
9
|
+
int get_comp_prm_names(char *comp_type, char *comp_name, int mxprm, char *names);
|
|
10
|
+
int define_SS(int ssID, char *filter1, int num1, char *filter2, int num2,char *filter3, int num3);
|
|
11
|
+
int get_SS(int ssID, int mxreclen, char *busNames);
|
|
12
|
+
int get_transformer_in_SS(int ssID, int location, int in_service, char *rettype, int mxreclen, char *retString, double *retdp, int *retint, int *elem);
|
|
13
|
+
int get_nbbus(void);
|
|
14
|
+
int get_bus_name(int i, char *name);
|
|
15
|
+
int get_nbsync(void);
|
|
16
|
+
int get_sync_name(int i, char *name);
|
|
17
|
+
int get_nbinj(void);
|
|
18
|
+
int get_inj_name(int i, char *name);
|
|
19
|
+
int get_nbdctl(void);
|
|
20
|
+
int get_dctl_name(int i, char *name);
|
|
21
|
+
int get_nbbra(void);
|
|
22
|
+
int get_branch_name(int i, char *name);
|
|
23
|
+
int get_nbtwop(void);
|
|
24
|
+
int get_twop_name(int i, char *name);
|
|
25
|
+
int get_nbshunt(void);
|
|
26
|
+
int get_shunt_name(int i, char *name);
|
|
27
|
+
int get_nbload(void);
|
|
28
|
+
int get_load_name(int i, char *name);
|
|
29
|
+
int set_pause_time(double c_pause_time);
|
|
30
|
+
int continue_simul(void);
|
|
31
|
+
int set_to_backup(void);
|
|
32
|
+
int set_end_simul(void);
|
|
33
|
+
int get_end_simul(void);
|
|
34
|
+
int add_disturb(double disturbtime, char *disturbdesc);
|
|
35
|
+
int get_named_prm(char *comp_type, char *comp_name, char *prm_name, double *retd);
|
|
36
|
+
int get_named_obs(char *comp_type, char *comp_name, char *obs_name, double *retd);
|
|
37
|
+
int initObserv(char *traj_filenm);
|
|
38
|
+
int addObserv(char *string);
|
|
39
|
+
int finalObserv(void);
|
|
40
|
+
int get_last_err_log(char *msg);
|
|
41
|
+
int get_Jac(void);
|
|
Binary file
|
|
Binary file
|
stepss/scripts/exec.py
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
"""Console entry point for the ``ramses`` command.
|
|
4
|
+
|
|
5
|
+
Provides a thin command-line wrapper around :class:`stepss.sim` so that a
|
|
6
|
+
RAMSES simulation can be launched directly from the terminal without writing
|
|
7
|
+
a Python script::
|
|
8
|
+
|
|
9
|
+
ramses -t cmd.txt
|
|
10
|
+
|
|
11
|
+
The command file (``cmd.txt``) must follow the RAMSES command-file format
|
|
12
|
+
(see :meth:`stepss.cfg.writeCmdFile` for the expected structure).
|
|
13
|
+
"""
|
|
14
|
+
import sys
|
|
15
|
+
import stepss
|
|
16
|
+
|
|
17
|
+
def run():
|
|
18
|
+
"""Parse command-line arguments and execute a RAMSES simulation.
|
|
19
|
+
|
|
20
|
+
Expected invocation::
|
|
21
|
+
|
|
22
|
+
ramses -t <cmd_file>
|
|
23
|
+
|
|
24
|
+
where ``<cmd_file>`` is the path to a RAMSES command file. The simulation
|
|
25
|
+
output trace is written to ``output_temp.trace`` in the current working
|
|
26
|
+
directory.
|
|
27
|
+
|
|
28
|
+
:raises SystemExit: if the argument count or the ``-t`` flag are incorrect.
|
|
29
|
+
"""
|
|
30
|
+
args = sys.argv[1:]
|
|
31
|
+
if len(args) != 2 or args[0] != '-t' :
|
|
32
|
+
sys.exit("Wrong arguments. Usage: ramses -t cmd.txt")
|
|
33
|
+
ram = stepss.sim()
|
|
34
|
+
case = stepss.cfg(args[1])
|
|
35
|
+
case.addOut('output_temp.trace')
|
|
36
|
+
ram.execSim(case)
|
|
37
|
+
print("The output_temp.trace file contains the execution trace.")
|
|
38
|
+
|