关于用模糊综合法评价水质现在有10个测站,每个测站都有10年的数据(各物质含量比如总氮、总磷、氨氮、生化需氧量等10个指标)现在要用模糊综合评价法来评价每个测站10年来的水质变化
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/07 19:28:08
关于用模糊综合法评价水质现在有10个测站,每个测站都有10年的数据(各物质含量比如总氮、总磷、氨氮、生化需氧量等10个指标)现在要用模糊综合评价法来评价每个测站10年来的水质变化
关于用模糊综合法评价水质
现在有10个测站,每个测站都有10年的数据(各物质含量比如总氮、总磷、氨氮、生化需氧量等10个指标)现在要用模糊综合评价法来评价每个测站10年来的水质变化情况,各位大侠给个思路,如果有C#源代码的话再加100分!
需用C#代码和模糊综合评价法算出每个测站每年的污染指数,然后和水质标准进行对比得到水质情况.
我想要C#(模糊综合评价法)代码,可以再加200分!必须是模糊综合评价发!
关于用模糊综合法评价水质现在有10个测站,每个测站都有10年的数据(各物质含量比如总氮、总磷、氨氮、生化需氧量等10个指标)现在要用模糊综合评价法来评价每个测站10年来的水质变化
模¡ê糊y综Á?合?评¨¤价?法¤¡§
private void btnEvaluate3_Click(object sender, RoutedEventArgs e)
{
if (EvaluateComboBox3.SelectedItem == null)
{
MessageBox.Show("请?先¨¨选?择?测a站?名?称?!ê?");
return;
}
DisplayWindow.Title = "模¡ê糊y综Á?合?评¨¤价?法¤¡§结¨¢果?展1示º?";
Evaluate evaluate = new Evaluate();
//记?录?每?种?物?质¨º的Ì?所¨´有®D含?量¢?
List ListMN = new List();
List ListNH3N = new List();
List ListCod = new List();
List ListO2 = new List();
List ListCr = new List();
List ListPb = new List();
List ListCd = new List();
List Listphenol = new List();
List ListN = new List();
List ListP = new List();
ListMN = WeightCalculateData("高?锰¨¬酸¨¢盐?");
ListNH3N = WeightCalculateData("氨ã¡À氮Ìa");
ListCod = WeightCalculateData("生¦¨²化¡¥需¨¨氧?量¢?");
ListO2 = WeightCalculateData("溶¨¨¹解a氧?");
ListCr = WeightCalculateData("六¢¨´价?铬?");
ListPb = WeightCalculateData("铅|");
ListCd = WeightCalculateData("镉¨®");
Listphenol = WeightCalculateData("挥¨®发¤¡é酚¤¨®");
ListN = WeightCalculateData("总Á¨¹氮Ìa");
ListP = WeightCalculateData("总Á¨¹磷¢¡Á");
//记?录?每?种?物?质¨º含?量¢?的Ì?所¨´有®D和¨ª
double sumMN, sumNH3N, sumCod, sumO2, sumCr, sumPb, sumCd, sumphenol, sumN, sumP;
sumMN = evaluate.SumElement(ListMN);
sumNH3N = evaluate.SumElement(ListNH3N);
sumCod = evaluate.SumElement(ListCod);
sumO2 = evaluate.SumElement(ListO2);
sumCr = evaluate.SumElement(ListCr);
sumPb = evaluate.SumElement(ListPb);
sumCd = evaluate.SumElement(ListCd);
sumphenol = evaluate.SumElement(Listphenol);
sumN = evaluate.SumElement(ListN);
sumP = evaluate.SumElement(ListP);
//记?录?每?种?物?质¨º每?条¬?记?录?的Ì?权¨¡§重?
List WiMN = new List();
List WiNH3N = new List();
List WiCod = new List();
List WiO2 = new List();
List WiCr = new List();
List WiPb = new List();
List WiCd = new List();
List Wiphenol = new List();
List WiN = new List();
List WiP = new List();
WiMN = evaluate.WeightCalculate(ListMN, sumMN);
WiNH3N = evaluate.WeightCalculate(ListNH3N, sumNH3N);
WiCod = evaluate.WeightCalculate(ListCod, sumCod);
WiO2 = evaluate.WeightCalculate(ListO2, sumO2);
WiCr = evaluate.WeightCalculate(ListCr, sumCr);
WiPb = evaluate.WeightCalculate(ListPb, sumPb);
WiCd = evaluate.WeightCalculate(ListCd, sumCd);
Wiphenol = evaluate.WeightCalculate(Listphenol, sumphenol);
WiN = evaluate.WeightCalculate(ListN, sumN);
WiP = evaluate.WeightCalculate(ListP, sumP);
//记?录?每?种?物?质¨º的Ì?熵¬?值¦Ì
double SiMN, SiNH3N, SiCod, SiO2, SiCr, SiPb, SiCd, Siphenol, SiN, SiP;
SiMN = evaluate.EntropyValue(WiMN);
SiNH3N = evaluate.EntropyValue(WiNH3N);
SiCod = evaluate.EntropyValue(WiCod);
SiO2 = evaluate.EntropyValue(WiO2);
SiCr = evaluate.EntropyValue(WiCr);
SiPb = evaluate.EntropyValue(WiPb);
SiCd = evaluate.EntropyValue(WiCd);
Siphenol = evaluate.EntropyValue(Wiphenol);
SiN = evaluate.EntropyValue(WiN);
SiP = evaluate.EntropyValue(WiP);
//计?算?每?种?物?质¨º的Ì?权¨¡§重?
double[] SiValue = new double[] { SiMN, SiNH3N, SiCod, SiO2, SiCr, SiPb, SiCd, Siphenol, SiN, SiP };
double SumSi = 0;
double[] weight = new double[10];
for (int i = 0; i < 10; i++)
{
SumSi = SumSi + SiValue[i];
}
for (int j = 0; j < 10; j++)
{
weight[j] = (1.0 - SiValue[j]) / (10 - SumSi);
}
//隶¢£¤属º?度¨¨
List MiMN = new List();
List MiNH3N = new List();
List MiCod = new List();
List MiO2 = new List();
List MiCr = new List();
List MiPb = new List();
List MiCd = new List();
List Miphenol = new List();
List MiN = new List();
List MiP = new List();
MiMN = evaluate.Membership(FMN, ListMN1);
MiNH3N = evaluate.Membership(FNH3N, ListNH3N1);
MiCod = evaluate.Membership(FCod, ListCod1);
MiO2 = evaluate.Membership(FO2, ListO21);
MiCr = evaluate.Membership(FCr, ListCr1);
MiPb = evaluate.Membership(FPb, ListPb1);
MiCd = evaluate.Membership(FCd, ListCd1);
Miphenol = evaluate.Membership(Fphenol, Listphenol1);
MiN = evaluate.Membership(FN, ListN1);
MiP = evaluate.Membership(FP, ListP1);
//定¡§义°?一°?个?泛¤o型¨ª用®?于®¨²存ä?储ä¡é测a站?历¤¨²年¨º来¤¡ä水?质¨º等̨¨级?变À?化¡¥情¨¦况?
List rank = new List();
//矩?阵¨®相¨¤乘?计?算?得Ì?到Ì?水?质¨º等̨¨级?
for (int m = 0; m < MiMN.Count; m++)
{
//声¦¨´明¡Â一°?个?10行D5列¢D的Ì?二t维?数ºy组Á¨¦,ê?用®?于®¨²存ä?放¤?隶¢£¤属º?度¨¨矩?阵¨®
double[,] MatrixMembership = new double[10, 5];
//for (int i = 0; i < 10; i++)
//{
for (int j = 0; j < 5; j++)
{
MatrixMembership[0, j] = MiMN[m][j];
MatrixMembership[1, j] = MiNH3N[m][j];
MatrixMembership[2, j] = MiCod[m][j];
MatrixMembership[3, j] = MiO2[m][j];
MatrixMembership[4, j] = MiCr[m][j];
MatrixMembership[5, j] = MiPb[m][j];
MatrixMembership[6, j] = MiCd[m][j];
MatrixMembership[7, j] = Miphenol[m][j];
MatrixMembership[8, j] = MiN[m][j];
MatrixMembership[9, j] = MiP[m][j];
}
//}
//声¦¨´明¡Â一°?个?1行D5列¢D的Ì?一°?维?数ºy组Á¨¦用®?于®¨²存ä?放¤?1行D10列¢D的Ì?权¨¡§重?数ºy组Á¨¦与®?10行D5列¢D的Ì?隶¢£¤属º?度¨¨矩?阵¨®的Ì?乘?积y
double[] result = new double[5];
for (int i = 0; i < 5; i++)
{
for (int j = 0; j < 10; j++)
{
result[i] += weight[j] * MatrixMembership[j, i];
}
}
//得Ì?到Ì?的Ì?一°?维?数ºy组Á¨¦result[]中D的Ì?最Á?大䨮值¦Ì的Ì?下?标À¨º加¨®1就¨ª该?指?标À¨º的Ì?水?质¨º等̨¨级?
double temp = result[0];
for (int i = 1; i < 5; i++)
{
if (result[i] > temp)
{
temp = result[i];
}
}
for (int j = 0; j < 5; j++)
{
if (temp == result[j])
{
rank.Add(j + 1);
break;
}
}
}
//用®?柱¨´状Á¡ä图ª?来¤¡ä表À¨ª示º?某3一°?测a站?历¤¨²年¨º来¤¡ä水?质¨º变À?化¡¥情¨¦况?
DisplayWindow.Visibility = Visibility.Visible;
EvaluateChart1.Title = EvaluateComboBox3.SelectedItem.ToString() + "测a站?历¤¨²年¨º来¤¡ä水?质¨º等̨¨级?变À?化¡¥";
FeatureLayer featurelayer = MyMap.Layers["djkFeature"] as FeatureLayer;
List lst2 = new List();
List dt = new List();
foreach (Graphic graphic in featurelayer.Graphics)
{
if (graphic.Attributes["NAME"].ToString() == EvaluateComboBox3.SelectedItem.ToString())
{
DateTime shijian = (DateTime)graphic.Attributes["时º¡À间?"];
dt.Add(shijian.Year.ToString());
}
}
for (int i = 0; i < dt.Count; i++)
{
lst2.Add(new KeyValuePair(dt[i], rank[i]));
}
ColumnSeries columnSeries = new ColumnSeries();
Binding keyBinding = new Binding();
keyBinding.Path = new PropertyPath("Key");
columnSeries.IndependentValueBinding = keyBinding;
columnSeries.Title = "水?质¨º等̨¨级?";
Binding valueBinding = new Binding();
valueBinding.Path = new PropertyPath("Value");
columnSeries.DependentValueBinding = valueBinding;
columnSeries.HorizontalAlignment = HorizontalAlignment.Stretch;
columnSeries.VerticalAlignment = VerticalAlignment.Stretch;
columnSeries.ItemsSource = lst2;
this.EvaluateChart1.Series.Clear();
this.EvaluateChart1.Series.Add(columnSeries);
}
private void EvaluateQuit_Click(object sender, RoutedEventArgs e)
{
EvaluateBorder.Visibility = Visibility.Collapsed;
EvaluateWindow.Visibility = Visibility.Collapsed;
DisplayWindow.Visibility = Visibility.Collapsed;
}
public class Binddata
{
public DateTime dt { set; get; }
public int grade { set; get; }
}
//得Ì?到Ì?每?种?物?质¨º的Ì?所¨´有®D记?录?
private List WeightCalculateData(string element)
{
FeatureLayer featureLayer = MyMap.Layers["djkFeature"] as FeatureLayer;
featureLayer.AutoSave = true;
List elementList = new List();
foreach (Graphic graphic in featureLayer.Graphics)
{
elementList.Add(Convert.ToDouble(graphic.Attributes[element]));
}
return elementList;
}