Weather Function Excel VBA 


Please use on a user's responsibility.
It will be obstructed if it copies to a standard module.

個人的に作成したものですので計算結果や不具合について責任はもちません。
利用者の責任で利用してください。
標準モジュールにコピーすればつかえます。


1.The weather function by Excel

Public Function es(td)
'水蒸気圧 es(td)
'露点温度から水蒸気圧を求める。
'water vapor pressure es (td)
‘It asks for water vapor pressure from dew point temperature.

a = 6.112
b = 17.67 * td / (243.5 + td)
c = Exp(b)
es = a * c
End Function



Public Function td(rh, t)
'露点温度 td(rh,t)
'相対湿度と温度から露点温度を求める。
‘Dew point temperature td (rh, t)
‘It asks for dew point temperature from relative humidity and temperature.

x1 = rh / 100
d = Log(x1)
e = 17.67 * t / (243.5 + t)
c = d + e
td = c * 243.5 / (17.67 - c)
End Function


Public Function θ(p, t)
'温位 θ(P,t
'気圧と温度から旧式の温位を求める。上空ほど+誤差が大きくなる。
‘Potential temperature   θ (P, t)
‘It asks for  potential temperature from 'atmospheric pressure and temperature.
High up in the sky, + error is large.

 Const p0 As Double = 1000#
 Const rd As Double = 287.05
 Const cpd As Double = 1005#

 θ = (t + 273.2) * (p0 / p) ^ (rd / cpd)
End Function




Public Function ssi(p1, t1, td, p2, tup)
'Showalter Stability Index  ssi(p1, t1, td, p2, tup)
'下層の気圧p1、気温t1、露点温度td
'上層の気圧p2、気温tup

'p1 p2 とのSSIを求める。
‘The lower layer atmospheric pressure p1, the temperature t1, dew point temperature td
‘The upper atmospheric pressure p2, temperature tup
‘SSI of p1 and p2 is calculated.

cp = 0.24: k = 0.2857: t0 = 273.2
tc = td + t0 - 0.216 * (t1 - td)
e = 6.112 * Exp(17.67 * td / (243.5 + td))
x = 0.622 * e / (p1 - e)
lc = 596.7 - 0.601 * (tc - t0)
ept85 = (t1 + t0) * (1000 / (p1 - e)) ^ k * Exp(lc * x / (cp * tc))

Delta = 0.001: t1 = -80: t2 = 50: a1 = Delta * 2
Do While Abs(a1) > Delta
   t = t1: td = t
   cp = 0.24: k = 0.2857: t0 = 273.2
   tc = td + t0 - 0.216 * (t - td)
   e = 6.112 * Exp(17.67 * td / (243.5 + td))
    x = 0.622 * e / (p2 - e)
    lc = 596.7 - 0.601 * (tc - t0)
    ept = (t + t0) * (1000 / (p2 - e)) ^ k * Exp(lc * x / (cp * tc))
    a1 = ept - ept85
    t = t2: td = t
    tc = td + t0 - 0.216 * (t - td)
    e = 6.112 * Exp(17.67 * td / (243.5 + td))
    x = 0.622 * e / (p2 - e)
    lc = 596.7 - 0.601 * (tc - t0)
    ept = (t + t0) * (1000 / (p2 - e)) ^ k * Exp(lc * x / (cp * tc))
    a2 = ept - ept85
    If a1 * a2 < 0 Then t2 = t2 - (t2 - t1) * 0.5 Else t3 = t1: t1 = t2: t2 = t2 + (t2 - t3) * 0.5
Loop

tr50 = t1
ssi = tup - tr50
End Function

Public Function θe(p, t, td)

'相当温位 θe(p, t, td)
'気圧p、温度t、露点温度tdから相当温位を求る。上空ほど+誤差が大きくなる。
‘Equivalent potential temperature   θe (p, t, td)
‘atmospheric pressure p, the temperature t, and the dew point temperature
High up in the sky, + error is large.


cp = 0.24
k = 0.2857
t0 = 273.2
tc = td + t0 - 0.216 * (t - td)
e = 6.112 * Exp(17.67 * td / (243.5 + td))
x = 0.622 * e / (p - e)

lc = 596.7 - 0.601 * (tc - t0)

p100 = 1000 / (p - e) ' a^b=A
p2 = Log(p100)        'ln A= b*ln a
c = p2 * k            'A= exp(b*in a)
Power = Exp(c)
θe = (t + t0) * Power * Exp(lc * x / (cp * tc))
End Function


Public Function tw(p, t, td)
'湿球温度 tw(p, t, td)
'気圧p、気温t、露点温度tdより湿球温度を求める
‘Wet bulb temperature tw (p, t, td)
‘atmospheric pressure p, the temperature t, and the dew point temperature td.

Const cp = 29108.82
Const l = 2.5 * 1000000 * 18
a1 = es(td)
p2 = p - a1
a2 = p2 / p
t0 = 273.2
a3 = a2 * cp * (t + t0)
a4 = (a1 / p) * l '水蒸気の潜熱
dall = a3 + a4

t1 = -130
t2 = 130
t3 = 130
Delta = 100
delta1 = -100
Do While Delta > 1#

If delta1 < 0 Then
   t2 = t3
   t3 = (t1 + t3) / 2

   Else
   t1 = t3
   t3 = (t2 + t3) / 2
   End If

b1 = es(t3)
p2 = p - b1
b2 = p2 / p
t0 = 273.2
b3 = b2 * cp * (t3 + t0)
b4 = (b1 / p) * l
ball = b3 + b4
delta1 = dall - ball
Delta = Abs(delta1)
Loop

tw = t3
End Function


Public Function pt(hight,  temp)
'温位 pt(hight,press,temp)
'位置エネルギーとエンタルピーから温位ptを求める。
'’ Potential temperature pt (hight, press, temp)
‘It asks for the potential temperature pt from potential energy and enthalpy.


cp = 29.10005
m = 0.028964
g = 9.8
localpt = (m * g * hight + cp * (temp + 273.15)) / cp
pt = Int(localpt * 10) / 10
End Function

Public Function eqpt(hight, press, temp, td)

'相当温位 eqpt(hight,press,temp,td)
'位置エネルギーとエンタルピーと潜熱から相当温位を求める。
‘Equivalent potential temperature eqpt (hight, press, temp, td)
‘It asks for equivalent-potential temperature from 'potential energy, enthalpy, and latent heat.

l = 51012
cp = 29.10882
m = 0.028964
g = 9.8
mypt = (m * g * hight + cp * (temp + 273.15)) / cp
myes = es(td)
eqpt = Int((mypt + (myes / press) * l / cp) * 10) / 10
End Function

***************************************************

使用例
The example of use
高度 Altitude 
気圧 Atmospheric pressure
気温 Temperature
データ部 Data division
計算結果 Calculation result




takanosunotama@mail.goo.ne.jp


  
2.The fuel
I consider the fuel of a nuclear power plant to be Pu of an abandonment nuclear weapon.
It is because think that fuel cannot be cheaply made from dangerous work.
If fuel is made, it is necessary to cool with water continuously, and there is a life in nuclear weapons.
It is necessary to also cool nuclear waste with water, and it is very troublesome.
It becomes impossible to have cooled the fuel pool and Tokyo became becoming ruins.
We cannot reduce radioactivity.
Radioactivity is a disposal method with best being spread.
It is necessary to make many nuclear power plants to Asia to reduce a U.S. nuclear power plant.

2.核燃料
わたしは原発の燃料は廃棄核兵器のPu考えます。
何故なら燃料は危険な作業から安価に作れないと思うからです。
燃料は作ってしまうと絶えず水で冷やす必要があり、核兵器には寿命があります。
核廃棄物も水で冷やす必要があり非常に厄介なものです。
燃料プールが冷やせなくなったとき東京が廃墟になる寸前でした。
放射能は人間の力で処理できるものではなく、拡散するのが一番の処理方法です。
アメリカの原発を減らすにはアジアに沢山の原発を作る必要があるのです。

3.The accident of a nuclear power plant

According to an interim report
I judged that piping of compressed air broke in the earthquake.
A result -- a vent -- it was not able to do .
The melt-through which a hole opens occurred in the pressure vessel.
When pressure fell, the fire truck was able to pour sea water.
The nuclear power plant in Japan cannot do a vent, when a big earthquake occurs.
But,  Nuclear and Industrial Safety Agency, electric power companies, and specialists do not do safety measures.
I  think they are  lunatic.
By this cult nature, I came to think that Japan is developing the atomic bomb.


sorry my poor English.
I appreciate your patience.
Thank you.

3.原子力発電所の事故
中間報告によると
地震で圧縮空気の配管が壊れベントができなくなったことが分かります。
圧力容器に穴が開くメルトスルーが起きて、消防車で海水を注水することができました。)
日本の原子力発電所はおおきな地震が起きた時ベントができないのです。

それなのに、
原子力安全保安院や電力会社、専門家は安全対策をしません。
狂人としか思えません。
このカルト性は、日本が原爆を開発していると考えると理解できます。

0 件のコメント:

コメントを投稿