Open guanze opened 7 years ago
@xavierong Hello Xavier,
I didn't comment the code and I apologise.
The line that you are looking at was just to generate a cyclic (seasonal) temperature profile that later will be used to produce a synthetic demand profile.
Instead of it, you could use actual temperature data and actual demand data to use with you regression model.
demand$temp <- -5*cosd(demand$days)-4*cosd((360*demand$hours/24))+10+rnorm(8760,mean=1,sd=1)
demand$demand <- ifelse(demand$monthsN==12,50,ifelse(demand$monthsN==1,150,100))+ifelse(demand$weekdaysN<6,100,20)+(demand$temp+5)^2
@xavierong as you can see, I used the demand$temp variable to generate de demand$demand, that is because there is usually a correlation between the temperature given by the time of the date and season of the year and the demand on the grid.
I know what u mean, thanks a lot
From: Luis Castro Date: 2017-02-14 10:54 To: luisecastro/economic_dispatch_sim CC: xavierong; Mention Subject: Re: [luisecastro/economic_dispatch_sim] Question (#1) @xavierong as you can see, I used the demand$temp variable to generate de demand$demand, that is because there is usually a correlation between the temperature given by the time of the date and season of the year and the demand on the grid. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
hi, sorry again, I have some question about Lagrange Multipliers, I can not understand what does this mean, and where the Lagrange Multipliers code in R, thank u a lot.
`eco_disp <- function(cs,pt){ ptt <- pt dcs <- cs[,-4] dcs$a <- 2*dcs$a temp <- NULL repeat{ lambda <- (sum(dcs$b/dcs$a)+pt)/sum(dcs$a^-1) p <- (lambda-dcs$b)/dcs$a less <- which(p<dcs$p.min) more <- which(p>dcs$p.max)
if(length(less)!=0){
pt <- pt-sum(dcs$p.min[less])
temp <- rbind(temp,cbind(cs[less,],power=dcs$p.min[less]))
}
if(length(more)!=0){
pt <- pt-sum(dcs$p.max[more])
temp <- rbind(temp,cbind(cs[more,],power=dcs$p.max[more]))
}
flag <- length(less)==0 & length(more)==0
if(!flag) dcs <- dcs[-c(less,more),]
if(!flag) cs <- cs[-c(less,more),]
if(flag) break
}
temp <- rbind(temp,cbind(cs,power=p))
temp$cost <- temp$a*temp$power^2+temp$b*temp$power+temp$k
temp$rate <- temp$cost/temp$power
temp$ci <- 2*temp$a*temp$power+temp$b
temp
}`
This part is the calculation of the Lagrange multipliers. Take a look at:
Basically is just calculating the lowest differential coast at every load profile, lambda calculation is at the first part for the quadratic equation which simulates the production costs of the plants.
Thank you very much! Sorry for such a long time did not reply, because busy work I forgot this thing. Thanks again.
hi, I have some question if u don't mind, could u please tell me what is "demand$temp <- -5cosd(demand$days)-4cosd((360*demand$hours/24))+10+rnorm(8760,mean=1,sd=1);". What does this mean? I don't get it, thx