?? distribution.cpp
字號:
// distribution.cpp: implementation of the distribution class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "2level.h"
#include "distribution.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
distribution::distribution()
{
}
distribution::~distribution()
{
}
global distribution::distribute(double H1,double h5,int m,double B)
{
int i;
de_dragmodel yield;
pressmodel press;
speedmodel speed;
double *p_speed;
torquemodel torque;
powermodel power;
GA GA;
double sum_power_ratio=0; //功率平衡因數(shù)和
double aver_power_ratio; //平均功率平衡因數(shù)
//confirm the thickness of last stand according the fixed
//select the yield number;
double rH[5]; //整體壓下量
initialdistribute init;
global y;
y.label=false;
y.m=m;
//////////////////////////////////////////////////////////////////////
// initialize
//////////////////////////////////////////////////////////////////////
y.InitializeData();
double *p1;
p1=init.distribute(H1,h5,m,B); //initial the schedule;
rf=0.05; //ensure the relative press value of last stand;
y.r[4]=rf;
//according the relative press value to ensure the entry thickness of last stand;
y.H[4]=h5/(1-rf);
y.H[0]=H1;
//initial the out thickness of all stands;
y.h[0]=p1[0];
y.h[1]=p1[1];
y.h[2]=p1[2];
y.h[3]=y.H[4];
y.h[4]=h5;
//initial the speed
p_speed=speed.init_speed(y.h);
for(i=0;i<=4;i++)
{
y.v[i]=p_speed[i];
}
//////////////////////////////////////////////////////////////////////
// distribution
//////////////////////////////////////////////////////////////////////
p1=GA.GA_1(y);
double x1,x2,x3;
y.time=(int)p1[0];
x1 = p1[1];
x2 = p1[2];
x3 = p1[3];
y.h[4]=y.h5;
y.h[0]=x1;
y.h[1]=x2;
y.h[2]=x3;
y.h[3]=y.h[4]/(1-0.05);
y.H[0]=y.H0;
y.H[1]=y.h[0];
y.H[2]=y.h[1];
y.H[3]=y.h[2];
y.H[4]=y.h[3];
//compute the relative press value of 1 stand to 4 stand;
rH[0]=(y.H[0]-y.h[0])/y.H0;
rH[1]=(y.H[0]-y.h[1])/y.H0;
rH[2]=(y.H[0]-y.h[2])/y.H0;
rH[3]=(y.H[0]-y.h[3])/y.H0;
rH[4]=(y.H[0]-y.h[4])/y.H0;
for(i=0;i<=4;i++)
{
y.r[i]=(y.H[i]-y.h[i])/y.H[i];
}
//compute the yield ;
for (i=0;i<=4;i++)
{
y.de_drag[i]=yield.de_drag(y.m,rH[i]);
}
//compute the press value of every stand;
for (i=0;i<=4;i++)
{
y.P[i]=press.press1(i,y,y.de_drag[i]);
}
//compute the rolling speed;
for(i=0;i<=4;i++)
{
y.vr[i]=speed.roll_speed(i,y);
}
//compute the torque of every stand;
for(i=0;i<=4;i++)
{
y.MM[i]=torque.torque(i,y);
}
//compute the power of every stand;
for(i=0;i<=4;i++)
{
y.W[i]=power.power(i,y);
}
//////////////////////////////////////////////////////////////////////
// 計算最終結(jié)果
//////////////////////////////////////////////////////////////////////
//重新計算功率
y.v[4]=speed.max_speed(y);
y.v[3]=y.h[4]/y.h[3]*y.v[4];
y.v[2]=y.h[4]/y.h[2]*y.v[4];
y.v[1]=y.h[4]/y.h[1]*y.v[4];
y.v[0]=y.h[4]/y.h[0]*y.v[4];
for(i=0;i<=4;i++)
{
y.vr[i]=speed.roll_speed(i,y);
}
for(i=0;i<=4;i++)
{
y.W[i]=power.power(i,y);
}
//////////////////////////////////////////////////////////////////////
//檢驗?zāi)繕?biāo)是否達(dá)到
//////////////////////////////////////////////////////////////////////
//計算平衡因數(shù)
for(i=0;i<=3;i++)
{
y.power_ratio[i]=y.W[i]/y.max_power[i];
}
//compute the average power ratio
for(i=1;i<=3;i++)
{
sum_power_ratio=sum_power_ratio+y.power_ratio[i];
}
aver_power_ratio=sum_power_ratio/3;
y.ratio[0]=y.P[0]/y.P[1];
y.ratio[1]=y.power_ratio[1]/aver_power_ratio;
y.ratio[2]=y.power_ratio[2]/aver_power_ratio;
y.ratio[3]=y.power_ratio[3]/aver_power_ratio;
double aa[4];
aa[0]=0.8;
aa[1]=1;
aa[2]=1;
aa[3]=1;
double OBJECTIVE=0;
for(i=0;i<=3;i++)
{
OBJECTIVE= OBJECTIVE+100*aa[i]*(1-y.ratio[i])*(1-y.ratio[i]);
}
y.n[0]=OBJECTIVE;
return y;
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -