-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Input API #2
Comments
EPANET has a toolkit API containing some good starting point ideas. https://github.com/OpenWaterAnalytics/EPANET/blob/master/src/toolkit.h Lines 243 and 244 reference the functions to "set" values for a node and a link. This could be expanded in SWMM to adjust hydrology and Ground water parameters. |
You and I must be drinking from the same well. I've been thinking about this recently too. Would be nice to brainstorm current/future needs for both softwares, maybe nail down a common set of conventions? |
@samhatchett Good timing! So the main SWMM InputAPI use case I foresee is for calibration - mostly oriented toward planning. However, there has been talk up here regarding parameter manipulation during simulation time (@rkertesz @lmontest )has some thoughts on this). |
the ultimate goal on the EPANET side is to have its code split up into three different modules:
of course there's a fair amount of work to do. I'm working on scraping together some thoughts related to structuring of the API for creating/altering network topology - I'd be interested in your thoughts once I have a draft. |
I'll let @lmontest chime in but, while we currently can manipulate anything that is controlled in the control section (like orifices), what would be nice is intra-simulation manipulation of things that aren't exposed right now, such as a property for a pipe. This can help not only with calibration and tuning as well as controlling for variables like sediment during a long-term simulation. |
@samhatchett, could you elaborate on your goals for the "Project Definition I/O" point? |
sure, what I mean is pretty simple. for maintainability and extensibility, we need to start pulling the code apart into logical units. the core of that outcome is going to be a streamlined hydraulic engine and associated structs (what i referred to as the "project definition"). you could also call it the "business logic / data model" unit. we will need to provide an API into that data model, which will be capable of programmatically constructing/ altering a hydraulic model and its associated parameters. Everything that is now done through the specification in the |
As it relates to the work we engage regularly, we find the need to be able to manipulate an asset based on the status of the system. Ideally designing RTC algorithms that can “measure” the state of the system (flows, depths, capacities, even water quality) and adjust setpoints for pumps, orifices, weirs, etc. This means that the control rules must be able to interact during simulation time with the model. The ideal situation would allow an external program to receive hydraulic status of select assets periodically and adjust setpoints at such points in time. To that end, and in our own effort to enable such applications, we have modified SWMM to allow simulations to halt periodically, populate an output database table with hydraulic states, allow time for a program to consume such data to generate appropriate setpoints, put them in an input database table, let SWMM to consume the new setpoints, and resume the simulation. The choice of using a database for the interaction with SWMM was driven by the ease of modifying the code and enable a variety of programs to interact with the data through ODBC connectors. We have demonstrated this by building a controller in Matlab. An even nicer application would be to interface SWMM directly with a PLC. I think that porting similar functionality with a DLL API should be straightforward. The main idea remains to break SWMM out of being a modeling tool and make it available to applications such a operators training modules, real time scenario analysis, and real time control applications. Cheers! |
reconfigure subcatch buildup as part of subcatchment stats
@lrntct, i must have removed that at some point. But truth be told; I doubt any of the ideas I had then were worthwhile :-) Here’s some stuff on the api. https://github.com/OpenWaterAnalytics/Stormwater-Management-Model/wiki/Enhanced-API I think we should have a roadmapping meeting to talk about the future of the data model and API |
One great addition would be to be able to add or remove objects from the simulation. |
@lrntct, I'm in agreement. I've read up on a few strategies to accomplish what we are trying to do. I just read one thread that essentially does a https://stackoverflow.com/questions/12917727/resizing-an-array-in-c
If we can pre-process an entire network before starting a simulation (which I imagine we are all in agreement).. we could add and remove items, and do a final sweep before running through validation.
I also agree that this would be an important change. The catch to this whole thing is going to be managing the connections. Links current index the upstream and downstream node indexes. So we are going to need to come up with a strategy to make sure as things change, the indeces still work out. @michaeltryby has been recommending the project incorporate a transactional data model. He can better explain his ideas |
we've done some similar work on EPANET -> OpenWaterAnalytics/EPANET#43 and OpenWaterAnalytics/EPANET#88 In basic form, we do use a realloc - which may end up being inefficient, but the primary purpose of the addition was to expand what was possible to do with the toolkit. And once we build and profile that capability, we can then optimize. And since it was done outside the "customary" procedure of opening an A transactional model may make plenty of sense, but smells more like an extension than something to build into the engine API. |
@bemcdonnell do we want to keep this ticket open? |
I think it's time to dream up an Input API that will find its way into the formal distribution of SWMM. :)
@rkertesz @fmyers @michaeltryby
The text was updated successfully, but these errors were encountered: