The possible values that the calibration parameters may have can be indicated in different ways, for example, through their respective statistical distributions. However, as indicated before and for the sake of simplicity, in this tutorial, let’s assume that only a limited amount of values is possible for each of them, and that the possible combinations of those cases are equally likely.
The kernel of the calibration algorithm is then a double loop with which we will iterate along all possible combinations of the parameters used in the procedure, BC at Boxbergen and roughness Strickler coefficient ksfor the default value of the Main type of cross section roughness. When the parameters have been updated, the model should be run. Then, the model results at the gauging station will be retrieved, and the deviation of these results with respect to the measured data will be calculated. The list containing the calibration parameters values and the goodness of the corresponding fit will be added to listCalibration. Finally, the entire time series of the results will also be added to the corresponding list timeSeriesToCompare. This last variable can be used, for example, in case we decide to change the threshold for which the model is considered to be warming up, and therefore, the results should be neglected, without having to run all the simulations one more time (since this process can be very time-consuming).
Main calibration loop
# Main calibration loop
for bcValue in rangeBC:
# Adjust boundary condition value
bcCalibration.Flow = bcValue
for roughnessValue in rangeRoughness:
# Adjust default roughness value for roughness section Main
roughnessMain.DefaultValue = roughnessValue
RunModel(flowModel, showDialog=True)
# Add deviation of results of current run with respect to measurements
calibResults = GetTimeSeriesFromWaterFlowModel(flowModel, calculationPoint, "Water level")
deviation = GetAverageDeviation(measuredTimeSeries, calibResults, startAt = warmUpTimeSteps)
listCalibration.append([bcValue, roughnessValue, deviation])
# Add timeseries to timeSeriesToCompare list
timeSeriesToCompare.append(calibResults)