Owa-epanet python wrapper settimeparam issue

I am currently trying to generate a network from scratch using the toolkit functions, but get an error when trying to set the simulation start time.

The following code captures the problem part:

import epanet.toolkit as en

def main():
    proj = en.createproject()
    en.init(ph=proj,
            rptFile='report.rpt', outFile='',
            unitsType=en.LPS, headLossType=en.DW)
    en.settimeparam(proj, en.STARTTIME, 0)

if __name__ == "__main__":
    main()

This gives Exception: Error 251: function call contains invalid parameter code.

en.settimeparam works fine with other parameters, and en.gettimeparam works fine with en.STARTTIME.

Any suggestions what I might be doing wrong?

0 is the wrong format. EPANET would be looking for 0:00as the start time

It is the parameter code (second argument) that is causing the problem though, not the 0 value?

According to the toolkit documentation (http://wateranalytics.org/EPANET/group___options.html), values for time paramters should be given in seconds (settimeparam doesn’t accept a string for the value), and when I use en.gettimeparam(proj, en.STARTTIME) with another network this returns an integer rather than a time in hh:mm format - so using 0 should be fine.

The unfortunate reality is that the C library does not allow setting the start time via the API. You can see a list of the parameters that are allowed in the function implementation:

… Please feel free to open an Issue on the repo for this addition!

Ah, that is indeed a shame! But thanks for clarifying. I have opened a new issue here.