23 lines
607 B
Matlab
23 lines
607 B
Matlab
function dataout2=limit_chk_process(datain,upper_lmt,lower_lmt,data_pass_to_loadflow)
|
|
|
|
|
|
datain=round(datain);
|
|
upper_cond=datain>upper_lmt;
|
|
lower_cond=datain<lower_lmt;
|
|
dataout=(datain.*(~(upper_cond+lower_cond)))+...
|
|
upper_lmt.*upper_cond+lower_lmt.*lower_cond;
|
|
|
|
if(~isempty(find(upper_cond)) | ~isempty(find(lower_cond)) )
|
|
dataout=randsrc(1,length(datain),[lower_lmt(1) upper_lmt(1)]);
|
|
dataout1=dataout;
|
|
else
|
|
dataout1=dataout;
|
|
end
|
|
if(length(unique(dataout1))==1)
|
|
dataout=randsrc(1,length(datain),[lower_lmt(1) upper_lmt(1)]);
|
|
dataout1=dataout;
|
|
|
|
end
|
|
dataout2=dataout1;
|
|
|