-
Notifications
You must be signed in to change notification settings - Fork 0
Home
This repo contains a draft CalSIM study that has been modified to use the calsurrogate libarary and a TensorFlow ANN for Emmaton. This is for surrogate work -- no fitness for a study or any other purpose is implied.
- This isn't a real CalSIM study.
- Please use the Issues tab on the GitHub repo or that of the calsurrogate libarary. We'll be looking at both, though obviously if an issue has to do with WRESL it belongs here.
In order to use this example you need the following:
- A recent version of the WRIMS GUI that has been modified. At this time, the version is an amalgam of a 2023-10-28 compile plus a modification to one of the jar files ... which is to say it is pretty far from being an open source product or even version controlled. So right now this is for collaborators.
- TensorFlow Java jni jar file and dll. This is embedded in the /lib of the WRIMS distribution mentioned above and doesn't get modified.
- To recompile and work on the calsurrogate library, you need that calsurrogate java code GitHub page. Note that this is only compilable with Java 1.8 right now.
- This study. Within this study there are some changes to:
- the launch file to register logging (which helps when analyzing ANNs offline)
- the main wresl file defining the numbering of the cycles. There is a funny design issue where the labels and a variable called cyclenum can get out of sync. I fixed that, but apparently it comes back to life so the two definitions need to be made proximate. This is a bigger calsim issue ... but if you do diffing it might show up.
- Java code in the Runs/External directory, currently limited to Emmaton and the SalinitySurrogateSetup class which will be specific to implementations.
- The DeltaExtFuncs_7inpANN.wresl where the External functions are declared.
- Emmaton constraints in Runs/Delta/ANN, which may change as things are developed.
For users with some CalSIM experience the example should run as-provided. You would not download the calsurrogate library, but you would need the updated GUI and calsim3-dcr example from thie repo
If you recompile calsurrogate you need to put the jar file in the /lib directory of the wrims gui. The calsurrogate.jar name is hardwired, which limits the "plugin" feel.
In order to keep the calsurrogate library independent of the larger CalSIM compile, most of the working code is in the library and a small amount of bridge code is in the /Run/External directory of the study. WRIMS can access java functions that are declared and that are located within its /Run/External directory. Howevever there are a few tricks/limitations:
- In order to recompile that code you would go to /Run/External and issue a command like this:
javac -source 1.8 -target 1.8 -classpath d:\path\to\wrimsv2_gui\lib\calsurrogate.jar;d:\path\to\wrimsv2_gui\lib\WRIMSv2.jar .\wrimsv2\external\*.java
- The code needs to access the calsurrogate.jar file as described above.
- The external functions need to be registered. This is in path\to\calsim3-dcr\Run\Delta\DeltaExtFuncs_7inpANN.wresl
- The type is shown as F90. As far as we know, Java is not available yet. However, note that this should be rare since the new material mostly goes in SalinitySurrogateSetup.java. Any additions should be rare.
- Any functions that are used in WRESL need to follow the External interface and have a name like Functionlowercase.java. Note that there is a utility in the WRIMS GUI to help generate the function interface needed.
- The calsurrogate plumbing for a second site may not all be there -- contact me for the first time.
- Add the tensorflow model to the External/ann_calsim-main directory. Please keep style (case and readability).
- Create a function in SalinitySurrogateSetup to load the function. Most of it will probably follow the Emmaton example. You will register the surrogate for whatever site you are adding inside that SalinitySurrogateSetup function.
- Create wresl analogous to Emmaton.
- This has never been done. Please contact me.
- Add the tensorflow model to the External/ann_calsim-main directory
- Create a function in SalinitySurrogateSetup to load the function. This time you will have to register the surrogate and the index within the surrogate output of the station in question. This probably is incomplete, but fairly thought out.
- Create wresl analogous to Emmaton. There shouldn't be much different in the WRESL.