stepss 3.77.1__tar.gz → 3.79__tar.gz
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-3.77.1/stepss.egg-info → stepss-3.79}/PKG-INFO +1 -1
- {stepss-3.77.1 → stepss-3.79}/stepss/__init__.py +1 -1
- {stepss-3.77.1 → stepss-3.79}/stepss/_bundled.py +1 -1
- {stepss-3.77.1 → stepss-3.79}/stepss/cases.py +60 -6
- stepss-3.79/stepss/libs/lin/ramses.so +0 -0
- {stepss-3.77.1 → stepss-3.79}/stepss/libs/mac/ramses.so +0 -0
- {stepss-3.77.1 → stepss-3.79}/stepss/libs/ramses.h +44 -44
- {stepss-3.77.1 → stepss-3.79}/stepss/libs/win/ramses.dll +0 -0
- {stepss-3.77.1 → stepss-3.79/stepss.egg-info}/PKG-INFO +1 -1
- stepss-3.77.1/stepss/libs/lin/ramses.so +0 -0
- {stepss-3.77.1 → stepss-3.79}/LICENSE.rst +0 -0
- {stepss-3.77.1 → stepss-3.79}/MANIFEST.in +0 -0
- {stepss-3.77.1 → stepss-3.79}/README.rst +0 -0
- {stepss-3.77.1 → stepss-3.79}/setup.cfg +0 -0
- {stepss-3.77.1 → stepss-3.79}/setup.py +0 -0
- {stepss-3.77.1 → stepss-3.79}/stepss/extractor.py +0 -0
- {stepss-3.77.1 → stepss-3.79}/stepss/globals.py +0 -0
- {stepss-3.77.1 → stepss-3.79}/stepss/helios.py +0 -0
- {stepss-3.77.1 → stepss-3.79}/stepss/libs/helios_api.h +0 -0
- {stepss-3.77.1 → stepss-3.79}/stepss/libs/lin/libhelios_api.so +0 -0
- {stepss-3.77.1 → stepss-3.79}/stepss/libs/mac/libhelios_api.dylib +0 -0
- {stepss-3.77.1 → stepss-3.79}/stepss/libs/win/helios_api.dll +0 -0
- {stepss-3.77.1 → stepss-3.79}/stepss/live.py +0 -0
- {stepss-3.77.1 → stepss-3.79}/stepss/scripts/__init__.py +0 -0
- {stepss-3.77.1 → stepss-3.79}/stepss/scripts/exec.py +0 -0
- {stepss-3.77.1 → stepss-3.79}/stepss/simulator.py +0 -0
- {stepss-3.77.1 → stepss-3.79}/stepss.egg-info/SOURCES.txt +0 -0
- {stepss-3.77.1 → stepss-3.79}/stepss.egg-info/dependency_links.txt +0 -0
- {stepss-3.77.1 → stepss-3.79}/stepss.egg-info/entry_points.txt +0 -0
- {stepss-3.77.1 → stepss-3.79}/stepss.egg-info/requires.txt +0 -0
- {stepss-3.77.1 → stepss-3.79}/stepss.egg-info/top_level.txt +0 -0
|
@@ -15,6 +15,48 @@ from .globals import RAMSESError, CustomWarning
|
|
|
15
15
|
warnings.showwarning = CustomWarning
|
|
16
16
|
|
|
17
17
|
|
|
18
|
+
def _dstProblem(dstfile):
|
|
19
|
+
"""Return None if *dstfile* can drive a run, or a sentence saying what is wrong.
|
|
20
|
+
|
|
21
|
+
Mirrors what the engine itself accepts. A blank line, or one opening with
|
|
22
|
+
``#`` or ``!``, is a comment. Every other line is a record whose first field
|
|
23
|
+
is a time and whose remainder is the description, and the run ends at the
|
|
24
|
+
first record whose description carries ``STOP``.
|
|
25
|
+
|
|
26
|
+
:param str dstfile: path to the disturbance file to check.
|
|
27
|
+
:returns: None when the file is usable, otherwise the reason it is not.
|
|
28
|
+
:rtype: str or None
|
|
29
|
+
"""
|
|
30
|
+
records = 0
|
|
31
|
+
untimed = False
|
|
32
|
+
try:
|
|
33
|
+
with open(dstfile, 'r', encoding='utf-8', errors='replace') as records_file:
|
|
34
|
+
for line in records_file:
|
|
35
|
+
text = line.strip()
|
|
36
|
+
if not text or text[0] in '#!':
|
|
37
|
+
continue
|
|
38
|
+
_, space, description = text.partition(' ')
|
|
39
|
+
if not space:
|
|
40
|
+
# The engine refuses a record with fewer than two fields.
|
|
41
|
+
# Noting a bare STOP separately turns "no STOP record" into
|
|
42
|
+
# a sentence the reader can act on, with STOP on screen.
|
|
43
|
+
untimed = untimed or 'STOP' in text
|
|
44
|
+
continue
|
|
45
|
+
records += 1
|
|
46
|
+
if 'STOP' in description:
|
|
47
|
+
return None
|
|
48
|
+
except IOError as e:
|
|
49
|
+
return 'RAMSES: The disturbance file %s could not be read: %s' % (dstfile, e)
|
|
50
|
+
|
|
51
|
+
if untimed:
|
|
52
|
+
return ('RAMSES: The disturbance file %s has a STOP without a time. Every '
|
|
53
|
+
'record starts with its time, as in "240.0 STOP".' % dstfile)
|
|
54
|
+
if records == 0:
|
|
55
|
+
return 'RAMSES: The disturbance file %s has no disturbance records.' % dstfile
|
|
56
|
+
return ('RAMSES: The disturbance file %s has no STOP record. A dynamic simulation '
|
|
57
|
+
'ends at its STOP time, so add a line such as "240.0 STOP".' % dstfile)
|
|
58
|
+
|
|
59
|
+
|
|
18
60
|
class cfg(object):
|
|
19
61
|
"""Simulation case configuration.
|
|
20
62
|
|
|
@@ -174,8 +216,16 @@ class cfg(object):
|
|
|
174
216
|
|
|
175
217
|
.. warning:: If *userFile* already exists it will be overwritten.
|
|
176
218
|
"""
|
|
177
|
-
if not self._dataset
|
|
178
|
-
raise RAMSESError('
|
|
219
|
+
if not self._dataset:
|
|
220
|
+
raise RAMSESError('RAMSES: No data file is set. A case needs at least one.')
|
|
221
|
+
if not self._dstset:
|
|
222
|
+
raise RAMSESError('RAMSES: No disturbance file is set. A dynamic simulation '
|
|
223
|
+
'needs one, ending in a STOP record.')
|
|
224
|
+
# Re-checked here rather than trusted from addDst: the file can be
|
|
225
|
+
# edited, or replaced, between being attached and being run.
|
|
226
|
+
problem = _dstProblem(self._dstset[0])
|
|
227
|
+
if problem:
|
|
228
|
+
raise RAMSESError(problem)
|
|
179
229
|
|
|
180
230
|
cmdFile = ""
|
|
181
231
|
|
|
@@ -534,11 +584,15 @@ class cfg(object):
|
|
|
534
584
|
|
|
535
585
|
.. warning:: A disturbance file must be provided before the simulation can start.
|
|
536
586
|
"""
|
|
537
|
-
if os.path.isfile(dstfile):
|
|
538
|
-
del self._dstset[:]
|
|
539
|
-
self._dstset.append(dstfile)
|
|
540
|
-
else:
|
|
587
|
+
if not os.path.isfile(dstfile):
|
|
541
588
|
raise IOError('RAMSES: The dstfile %s does not exist or is not valid.' % (dstfile))
|
|
589
|
+
# Checked before the case is touched, so a rejected file never replaces
|
|
590
|
+
# a working one.
|
|
591
|
+
problem = _dstProblem(dstfile)
|
|
592
|
+
if problem:
|
|
593
|
+
raise RAMSESError(problem)
|
|
594
|
+
del self._dstset[:]
|
|
595
|
+
self._dstset.append(dstfile)
|
|
542
596
|
|
|
543
597
|
def getDst(self):
|
|
544
598
|
"""Get disturbance
|
|
Binary file
|
|
Binary file
|
|
@@ -1,44 +1,44 @@
|
|
|
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);
|
|
42
|
-
int run_ssa(char *basename
|
|
43
|
-
int get_state_matrix_size(int *nx);
|
|
44
|
-
int get_state_matrix(int nx, double *a_sys);
|
|
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);
|
|
42
|
+
int run_ssa(char *basename);
|
|
43
|
+
int get_state_matrix_size(int *nx);
|
|
44
|
+
int get_state_matrix(int nx, double *a_sys);
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|