tune {RHMS} | R Documentation |
tunning an RHMS model
Description
a function for tunning an RHMS model based on a set of observed time series, using particle swarm optimization
Usage
tune(object,targetObject,decisionObjects,
observationTS,delay=0,
transformBandWith=list(ct=c(1 , 2.5),
cp=c(0.1, 0.3),
cn=c(25 , 85 ),
k =c(0.1, 2 )),
routingBandWith=list(manning = c(0.0001, 0.1),
x = c(0.2 , 0.6),
k = c(1 , 5 )),
maxiter=NA,update=FALSE,plot=FALSE)
Arguments
object |
an object from class of |
targetObject |
an object from either of classes: |
decisionObjects |
A list of objects, also, already existing in the |
observationTS |
a vector: an observed flow time series (cms) |
delay |
(optional) an integer presenting the number of time steps to delay |
transformBandWith |
an list: a list of vector(s), including upper and lower limit of parameters of tansformation methods. Each parameter search domain is set as a two-value vector, whose first element indicates lower limit and second elemnt is upper limit.
|
routingBandWith |
an list: a list of vector(s), including upper and lower limit of parameters of routing methods. Each parameter search domain is set as a two-value vector, whose first element indicates lower limit and second elemnt is upper limit.
|
maxiter |
(optional) an integer: maximum number of iterations. default to the square of dimension of decision variables |
plot |
(optional) logical: plots the optimization results |
update |
(optional) logical: If FALSE, the optimized parameter(s) are returned,If TRUE, the calibrated object from class of |
Value
a vector of tunned parameters or an object from class of createBasin
Author(s)
Rezgar Arabzadeh
References
Kennedy, J. (1997). "The particle swarm: social adaptation of knowledge". Proceedings of IEEE International Conference on Evolutionary Computation. pp. 303-308
Examples
J1<-createJunction (name="J1")
R1<-createReach(name="R1",routingMethod="muskingum",
routingParams=list(k=3,x=0.2),
downstream=J1)
R2<-createReach(name="R2",routingMethod="muskingumcunge",
routingParams=list(bedWith=50,
sideSlope=2,
channelSlope=0.0005,
manningRoughness=0.025,
riverLength=100),
downstream=J1)
S1<-createSubbasin(name = "S1",
precipitation=sin(seq(0,pi,length.out=20))*40,
Area=100,downstream=R1,
transformMethod="SCS",lossMethod="SCS",
transformParams=list(Tlag=4),lossParams=list(CN=60))
S2<-createSubbasin(name = "S2",
precipitation=sin(seq(0,pi,length.out=20))*30,
Area=300,downstream=R2,
transformMethod="snyder",lossMethod="horton",
transformParams=list(Cp=0.17,Ct=2,L=30,Lc=15),
lossParams=list(f0=10,f1=4,k=1))
basin1<-createBasin(name = "Ghezil_Ozan",
simulation=list(start='2000-01-01',
end ='2000-01-05',
by =3600))
basin1<-addObjectToBasin(S1, basin1)
basin1<-addObjectToBasin(S2, basin1)
basin1<-addObjectToBasin(R1, basin1)
basin1<-addObjectToBasin(R2, basin1)
basin1<-addObjectToBasin(J1, basin1)
## Not run: plot(basin1)
simulated<-sim(basin1)
plot(simulated)
observationTS1<-simulated$operation$junctions[[1]]$outflo[,1]
set.seed(1)
observationTS1<-observationTS1+rnorm(length(observationTS1),0,25)
y<-observationTS1; x<-1:length(observationTS1)
observationTS1<-predict(loess(y~x),x)
observationTS1[which(observationTS1<0)]<-0
observationTS<-observationTS1
plot(simulated$operation$junctions[[1]]$outflow[,1],typ='o',ylab='flow rate (cms)',xlab='time step')
lines(observationTS,col=2)
transformBandWith=list(ct=c(1 ,2.5),
cp=c(0.1,0.3),
cn=c(25 ,85) ,
k =c(0.1,2))
routingBandWith=list(maning = c(0.0001,0.1),
x = c(0.2 ,0.6),
k = c(1 ,5))
targetObject<-J1
decisionObjects<-list(R1,R2,S1,S2)
## Not run:
tune(object=basin1,
targetObject=targetObject,
decisionObjects=decisionObjects,
observationTS=observationTS,
routingBandWith=routingBandWith,
transformBandWith=transformBandWith,
plot=TRUE)
## End(Not run)