CAPACITY CONVERSIONS FOR SAFETY VALVES PROGRAM
安全閥流量轉換程式

1. maxima 基本程式

原始碼下載: ccfave.mac

/*CAPACITY CONVERSIONS FOR SAFETY VALVES 安全閥流量轉換*/
/*kill(all);*/
/*單位系統*/
/* unit_system: "U.S. Customary" or "SI";*/

/*對於蒸汽
C_N = 51.5 for U.S. Customary calculations
    = 5.25 for SI calculations
*/
W_s(K,A,P):=block([CN:if unit_system = "U.S. Customary" then 51.5 else 5.25],CN*K*A*P);

/*對於空氣
C = 356 for U.S. Customary calculations
  = 27.03 for SI calculations
M = 28.97 mol/wt.
T = 520 when W a is the rated capacity (for U.S. Cus-
    tomary calculations)
  = 293 when W a is the rated capacity (for SI
    calculations)
  */

W_a(K,A,P):=block([
  C: if unit_system = "U.S. Customary" then 356.0 else 27.03,
  M: 28.97,
  T: if unit_system = "U.S. Customary" then 520.0 else 29.3],
  C*K*A*P*sqrt(M/T));

/*對於任何氣體或蒸氣 */
/*
A = ac tua l dis c harge area of the s af ety v alve ,
in. 2 (mm 2 )
C = constant for gas or vapor which is function of the
ratio of specific heats, k = c p /c v (see Figure 11-1)
K = coefficient of discharge [see UG-131(d) and
UG-131(e)]
M = molecular weight
P = (set pressure × 1.10) plus atmospheric pressure,
psia (MPa a b s )
T = absolute temperature at inlet [(°F + 460) (K)]
W = flow of any gas or vapor, lb/hr
W a = rated capacity, converted to lb/hr (kg/h) of air at
60°F (20°C), inlet temperature
W s = rated capacity, lb/hr (kg/h) of steam
*/
W(C,K,A,P,M,T):= block([], C*K*A*P*sqrt(M/T));

2. 例子

2.1. EXAMPLE 1

鑑於:安全閥具有經過認證的額定容量壓力設定為 200 psi 時,蒸汽流量為 3,020 lb/hr。問題:此閥門的洩壓能力是多少就相同壓力設定下 100°F 的 空氣而言?

/* EX1 */
/*
GIVEN: A safety valve bears a certified capacity rating
of 3,020 lb/hr of steam for a pressure setting of 200 psi.
PROBLEM: What is the relieving capacity of that valve
in terms of air at 100°F for the same pressure setting?
*/
/*SOLUTION:*/
batch("ccfave.mac");
/*單位系統*/
unit_system: "U.S. Customary";

/*For steam*/
W[s]:3020.0$
s1:solve(ratsubst(KAP,K*A*P,W[s]=W_s(K,A,P)),KAP)$
/*printf(true,"~&~A~&~A",ratsubst(KAP,K*A*P,W[s]=W_s(K,A,P)),s1)$*/
print("W[s]=",W[s])$
print(float(ratsubst(KAP,K*A*P,W[s]=W_s(K,A,P))))$
print(float(s1))$

C[a]:if unit_system = "U.S. Customary" then 356.0 else 27.03$
M[a]:28.97$
T[a]:460.0+100.0$
W[a]:W(C[a],K,A,P,M[a],T[a])$

print("C=", C[a])$
print("M=", M[a])$
print("T=460+100=", T[a])$
print("W[a]=",float(ratsubst(KAP,K*A*P,W[a])))$
print("=",float(ev(ratsubst(KAP,K*A*P,W[a]),s1)))$

2.2. EXAMPLE 2

鑑於:需要釋放 5,000 lb/hr 的丙烷從壓力容器經安全閥組洩壓,壓力為 P_s, psi ,入口溫度為溫度為 125°F。 問題:安全閥必須提供的總流量(lb/hr 蒸汽)是多少?

2.2.1. maxima

/*
GIVEN: It is required to relieve 5,000 lb/hr of propane
from a pressure vessel through a safety valve set to re-
lieve at a pressure of P s , psi, and with an inlet temperature
at 125°F.
PROBLEM: What total capacity in pounds of steam per
hour in safety valves must be furnished?
*/

/*SOLUTION:*/
kill(all);
/*自行下載 ccfave.mac */
batch("ccfave.mac");
/*單位系統*/
unit_system: "U.S. Customary";

/*
對於丙烷
*/
f0:W[p]=W(C,K,A,P,M,T);
/*
The value of C is not definitely known. Use the conser- value, C = 315.
*/
C[p]:315.0;
M[p]:44.09;
T[p]:460.0+125.0;
W[p]:5000.0;

f01:ev(f0,C=C[p],M=M[p],T=T[p],W[p]:W[p]);
f02:ratsubst(KAP,K*A*P,f01);

f1:float(solve(f02,KAP));

/*For steam, 對於蒸汽*/

f2:W[s]=ratsubst(KAP,K*A*P,W_s(K,A,P));

/* unit: lb/hr set to relieve at P_s,psi */
f3:ev(f2,f1);

3. 說明

  • 本文件非法規設備設計文件。
  • This document is not a regulatory equipment design document.

3.1. 授權條款/ License

Copyright (C) 2024 Each Application Mechanical Design Studio

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

4. 相關網頁