Bootstrap

【数学建模】基于贪心算法的电力市场的输电阻塞管理(附论文及matlab、lingo代码)

      适合数学建模新手研究的题目,备战国赛的同学可以拿这道题目练手,本文含论文代码,帮助解题理解思路。

题目:

(1)题目信息:

某电网有若干台发电机组和若干条主要线路,每条线路上的有功潮流(输电功率和方向)取决于电网结构和各发电机组的出力。电网每条线路上的有功潮流的绝对值有一安全限值,限值还具有一定的相对安全裕度(即在应急情况下潮流绝对值可以超过限值的百分比的上限)。如果各机组出力分配方案使某条线路上的有功潮流的绝对值超出限值,称为输电阻塞。当发生输电阻塞时,需要研究如何制订既安全又经济的调度计划。

(2)电力市场交易规则:

1. 以15分钟为一个时段组织交易,每台机组在当前时段开始时刻前给出下一个时段的报价。各机组将可用出力由低到高分成至多10段报价,每个段的长度称为段容量,每个段容量报一个价(称为段价),段价按段序数单调不减。在最低技术出力以下的报价一般为负值,表示愿意付费维持发电以避免停机带来更大的损失。

2. 在当前时段内,市场交易-调度中心根据下一个时段的负荷预报,每台机组的报价、当前出力和出力改变速率,按段价从低到高选取各机组的段容量或其部分(见下面注释),直到它们之和等于预报的负荷,这时每个机组被选入的段容量或其部分之和形成该时段该机组的出力分配预案(初始交易结果)。最后一个被选入的段价(最高段价)称为该时段的清算价,该时段全部机组的所有出力均按清算价结算。

注释:

1.每个时段的负荷预报和机组出力分配计划的参照时刻均为该时段结束时刻。

2.机组当前出力是对机组在当前时段结束时刻实际出力的预测值。

3.假设每台机组单位时间内能增加或减少的出力相同,该出力值称为该机组的爬坡速率。由于机组爬坡速率的约束,可能导致选取它的某个段容量的部分。

4.为了使得各机组计划出力之和等于预报的负荷需求,清算价对应的段容量可能只选取部分。

(3)市场交易-调度中心在当前时段内要完成的具体操作过程如下:

1.监控当前时段各机组出力分配方案的执行,调度AGC辅助服务,在此基础上给出各机组的当前出力值。

2.作出下一个时段的负荷需求预报。

3.根据电力市场交易规则得到下一个时段各机组出力分配预案。

  1. 计算当执行各机组出力分配预案时电网各主要线路上的有功潮流,判断是否会出现输电阻塞。如果不出现,接受各机组出力分配预案;否则,按照如下原则实施阻塞管理:

(4)输电阻塞管理原则:

1.调整各机组出力分配方案使得输电阻塞消除。

2.如果(1)做不到,还可以使用线路的安全裕度输电,以避免拉闸限电(强制减少负荷需求),但要使每条线路上潮流的绝对值超过限值的百分比尽量小。

3.如果无论怎样分配机组出力都无法使每条线路上的潮流绝对值超过限值的百分比小于相对安全裕度,则必须在用电侧拉闸限电。

4.当改变根据电力市场交易规则得到的各机组出力分配预案时,一些通过竞价取得发电权的发电容量(称序内容量)不能出力;而一些在竞价中未取得发电权的发电容量(称序外容量)要在低于对应报价的清算价上出力。因此,发电商和网方将产生经济利益冲突。网方应该为因输电阻塞而不能执行初始交易结果付出代价,网方在结算时应该适当地给发电商以经济补偿,由此引起的费用称之为阻塞费用。网方在电网安全运行的保证下应当同时考虑尽量减少阻塞费用。

(5)信息表格:

表1  各机组出力方案 (单位:兆瓦,记作MW

方案\机组

1

2

3

4

5

6

7

8

0

120

73

180

80

125

125

81.1

90

1

133.02

73

180

80

125

125

81.1

90

2

129.63

73

180

80

125

125

81.1

90

3

158.77

73

180

80

125

125

81.1

90

4

145.32

73

180

80

125

125

81.1

90

5

120

78.596

180

80

125

125

81.1

90

6

120

75.45

180

80

125

125

81.1

90

7

120

90.487

180

80

125

125

81.1

90

8

120

83.848

180

80

125

125

81.1

90

9

120

73

231.39

80

125

125

81.1

90

10

120

73

198.48

80

125

125

81.1

90

11

120

73

212.64

80

125

125

81.1

90

12

120

73

190.55

80

125

125

81.1

90

13

120

73

180

75.857

125

125

81.1

90

14

120

73

180

65.958

125

125

81.1

90

15

120

73

180

87.258

125

125

81.1

90

16

120

73

180

97.824

125

125

81.1

90

17

120

73

180

80

150.71

125

81.1

90

18

120

73

180

80

141.58

125

81.1

90

19

120

73

180

80

132.37

125

81.1

90

20

120

73

180

80

156.93

125

81.1

90

21

120

73

180

80

125

138.88

81.1

90

22

120

73

180

80

125

131.21

81.1

90

23

120

73

180

80

125

141.71

81.1

90

24

120

73

180

80

125

149.29

81.1

90

25

120

73

180

80

125

125

60.582

90

26

120

73

180

80

125

125

70.962

90

27

120

73

180

80

125

125

64.854

90

28

120

73

180

80

125

125

75.529

90

29

120

73

180

80

125

125

81.1

104.84

30

120

73

180

80

125

125

81.1

111.22

31

120

73

180

80

125

125

81.1

98.092

32

120

73

180

80

125

125

81.1

120.44

表2  各线路的潮流值(各方案与表1相对应,单位:MW

方案\线路

1

2

3

4

5

6

0

164.78

140.87

-144.25

119.09

135.44

157.69

1

165.81

140.13

-145.14

118.63

135.37

160.76

2

165.51

140.25

-144.92

118.7

135.33

159.98

3

167.93

138.71

-146.91

117.72

135.41

166.81

4

166.79

139.45

-145.92

118.13

135.41

163.64

5

164.94

141.5

-143.84

118.43

136.72

157.22

6

164.8

141.13

-144.07

118.82

136.02

157.5

7

165.59

143.03

-143.16

117.24

139.66

156.59

8

165.21

142.28

-143.49

117.96

137.98

156.96

9

167.43

140.82

-152.26

129.58

132.04

153.6

10

165.71

140.82

-147.08

122.85

134.21

156.23

11

166.45

140.82

-149.33

125.75

133.28

155.09

12

165.23

140.85

-145.82

121.16

134.75

156.77

13

164.23

140.73

-144.18

119.12

135.57

157.2

14

163.04

140.34

-144.03

119.31

135.97

156.31

15

165.54

141.1

-144.32

118.84

135.06

158.26

16

166.88

141.4

-144.34

118.67

134.67

159.28

17

164.07

143.03

-140.97

118.75

133.75

158.83

18

164.27

142.29

-142.15

118.85

134.27

158.37

19

164.57

141.44

-143.3

119

134.88

158.01

20

163.89

143.61

-140.25

118.64

133.28

159.12

21

166.35

139.29

-144.2

119.1

136.33

157.59

22

165.54

140.14

-144.19

119.09

135.81

157.67

23

166.75

138.95

-144.17

119.15

136.55

157.59

24

167.69

138.07

-144.14

119.19

137.11

157.65

25

162.21

141.21

-144.13

116.03

135.5

154.26

26

163.54

141

-144.16

117.56

135.44

155.93

27

162.7

141.14

-144.21

116.74

135.4

154.88

28

164.06

140.94

-144.18

118.24

135.4

156.68

29

164.66

142.27

-147.2

120.21

135.28

157.65

30

164.7

142.94

-148.45

120.68

135.16

157.63

31

164.67

141.56

-145.88

119.68

135.29

157.61

32

164.69

143.84

-150.34

121.34

135.12

157.64

表3  各机组的段容量  (单位:MW

机组\段

1

2

3

4

5

6

7

8

9

10

1

70

0

50

0

0

30

0

0

0

40

2

30

0

20

8

15

6

2

0

0

8

3

110

0

40

0

30

0

20

40

0

40

4

55

5

10

10

10

10

15

0

0

1

5

75

5

15

0

15

15

0

10

10

10

6

95

0

10

20

0

15

10

20

0

10

7

50

15

5

15

10

10

5

10

3

2

8

70

0

20

0

20

0

20

10

15

5

表4  各机组的段价(单位:元/兆瓦小时,记作元/MWh

机组\段

1

2

3

4

5

6

7

8

9

10

1

-505

0

124

168

210

252

312

330

363

489

2

-560

0

182

203

245

300

320

360

410

495

3

-610

0

152

189

233

258

308

356

415

500

4

-500

150

170

200

255

302

325

380

435

800

5

-590

0

116

146

188

215

250

310

396

510

6

-607

0

159

173

205

252

305

380

405

520

7

-500

120

180

251

260

306

315

335

348

548

8

-800

153

183

233

253

283

303

318

400

800

表5  各机组的爬坡速率  (单位:MW/分钟)

机组

1

2

3

4

5

6

7

8

速率

2.2

1

3.2

1.3

1.8

2

1.4

1.8

表6  各线路的潮流限值(单位:MW和相对安全裕度  

线路

1

2

3

4

5

6

限值

165

150

160

155

132

162

安全裕度

13%

18%

9%

11%

15%

14%

解题思路及论文代码:

附录

一、支撑材料的文件列表

(1)问题三及问题五答案(1)(1)(1).xlsx

(2)数据.xlsx

(3)电力分配.lg4

(4)电力分配2.lg4

(5)负荷最大.lg4

(6)duoyuan.m

(7)dsw.m

(8)阻塞费用.lg4

(8)阻塞费用982.4.lg4

二、解决问题代码

(一)多元回归模型(duoyuan.m):

x1=xlsread('C:\Users\86182\Desktop\数学建模论文\第六题\第六道问题:电力分配问题\数据.xlsx','B4:B35');
x2=xlsread('C:\Users\86182\Desktop\数学建模论文\第六题\第六道问题:电力分配问题\数据.xlsx','C4:C35');
x3=xlsread('C:\Users\86182\Desktop\数学建模论文\第六题\第六道问题:电力分配问题\数据.xlsx','D4:D35');
x4=xlsread('C:\Users\86182\Desktop\数学建模论文\第六题\第六道问题:电力分配问题\数据.xlsx','E4:E35');
x5=xlsread('C:\Users\86182\Desktop\数学建模论文\第六题\第六道问题:电力分配问题\数据.xlsx','F4:F35');
x6=xlsread('C:\Users\86182\Desktop\数学建模论文\第六题\第六道问题:电力分配问题\数据.xlsx','G4:G35');
x7=xlsread('C:\Users\86182\Desktop\数学建模论文\第六题\第六道问题:电力分配问题\数据.xlsx','H4:H35');
x8=xlsread('C:\Users\86182\Desktop\数学建模论文\第六题\第六道问题:电力分配问题\数据.xlsx','I4:I35');
y1=xlsread('C:\Users\86182\Desktop\数学建模论文\第六题\第六道问题:电力分配问题\数据.xlsx','M4:M35');
y2=xlsread('C:\Users\86182\Desktop\数学建模论文\第六题\第六道问题:电力分配问题\数据.xlsx','N4:N35');
y3=xlsread('C:\Users\86182\Desktop\数学建模论文\第六题\第六道问题:电力分配问题\数据.xlsx','O4:O35');
y4=xlsread('C:\Users\86182\Desktop\数学建模论文\第六题\第六道问题:电力分配问题\数据.xlsx','P4:P35');
y5=xlsread('C:\Users\86182\Desktop\数学建模论文\第六题\第六道问题:电力分配问题\数据.xlsx','Q4:Q35');
y6=xlsread('C:\Users\86182\Desktop\数学建模论文\第六题\第六道问题:电力分配问题\数据.xlsx','R4:R35');
X=[ones(size(y1)) x1 x2 x3 x4 x5 x6 x7 x8];
[b1,bint1,r1,rint1,stats1] = regress(y1,X);
[b2,bint2,r2,rint2,stats2] = regress(y2,X);
[b3,bint3,r3,rint3,stats3] = regress(y3,X);
[b4,bint4,r4,rint4,stats4] = regress(y4,X);
[b5,bint5,r5,rint5,stats5] = regress(y5,X);
[b6,bint6,r6,rint6,stats6] = regress(y6,X);
subplot(2,2,1);
rcoplot(r1,rint1);
title('线路一残差图');
xlabel('方案'); ylabel('残差');
hold on;
subplot(2,2,2);
rcoplot(r2,rint2);
title('线路二残差图');
xlabel('方案'); ylabel('残差');
subplot(2,2,3);
rcoplot(r3,rint3);
title('线路三残差图');
xlabel('方案'); ylabel('残差');
subplot(2,2,4);
rcoplot(r4,rint4);
title('线路四残差图');
xlabel('方案'); ylabel('残差');
%subplot(3,2,5);
%rcoplot(r5,rint5);
%title('线路五残差图');
%xlabel('方案'); ylabel('残差');
%subplot(3,2,6);
%rcoplot(r6,rint6);
%title('线路六残差图');
%xlabel('方案'); ylabel('残差');

(2)潮流值计算(dsw.m):

%x1=150;
%x2=79;
%x3=180;
%x4=99.5;
%x5=125;
%x6=140;
%x7=95;
%x8=113.9;
%982.4
%x1=152.9336938;
%x2=87.82502504;
%x3=227.9557797;
%x4=79.94245866;
%x5=151.9452826;
%x6=95;
%x7=69.85917655;
%x8=116.9385837;
%1052.8
x1=132.9250407;
x2=74.88112127;
x3=228;
x4=99.5;
x5=152;
x6=155;
x7=93.49383801;
x8=117;
yy1=b1(2)*x1+b1(3)*x2+b1(4)*x3+b1(5)*x4+b1(6)*x5+b1(7)*x6+b1(8)*x7+b1(9)*x8+b1(1);
yy2=b2(2)*x1+b2(3)*x2+b2(4)*x3+b2(5)*x4+b2(6)*x5+b2(7)*x6+b2(8)*x7+b2(9)*x8+b2(1);
yy3=b3(2)*x1+b3(3)*x2+b3(4)*x3+b3(5)*x4+b3(6)*x5+b3(7)*x6+b3(8)*x7+b3(9)*x8+b3(1);
yy4=b4(2)*x1+b4(3)*x2+b4(4)*x3+b4(5)*x4+b4(6)*x5+b4(7)*x6+b4(8)*x7+b4(9)*x8+b4(1);
yy5=b5(2)*x1+b5(3)*x2+b5(4)*x3+b5(5)*x4+b5(6)*x5+b5(7)*x6+b5(8)*x7+b5(9)*x8+b5(1);
yy6=b6(2)*x1+b6(3)*x2+b6(4)*x3+b6(5)*x4+b6(6)*x5+b6(7)*x6+b6(8)*x7+b6(9)*x8+b6(1);

(3)982.4MV电力分配(电力分配.lg4):

sets:
aa/1..8/:sx,xx;
bb/1..10/:;
cc(aa,bb):x,f,dr,dj;
dd/1..6/:xz;
endsets
data:
dr=@ole('C:\Users\86182\Desktop\Êýѧ½¨Ä£ÂÛÎÄ\µÚÁùÌâ\µÚÁùµÀÎÊÌ⣺µçÁ¦·ÖÅäÎÊÌâ\Êý¾Ý.xlsx','dr');
dj=@ole('C:\Users\86182\Desktop\Êýѧ½¨Ä£ÂÛÎÄ\µÚÁùÌâ\µÚÁùµÀÎÊÌ⣺µçÁ¦·ÖÅäÎÊÌâ\Êý¾Ý.xlsx','dj');
sx=
153	88	228	99.5	152	155	102.1	117
;
xx=
87	58	132	60.5	98	95	60.1	63
;
xz=165 150 160 155 132 162;
@ole('C:\Users\86182\Desktop\数学建模论文\第六题\第六道问题:电力分配问题\数据.xlsx','tz')=x;
enddata
@for(cc(i,j):@bin(f));
min=z;
!min=@sum(cc:x*dj*f*0.25);
@sum(cc:x)=982.4;
@for(aa(i):@sum(bb(j):x(i,j))<=sx(i));
@for(aa(i):@sum(bb(j):x(i,j))>=xx(i));
@for(cc(i,j):x(i,j)<=dr(i,j)*f(i,j));
@for(cc(i,j)|j#le#9:f(i,j+1)-f(i,j)<=0);
z=@max(cc:dj*f);
!x1=@sum(aa(j):x(1,j));
!x2=@sum(aa(j):x(2,j));
!x3=@sum(aa(j):x(3,j));
!x4=@sum(aa(j):x(4,j));
!x5=@sum(aa(j):x(5,j));
!x6=@sum(aa(j):x(6,j));
!x7=@sum(aa(j):x(7,j));
!x8=@sum(aa(j):x(8,j));
!0.082841*x1+0.048279*x2+0.052971*x3+0.119934*x4+(-0.025441)*x5+0.122011*x6+0.121576*x7+(-0.001226)*x8+110.296510<=xz(1);
!-0.054558*x1+0.127851*x2-0.000026*x3+0.033277*x4+0.086847*x5-0.11244*x6-0.018928*x7+0.098726*x8+131.228924<=xz(2);
!-0.069542*x1+0.061645*x2-0.156617*x3-0.009922*x4+0.124494*x5+0.002117*x6-0.002511*x7-0.201387*x8-108.873164<=xz(3);
!-0.034463*x1-0.102409*x2+0.205164*x3-0.020827*x4-0.011828*x5+0.005953*x6+0.144918*x7+0.076546*x8+77.48168<=xz(4);
!0.000533*x1+0.243286*x2-0.06455*x3-0.041134*x4-0.065220*x5+0.070343*x6-0.004263*x7-0.008913*x8+132.974473<=xz(5);
!0.237809*x1-0.060168*x2-0.077874*x3+0.092975*x4+0.0466904*x5+0.000078*x6+0.165933*x7+0.000687*x8+120.663278<=xz(6);
!@for(cc(i,j)|j#le#5:x(i,j)=dr(i,j)*f(i,j));
!@for(cc(i,j)|j#ge#2:x(i,j-1)=@if(f(i,j-1)#eq#1,dr(i,j-1),0));
!x(1,1)=dr(1,1);
!x(2,1)=dr(2,1);
!x(3,1)=dr(3,1);
!x(4,1)=dr(4,1);
!x(5,1)=dr(5,1);
!x(6,1)=dr(6,1);
!x(7,1)=dr(7,1);
!x(8,1)=dr(8,1);

(4)1052.8MV电力分配(电力分配2.lg4):

sets:
aa/1..8/:sx,xx;
bb/1..10/:;
cc(aa,bb):x,f,dr,dj;
dd/1..6/:xz,t,y;
ee(aa,dd):b;
endsets
data:
dr=@ole('C:\Users\86182\Desktop\Êýѧ½¨Ä£ÂÛÎÄ\µÚÁùÌâ\µÚÁùµÀÎÊÌ⣺µçÁ¦·ÖÅäÎÊÌâ\Êý¾Ý.xlsx','dr');
dj=@ole('C:\Users\86182\Desktop\Êýѧ½¨Ä£ÂÛÎÄ\µÚÁùÌâ\µÚÁùµÀÎÊÌ⣺µçÁ¦·ÖÅäÎÊÌâ\Êý¾Ý.xlsx','dj');
sx=
153	88	228	99.5	152	155	102.1	117
;
xx=
87	58	132	60.5	98	95	60.1	63
;
xz=165 150 160 155 132 162;
b=@ole('C:\Users\86182\Desktop\数学建模论文\第六题\第六道问题:电力分配问题\数据.xlsx','b');
t=@ole('C:\Users\86182\Desktop\数学建模论文\第六题\第六道问题:电力分配问题\数据.xlsx','t');
@ole('C:\Users\86182\Desktop\数学建模论文\第六题\第六道问题:电力分配问题\数据.xlsx','tz')=x;
@ole('C:\Users\86182\Desktop\数学建模论文\第六题\第六道问题:电力分配问题\问题三及问题五答案(1)(1)(1).xlsx','yy')=y;
enddata
@for(cc(i,j):@bin(f));
!min=z;
!min=@sum(cc:x*dj*f*0.25);
min=@sum(dd:y);
@sum(cc:x)=1052.8;
@for(aa(i):@sum(bb(j):x(i,j))<=sx(i));
@for(aa(i):@sum(bb(j):x(i,j))>=xx(i));
@for(cc(i,j):x(i,j)<=dr(i,j)*f(i,j));
@for(cc(i,j)|j#le#9:f(i,j+1)-f(i,j)<=0);
z=@max(cc:dj*f);
x1=@sum(bb(j):x(1,j));
x2=@sum(bb(j):x(2,j));
x3=@sum(bb(j):x(3,j));
x4=@sum(bb(j):x(4,j));
x5=@sum(bb(j):x(5,j));
x6=@sum(bb(j):x(6,j));
x7=@sum(bb(j):x(7,j));
x8=@sum(bb(j):x(8,j));
@abs(b(1,1)*x1+b(2,1)*x2+b(3,1)*x3+b(4,1)*x4+b(5,1)*x5+b(6,1)*x6+b(7,1)*x7+b(8,1)*x8+t(1))<=@abs(xz(1))*(1+y(1));
@abs(b(1,2)*x1+b(2,2)*x2+b(3,2)*x3+b(4,2)*x4+b(5,2)*x5+b(6,2)*x6+b(7,2)*x7+b(8,2)*x8+t(2))<=@abs(xz(2))*(1+y(2));
@abs(b(1,3)*x1+b(2,3)*x2+b(3,3)*x3+b(4,3)*x4+b(5,3)*x5+b(6,3)*x6+b(7,3)*x7+b(8,3)*x8+t(3))<=@abs(xz(3))*(1+y(3));
b(1,4)*x1+b(2,4)*x2+b(3,4)*x3+b(4,4)*x4+b(5,4)*x5+b(6,4)*x6+b(7,4)*x7+b(8,4)*x8+t(4)<=xz(4)*(1+y(4));
b(1,5)*x1+b(2,5)*x2+b(3,5)*x3+b(4,5)*x4+b(5,5)*x5+b(6,5)*x6+b(7,5)*x7+b(8,5)*x8+t(5)<=xz(5)*(1+y(5));
b(1,6)*x1+b(2,6)*x2+b(3,6)*x3+b(4,6)*x4+b(5,6)*x5+b(6,6)*x6+b(7,6)*x7+b(8,6)*x8+t(6)<=xz(6)*(1+y(6));
y(1)<=0.13;
y(2)<=0.18;
y(3)<=0.09;
y(4)<=0.11;
y(5)<=0.15;
y(6)<=0.14;

(5)982.4MV的阻塞费用(阻塞费用982.4.lg4):

sets:
aa/1..8/:sx,xx;
bb/1..10/:;
cc(aa,bb):x,m,n,xyy,xy,f,dr,dj;
dd/1..6/:xz,t,y;
ee(aa,dd):b;
endsets
data:
dr=@ole('C:\Users\86182\Desktop\Êýѧ½¨Ä£ÂÛÎÄ\µÚÁùÌâ\µÚÁùµÀÎÊÌ⣺µçÁ¦·ÖÅäÎÊÌâ\Êý¾Ý.xlsx','dr');
dj=@ole('C:\Users\86182\Desktop\Êýѧ½¨Ä£ÂÛÎÄ\µÚÁùÌâ\µÚÁùµÀÎÊÌ⣺µçÁ¦·ÖÅäÎÊÌâ\Êý¾Ý.xlsx','dj');
sx=
153	88	228	99.5	152	155	102.1	117
;
xx=
87	58	132	60.5	98	95	60.1	63
;
xz=165 150 160 155 132 162;
b=@ole('C:\Users\86182\Desktop\数学建模论文\第六题\第六道问题:电力分配问题\数据.xlsx','b');
t=@ole('C:\Users\86182\Desktop\数学建模论文\第六题\第六道问题:电力分配问题\数据.xlsx','t');
!x=@ole('C:\Users\86182\Desktop\数学建模论文\第六题\第六道问题:电力分配问题\数据.xlsx','tz');
@ole('C:\Users\86182\Desktop\数学建模论文\第六题\第六道问题:电力分配问题\数据.xlsx','tz')=x;
!@ole('C:\Users\86182\Desktop\数学建模论文\第六题\第六道问题:电力分配问题\问题三及问题五答案(1)(1)(1).xlsx','yy')=y;
xyy=@ole('C:\Users\86182\Desktop\数学建模论文\第六题\第六道问题:电力分配问题\问题三及问题五答案(1)(1)(1).xlsx','xyy');
xy=@ole('C:\Users\86182\Desktop\数学建模论文\第六题\第六道问题:电力分配问题\问题三及问题五答案(1)(1)(1).xlsx','xy');
enddata
@for(cc(i,j):@bin(f));
!min=z;
!min=@sum(cc:x*f);
!min=@sum(dd:y);
min=@sum(cc:n-m);
@for(cc:m=@if((xy-x)#gt#0,(xy-x)*303,0));
@for(cc:n=@if((x-xy)#gt#0,(x-xy)*dj,0));
@sum(dd:y)=0;
!@for(dd:y>=0);
@sum(cc:x)=982.4;
@for(aa(i):@sum(bb(j):x(i,j))<=sx(i));
@for(aa(i):@sum(bb(j):x(i,j))>=xx(i));
@for(cc(i,j):x(i,j)<=dr(i,j)*f(i,j));
@for(cc(i,j)|j#le#9:f(i,j+1)-f(i,j)<=0);
z=@max(cc:dj*f);
x1=@sum(bb(j):x(1,j));
x2=@sum(bb(j):x(2,j));
x3=@sum(bb(j):x(3,j));
x4=@sum(bb(j):x(4,j));
x5=@sum(bb(j):x(5,j));
x6=@sum(bb(j):x(6,j));
x7=@sum(bb(j):x(7,j));
x8=@sum(bb(j):x(8,j));
@abs(b(1,1)*x1+b(2,1)*x2+b(3,1)*x3+b(4,1)*x4+b(5,1)*x5+b(6,1)*x6+b(7,1)*x7+b(8,1)*x8+t(1))<=@abs(xz(1))*(1+y(1));
@abs(b(1,2)*x1+b(2,2)*x2+b(3,2)*x3+b(4,2)*x4+b(5,2)*x5+b(6,2)*x6+b(7,2)*x7+b(8,2)*x8+t(2))<=@abs(xz(2))*(1+y(2));
@abs(b(1,3)*x1+b(2,3)*x2+b(3,3)*x3+b(4,3)*x4+b(5,3)*x5+b(6,3)*x6+b(7,3)*x7+b(8,3)*x8+t(3))<=@abs(xz(3))*(1+y(3));
b(1,4)*x1+b(2,4)*x2+b(3,4)*x3+b(4,4)*x4+b(5,4)*x5+b(6,4)*x6+b(7,4)*x7+b(8,4)*x8+t(4)<=xz(4)*(1+y(4));
b(1,5)*x1+b(2,5)*x2+b(3,5)*x3+b(4,5)*x4+b(5,5)*x5+b(6,5)*x6+b(7,5)*x7+b(8,5)*x8+t(5)<=xz(5)*(1+y(5));
b(1,6)*x1+b(2,6)*x2+b(3,6)*x3+b(4,6)*x4+b(5,6)*x5+b(6,6)*x6+b(7,6)*x7+b(8,6)*x8+t(6)<=xz(6)*(1+y(6));
y(1)<=0.13;
y(2)<=0.18;
y(3)<=0.09;
y(4)<=0.11;
y(5)<=0.15;

(6)1052.8MV阻塞费用计算(阻塞费用.lg4):

sets:
aa/1..8/:sx,xx;
bb/1..10/:;
cc(aa,bb):x,m,n,xyy,f,dr,dj;
dd/1..6/:xz,t,y;
ee(aa,dd):b;
endsets
data:
dr=@ole('C:\Users\86182\Desktop\Êýѧ½¨Ä£ÂÛÎÄ\µÚÁùÌâ\µÚÁùµÀÎÊÌ⣺µçÁ¦·ÖÅäÎÊÌâ\Êý¾Ý.xlsx','dr');
dj=@ole('C:\Users\86182\Desktop\Êýѧ½¨Ä£ÂÛÎÄ\µÚÁùÌâ\µÚÁùµÀÎÊÌ⣺µçÁ¦·ÖÅäÎÊÌâ\Êý¾Ý.xlsx','dj');
sx=
153	88	228	99.5	152	155	102.1	117
;
xx=
87	58	132	60.5	98	95	60.1	63
;
xz=165 150 160 155 132 162;
b=@ole('C:\Users\86182\Desktop\数学建模论文\第六题\第六道问题:电力分配问题\数据.xlsx','b');
t=@ole('C:\Users\86182\Desktop\数学建模论文\第六题\第六道问题:电力分配问题\数据.xlsx','t');
x=@ole('C:\Users\86182\Desktop\数学建模论文\第六题\第六道问题:电力分配问题\数据.xlsx','tzz');
!@ole('C:\Users\86182\Desktop\数学建模论文\第六题\第六道问题:电力分配问题\数据.xlsx','tzz')=x;
!@ole('C:\Users\86182\Desktop\数学建模论文\第六题\第六道问题:电力分配问题\问题三及问题五答案(1)(1)(1).xlsx','yy')=y;
xyy=@ole('C:\Users\86182\Desktop\数学建模论文\第六题\第六道问题:电力分配问题\问题三及问题五答案(1)(1)(1).xlsx','xyy');
enddata
@for(cc(i,j):@bin(f));
!min=z;
!min=@sum(cc:x*f);
!min=@sum(dd:y);
min=@sum(cc:n-m);
@for(cc:m=@if((xyy-x)#gt#0,(xyy-x)*356,0));
@for(cc:n=@if((x-xyy)#gt#0,(x-xyy)*dj,0));
!@sum(dd:y)=0;
@sum(cc:x)=1052.8;
@for(aa(i):@sum(bb(j):x(i,j))<=sx(i));
@for(aa(i):@sum(bb(j):x(i,j))>=xx(i));
@for(cc(i,j):x(i,j)<=dr(i,j)*f(i,j));
@for(cc(i,j)|j#le#9:f(i,j+1)-f(i,j)<=0);
z=@max(cc:dj*f);
x1=@sum(bb(j):x(1,j));
x2=@sum(bb(j):x(2,j));
x3=@sum(bb(j):x(3,j));
x4=@sum(bb(j):x(4,j));
x5=@sum(bb(j):x(5,j));
x6=@sum(bb(j):x(6,j));
x7=@sum(bb(j):x(7,j));
x8=@sum(bb(j):x(8,j));
@abs(b(1,1)*x1+b(2,1)*x2+b(3,1)*x3+b(4,1)*x4+b(5,1)*x5+b(6,1)*x6+b(7,1)*x7+b(8,1)*x8+t(1))<=@abs(xz(1))*(1+y(1));
@abs(b(1,2)*x1+b(2,2)*x2+b(3,2)*x3+b(4,2)*x4+b(5,2)*x5+b(6,2)*x6+b(7,2)*x7+b(8,2)*x8+t(2))<=@abs(xz(2))*(1+y(2));
@abs(b(1,3)*x1+b(2,3)*x2+b(3,3)*x3+b(4,3)*x4+b(5,3)*x5+b(6,3)*x6+b(7,3)*x7+b(8,3)*x8+t(3))<=@abs(xz(3))*(1+y(3));
b(1,4)*x1+b(2,4)*x2+b(3,4)*x3+b(4,4)*x4+b(5,4)*x5+b(6,4)*x6+b(7,4)*x7+b(8,4)*x8+t(4)<=xz(4)*(1+y(4));
b(1,5)*x1+b(2,5)*x2+b(3,5)*x3+b(4,5)*x4+b(5,5)*x5+b(6,5)*x6+b(7,5)*x7+b(8,5)*x8+t(5)<=xz(5)*(1+y(5));
b(1,6)*x1+b(2,6)*x2+b(3,6)*x3+b(4,6)*x4+b(5,6)*x5+b(6,6)*x6+b(7,6)*x7+b(8,6)*x8+t(6)<=xz(6)*(1+y(6));
y(1)<=0.13;
y(2)<=0.18;
y(3)<=0.09;
y(4)<=0.11;
y(5)<=0.15;

(7负荷最大值计算(负荷最大.lg4):

sets:
aa/1..8/:sx,xx;
bb/1..10/:;
cc(aa,bb):x,f,dr,dj;
dd/1..6/:xz,t,y;
ee(aa,dd):b;
endsets
data:
dr=@ole('C:\Users\86182\Desktop\Êýѧ½¨Ä£ÂÛÎÄ\µÚÁùÌâ\µÚÁùµÀÎÊÌ⣺µçÁ¦·ÖÅäÎÊÌâ\Êý¾Ý.xlsx','dr');
dj=@ole('C:\Users\86182\Desktop\Êýѧ½¨Ä£ÂÛÎÄ\µÚÁùÌâ\µÚÁùµÀÎÊÌ⣺µçÁ¦·ÖÅäÎÊÌâ\Êý¾Ý.xlsx','dj');
sx=
153	88	228	99.5	152	155	102.1	117
;
xx=
87	58	132	60.5	98	95	60.1	63
;
xz=165 150 160 155 132 162;
b=@ole('C:\Users\86182\Desktop\数学建模论文\第六题\第六道问题:电力分配问题\数据.xlsx','b');
t=@ole('C:\Users\86182\Desktop\数学建模论文\第六题\第六道问题:电力分配问题\数据.xlsx','t');
@ole('C:\Users\86182\Desktop\数学建模论文\第六题\第六道问题:电力分配问题\数据.xlsx','tz')=x;
!@ole('C:\Users\86182\Desktop\数学建模论文\第六题\第六道问题:电力分配问题\问题三及问题五答案(1)(1)(1).xlsx','yy')=y;
enddata
@for(cc(i,j):@bin(f));
!min=z;
!min=@sum(cc:x*f);
max=@sum(cc:x);
!min=@sum(dd:y);
!@sum(dd:y)=0;
!@sum(cc:x)=985;
@for(aa(i):@sum(bb(j):x(i,j))<=sx(i));
@for(aa(i):@sum(bb(j):x(i,j))>=xx(i));
@for(cc(i,j):x(i,j)<=dr(i,j)*f(i,j));
@for(cc(i,j)|j#le#9:f(i,j+1)-f(i,j)<=0);
z=@max(cc:dj*f);
x1=@sum(bb(j):x(1,j));
x2=@sum(bb(j):x(2,j));
x3=@sum(bb(j):x(3,j));
x4=@sum(bb(j):x(4,j));
x5=@sum(bb(j):x(5,j));
x6=@sum(bb(j):x(6,j));
x7=@sum(bb(j):x(7,j));
x8=@sum(bb(j):x(8,j));
@abs(b(1,1)*x1+b(2,1)*x2+b(3,1)*x3+b(4,1)*x4+b(5,1)*x5+b(6,1)*x6+b(7,1)*x7+b(8,1)*x8+t(1))<=@abs(xz(1))*(1+y(1));
@abs(b(1,2)*x1+b(2,2)*x2+b(3,2)*x3+b(4,2)*x4+b(5,2)*x5+b(6,2)*x6+b(7,2)*x7+b(8,2)*x8+t(2))<=@abs(xz(2))*(1+y(2));
@abs(b(1,3)*x1+b(2,3)*x2+b(3,3)*x3+b(4,3)*x4+b(5,3)*x5+b(6,3)*x6+b(7,3)*x7+b(8,3)*x8+t(3))<=@abs(xz(3))*(1+y(3));
b(1,4)*x1+b(2,4)*x2+b(3,4)*x3+b(4,4)*x4+b(5,4)*x5+b(6,4)*x6+b(7,4)*x7+b(8,4)*x8+t(4)<=xz(4)*(1+y(4));
b(1,5)*x1+b(2,5)*x2+b(3,5)*x3+b(4,5)*x4+b(5,5)*x5+b(6,5)*x6+b(7,5)*x7+b(8,5)*x8+t(5)<=xz(5)*(1+y(5));
b(1,6)*x1+b(2,6)*x2+b(3,6)*x3+b(4,6)*x4+b(5,6)*x5+b(6,6)*x6+b(7,6)*x7+b(8,6)*x8+t(6)<=xz(6)*(1+y(6));
!y(1)<=0.13;
!y(2)<=0.18;
!y(3)<=0.09;
!y(4)<=0.11;
!y(5)<=0.15;
!y(6)<=0.14;
y(1)>=0;
y(2)>=0;
y(3)>=0;
y(4)>=0;
y(5)>=0;
y(6)>=0;

y(1)=0;
y(2)=0;
y(3)=0;
y(4)=0;
y(5)=0;
y(6)=0;

;