# 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)