Error in the calculation of the objetive function

215 views
Skip to first unread message

Nerea Bilbao

unread,
Feb 1, 2023, 3:15:35 PM2/1/23
to R-SWAT
Dear all,

I am encountering some problems that maybe you can help me to solve.

I just started using R-SWAT and I want to perform a sensitivity analysis of the monthly flow variable for SWAT+ data. I have followed the steps you indicate in the video tutorial (https://www.youtube.com/watch?v=UOknxfrzplY&t=2s) and I have been fulfilling the steps one by one without errors. I have run the model and it seems that it performs well according to the CurrentSimulationReport.txt.

However, I have problems with section 4. Evaluation of results. After defining the objective function and entering the observed flow data in the correct format, I click on the button to calculate the objective function and I get the results attached in the screenshots.

As you can see in the ss_02.png, the objective function does not change with each simulation.

What can be the origin of the problem? How can I solve it?

Thank you very much in advance 

ss_03.png
ss_02.png
ss_01.png

Tam Nguyen

unread,
Feb 2, 2023, 4:13:56 AM2/2/23
to R-SWAT
Hi Nerea,

I could be the case that you didn't tell SWAT+ to print out the output file at monthly so the output file is the same for all simulations. Please try to set this value is "yes". If the problem still persist, please let me know

Cheers,
Tam

Capture.PNG

Nerea Bilbao

unread,
Feb 2, 2023, 4:59:50 AM2/2/23
to R-SWAT

Hello Tam,

Thanks for the quick answer. If I understood you correctly you asked me to change the simulation in SWAT+ so that it prints me the file channel_sd_mon.txt. I have already done that and reproduced the sensitivity analysis process with R-SWAT again. I still have the same problem...

Tam Nguyen

unread,
Feb 2, 2023, 7:40:24 AM2/2/23
to R-SWAT
could you send me your RSWATproject.rds (and TxtInOut folder)?

Nerea Bilbao

unread,
Feb 2, 2023, 9:07:17 AM2/2/23
to R-SWAT
I shared with you a drive folder with the data you requested.
Thank you,

Tam Nguyen

unread,
Feb 3, 2023, 5:18:11 AM2/3/23
to R-SWAT
Hi Nerea,
I have checked the data that you shared. In the file.cio (Line 22, column 3 - attached below ) you didn't put the "calibration.cal". That why SWAT+ will not run with the provided parameter values in this file and you will got the same simulation for all simulations => so the model performance is the same

It should work if you replace the text "null" with "calibration.cal" in line 22 - column 3 in this file.cio file

Capture.PNG

Nerea Bilbao

unread,
Feb 3, 2023, 8:38:40 AM2/3/23
to R-SWAT
Hi Tam,

Solved! That was the problem. Thank you very much for your help and quick answers. RSWAT is a very complete tool.

Cheers
Message has been deleted

Tam Nguyen

unread,
Aug 1, 2023, 2:26:02 AM8/1/23
to R-SWAT
Hi Aseelabde....I run your project and it works (the objective function values are NOT the same) - please see attached sreenshot
Untitled.png
On Monday, July 31, 2023 at 11:52:01 PM UTC+2 aseelabde...@gmail.com wrote:
Hi Tam,

Thank you for the great R-SWAT tool!
I'm currently encountering a similar issue as Nerea. Despite following your suggestions, I haven't been able to resolve the problem, and I'm still getting the same results for the different parameter sets. Could you please assist me in identifying the potential cause behind this issue?

I have uploaded the R_SWAT and TextInOut folder to the following link.


Regards

Louise Malmquist

unread,
Aug 2, 2023, 4:29:31 AM8/2/23
to R-SWAT
Dear all

I also faced similar problems with the objective function. After reading through and testing the solutions provided here in the google group, the only solution that worked for me was to run R-SWAT from an external hard drive and keep my project file in the  C:/ folder, as suggested here: https://groups.google.com/g/r-swat/c/oEadVEnsxPk/m/3JKwCpNKAgAJ 

Hope it works.

Kind regards,
Louise

Reply all
Reply to author
Forward
0 new messages