⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 plant.cpp

📁 求解梯级水库群优化调度
💻 CPP
📖 第 1 页 / 共 2 页
字号:
	    h1=GetSectionWaterLevel(section-1);
	else 
		h1=GetStartLevel();
	v2=GetPlantVolume(section);
	v1=GetPlantVolume(h1);
	down=GetSectionIntervalFlow(section)+last_down+(v1-v2)/GetSectionTime();
	hf=GetPlantTailLevel(down);
	power=GetSectionPower(section);
	return power/(GetEvageCoeff()*((h1+h2)/2-hf-GetEvageLevelLost()));	
}

double CPlant::GetPlantVolume(double level)
{
	//注意:此处第1个参数是0次方的系数,第2个参数是1次方的参数
	//由水位求库容,库容单位为万立方米,水位单位为m
	double result=0;
	for(int i=0;i<ParamNum;i++)
		result+=GetVolumeLevelParam(i)*pow(level,i);
	return result;
}
double CPlant::GetPlantLevel(double volume)
{
	//注意:此处第1个参数是0次方的系数,第2个参数是1次方的参数
	//由库容求水位,库容单位为万立方米,水位单位为m
	double result=0;
	for(int i=0;i<ParamNum;i++)
		result+=GetLevelVolumeParam(i)*pow(volume,i);
	return result;
}
double CPlant::GetPlantTailLevel(double downflow)
{
	//注意:此处第1个参数是0次方的系数,第2个参数是1次方的参数
	double result=0;
	for(int i=0;i<ParamNum;i++)
		result+=GetTailFlowParam(i)*pow(downflow,i);
	return result;
}
double CPlant::GetPlantLostLevel(double powerflow)
{
	//注意水头损失与发电流量2次方成正比
	return GetLevelLostParam()*pow(powerflow,2);
}

int CPlant::GetSectionNum(){return SectionNum;}
int CPlant::GetPlantNum(){return PlantNum;}
int CPlant::GetParamNum(){return ParamNum;}
double CPlant::GetSectionTime(){return SectionTime;}
string CPlant::GetPlantName(){return PlantName;}
int CPlant::GetStartSectionSerial(){return StartSectionSerial;}
double CPlant::GetEvageCoeff(){return EvageCoeff;}
double CPlant::GetStartLevel(){return StartLevel;}
double CPlant::GetStoredPrice(){return StoredPrice;}
double CPlant::GetNormalLevel(){return NormalLevel;}//正常蓄水位,标记位N
double CPlant::GetDeadLevel(){return DeadLevel;}//死水位,标记位D
double CPlant::GetLimitLevel(){return LimitLevel;}//汛期限制水位
double CPlant::GetDesignLevel(){return DesignLevel;}//设计洪水位
double CPlant::GetCheckLevel(){return CheckLevel;}//校核洪水位
double CPlant::GetHighLevel(){return HighLevel;}//防洪高水位
double CPlant::GetLevelLostParam(){return LevelLostParam;}//
double CPlant::GetMaxWaterLevel(int m){return MaxWaterLevel[m];}
double CPlant::GetMinWaterLevel(int m){return MinWaterLevel[m];}
double CPlant::GetMaxPower(int m){return MaxPower[m];}
double CPlant::GetMinPower(int m){return MinPower[m];}
double CPlant::GetMaxPowerFlow(int m){return MaxPowerFlow[m];}
double CPlant::GetMinPowerFlow(int m){return MinPowerFlow[m];}
double CPlant::GetMaxDownFLow(int m){return MaxDownFlow[m];}
double CPlant::GetMinDownFlow(int m){return MinDownFlow[m];}
double CPlant::GetSectionIntervalFlow(int m){return SectionIntervalFlow[m];}
double CPlant::GetVolumeLevelParam(int m){return VolumeLevelParam[m];}
double CPlant::GetTailFlowParam(int m){return TailFlowParam[m];}
double CPlant::GetSectionPowerPrice(int m){return SectionPowerPrice[m];}
double CPlant::GetLevelVolumeParam(int m){return LevelVolumeParam[m];}
double CPlant::GetEvageLevelLost(){return EvageLevelLost;}
double CPlant::GetSectionPower(int m){return SectionPower[m];}
double CPlant::GetSectionPowerFlow(int m){return SectionPowerFlow[m];}
double CPlant::GetSectionDischarge(int m){return SectionDischarge[m];}
double CPlant::GetSectionWaterLevel(int m){return SectionWaterLevel[m];}
double CPlant::GetPlantStepLength(){return StepLength;}
void CPlant::SetPlantStepLength(double length){StepLength=length;}


double CPlant::GetProfitOfPower()
{
	//获得电站整周期发电收益
	double profit,powerprice;
	profit=0;
	for(int i=0;i<SectionNum;i++)
	{
		powerprice=GetSectionPowerPrice(i);//时段电价
		profit+=powerprice*GetSectionPower(i);//叠加
	}

	return profit;
}

double CPlant::GetWaterRate()
{
	//得到电站耗水率,发电1KWH需要的水量
	return WaterRate;
}


double CPlant::GetStoredValue(double volume, double userate)
{
	//给出上游电站存水量及其在欲求电站的存水利用率,得到欲求电站的存水价值
	double sv=GetStoredPrice();
	return volume*userate*sv;
}

int CPlant::SetConfiguration()
{
	//设置存水价值
// 	double temp;
// 	for(int i=0;i<SectionNum;i++)
// 		temp+=SectionPowerPrice[i];
// 	StoredPrice=temp/(SectionNum*GetWaterRate());
	return 1;
}

void CPlant::GetMaxMinLevel(double &max, double &min,int section,double lastdown)
{
	//lastdown :上水库泄流
	//求得水库实际水位约束范围,存入max,min
	double l,h,sl;//最小水位约束,最大水位约束,开始水位
	double i,dmax,dmin,t;//区间入流,最大泄流量,最小泄流量,时段时间
	l=GetMinWaterLevel(section);
	h=GetMaxWaterLevel(section);
	i=GetSectionIntervalFlow(section);
	t=GetSectionTime();
	sl=section>0 ? GetSectionWaterLevel(section-1):GetStartLevel();
	dmin=GetMinDownFlow(section);
	dmax=GetMaxDownFLow(section);
	//库容单位为万立方米,流量单位为立方米每秒
	double v1=GetPlantVolume(sl);
	double v2=(i+lastdown-dmax)*t/10000;
	double htemp1=GetPlantLevel(v1+v2);
	min=l>htemp1?l:htemp1;
	double v3=(i+lastdown-dmin)*t/10000;
	double htemp2=GetPlantLevel(v1+v3);
	max=h>htemp2?htemp2:h;
	//min=l>GetPlantLevel(GetPlantVolume(sl)+(i+lastdown-dmax)*t/10000)?l:GetPlantLevel(GetPlantVolume(sl)+(i+lastdown-dmax)*t/10000);
	//max=h<GetPlantLevel(GetPlantVolume(sl)+(i+lastdown-dmin)*t/10000)?h:GetPlantLevel(GetPlantVolume(sl)+(i+lastdown-dmin)*t/10000);
}


void CPlant::GetMaxMinLevel(double &max, double &min,double sl,double lastdown,int section)
{
	//lastdown :上水库泄流
	//求得水库实际水位约束范围,存入max,min
	double l,h;//最小水位约束,最大水位约束
	double i,dmax,dmin,t;//区间入流,最大泄流量,最小泄流量,时段时间
	l=GetMinWaterLevel(section);
	h=GetMaxWaterLevel(section);
	i=GetSectionIntervalFlow(section);
	t=GetSectionTime();
	dmin=GetMinDownFlow(section);
	dmax=GetMaxDownFLow(section);
	//库容单位为万立方米,流量单位为立方米每秒
	double v1=GetPlantVolume(sl);
	double v2=(i+lastdown-dmax)*t/10000;
	if(between(GetPlantVolume(l),GetPlantVolume(h),v1+v2))min=GetPlantLevel(v1+v2);
	else min=l;
	//double htemp1=GetPlantLevel(v1+v2);//getplantlevel仅在死库容与总库容之间有效
	//min=l>htemp1?l:htemp1;
	double v3=(i+lastdown-dmin)*t/10000;
	if(between(GetPlantVolume(l),GetPlantVolume(h),v1+v3))max=GetPlantLevel(v1+v3);
	else max=h;
// 	double htemp2=GetPlantLevel(v1+v3);
// 	max=h>htemp2?htemp2:h;
}

double CPlant::GetPlantDownFlow(double sl, double el, int section,double lastdown)
{
	double t;
	t=GetSectionTime();
	double v1=GetPlantVolume(sl);
	double v2=GetPlantVolume(el);
	double i=GetSectionIntervalFlow(section);
	double r1=(v1-v2)*10000/t;
	double r=r1+i+lastdown;
	return r;
	//return (GetPlantVolume(sl)-GetPlantVolume(el))*10000/t+GetSectionIntervalFlow(section)+lastdown;
}

void CPlant::SetSectionPower(int section, double power)
{
	SectionPower[section]=power;
}

void CPlant::SetSectionPowerFlow(int section, double powerflow)
{
	SectionPowerFlow[section]=powerflow;
}

void CPlant::SetSectionWaterLevel(int section, double level)
{
	SectionWaterLevel[section]=level;
}

void CPlant::SetSectionDischarge(int section, double discharge)
{
	SectionDischarge[section]=discharge;
}

double CPlant::GetRatePowerLevel()
{
	return RatePowerLevel;
}

double CPlant::GetEvageTailLevel()
{
	return EvageTailLevel;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -