EPANET icon indicating copy to clipboard operation
EPANET copied to clipboard

adds an API function to get information about upcoming events

Open samhatchett opened this issue 2 years ago • 6 comments

I tried to make this as non-invasive as possible - but i did change the signature for a very old function to return an index instead of being declared void. Added doxy markup for an explanation of the new API.

samhatchett avatar Jul 27 '22 18:07 samhatchett

@samhatchett , in line 647 the control index is not returned, is it because its not needed there?

eladsal avatar Jul 27 '22 19:07 eladsal

@eladsal that's right - the old behavior doesn't change within that calling code, this PR just hijacks the control timestep function get information back about which element caused the control action so it can be used by the new calling code.

samhatchett avatar Jul 28 '22 15:07 samhatchett

Thank you. Can you please also add the single-threaded version of the function?

eladsal avatar Jul 28 '22 16:07 eladsal

@eladsal yes, I would be happy to add s/t versions.

samhatchett avatar Jul 28 '22 20:07 samhatchett

@eladsal I have made the suggested changes, if you wouldn't mind taking a look. thanks!

samhatchett avatar Aug 08 '22 16:08 samhatchett

@samhatchett my concern is with the eventType in EN_timetonextevent. Such a type may be difficult to use in other programming languages. For example, in EN_getlinktype we use an Int for the link type. Is there a function we use a user-defined type?

eladsal avatar Aug 13 '22 15:08 eladsal

@eladsal Looking over this again, I'm re-discovering that the C API relies on client code to handle the implicit casting from enum types to integers. I will change the new functions to reflect that convention. Thanks for the comments, and i regret that it's taken me this long to circle back!

samhatchett avatar Jan 19 '23 14:01 samhatchett

Thank you @samhatchett, I think we are good to go.

eladsal avatar Jan 19 '23 19:01 eladsal