August 4, 2019 at 12:42 am #6157
I would like to run EFDCplus from within a Matlab script. I have an existing Matlab script that does automated calibration based upon many runs of EFDC. Is it possible to run EFDCplus from within a windows command line? I can do it w/ the single threaded version of the code that I’ve compiled and run on my Mac, I but haven’t gotten it working on the PC. I’ve experimented w/ copying the .exe and some .dll files to the folder w/ the .inp files. There seems to be a license file missing. Can you advise if I can do this, and if so, how?
Jim BowenAugust 4, 2019 at 4:49 am #6158Tom MathisModerator
You can definitely do that by having your MATLAB script run a simple batch file using the Windows command line. A few things:
– The EFDC+ executable does not need to be in the same folder as the model input files, just leave it in the directory it was installed to. This will ensure that your license works.
– You can run an EFDC+ model from the folder with the model input files by creating a batch file which calls the EFDC+ in it’s installed location.
– When the model starts running, an empty file called 0run will be created in the same folder as the model input files. This file will be deleted if the user ends the run, or if the run is completed. However, if the model crashes due to an error then the 0run file will not be deleted.
An example of the batch file for EFDC+, which would reside in the same folder (the file created by EFDC_Explorer is always called 0run_efdc.bat):
TITLE D:\Projects\Portland Harbor RM 4-7 Group\temp\Hyd_00
CD “D:\Projects\Portland Harbor RM 4-7 Group\temp\Hyd_00”
The first line sets the KMP offset, which helps you run multiple models efficiently on the same processor. More info here: https://eemodelingsystem.atlassian.net/wiki/spaces/EEREF/pages/2387021/KMP+Offset
The next line is the title of the run, this is the folder with the model input files.
The next 2 lines tell the command line to change the current directory to the folder with the model input files.
The last line calls the EFDC+ executable (make sure this matches the original install path, so that your license will work), and sets the number of threads for the run. In the example I gave above, the run would have used 2 processor cores for the simulation.
Hope that helps. Let me know if you have any more questions.
Tom MathisAugust 4, 2019 at 8:31 am #6159
Thanks Tom for the quick response. Duh, it should have occurred to me to try running the batch file instead of the .exe file. I have seen those files in the folders. I opened a command window to test running one of those batch files. It worked fine. I think I should be good to go. Thanks for the info on the batch file. I will be creating them inside the matlab script so it’s good to know what each lines does. I will let you know when I’ve got the whole thing working.
JimAugust 8, 2019 at 10:00 pm #6175Dimitri KouomParticipant
Please can you share your Matlab script for the automatic calibration ? Actually, with my colleagues we are planning to investigate this interesting path. So we are kindly interested to work in collaboration with you in order to make it possible.
We appreciated !
RalphSeptember 2, 2019 at 9:07 pm #6210
Ralph, I might be able to share the MATLAB code sometime, but not right now, as it’s set up very specifically for how we do things. I just don’t have time to adequately set it up and document it for someone else’s use until I get this project report in at the end of the year.
FYI, what the system requires is a way to run EFDC+ many times, with an assessment of calibration performance occurring we each run. The system must be able to vary EFDC+ parameters for each run by editing the WQ3DWC.INP file. In my code that is done w/i the MATLAB code. Assessment of calibration performance is also done w/i the MATLAB code. In the system we’ve got going now we’re doing Latin Hypercube sampling of parameters, with the computing work shared by a computer cluster that work cooperatively to make and analyze the runs. I’ve used the system before w/ CE-QUAL-W2 to do a full factorial analysis of parameters. Check out the paper we wrote (Bowen and Harrigan 2018) for more info. We can talk next year if you’re still interested.
- You must be logged in to reply to this topic.