Uncertainty Analysis

Hello everybody

I want to examine uncertainty of rainfall duration with the monte carlo method. So I should link SWMM with MATLAB program and run the program many times (here 1000 times). In each iteration I should change the duration of rainfall and so the temporal pattern of rainfall will be changed.  Now I want to know is it possible that I change rainfall timeseries for a gage in each iteration?

 At this stage I have prepared a code that generate different  types of rainfall timeseries. How can I introduce these timeseries to the program that is linked with MATLAB in each iteration?

Best Regards

You need to be a member of SWMM 5 or SWMM or EPASWMM - (not formally associated with EPA) to add comments!

Join SWMM 5 or SWMM or EPASWMM - (not formally associated with EPA)

Email me when people reply –


  • thanks for your reply. I am planning to call swmm in matlab. Could you please tell me how to change a variable during running swmm in matlab environment?thanks
  • It is not hard to add the ability to change a variable during the run in SWMM 5.  You need to alter the C and Delphi code but it is only a few lines of code in the engine and Delphi.  I will add a blog with one example so you can see how it is done.  

    Another idea would be to use the ADD IN tools - what exactly are your trying to change during the simulation run?

    What are Add-In Tools
    Add-in tools are third party applications that users can add to the Tools menu of the main SWMM menu bar and be launched while SWMM is still running. SWMM can interact with these applications to a limited degree by exchanging data through its pre-defined files or through the Windows clipboard. Add-in tools can provide additional modeling capabilities to what SWMM already offers. Some examples of useful add-ins might include:
    · a tool that performs a statistical analysis of long-term rainfall data prior to adding it to a SWMM rain gage,  
    · an external spreadsheet program that would facilitate the editing of a SWMM data set,  
    · a unit hydrograph estimator program that would derive the R-T-K parameters for a set of RDII unit hydrographs which could then be copied and pasted directly into SWMM's Unit Hydrograph Editor,  
    · a post-processor program that uses SWMM's hydraulic results to compute suspended solids removal through a storage unit,  
    · a third-party dynamic flow routing program used as a substitute for SWMM's own internal procedure.  

    The figure below shows what the Tools menu might look like after several add-in tools have been registered with it. The Configure Tools option is used to add, delete, or modify add-in tools. The options below this are the individual tools that have been made available (by this particular user) and can be launched by selecting them from the menu. 
  • so we can play swmm only with input and output files,right? Can we use a function to reset a parameter value during running swmm like epanet toolkit doing?thanks
  • Dear Lionel,

    This matter is explained in Appendix D of SWMM manual under the title of “Command line SWMM”. So in MATLAB you can use below format under DOS window:

    "The address of place that SWMM is there"   input file name.inp   output file name

  • Hi Fateme Fallah,


    I am doing something similar but in my case I am varying the infiltration factor. I am not very good with Matlab so require a bit of help on the coding. I would like to check if you have been successful in your attempt to link Matlab and SWMM 5? Would you be able to share with me on how you did it? Thank you!

  • I would suggest having your rainfall as an external time series and have that external time series change before each iteration.



    Change External Time Series

    Call SWMM5.EXE and have a Raingage use the External Time Series




    I have not done this myself but it should be feasible.

This reply was deleted.