| 2 | 1/1 | 返回列表 |
| 查看: 561 | 回復(fù): 1 | |||
askding金蟲 (小有名氣)
|
[求助]
環(huán)境風(fēng)險(xiǎn)評價(jià)及作圖請教
|
|
想做一個(gè)環(huán)境風(fēng)險(xiǎn)評價(jià)的圖,使用VBA編程看的不是很懂,有人能幫助下嗎? 我試著編了下,求高人幫我看下編的對嗎? 如下:在評價(jià)區(qū)域內(nèi),將區(qū)域污染源可能影響區(qū)域14km×14km的范圍網(wǎng)格化,取步長為500 m,形成29行29列的網(wǎng)格。在每個(gè)網(wǎng)格對7個(gè)源的擴(kuò)散后的風(fēng)險(xiǎn)值進(jìn)行迭加得到總和r。然后在Excel中將網(wǎng)格的數(shù)據(jù)轉(zhuǎn)成X/Y/Z格式。具體編程如下:Sub 環(huán)境風(fēng)險(xiǎn)評價(jià)() Dim k As Integer, j As Integer, i As Integer, x As Integer, y As Integer, m As Integer, n As Integer, d1 As Integer, d2 As Integer, d3 As Integer, d4 As Integer, d5 As Integer, d6 As Integer, d7 As Integer, r1 As Double, r2 As Double, r3 As Double, r4 As Double, r5 As Double, r6 As Double, r7 As Double , rr As Double k=0'定義X軸最小值 For j= 2 To 30 Sheet1.Cells(1,j)=k k=k+50 '間隔為500m(將實(shí)際距離換算成相對坐標(biāo)系下的距離長度,實(shí)際為500m,坐標(biāo)下為50m) Next k=1400 'Y軸最大值 For j=2 To 30 Sheet1.Cells(j,1)=k k=k-50 Next x=0 For m=2 To 30 y=1400 For n=2 To 30 Sheet1.Cells(n,m)=Sqr((705-x)^2+(652-y)^2)'輸入源1坐標(biāo) Sheet1.Cells(n+30,m)=Sqr((690-x)^2+(523-y)^2)'輸入源2坐標(biāo) Sheet1.Cells(n+60,m)=Sqr((769-x)^2+(416-y)^2)'輸入源3坐標(biāo) Sheet1.Cells(n+90,m)=Sqr((552-x)^2+(682-y)^2)'輸入源4坐標(biāo) Sheet1.Cells(n+120,m)=Sqr((758-x)^2+(815-y)^2)'輸入源5坐標(biāo) Sheet1.Cells(n+150,m)=Sqr((894-x)^2+(983-y)^2)'輸入源6坐標(biāo) Sheet1.Cells(n+180,m)=Sqr((667-x)^2+(381-y)^2)'輸入源7坐標(biāo) y=y-50 Next x=x+50 Next For m=2 To 30 For n=2 To 30 d1=Sheet1.Cells(n,m)'表示距離 d2=Sheet1.Cells(n+30,m) d3=Sheet1.Cells(n+60,m) d4=Sheet1.Cells(n+90,m) d5=Sheet1.Cells(n+120,m) d6=Sheet1.Cells(n+150,m) d7=Sheet1.Cells(n+180,m) r1=(400-d1)/350*8.33*0.00001'風(fēng)險(xiǎn)值計(jì)算,需輸入影響半徑m r2=(400-d2)/350*8.33*0.00001 r3=(400-d3)/ 350*8.33*0.00001 r4=(417-d4)/367*8.08*0.0001 r5=(250-d5)/200*9.16*0.00001 r6=(333-d6)/283*5.7*0.00001 r7=(400-d7)/350*3.72*0.001 Sheet2.Cells(n,m)=r1 If r1<0 Then r1=0 End If Sheet2.Cells(n+30,m)=r2 If r2<0 Then r2=0 End If Sheet2.Cells(n+60,m)=r3 If r3<0 Then r3=0 End If Sheet2.Cells(n+90,m)=r4 If r4<0 Then r4=0 End If Sheet2.Cells(n+120,m)=r5 If r5<0 Then r5=0 End If Sheet2.Cells(n+150,m)=r6 If r6<0 Then r6=0 End If Sheet2.Cells(n+180,m)=r7 If r7<0 Then r7=0 End If Sheet3.Cells(n,m)=rl+r2+r3+r4+r5+r6+r7 Next Next For m=2 To 30 For n=2 To 30 rr=Sheet3.Cells(n,m) If rr>0 Then Sheet5.Cells(n,m)=Int(Log(rr)/Log(10)+8)'轉(zhuǎn)化為小數(shù)形式,并存入表單5 Else Sheet5.Cells(n,m)=1 End If Next Next For m=2 To 30 For n=2 To 30 Sheet4.Cells((m-2)*29+n,3)=Sheet5.Cells(n,m)'以YXZ形式存入表單4 Next Next For m=2 To 30 For n=2 To 30 Sheet4.Cells((m-2)*29+n,2)=1400-50*(n-2) Next Next For m=2 To 30 For n=2 To 30 Sheet4.Cells((m-2)*29+n,l)=0+(m-2)*50 Next Next End Sub |
鐜 |
金蟲 (小有名氣)
| 2 | 1/1 | 返回列表 |
| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考研] 341求調(diào)劑 +5 | 青檸檬1 2026-03-26 | 5/250 |
|
|---|---|---|---|---|
|
[考研] 311求調(diào)劑 +5 | lin0039 2026-03-26 | 5/250 |
|
|
[考研] 一志愿北化求調(diào)劑 +3 | Jsman 2026-03-22 | 3/150 |
|
|
[考研] 266分求材料化工冶金礦業(yè)等專業(yè)的調(diào)劑 +3 | 哇呼哼呼哼 2026-03-26 | 3/150 |
|
|
[考研] 生物學(xué) 296 求調(diào)劑 +4 | 朵朵- 2026-03-26 | 6/300 |
|
|
[考研] 生物學(xué)學(xué)碩,一志愿湖南大學(xué),初試成績338 +4 | YYYYYNNNNN 2026-03-26 | 4/200 |
|
|
[考研] 085600材料與化工306 +7 | z1z2z3879 2026-03-21 | 7/350 |
|
|
[考研] 考研調(diào)劑 +8 | 小蠟新筆 2026-03-26 | 8/400 |
|
|
[考研] 0856調(diào)劑 +4 | 求求讓我有書讀?/a> 2026-03-26 | 5/250 |
|
|
[考研] 291 求調(diào)劑 +7 | 化工2026屆畢業(yè)?/a> 2026-03-21 | 8/400 |
|
|
[考研] 【2026考研調(diào)劑】制藥工程 284分 求相關(guān)專業(yè)調(diào)劑名額 +4 | 袁奐奐 2026-03-25 | 8/400 |
|
|
[考研] 086003食品工程求調(diào)劑 +6 | 淼淼111 2026-03-24 | 6/300 |
|
|
[考研] 0703化學(xué)求調(diào)劑 +6 | 奶油草莓. 2026-03-22 | 7/350 |
|
|
[考研] 化學(xué)調(diào)劑 +6 | yzysaa 2026-03-21 | 6/300 |
|
|
[考研] 求調(diào)劑 +7 | 十三加油 2026-03-21 | 7/350 |
|
|
[考研] 336化工調(diào)劑 +4 | 王大坦1 2026-03-23 | 5/250 |
|
|
[論文投稿] 急發(fā)核心期刊論文 +3 | 賢達(dá)問津 2026-03-23 | 5/250 |
|
|
[考研] 291求調(diào)劑 +5 | 孅華 2026-03-22 | 5/250 |
|
|
[考研] 一志愿華中科技大學(xué)071000,求調(diào)劑 +4 | 沿岸有貝殼6 2026-03-21 | 4/200 |
|
|
[考研] 材料與化工(0856)304求B區(qū)調(diào)劑 +3 | 邱gl 2026-03-20 | 7/350 |
|