Vous êtes sur la page 1sur 6

Run STOAT from the command line?

: Thank you WRc group for open STOAT as a freeware tool. I had implemented already my model of Gouda
WwTP (The Netherlands) and is giving excellent results.

I am doing my PhD in optimization of Control Strategies of WwTP. I want to use optimization algorithms with
STOAT. For that reason I need to run the STOAT executable from the command line so I can include in my code.
Could you please let me know which parameters are needed to make STOAT run from command line? If any user has
some similar experience documented I will appreciate if you can point me to the right documents.
Thanks in advance
Carlos

: To run STOAT as if it is a command line program requires writing a small file and setting a command line
switch. I'll look up the details tomorrow.

There are two alternative approaches. One is to use OpenMI to control STOAT; this may be acceptable to
you. The other is to use the STOAT COM Model. If either are of interest please post, & I will locate details. There is
some documentation in the STOAT update files - I'll check how much during tomorrow.
Reply:
For running STOAT while bypassing the GUI you need the following command line
FILE= <command file name> RUN= <run filename>
(important: no space between FILE and =, and no space between RUN and =)
There are also two COM sets to control STOAT. One is based on OpenMI, the other on DHI procedures. In Visual
Basic format you would access them as
DIM mySTOAT as STOAT4.HarmonIT
DIM mySTOAT as STOAT4.clsTVPSTOAT
Both of these would require programming. Let me know if you need details.
Coming back to the command line, the RUN file is easy to create. With a works & run open, select from the menu bar
Tools/Create PFS. You are then given a simple menu to specify the run you wish to use as the BASE run - a NEW run
will be created based on this. Save the resulting file.
The command file contains the following:
(where the text is in <> then you would need to change this with your values)
[IMS_EXTRACTION]
[STOAT_PROCESS_OUTPUT]
PROCESS = STOAT, DUMMY
SOURCE_NAME = RESULT_FILE
EXTRACTION_FILNEAME = <Filename>
ENDSECT
[EXTRACTION_LABEL]
LABEL_ID = <Label name on output file>

[DISCHARGE]
DISCHARGE_TS = <STOAT stream name>
ENDSECT
ENDSECT
[EXTRACTION_LABEL]
LABEL_ID = <...>
[CONCENTRATION]
CONCENTRATION_TS = <Parameter>, <STOAT stream name>
ENDSECT
ENDSECT
ENDSECT
<Repeat [EXTRACTION_LABEL] for as many locations and parameters that you wish.
[DISCHARGE] is used to extract flow
[CONCENTRATION] is used to extract water quality parameters
Defined water quality parameters:
TEMPERATURE, PH, DO, BOD, DISSOLVED_BOD, SUSPENDED_BOD
VFA, COD, DISSOLVED_COD, SUSPENDED_COD, BIO_SOL_COD, BIO_SUSP_COD
INERT_SOL_COD, INERT_SUSP_COD, AMMONIA, NITRATE, SOLUBLE_ORG_N
PART_ORG_N, SOLUBLE_P, PHOSPHOR, SUSPENDED_P, TSS, SS (same as TSS)
VSS, NVSS, BIOMASS, ALKALINITY (also known as ALK and CACO3)
There is the possibility of getting data from processes as well as streams let me know if you need the keywords for any process.
[IMS_INPUT]
This follows the same structure as IMS_EXTRACTION, and is used to define how a text file should be used to provide
data to STOAT. Let me know if you need any details on this.

Thank you for your answer. Is very kind from you to post this information for us to have more specialized use
of STOAT.

OpenMI is not an option for me because the programs that I want to link with STOAT are not complaint with
OpenMI (SWMM, WASP, MatLab scripts)
I have been trying to run STOAT from command line with the info that you provide here but I could not make it. I
have some questions that still puzzle me
1. Which kind of extension is the command file? I used a text editor to produce that file but I miss the extension, I
mean is a ".cmd" or ".bat" or something else?.
2. Where command and run files should be placed? I guest with the executable Stoat32.exe?
3. How to run from command line of windows? I use:
"c:\Program Files\WRc\STOAT\Stoat32.exe" FILE= 'CommandFile.bat' RUN= 'TVP_Gouda.pfs'
Or
"c:\Program Files\WRc\STOAT\Stoat32.exe" RUN= 'TVP_Gouda.pfs' FILE= 'CommandFile.bat'
It open the stoat GUI and does not execute nothing. I chose the pfs creation start and end without press button, I
will expect to run the model pre-configured, but no success so far!

4. Because I am trying to change the control parameters of the treatment work I also need to change the input file. I
will appreciate if you can give some more details of how to change the input file. I was thinking to use data base in
access and change directly there but if there is a better way with an input file, that will be great.
5. If any written documentation is available, I will appreciate if I can have it.
Thank you for all your help
Carlos

Dear Carlos,
1. The file extensions can be anything you wish. The file format was developed by DHI, and they used the
extension .PFS for both files. I don't remember what PFS stands for.

2. The command and run files can be placed anywhere; the FILE= and RUN= statements should then have a fullyqualified path. DHI had a product called ICS (Integrated Catchment Simulator) where a project would be created to
run MOUSE (sewer), STOAT (sewage works) and MIKE11 (river). The 'command file' was kept in the project top
directory, and the RUN files in subfolders for each program.
3. The order of FILE= and RUN= does not matter. STOAT looks for these as keywords, and expects only that there be
a space before the next keyword, and that the filenames be enclosed in apostrophes (')
4. Let me know what parameters you wish to change. The STOAT list is (a) rather extensive and (b) I cannot find the
formal documentation. The TVP project was done 1996 - 1998, from memory, and the project archive does not have
all the material. The paper records may have been destroyed because the work was done more than 10 years ago. I
can recreate the material from the STOAT source code, but would prefer to do it in bits as necessary, rather than to
try & capture everything.
STOAT should have run with what you described. I will paste some old PFS files that we have used.
5. There was written documentation, and I thought that I had put it in one of the STOAT reports. But looking through
it I cannot find it. At some point I will recreate it, using this discussion as a basis.
Example of a command file:
The RUN file is the second parameter on the PROCESS = line. Earlier I had that it should be specified as DUMMY, but
it may be better if it is specified to match the file passed on the RUN= parameter.
This file passed data to STOAT.
[IMS_INPUT]
[STOAT_PROCESS_INPUT]
PROCESS = 'STOAT', 'c:\stoatproj\tvpdemo\tvpdemo1.pfs'
[INPUT_LABEL]
LABEL_ID = 'QOUT-A010'
[DISCHARGE_STOAT]
LOCATION = 'stream 1'
EndSect // [DISCHARGE_STOAT]
EndSect // [INPUT_LABEL]
[INPUT_LABEL]
LABEL_ID = 'DO-A010'
[CONCENTRATION_STOAT]

LOCATION = 'DO', 'stream 1',1


EndSect
EndSect // [INPUT_LABEL]
[INPUT_LABEL]
LABEL_ID = 'T-A010'
[CONCENTRATION_STOAT]
LOCATION = 'TEMPERATURE', 'stream 1',1
EndSect
EndSect // [INPUT_LABEL]
[INPUT_LABEL]
LABEL_ID = 'DBOD-A010'
[CONCENTRATION_STOAT]
LOCATION = 'DISSOLVED_BOD', 'stream 1',1
EndSect
EndSect // [INPUT_LABEL]
[INPUT_LABEL]
LABEL_ID = 'SBOD-A010'
[CONCENTRATION_STOAT]
LOCATION = 'SUSPENDED_BOD', 'stream 1',1
EndSect
EndSect // [INPUT_LABEL]
[INPUT_LABEL]
LABEL_ID = 'AMM-A010'
[CONCENTRATION_STOAT]
LOCATION = 'AMMONIA', 'stream 1',1
EndSect
EndSect // [INPUT_LABEL]
[INPUT_LABEL]
LABEL_ID = 'PO4-A010'
[CONCENTRATION_STOAT]
LOCATION = 'PHOSPHOR', 'stream 1',1
EndSect
EndSect // [INPUT_LABEL]
EndSect // [STOAT_PROCESS_INPUT]
EndSect // [IMS_INPUT]

Example of a hydraulics (flow) data file


MOUSE
C:\ICS_MM1\ICSTEST1.PFS
QOUT-A010
DISCHARGE
m3/s
1998-01-01 00:00:00 0.1470
1998-01-01 00:05:00 0.1459
1998-01-01 00:10:00 0.1463
1998-01-01 00:15:00 0.1533

1998-01-01 00:20:00 0.1699


1998-01-...

Example of a water quality data file


MOUSE
C:\ICS_MM1\ICSTEST1.PFS
DO-A010 T-A010 DBOD-A010 SBOD-A010 AMM-A010 PO4-A010
DO TEMPERATURE DISSOLVED_BOD SUSPENDED_BOD AMMONIA PHOSPHOR
g/m3 Celsius g/m3 g/m3 g/m3 g/m3
1998-01-01 00:00:00 3.0000 10.0000 200.0000 10.0000 30.0000 10.0000
1998-01-01 00:05:00 3.0000 10.0000 200.0000 10.0000 30.0000 10.0000
1998-01-01 00:10:00 2.9791 9.9303 198.6062 9.9303 29.7909 9.9303
1998-01-01 00:15:00 2.8124 9.3747 187.4942 9.3747 28.1241 9.3747
1998-01-01 00:20:00 2.5901 8.6337 172.6732 8.6337 25.9010 8.6337
1998-01-01 00:25:00 2.3547 7.8492 156.9831 7.8492 23.5475 7.8492
1998-01-01 00:30:00 2.1701 7.2337 144.6746 7.2337 21.7012 7.2337
1998-01-01 00:35:00 1.9663 6.5542 131.0839 6.5542 19.6626 6.5542
1998-01-01 00:40:00 1.7040 5.6799 113.5978 5.6799 17.0397 5.6799
1998-01-01 00:45:00 1.4302 4.7674 95.3484 4.7674 14.3023 4.7674
1998-01-01 00:50:00 1.1885 3.9618 79.2357 3.9618 11.8854 3.9618
1998-01-01 00:55:00 1.0128 3.3761 67.5212 3.3761 10.1282 3.3761
1998-01-01 01:00:00 0.9214 3.0713 61.4269 3.0713 9.2140 3.0713
I will run STOAT with these files & update the comments based on my experience. Expect a post in the next day or
so.
Dear Carlos,
I got STOAT to run fine with the following.
RUN file, called TVP.PFS
[STOAT_SIMULATION_BLOCK]
DATABASE_NAME = 'd:\My Documents\SH_2010 ASM#1.mdb'
WORK_ID = 1
RUN_ID = 3
OLD_RUN = 2
START_CODE = 0
CLOSE_ACTION = -1
RUN_ACTION = -1
START_DATE = # 2008-07-22 00:00 #
END_DATE = # 2009-05-31 00:00 #
INPUT_INTERVAL = 1
OUTPUT_INTERVAL = 1
EndSect
Command file, called STOAT.PFS. Comments are preceded by //
[IMS_PROGRAM_EXECUTION]
[EXECUTION_BLOCK]
PROCESS = 'STOAT', 'd:\stoat\TVP.PFS'
// Must be name of RUN file and must match case as used on command line.
EndSect

EndSect
[IMS_EXTRACTION]
[STOAT_PROCESS_OUTPUT]
PROCESS = 'STOAT', 'TVP.PFS'
SOURCE_NAME = RESULT_FILE
EXTRACTION_FILENAME = 'd:\stoat\STOAT Output.dat'
EndSect
EndSect
[EXTRACTION_LABEL]
LABEL_ID = 'Stream 1'
[DISCHARGE]
DISCHARGE_TS = 'Crude sewage'
EndSect
EndSect
Command line: stoat32 FILE=d:\program files\wrc\stoat\STOAT.pfs
RUN=d:\program files\wrc\stoat\TVP.PFS
Case of RUN= filename MUST match that of the file specified in the EXECUTION_BLOCK

Success!
Thank you very much for all the information that you post here. Indeed it works also with my Command and Run
files. I lunch the run from command window and it works ok.
Now I will try to do it from my code and modify the input, so I can run the optimization loop. I will post advance here
for that.
Thanks
Carlos
Carlos PhD thesis can be found at http://repository.tudelft.nl/assets/uuid:5cea81ea-c0a4-409a-810b5d84ac77d761/UNESCO-IHE_PhD_VELEZ_THESIS.pdf

Vous aimerez peut-être aussi