epanet.de / DC Water Design Extension / Manual
This section contains information that is relevant to developers. Most probably you only want to read this if you are a programmer.
This section documents extension scripts that could be used from the field calculator or in queries. In Addition, the script responsible for the extension dictionaries is documented. In general, the API documentation should only be of concern for programmers.
DCWatDes.Bitcode.or performs a bytewise or operation on string numbers.
string DCWatDes.Bitcode.or(string a, string b)
a byte-coded string
b byte-coded string
Returns: the result of the bytewise a or b as a string
The following AVENUE code can be used in the field calculator to perform of a bytewise or-operation on the fields a and b:
av.run("DCWatDes.Bitcode.or", {[a], [b]})
DCWatDes.Bitcode.xor performs a bytewise xor operation on string numbers.
string DCWatDes.Bitcode.xor(string a, string b)
a byte-coded string
b byte-coded string
Returns: the result of the bytewise a xor b as a string
The following AVENUE code can be used in the field calculator to perform of a bytewise or-operation on the fields a and b:
av.run("DCWatDes.Bitcode.xor", {"111", "101"})
The result of the example above will be "111".
DCWatDes.Bitcode.and performs a bytewise and operation on string numbers
string DCWatDes.Bitcode.and(string a, string b)
a bit-coded string
b bit-coded string
Returns: the result of the bytewise a and b as a string
The following AVENUE code can be used in the field calculator to perform of a bytewise and-operation on the fields a and b:
av.run("DCWatDes.Bitcode.and", {[a], [b]})
DCWatDes.Bitcode.isSetAsNumber returns whether the n-th byte of a string is set or not
integer DCWatDes.Bitcode.isSetAsNumber(string a, integer n)
a byte-coded string
n number of the byte to check
Returns: an integer of value 1 in case the n-th byte is set, 0 otherwise
The following AVENUE query can be used to select all the records which have set the 4th bit in the example field (usable with the query tools of view and table GUI):
av.run("DCWatDes.Bitcode.isSetAsNumber",{"0001", 3})
= 1The expression will return true
Note that the bit numbering starts at 0. "= 1" is used to convert the numbers 0 and 1 to the boolean values to true or false, respective.
![]() | Tip |
|---|---|
Note that you can also use the "0001".middle(3,1) = "1"
|
Creates the Localization dictionaries of the Extension
In order to add another Dictionary, you'll first have to create one:
dicNew = Dictionary.make(100)
Then you can start adding dictionary entries:
dicNew.add("English Term", "New translated term")Look at the German dictionary for the terms that have to be translated. After you've added all the terms to the new Dictionary, you have to add the Dictionary to the Dictionary of Dictionaries:
_dcwDicDictionaries.add("de", dicNew)
Where "de" is describes the locale (In this case "de" for Germany).
Updates the valves status field, reflecting the status at a given time.
All valves are closed before applying the controls.
Expects the timestep as a number as the argument (Hours since simulation start).
Returns nothing.
Requires valves theme and controls table registered with the extension.
Works only for SOV valves. The supported controls syntax is:
LINK link_id status AT TIME hours_since_simulation_start
Procedures in the development process.
Steps that should be followed in the release process.
Update the version number in
dcwatdes2.apr, build.xml,
doc/en/dcwaterdesign.xml,
installer/dc_water_design_extension.nsi.
Build the documentation using ant
and doc/build.xml.
Build the installer using NSIS and
installer/dc_water_design_extension.nsi.
Test the installer.
Build the source zip file using ant
and build.xml.
Upload the files to ftp://upload.sourceforge.net/incoming/
Create the release on Sourceforge.
Create a Sourceforge news item
Announce the release on the EPANET, DC Water Design mailing lists.