TABLE OF CONTENTS

1. ganessa.multithread/Functions_m [ Introduction ]

[ Top ] [ Introduction ]

1.1. Functions_m/mp_run [ Fonctions ]

[ Top ] [ Functions_m ] [ Fonctions ]

DESCRIPTION

This function is provided for legacy Compatibility. parallel.MultiProc should be used instead.

SYNTAX

mp_run(logprint, tasks [, nb_cpu= -1] [, wait= 0.0] [, use_wpnum= False])

ARGUMENT

see MultiProc and run

RESULT

this function is implemented as:

HISTORY

2. ganessa.parallel/About [ Introduction ]

[ Top ] [ Introduction ]

PURPOSE

The module ganessa.parallel provides a multitasking (parallel) computing capability based on multiprocessing Process and Queue objects.

3. ganessa.parallel/Classes_p [ Introduction ]

[ Top ] [ Introduction ]

3.1. Classes_p/MultiProc, run,
run_sequential [ Objects ]

[ Top ] [ Classes_p ] [ Objects ]

DESCRIPTION

The MultiProc class allows to define and run tasks in parallel. A number of N processing instances (nb_cpu provided, default all cores but one) are created; then tasks from the tasks list are dispatched to the processing instances.

An init task (resp. a term task) may be provided; if so it is called by each processing instance before the 1st task (resp. after the last one). If init is not provided, first N tasks are guaranteed to be run on distinct instances and can also be used for initialisation purposes. Then each task in the list is associated to the next processing instance available in turn. The execution order is not guaranteed (except the first N tasks if init is not provided).

run executes the tasks list in parallel processing instances; run_sequential executes the tasks list sequentially, i.e. init, tasks in order, term.

SYNTAX

ARGUMENT

RESULT

When reduce function is not provided:

When reduce function is provided:

REMARKS

HISTORY

4. ganessa.sim&th/About [ Introduction ]

[ Top ] [ Introduction ]

PURPOSE

The module ganessa.sim (resp. ganessa.th) provides a Python interface to Picwin32.dll and Ganessa_SIM.dll (resp. Ganessa_TH.dll) kernels. It will be extended as needed.

The module name ganessa.sim&th is used for items availble both in .sim and .th environments

INSTALLATION

pip install ganessa

numpy must be installed in version >= 1.7; pip will handle it.

The package expects the simulation kernel .dll to be found either in the folders given by %GANESSA_DIR environment variable (for Ganessa_xx.dll) or %PICCOLO_DIR (for Picwin32.dll), or in the %PATH environment variable (either name), or in one of the sub folders of Program Files folder (x86 under Windows 7):

in either drive D: or C:

USE

Syntax:

Or:

the import will perform the following initialisation tasks:

CONTENT

The package provides the following content:

REMARKS

HISTORY

The history of the package is:

5. ganessa.sim&th/Classes [ Introduction ]

[ Top ] [ Introduction ]

DESCRIPTION

Classes available to ganessa.sim and ganessa.th

5.1. Classes/Graph, extrnodes,
adjlinks, adjnodes,
propagate, dtree [ Objects ]

[ Top ] [ Classes ] [ Objects ]

PURPOSE

Builds a simple Graph from the current model topology.

SYNTAX

Graph = Graph()

METHODS

ARGUMENTS

RESULT

The Graph is built from the current model Links and Nodes:

REMARK

first key, value returned by dtree is the root NODE, and ('', 0)

HISTORY

6. ganessa.sim&th/Compatibility [ Introduction ]

[ Top ] [ Introduction ]

PURPOSE

The installation of pyganessa is compatible with several versions of Picwin32.dll (regular Piccolo / Picalor). Missing functions in older versions should NOT be called.

HISTORY

REMARK

pyganessa is compatible with matching or newer versions of Ganessa_SIM/Ganessa_TH.dll only; except a Compatibility break on 170117.

7. ganessa.sim&th/Constants [ Introduction ]

[ Top ] [ Introduction ]

DESCRIPTION

Several categories of Constants are available:

7.1. Constants/BRANCH, LINK,
NODE, NOEUD,
TANK, RESERVOIR,
RSV [ Constants ]

[ Top ] [ Constants ] [ Constants ]

DESCRIPTION

Those Constants allow to select one of the three types of model Elements:

REMARK

M.LNK, M.NOD and M.RSV are object Constants for calling BRANCH, NODE and RESERVOIR modules

7.2. Constants/DICT [ Constants ]

[ Top ] [ Constants ] [ Constants ]

DESCRIPTION

The DICT class provide a dictionnary tree for keywords

SYNTAX

DICT.SYMBOLIC_NAME

CONTENT

7.3. Constants/M, NONE [ Constants ]

[ Top ] [ Constants ] [ Constants ]

DESCRIPTION

The M class provide a dictionnary tree for modules. It provides a hierarchical naming of the commands by modules, for building language-independant commands using gencmd, gencmdw, _gencmdw functions.

SYNTAX

One of the following:

CONTENT

The available MODULE_SYMBOLIC_NAME are:

ROOT: modules names: BRA, NOD, RSV, DYN, MOD, SIM, QUA, MES, LAB, FIR, INV, OPT. They can be used in three forms, as first argument for the functions above:

GEN: general purpose commands:

LNK: LINK commands and submodules, including LINK types (.PIPE .PUMP .NRV .PRV .PSV .FCV .TCV etc.)

NOD: NODE commands and submodules:

RSV: RESERVOIR command and submodules:

MES: measurement commands:

SIM: simulation commands:

QUA: Water quality module commands

REMARK

The above codes are not exhaustive. Please refer to the script.

8. ganessa.sim&th/Functions [ Introduction ]

[ Top ] [ Introduction ]

DESCRIPTION

Functions available to ganessa.sim and ganessa.th

8.1. Functions/addSHLtype, addSHL,
updateSHL, delSHL [ Fonctions ]

[ Top ] [ Functions ] [ Fonctions ]

PURPOSE

SYNTAX

ARGUMENTS

RESULT

int istat: error status (0 if OK) COMMENTS If shltype is not given or is '' for delSHL then all SHL are removed from pipe.

REMARK

8.2. Functions/areas [ Fonctions ]

[ Top ] [ Functions ] [ Fonctions ]

PURPOSE

SYNTAX

ARGUMENTS

RESULT

HISTORY

From version 1.9.0 (05/04/2018) area are returned as unicode strings.

8.3. Functions/cmd, addcmdw,
execute, cmdfile [ Fonctions ]

[ Top ] [ Functions ] [ Fonctions ]

SYNTAX

ARGUMENTS

RESULT

int istat: error status (0 if OK)

REMARKS

If an error occurs while reading a file or nested files, the execution stops. If the useException mode is set, the error will raise a GanessaError

8.4. Functions/commit [ Fonctions ]

[ Top ] [ Functions ] [ Fonctions ]

PURPOSE

Executes all the commands available on the stack (first in, first executed)

SYNTAX

istat = commit()

RESULT

int istat: error status (0 if OK)

REMARK

If an error occurs, the remaining part of the stack is cleared

8.5. Functions/cwfold [ Fonctions ]

[ Top ] [ Functions ] [ Fonctions ]

SYNTAX

ret = cwfold(folder)

ARGUMENT

str folder: folder name where journal (piccolo.jnl) and work files will be created

RESULT

bool ret: True if folder exists; False otherwise

HISTORY

introduced in 1.7.7 (170705)

8.6. Functions/dist2link [ Fonctions ]

[ Top ] [ Functions ] [ Fonctions ]

PURPOSE

Returns the distance and curvilinear abcissae of a point from the given LINK

SYNTAX

ARGUMENTS

RESULT

HISTORY

introduced in 1.3.7 (160706)

REMARKS

8.7. Functions/dll_version, full_version [ Fonctions ]

[ Top ] [ Functions ] [ Fonctions ]

SYNTAX

RESULT

HISTORY

8.8. Functions/extrnodes [ Fonctions ]

[ Top ] [ Functions ] [ Fonctions ]

PURPOSE

Returns the from and to NODE (indexes) form BRANCH index

SYNTAX

i_from, i_to = extrnodes(i_branch)

ARGUMENTS

RESULT

REMARKS

8.9. Functions/gencmd, gencmdw,
_gencmdw [ Fonctions ]

[ Top ] [ Functions ] [ Fonctions ]

PURPOSE

Those fuctions allow to generate a language independant command line based upon the keywords id of a module and its commands (see M).

SYNTAX

ARGUMENTS

RESULT

int istat: error status (0 if OK)

REMARKS

EXAMPLES

The following are equivalent:

The following are equivalent:

HISTORY

1.8.0 (170908): added raw_gencmdw

8.10. Functions/getall [ Fonctions ]

[ Top ] [ Functions ] [ Fonctions ]

PURPOSE

SYNTAX

ARGUMENTS

RESULT

REMARKS

getall(typelt, attr): when typelt =1 (Links), attr can be either a regular attribute ('Q', 'V', 'D', etc.) or a NODE-based attribute such as 'P:M' for mean pressure, 'P:G' for geometric mean, 'P:N' for min and 'p:X' for max.

8.11. Functions/getcodescount, nextcode [ Fonctions ]

[ Top ] [ Functions ] [ Fonctions ]

PURPOSE

SYNTAX

ARGUMENTS

RESULT

REMARKS

HISTORY

From version 1.9.0 (05/04/2018) codes are returned as unicode strings.

8.12. Functions/getdemandbycode, getcodedemandinit,
nextcodedemand [ Fonctions ]

[ Top ] [ Functions ] [ Fonctions ]

PURPOSE

SYNTAX

ARGUMENTS

RESULT

REMARKS

HISTORY

From version 1.9.0 (05/04/2018) codes are returned as unicode strings.

8.13. Functions/getid [ Fonctions ]

[ Top ] [ Functions ] [ Fonctions ]

PURPOSE

Returns the id of an element by type and index

SYNTAX

id = getid(typelt, numelt)

ARGUMENTS

RESULT

unicode string id: id of the element

REMARKS

HISTORY

From version 1.9.0 (05/04/2018) ids are returned as unicode strings.

8.14. Functions/getindex [ Fonctions ]

[ Top ] [ Functions ] [ Fonctions ]

SYNTAX

num = getindex(typelt, id)

ARGUMENT

int typelt: type of element string id: ID of element

RESULT

int num: index of element ID (starting at pos 1)

HISTORY

new in 1.3.3

8.15. Functions/getkeyword, modulekeyword,
attrkeyword [ Fonctions ]

[ Top ] [ Functions ] [ Fonctions ]

PURPOSE

get keyword or command name by index - for building command language independant functions

SYNTAX

ARGUMENTS

RESULT

str sret: trimmed value of the keyword or global command or module submodule

         (null string if the code or module/submodule is not recognised)

HISTORY

8.16. Functions/getvar, getunitname,
getunitcoef [ Fonctions ]

[ Top ] [ Functions ] [ Fonctions ]

PURPOSE

Returns the value of a Piccolo expression or variable

SYNTAX

ARGUMENTS

RESULT

REMARKS

Internal units are SI units excepted:

EXAMPLE

If the user flow unit is 'l/s', since internal flow unit is 'm3/s', getunitcoef('Q') returns 0.001

HISTORY

From version 1.9.0 (05/04/2018) info returned as unicode strings.

8.17. Functions/importEpanet, exportEpanet [ Fonctions ]

[ Top ] [ Functions ] [ Fonctions ]

SYNTAX

ARGUMENTS

string fname: file name to import from / export to (should be an .inp)

RESULT

int istat: error status (0 if OK)

REMARK

At import, .inp file is first converted to a .inp_cvt.dat Piccolo file, then this file is read. Syntax error if any will refer to the converted .dat file.

8.18. Functions/init [ Fonctions ]

[ Top ] [ Functions ] [ Fonctions ]

SYNTAX

init([folder])

ARGUMENT

str folder: optional folder name where journal and work files will be created

DESCRIPTION

Initialises the ganessa simulation/command language engine.

REMARKS

HISTORY

8.19. Functions/linkattr, nodeattr,
tankattr, linkattrs,
nodeattrs, tankattrs,
attr, attrs,
meanattr [ Fonctions ]

[ Top ] [ Functions ] [ Fonctions ]

PURPOSE

SYNTAX

ARGUMENTS

RESULT

REMARKS

HISTORY

From version 1.9.0 (05/04/2018) ids and attributes are returned as unicode strings.

8.20. Functions/linkbbox [ Fonctions ]

[ Top ] [ Functions ] [ Fonctions ]

PURPOSE

Returns the LINK bounding box

SYNTAX

ARGUMENTS

RESULT

HISTORY

Created in 1.8.5 (171128)

8.21. Functions/linkXYZV, branchXYZV [ Fonctions ]

[ Top ] [ Functions ] [ Fonctions ]

PURPOSE

Returns the XYZ polyline representing a LINK, and eventually an additional NODE attribute

SYNTAX

ARGUMENTS

RESULT

HISTORY

optional argument include_depth introduced in 1.4.2 (160908)

REMARKS

8.22. Functions/loadbin [ Fonctions ]

[ Top ] [ Functions ] [ Fonctions ]

PURPOSE

Clears (removes) all model objects and loads a binary file

SYNTAX

istat = loadbin(fname)

ARGUMENT

string fname: binary data/result file name to be loaded

RESULT

int istat: error status (0 if OK)

REMARKS

8.23. Functions/loadres [ Fonctions ]

[ Top ] [ Functions ] [ Fonctions ]

PURPOSE

Loads the default binary result file.

SYNTAX

istat = loadres()

RESULT

int istat: error status (0 if OK)

REMARK

The current model is discarded before the data corresponding to the last simulation making use of the default result file is loaded.

8.24. Functions/nbobjects [ Fonctions ]

[ Top ] [ Functions ] [ Fonctions ]

PURPOSE

Returns the number of model Elements in the given type

SYNTAX

nb = nbobjects(typelt)

ARGUMENT

int typelt: type of element (LINK, NODE, TANK)

RESULT

int nb: number of element in that type

8.25. Functions/nlinkattr, nnodeattr,
ntankattr, nlinkattrs,
nnodeattrs, ntankattrs,
nattr, nattrs [ Fonctions ]

[ Top ] [ Functions ] [ Fonctions ]

PURPOSE

SYNTAX

ARGUMENTS

RESULT

REMARKS

HISTORY

From version 1.9.0 (05/04/2018) ids and attributes are returned as unicode strings.

8.26. Functions/nodeXYZ [ Fonctions ]

[ Top ] [ Functions ] [ Fonctions ]

PURPOSE

Returns the XYZ coordinates and depth of a NODE

SYNTAX

ARGUMENTS

RESULT

REMARKS

8.27. Functions/quit, close [ Fonctions ]

[ Top ] [ Functions ] [ Fonctions ]

SYNTAX

ret = quit([True])

ARGUMENT

optional bool verbose: if set to True, a message is printed. Defaults to False.

RESULT

text ret: text string telling that he module has been unloaded. Terminates the ganessa session and unloads the module ganessa.sim&th

REMARKS

8.28. Functions/reset [ Fonctions ]

[ Top ] [ Functions ] [ Fonctions ]

PURPOSE

Clears (removes) all model objects

SYNTAX

istat = reset()

RESULT

int istat: error status (0 if OK)

8.29. Functions/resfile [ Fonctions ]

[ Top ] [ Functions ] [ Fonctions ]

PURPOSE

Returns the name of the default binary result file.

SYNTAX

name = resfile()

RESULT

str name: file name or '' if undefined

HISTORY

Introduced in version 1.8.0 (170919)

8.30. Functions/save, savemodel [ Fonctions ]

[ Top ] [ Functions ] [ Fonctions ]

SYNTAX

ARGUMENTS

RESULT

int istat: error status (0 if OK)

REMARKS

8.31. Functions/selectlen, select [ Fonctions ]

[ Top ] [ Functions ] [ Fonctions ]

PURPOSE

SYNTAX

ARGUMENT

string sname: name of selection

RESULT

8.32. Functions/setbatchmode [ Fonctions ]

[ Top ] [ Functions ] [ Fonctions ]

SYNTAX

oldmode = setbatchmode(mode)

ARGUMENT

int mode: batch mode to activate

RESULT

int oldmode: batch mode that was in effect

REMARK

Defaults to 1 (True)

8.33. Functions/setlang [ Fonctions ]

[ Top ] [ Functions ] [ Fonctions ]

SYNTAX

oldlang = setlang(new_lang)

ARGUMENT

str new_lang: one of 'English', 'French', 'Spanish'

RESULT

str old_lang: previous language

DESCRIPTION

Modifiy the current command language to new_lang (console version and macros only). If the language name is misspelled, it will be ignored withour raising an error.

HISTORY

introduced in 1.8.0 (170912)

8.34. Functions/setlinkattr, setbranchattr [ Fonctions ]

[ Top ] [ Functions ] [ Fonctions ]

SYNTAX

ARGUMENTS

RESULT

int istat: error status:

REMARKS

8.35. Functions/shearstr [ Fonctions ]

[ Top ] [ Functions ] [ Fonctions ]

PURPOSE

Returns the shear stress associated with a velocity for the given pipe

SYNTAX

val, grad = shearstr(id, v)

ARGUMENTS

RESULT

REMARKS

HISTORY

8.36. Functions/useExceptions, GanessaError,
SimulationError [ Fonctions ]

[ Top ] [ Functions ] [ Fonctions ]

SYNTAX

ARGUMENTS

bool status: if True, errors will raise exceptions

RESULT

DESCRIPTION

SimulationError is a derived class of GanessaError. The simulation error subtypes are the following:

REMARK

Defaults to False: errors do not raise 'GanessaError' exceptions. If set to True, errors raise exceptions with a string name giving the error message and a int reason giving the type of exception.

9. ganessa.sim&th/Iterators [ Introduction ]

[ Top ] [ Introduction ]

DESCRIPTION

Iterators available to ganessa.sim and ganessa.th

9.1. Iterators/Branches, Links [ Iterator ]

[ Top ] [ Iterators ] [ Iterator ]

SYNTAX

RESULT

string id: returns each BRANCH id in turn

REMARK

Branches and Links are synonyms

HISTORY

From version 1.9.0 (05/04/2018) ids are returned as unicode strings.

9.2. Iterators/DemandCodes [ Iterator ]

[ Top ] [ Iterators ] [ Iterator ]

SYNTAX

for code, demand, nodecount in DemandCodes():

RESULT

Returns each demand code and NODE count in turn:

REMARK

HISTORY

Added 11/09/2015

9.3. Iterators/Demands [ Iterator ]

[ Top ] [ Iterators ] [ Iterator ]

SYNTAX

for code, csm in Demands(node_id):

ARGUMENT

string node_id: id of NODE

RESULT

Returns each demand code and nominal value for the NODE in turn:

REMARK

HISTORY

From version 1.9.0 (05/04/2018) codes are returned as unicode strings.

9.4. Iterators/Elements [ Iterator ]

[ Top ] [ Iterators ] [ Iterator ]

SYNTAX

for id in Elements(typelt):

ARGUMENT

int typelt: type element Constants LINK, NODE, TANK

RESULT

string id: id of each element of the given type in turn

HISTORY

From version 1.9.0 (05/04/2018) ids are returned as unicode strings.

9.5. Iterators/Nodes [ Iterator ]

[ Top ] [ Iterators ] [ Iterator ]

SYNTAX

for id in Nodes():

RESULT

Returns each NODE id in turn

HISTORY

From version 1.9.0 (05/04/2018) ids are returned as unicode strings.

9.6. Iterators/Selected [ Iterator ]

[ Top ] [ Iterators ] [ Iterator ]

SYNTAX

for id, typelt in Selected(sname):

ARGUMENT

string sname: name of a selection

RESULT

Returns the id and type of each element in the selection in turn:

9.7. Iterators/Table [ Iterator ]

[ Top ] [ Iterators ] [ Iterator ]

SYNTAX

for item, objcount in Table(Table, typelt):

ARGUMENTS

RESULT

Returns each Table entry and associated object count in turn:

REMARK

HISTORY

From version 1.9.0 (05/04/2018) items are returned as unicode strings.

9.8. Iterators/Tanks, Reservoirs [ Iterator ]

[ Top ] [ Iterators ] [ Iterator ]

SYNTAX

RESULT

string id: returns each RESERVOIR id in turn

HISTORY

From version 1.9.0 (05/04/2018) ids are returned as unicode strings.

9.9. Iterators/Unstable [ Iterator ]

[ Top ] [ Iterators ] [ Iterator ]

PURPOSE

Provide access to the list of Elements which status cannot be determined thus causing a simulation not converge.

SYNTAX

for item, typelt in Unstable():

ARGUMENTS

NONE

RESULT

Returns each Unstable element in turn:

REMARK

HISTORY

10. ganessa.sim/sFunctions [ Introduction ]

[ Top ] [ Introduction ]

DESCRIPTION

Functions available to ganessa.sim ONLY.

10.1. sFunctions/browseH, browseWQ [ Fonctions ]

[ Top ] [ sFunctions ] [ Fonctions ]

PURPOSE

Retrieves and interpolate results from a given time step or instant:

SYNTAX

ARGUMENTS

RESULT

int istat: error status (0 if OK)

REMARKS

For hydraulic results, two set of results may be available at a given instant:

In such a situation the results are those from the end of the previous interval.

10.2. sFunctions/defcalind, getcalind [ Fonctions ]

[ Top ] [ sFunctions ] [ Fonctions ]

PURPOSE

Compute and return calibration indicators

SYNTAX

ARGUMENTS

RESULT

val: percentage of values below threshold ival: indicator rank, from 1 (best) to 4 (worse) (-1 if not defined)

REMARK

defcalind actually compute all indicators; getcalind returns them.

10.3. sFunctions/full_solveH [ Fonctions ]

[ Top ] [ sFunctions ] [ Fonctions ]

PURPOSE

Runs the full simulation and loads the result file for browsing results

SYNTAX

istat = full_solveH([resultfile] [, silent] [, iverb] [, retry])

ARGUMENT

RESULT

int istat: error status (0 if OK)

REMARKS

HISTORY

optional argument 'retry' added in 1.5.1

10.4. sFunctions/getallminmax [ Fonctions ]

[ Top ] [ sFunctions ] [ Fonctions ]

PURPOSE

SYNTAX

ARGUMENTS

RESULT

10.5. sFunctions/hstepcount, tslen,
mslen, tsval,
msval, tsvalbymts,
tsinterv, refdate [ Fonctions ]

[ Top ] [ sFunctions ] [ Fonctions ]

PURPOSE

SYNTAX

ARGUMENTS

RESULT

REMARKS

HISTOTY 12/12/2016 (1.5.1): bug fix when no simulation result available

10.6. sFunctions/inv_summary [ Fonctions ]

[ Top ] [ sFunctions ] [ Fonctions ]

SYNTAX

ARGUMENTS

NONE

RESULT

REMARK

HISTORY

new in 1.3.4

10.7. sFunctions/msmooth [ Fonctions ]

[ Top ] [ sFunctions ] [ Fonctions ]

PURPOSE

Defines the smoothing constant for time series of measurements

SYNTAX

msmooth(twidth)

ARGUMENTS

twidth: characteristic time window for smoothing, in seconds

REMARKS

10.8. sFunctions/setWQresultfile [ Fonctions ]

[ Top ] [ sFunctions ] [ Fonctions ]

PURPOSE

Defines the binary result file(s) for WQ simulation.

SYNTAX

setWQresultfile([fnode] , [flink])

ARGUMENTS

REMARK

10.9. sFunctions/solveH [ Fonctions ]

[ Top ] [ sFunctions ] [ Fonctions ]

PURPOSE

Runs the simulation at a given instant

SYNTAX

istat = solveH(time [, retry])

ARGUMENT

RESULT

int istat: error status (0 if OK)

HISTORY

added 2017.05.15 - version 1.7.5

10.10. sFunctions/stat_quantiles, stat_duration [ Fonctions ]

[ Top ] [ sFunctions ] [ Fonctions ]

PURPOSE

stat_quantiles and stat_duration returns stat info associated with result TS of a given attribute for all Elements in a selection. raw_stat_quantiles and raw_stat_duration are pass_thru versions where the selection is provided as its type, buffer and length

SYNTAX

ARGUMENTS

RESULT

The functions return an empty list if the selection or qtl is empty .

EXAMPLE

REMARK

Allowed attributes are:

See also: getallminmax, getMinMax, Dynamic_Stats

HISTORY

10.11. sFunctions/tsdemand, tsdevice,
tsdemandlen, tsdevicelen [ Fonctions ]

[ Top ] [ sFunctions ] [ Fonctions ]

PURPOSE

SYNTAX

ARGUMENTS

RESULT

REMARKS

HISTORY

11. ganessa.sim/sIterators [ Introduction ]

[ Top ] [ Introduction ]

DESCRIPTION

Iterators available to ganessa.sim ONLY

11.1. sIterators/Dynamic_Stats [ Iterator ]

[ Top ] [ sIterators ] [ Iterator ]

PURPOSE

Iterator which returns stat info associated with result TS of a given attribute for all Elements in a selection in turn.

SYNTAX

for id, retval in Dynamic_Stats(sel, attr [, quantile= qtl] [, duration= (sop, threshold)]):

ARGUMENT

RESULT

Returns the id and type of each element in the selection in turn:

The return value depends on the input parameters:

REMARK

See also getallminmax, stat_quantiles, stat_duration, getMinMax

HISTORY

new in 1.5.0 (161124) - should be compatible with 2016b kernel.

11.2. sIterators/getMinMax [ Iterator ]

[ Top ] [ sIterators ] [ Iterator ]

PURPOSE

Returns the id, min, max, avg value reached by the attribute for each object of the given type or selection in turn

SYNTAX

for id, vmin, vmax, vavg in getMinMax(typelt or selection, sattr):

ARGUMENT

RESULT

id, vmin, vmax, vavg: str element id, minimum, maximum and average values for the attribute over the simulation

12. ganessa.sort/About [ Introduction ]

[ Top ] [ Introduction ]

PURPOSE

The module ganessa.sort provides sorting functions and Classes used by the Ganessa tools.

13. ganessa.sort/sClasses [ Introduction ]

[ Top ] [ Introduction ]

13.1. sClasses/HeapSort [ Objects ]

[ Top ] [ sClasses ] [ Objects ]

SYNTAX

Instances provide the following methods:

ARGUMENTS

RESULT

HISTORY

Introduced in 1.8.2 (171031)

14. ganessa.th/tFunctions [ Introduction ]

[ Top ] [ Introduction ]

DESCRIPTION

Functions available to ganessa.th ONLY

14.1. tFunctions/symmetric_node [ Fonctions ]

[ Top ] [ tFunctions ] [ Fonctions ]

SYNTAX

ids = symmetric_node(sid)

ARGUMENTS

string sid: NODE ID for which the symmetric (counterpart NODE on the other circuit) is looked for

RESULT

REMARKS

HISTORY

new in 1.3.6

15. ganessa.util/About [ Introduction ]

[ Top ] [ Introduction ]

PURPOSE

The module ganessa.util provides useful functions used by the Ganessa tools.

REMARK

Some of the functions must be preceded by 'import ganessa.sim'

16. ganessa.util/functions [ Introduction ]

[ Top ] [ Introduction ]

16.1. functions/decode_time, decode_date [ Fonctions ]

[ Top ] [ functions ] [ Fonctions ]

SYNTAX

ARGUMENT

RESULT

16.2. functions/dist_to_poly, dist_p_seg,
dist [ Fonctions ]

[ Top ] [ functions ] [ Fonctions ]

PURPOSE

Computes the distance of a point (xn, yn) to a polyline or a segment

SYNTAX

ARGUMENTS

RESULT

REMARKS

HISTORY

16.3. functions/envoi_msg [ Fonctions ]

[ Top ] [ functions ] [ Fonctions ]

SYNTAX

status = envoi_msg(exp, dst, objet, texte [, serveur=smtp.safege.net] [, pwd=NONE])

ARGUMENT

RESULT

HISTORY

16.4. functions/FichInfo, banner [ Fonctions ]

[ Top ] [ functions ] [ Fonctions ]

SYNTAX

ARGUMENT

string filename: input file name - expects the name of the caller '__file__'

RESULT

a class member containing the following fields and method:

16.5. functions/formatting: strf3, stri,
hhmmss, strd,
quotefilename [ Fonctions ]

[ Top ] [ functions ] [ Fonctions ]

SYNTAX

ARGUMENT

RESULT

REMARK

The value 'fval' is rounded before conversion

16.6. functions/get_proxy [ Fonctions ]

[ Top ] [ functions ] [ Fonctions ]

SYNTAX

proxy = get_proxy([folder= NONE] [, default_proxy= ''])

ARGUMENTS

RESULT

string proxy: value of the proxy, False if not found

REMARKS

The .json configuration files are searched for either a "proxy" key or the first element of the first list. Files names are: 'https_proxy', 'Mise_a_jour_packages', 'proxy'.

HISTORY

1.8.8 (171212) created get_proxy

16.7. functions/gfloat, gint,
gbool [ Fonctions ]

[ Top ] [ functions ] [ Fonctions ]

SYNTAX

ARGUMENT

string input_str: string value to be converted to a float or int or bool. The decimal separator can either be '.' or ','.

RESULT

HISTORY

171127: gbool added

16.8. functions/IniFile, get,
set, getall,
setall, save [ Fonctions ]

[ Top ] [ functions ] [ Fonctions ]

SYNTAX

ARGUMENT

RESULT

HISTORY

16.9. functions/is_text, ascii,
unistr, str2uni,
utf2uni, con2uni [ Fonctions ]

[ Top ] [ functions ] [ Fonctions ]

SYNTAX

ARGUMENT

input_str: value to be converted. Can be of any type: non text input are first converted to unicode.

RESULT

HISTORY

16.10. functions/layout [ Fonctions ]

[ Top ] [ functions ] [ Fonctions ]

PURPOSE

Determines the number of pages, lines and columns of a figure

SYNTAX

npages, nlines, ncols = layout(nbplots [, nlmax=6 ] [, ncmax= 4])

ARGUMENT

RESULT

EXAMPLE

16.11. functions/lec_csv [ Fonctions ]

[ Top ] [ functions ] [ Fonctions ]

SYNTAX

header, content = lec_csv(filename [, sep=','] [, skip_before=0] [, skip_after=0] [, as_tuple=False])

ARGUMENT

RESULT

REMARK

The entire file is read into 'content'

16.12. functions/list2file [ Fonctions ]

[ Top ] [ functions ] [ Fonctions ]

SYNTAX

fname = list2file(idlist [, header] [, footer] [, folder] [, suffix])

ARGUMENT

RESULT

str fname: name of a temporary file containing header if any, Elements of idlist, footer if any, one per line.

16.13. functions/plotmes, plotmesx,
pageplot [ Fonctions ]

[ Top ] [ functions ] [ Fonctions ]

PURPOSE

SYNTAX

ARGUMENT

REMARK

Type of data and units are displayed (in french) in the figure title

HISTORY

16.14. functions/roundval, scaladjust [ Fonctions ]

[ Top ] [ functions ] [ Fonctions ]

PURPOSE

Computes a rounded approximation of a float number

SYNTAX

ARGUMENT

RESULT

REMARK

scaladjust is used to determine the grid interval for plots as scaladjust(0.25*(ymax-ymin))

16.15. functions/toidpic [ Fonctions ]

[ Top ] [ functions ] [ Fonctions ]

SYNTAX

out_str = toidpic(input_str)

ARGUMENT

unicode or string input_str: string value to be converted to a Piccolo ID

RESULT

ascii string where blank, comma, equal are replaced with underscore, other non litteral or digit are replaced with minus.

16.16. functions/update_package [ Fonctions ]

[ Top ] [ functions ] [ Fonctions ]

SYNTAX

stat = update_package(package_name [, minvers=''] [, pypi_name=NONE] [, deps= False] [, https_proxy= NONE])

ARGUMENT

RESULT

bool stat: true if the package has been installed or updated

REMARKS

HISTORY

16.17. functions/winstr, utf,
ws, codewinfile [ Fonctions ]

[ Top ] [ functions ] [ Fonctions ]

SYNTAX

ARGUMENT

unicode or byte string input_str: string value to be encoded to windows-compatible string

RESULT

REMARK

codewinfile and winstr are synonyms

HISTORY

16.18. functions/XMLduration [ Fonctions ]

[ Top ] [ functions ] [ Fonctions ]

SYNTAX

ival = XMLduration(input_string)

ARGUMENT

string input_str: XML duration string value to be converted to a number of seconds.

The input format is [-]PnYnMnDTnHnMnS where:

RESULT

int ival: number of seconds

17. ganessa.util/iterators [ Introduction ]

[ Top ] [ Introduction ]

17.1. iterators/group [ Iterator ]

[ Top ] [ iterators ] [ Iterator ]

SYNTAX

for items in group(iterable, count= 2):

ARGUMENT

RESULT

this iterator allows to return the Elements of iterable grouped by lists of size count. The last list may contain less than group Elements

HISTORY

1.7.6 (170613): iterator added

18. Functions_p/required_cpu [ Fonctions ]

[ Top ] [ Fonctions ]

SYNTAX

ncpu = required_cpu(nb_cpu)

ARGUMENT

int nb_cpu: expected number of parallel processes, up to the hardware core count. A negative or null value indicates the number of hardware cores + nb_cpu.

RESULT

int ncpu: actual number of parallel processes (1 ... max physical core count)

EXAMPLE