Das habe ich bereits gemacht:
import matplotlib.pyplot as plt
# Settings
path = ["C:\\Users\\buehlpas\\Documents\\Messungen\\"]
name = ["PED"]
ending = [".csv", ".svg"]
# Definition List, Array
filename = path[0] + name[0] + ending[0] # File path for storing values
figurename = path[0] + name[0] + ending[1] # Figure path for storing chart
# Representation / Graphic
fig = plt.figure(figsize=(8,

)
fig.tight_layout()
plt.subplots_adjust(left=0.1, bottom=0.10, right=0.90, top=0.94, wspace=0.1, hspace=0.1)
plt.rc('font', size=10)
plt.grid( which='both', color='black', linestyle=':', linewidth=0.5)
plt.title(r'$PED\ Estimation $' + "\n" + r'$\vartheta=23 ^\circ C\ \slash\ \varphi=35\%r.F.\ \slash\ \ p=101325Pa$',fontsize=12)
plt.arrow(0.1, 0.1, 11000, 0, head_width=0.01, head_length=1000, linewidth=2, color='g', length_includes_head=False)
plt.arrow(0.1, 0.1, 0, 11000, head_width=0.01, head_length=1000, linewidth=2, color='g', length_includes_head=False)
def PED(device, fluid_group, fluid_type, PS, V, DN, TS):
"""
Categorize pressure equipment based on PED guidelines.
Parameters:
PS (float): Maximum allowable pressure (bar).
V (float): Volume of the equipment (liters).
DN (float): Nominal diameter of pipe (mm)
TS (float): Temperature of the medium (°C)
fluid_type (str): Type of fluid ('gas' or 'liquid').
fluid_group (float): Group of fluid (1 or 2).
device (str): Type of device ('vessel' or 'heaters' or 'pipe')
Returns:
"""
match device:
case 'vessel':
match fluid_group:
case 1:
match fluid_type:
case 'gas':
x1,y1 = (0.1, 11000), (0.5, 0.5)
x2,y2 = (0.1, 1, 2000), (1000, 1000, 0.5)
x3,y3 = (0.1, 1, 400), (200, 200, 0.5)
x4,y4 = (1, 1, 50), (200, 25, 0.5)
x5,y5 = (1,100), (50,0.5)
a = V
b = PS
dia=plt.loglog(x1,y1,x2,y2,x3,y3,x4,y4,x5,y5, label="Diagram 1", color="blue", linewidth=1)
ax1 = fig.gca()
ax1.set_xlabel(r"$V\ [Litres]$")
ax1.set_ylabel(r"$PS\ [bar]$")
ax1.text(2500, 0.55, r'$PS=0.5$', rotation=0)
ax1.text(1, 6, r'$PS*V=25$',rotation =-45)
ax1.text(2, 9, r'$PS*V=50$', rotation=-45)
ax1.text(5, 14, r'$PS*V=200$', rotation=-45)
ax1.text(14, 22, r'$PS*V=1000$', rotation=-45)
ax1.text(0.7, 80, r'$V=1$', rotation=90)
ax1.text(0.15, 210, r'$PS=200$', rotation=0)
ax1.text(0.15, 1040, r'$PS=1000$', rotation=0)
ax1.text(0.15, 10, r'$GIP$', bbox=dict(boxstyle='round', facecolor='white', alpha=1),rotation=0)
ax1.text(0.15, 0.25, r'$GIP$', bbox=dict(boxstyle='round', facecolor='white', alpha=1),rotation=0)
ax1.text(25, 0.7, r'$Kat.1$', bbox=dict(boxstyle='round', facecolor='white', alpha=1),rotation=-45)
ax1.text(75, 0.7, r'$Kat.2$', bbox=dict(boxstyle='round', facecolor='white', alpha=1),rotation=-45)
ax1.text(400, 0.7, r'$Kat.3$', bbox=dict(boxstyle='round', facecolor='white', alpha=1),rotation=-45)
ax1.text(200, 200, r'$Kat.4$', bbox=dict(boxstyle='round', facecolor='white', alpha=1),rotation=0)
specimen = plt.loglog(a, b, label="Specimen", color="red", marker="x", markersize=8)
ax2 = fig.gca()
ax2.legend(specimen, [r"$Specimen$"], loc='upper right')
match PS <= 0.5 and V >= 0.1:
case True:
print('GIP / Diagram 1')
match PS <= 200 and V <= 1:
case True:
print('GIP / Diagram 1')
match (PS * V) <= 25:
case True:
print('GIP Diagram 1')
match (PS * V) <= 50:
case True:
print('Category I / Module A / Diagram 1')
match (PS * V) <= 200:
case True:
print('Category II / Module A2 / D1 / E1 / Diagram 1')
match (PS * V) <= 1000:
case True:
print('Category III / Module B+F / B+C2 / B+D / B+E / H / Diagram 1')
match (PS * V) > 1000:
case True:
print('Category IV / Module G / B+F / H1 / B+D / Diagram 1')
case 'liquid':
x1, y1 = (0.1, 11000), (0.5, 0.5)
x2, y2 = (0.1, 11000), (500, 500)
x3, y3 = (1, 1, 400), (11000, 200, 0.5)
x4, y4 = (20, 11000), (10, 10)
a = V
b = PS
plt.loglog(x1, y1, x2, y2, x3, y3, x4, y4, label="Diagram 3", color="blue",linewidth=1)
ax1 = fig.gca()
ax1.set_xlabel(r"$V\ [Litres]$")
ax1.set_ylabel(r"$PS\ [bar]$")
ax1.text(2500, 0.55, r'$PS=0.5$', rotation=0)
ax1.text(2500, 11, r'$PS=10$', rotation=0)
ax1.text(2500, 520, r'$PS=500$', rotation=0)
ax1.text(5, 14, r'$PS*V=200$', rotation=-45)
ax1.text(0.7, 1000, r'$V=1$', rotation=90)
ax1.text(0.15, 0.25, r'$GIP$', bbox=dict(boxstyle='round', facecolor='white', alpha=1),rotation=0)
ax1.text(0.15, 10, r'$GIP$', bbox=dict(boxstyle='round', facecolor='white', alpha=1),rotation=0)
ax1.text(600, 5, r'$Kat.1$', bbox=dict(boxstyle='round', facecolor='white', alpha=1),rotation=0)
ax1.text(600, 50, r'$Kat.2$', bbox=dict(boxstyle='round', facecolor='white', alpha=1),rotation=0)
ax1.text(0.15, 2500, r'$Kat.2$', bbox=dict(boxstyle='round', facecolor='white', alpha=1),rotation=0)
ax1.text(600, 1000, r'$Kat.3$', bbox=dict(boxstyle='round', facecolor='white', alpha=1),rotation=0)
specimen = plt.loglog(a, b, label="Specimen", color="red", marker="x", markersize=8)
ax2 = fig.gca()
ax2.legend(specimen, [r"$Specimen$"], loc='upper right')
match PS <= 0.5 and V >= 0.1:
case True:
print('GIP / Diagram 3')
match PS <= 500 and V <= 1:
case True:
print('GIP / Diagram 3')
match (PS * V) <= 200:
case True:
print('GIP / Diagram 3')
match PS <= 10 and V > 20:
case True:
print('Category I / Module A / Diagram 3')
match (PS * V) >= 200:
case True:
print('Category I / Module A / Diagram 3')
match PS > 500 and V <= 1.0 :
case True:
print('Category II / Module A2 / D1 / E1 / Diagram 3')
match PS <= 500:
case True:
print('Category II / Module A2 / D1 / E1 / Diagram 3')
match (PS * V) >= 200:
case True:
print('Category II / Module A2 / D1 / E1 / Diagram 3')
match PS > 500 and V > 1:
case True:
print('Category III / Module B+F / B+C2 / B+D / B+E / H / Diagram 3')
case 2:
match fluid_type:
case 'gas':
x1, y1 = (0.1, 11000), (0.5, 0.5)
x2, y2 = (0.1, 1, 1000, 11000), (3000, 3000, 4, 4)
x3, y3 = (0.1, 1, 3000), (1000, 1000, 0.5)
x4, y4 = (1, 1, 100), (1000, 50, 0.5)
x5, y5 = (1, 400), (200, 0.5)
a = V
b = PS
plt.loglog(x1, y1, x2, y2, x3, y3, x4, y4, x5, y5, label="Diagram 2", color="blue",linewidth=1)
ax1 = fig.gca()
ax1.set_xlabel(r"$V\ [Litres]$")
ax1.set_ylabel(r"$PS\ [bar]$")
ax1.text(3000, 0.55, r'$PS=0.5$', rotation=0)
ax1.text(3, 6, r'$PS*V=50$', rotation=-45)
ax1.text(8, 9, r'$PS*V=200$', rotation=-45)
ax1.text(27, 14, r'$PS*V=1000$', rotation=-45)
ax1.text(50, 22, r'$PS*V=3000$', rotation=-45)
ax1.text(0.7, 80, r'$V=1$', rotation=90)
ax1.text(0.15, 1050, r'$PS=1000$', rotation=0)
ax1.text(0.15, 3100, r'$PS=3000$', rotation=0)
ax1.text(0.15, 10, r'$GIP$', bbox=dict(boxstyle='round', facecolor='white', alpha=1),rotation=0)
ax1.text(0.15, 0.25, r'$GIP$', bbox=dict(boxstyle='round', facecolor='white', alpha=1),rotation=0)
ax1.text(75, 0.7, r'$Kat.1$', bbox=dict(boxstyle='round', facecolor='white', alpha=1),rotation=-45)
ax1.text(500, 0.7, r'$Kat.2$', bbox=dict(boxstyle='round', facecolor='white', alpha=1),rotation=-45)
ax1.text(2500, 2, r'$Kat.3$', bbox=dict(boxstyle='round', facecolor='white', alpha=1),rotation=0)
ax1.text(200, 200, r'$Kat.4$', bbox=dict(boxstyle='round', facecolor='white', alpha=1),rotation=0)
specimen = plt.loglog(a, b, label="Specimen", color="red", marker="x", markersize=8)
ax2 = fig.gca()
ax2.legend(specimen, [r"$Specimen$"], loc='upper right')
match PS <= 0.5 and V >= 0.1:
case True:
print('GIP / Diagram 2')
match PS <= 1000 and V <= 1:
case True:
print('GIP / Diagram 2')
match (PS * V) <= 50:
case True:
print('Category I / Module A / Diagram 2')
match (PS * V) <= 200:
case True:
print('Category II / Module A2 / D1 / E1 / Diagram 2')
match (PS * V) <= 1000:
case True:
print('Category III / Module B+F / B+C2 / B+D / B+E / H / Diagram 2')
match (PS * V) > 1000:
case True:
print('Category IV / Module G / B+F / H1 / B+D / Diagram 2')
case 'liquid':
x1, y1 = (0.1, 11000), (0.5, 0.5)
x2, y2 = (0.1, 10, 1000, 11000), (1000, 1000, 10,10)
x3, y3 = (10, 10), (1000, 11000)
x4, y4 = (20, 11000), (500, 500)
a = V
b = PS
plt.loglog(x1, y1, x2, y2, x3, y3, x4, y4, label="Diagram 4", color="blue",linewidth=1)
ax1 = fig.gca()
ax1.set_xlabel(r"$V\ [Litres]$")
ax1.set_ylabel(r"$PS\ [bar]$")
ax1.text(2500, 0.55, r'$PS=0.5$', rotation=0)
ax1.text(100, 27, r'$PS*V=10000$', rotation=-45)
ax1.text(8, 2000, r'$V=10$', rotation=90)
ax1.text(2500, 11, r'$PS=10$', rotation=0)
ax1.text(2500, 510, r'$PS=500$', rotation=0)
ax1.text(1, 1100, r'$PS=1000$', rotation=0)
ax1.text(0.15, 10, r'$GIP$', bbox=dict(boxstyle='round', facecolor='white', alpha=1),rotation=0)
ax1.text(0.15, 0.25, r'$GIP$', bbox=dict(boxstyle='round', facecolor='white', alpha=1),rotation=0)
ax1.text(0.5, 2000, r'$Kat.1$', bbox=dict(boxstyle='round', facecolor='white', alpha=1),rotation=0)
ax1.text(2000, 100, r'$Kat.1$', bbox=dict(boxstyle='round', facecolor='white', alpha=1),rotation=0)
ax1.text(2000, 2000, r'$Kat.2$', bbox=dict(boxstyle='round', facecolor='white', alpha=1),rotation=0)
specimen = plt.loglog(a, b, label="Specimen", color="red", marker="x", markersize=8)
ax2 = fig.gca()
ax2.legend(specimen, [r"$Specimen$"], loc='upper right')
match PS <= 0.5 and V >= 0.1:
case True:
print('GIP / Diagram 4')
match (PS * V) <= 10000:
case True:
print('GIP / Diagram 4')
match (PS * V) > 10000 and PS >= 10:
case True:
print('Category I / Module A / Diagram 4')
match PS >= 1000 and V <= 10:
case True:
print('Category I / Module A / Diagram 4')
match PS >= 500 and V >= 10:
case True:
print('Category II / Module A2 / D1 / E1 / Diagram 4')
match (PS * V) > 10000 and PS >= 500:
case True:
print('Category II / Module A2 / D1 / E1 / Diagram 4')
case 'heater':
match TS > 110 and V > 2:
case True:
print('Diagram 5')
x1, y1 = (0.1, 11000), (0.5, 0.5)
x2, y2 = (2, 2), (0.5, 11000)
x3, y3 = (2, 100, 1000, 1000), (32, 32, 4, 0.5)
x4, y4 = (10, 400), (32, 0.5)
x5, y5 = (2, 100), (25, 0.5)
a = V
b = PS
plt.loglog(x1, y1, x2, y2, x3, y3, x4, y4, x5, y5, label="Diagram 5", color="blue", linewidth=1)
ax1 = fig.gca()
ax1.set_xlabel(r"$V\ [Litres]$")
ax1.set_ylabel(r"$PS\ [bar]$")
ax1.text(2500, 0.55, r'$PS=0.5$', rotation=0)
ax1.text(5, 4, r'$PS*V=50$', rotation=-45)
ax1.text(19, 5, r'$PS*V=200$', rotation=-45)
ax1.text(170, 6, r'$PS*V=3000$', rotation=-45)
ax1.text(1.5, 80, r'$V=2$', rotation=90)
ax1.text(1100, 1.1, r'$V=1000$', rotation=90)
ax1.text(20, 34, r'$PS=32$', rotation=0)
ax1.text(0.15, 10, r'$GIP$', bbox=dict(boxstyle='round', facecolor='white', alpha=1), rotation=0)
ax1.text(0.15, 0.25, r'$GIP$', bbox=dict(boxstyle='round', facecolor='white', alpha=1), rotation=0)
ax1.text(5, 2, r'$Kat.1$', bbox=dict(boxstyle='round', facecolor='white', alpha=1), rotation=0)
ax1.text(35, 2, r'$Kat.2$', bbox=dict(boxstyle='round', facecolor='white', alpha=1), rotation=0)
ax1.text(200, 2, r'$Kat.3$', bbox=dict(boxstyle='round', facecolor='white', alpha=1), rotation=0)
ax1.text(200, 200, r'$Kat.4$', bbox=dict(boxstyle='round', facecolor='white', alpha=1), rotation=0)
specimen = plt.loglog(a, b, label="Specimen", color="red", marker="x", markersize=8)
ax2 = fig.gca()
ax2.legend(specimen, [r"$Specimen$"], loc='upper right')
match PS <= 0.5 and V >= 0.1:
case True:
print('GIP / Diagram 5')
match PS >= 0.5 and V <= 2:
case True:
print('GIP / Diagram 5')
match (PS * V) <= 50:
case True:
print('Category I / Module A / Diagram 5')
match (PS * V) <= 200 and PS <= 32:
case True:
print('Category II / Module A2 / D1 / E1 / Diagram 5')
match (PS * V) <= 3000 and PS <= 32 and V <= 100:
case True:
print('Category III / Module B+F / B+C2 / B+D / B+E / H / Diagram 5')
match (PS * V) > 3000 and PS > 0.5 and V > 2:
case True:
print('Category IV / Module G / B+F / H1 / B+D / Diagram 5')
case 'pipe':
match fluid_group:
case 1:
match fluid_type:
case 'gas':
x1, y1 = (0.1, 11000), (0.5, 0.5)
x2, y2 = (25, 25), (0.5, 11000)
x3, y3 = (100, 100, 25), (0.5, 10, 40)
x4, y4 = (350, 350, 100, 100), (0.5, 10, 35, 11000)
a = DN
b = PS
plt.loglog(x1, y1, x2, y2, x3, y3, x4, y4, label="Diagram 6", color="blue",linewidth=1)
ax1 = fig.gca()
ax1.set_xlabel(r"$DN\ [mm]$")
ax1.set_ylabel(r"$PS\ [bar]$")
ax1.text(20, 1100, r'$DN=25$', rotation=90)
ax1.text(80, 1100, r'$DN=100$', rotation=90)
ax1.text(80, 2, r'$DN=100$', rotation=90)
ax1.text(280, 2, r'$DN=350$', rotation=90)
ax1.text(2500, 0.55, r'$PS=0.5$', rotation=0)
ax1.text(25, 10, r'$PS*DN=1000$', rotation=-45)
ax1.text(100, 9, r'$PS*DN=3500$', rotation=-45)
ax1.text(0.15, 10, r'$GIP$', bbox=dict(boxstyle='round', facecolor='white', alpha=1),rotation=0)
ax1.text(0.11, 0.25, r'$GIP$', bbox=dict(boxstyle='round', facecolor='white', alpha=1),rotation=0)
ax1.text(30, 1.2, r'$Kat.1$', bbox=dict(boxstyle='round', facecolor='white', alpha=1),rotation=0)
ax1.text(30, 200, r'$Kat.2$', bbox=dict(boxstyle='round', facecolor='white', alpha=1),rotation=0)
ax1.text(200, 200, r'$Kat.3$', bbox=dict(boxstyle='round', facecolor='white', alpha=1),rotation=0)
specimen = plt.loglog(a, b, label="Specimen", color="red", marker="x", markersize=8)
ax2 = fig.gca()
ax2.legend(specimen, [r"$Specimen$"], loc='upper right')
match PS <= 0.5 and DN >= 0.1:
case True:
print('GIP / Diagram 6')
match PS > 0.5 and DN <= 25:
case True:
print('GIP / Diagram 6')
match (PS * DN) <= 1000 and DN <=100:
case True:
print('Category I / Module A / Diagram 6')
match (PS * DN) <= 3500:
case True:
print('Category II / Module A2 / D1 / E1 / Diagram 6')
match PS > 0.5 and DN <= 350:
case True:
print('Category II / Module A2 / D1 / E1 / Diagram 6')
match PS > 35 and DN <= 100:
case True:
print('Category II / Module A2 / D1 / E1 / Diagram 6')
match (PS * DN) <= 3500:
case True:
print('Category III / Module B+F / B+C2 / B+D / B+E / H / Diagram 6')
match PS > 0.5 and DN > 350:
case True:
print('Category III / Module B+F / B+C2 / B+D / B+E / H / Diagram 6')
match PS > 35 and DN > 100:
case True:
print('Category III / Module B+F / B+C2 / B+D / B+E / H / Diagram 6')
case 'liquid':
x1, y1 = (0.1, 11000), (0.5, 0.5)
x2, y2 = (25, 25, 4000), (11000, 80, 0.5)
x3, y3 = (25, 11000), (500, 500)
x4, y4 = (200, 11000), (10, 10)
a = DN
b = PS
plt.loglog(x1, y1, x2, y2, x3, y3, x4, y4, label="Diagram 8", color="blue",linewidth=1)
ax1 = fig.gca()
ax1.set_xlabel(r"$DN\ [mm]$")
ax1.set_ylabel(r"$PS\ [bar]$")
ax1.text(4000, 0.55, r'$PS=0.5$', rotation=0)
ax1.text(20, 1100, r'$DN=25$', rotation=90)
ax1.text(80, 12, r'$PS*DN=2000$', rotation=-45)
ax1.text(4000, 11, r'$PS=10$', rotation=0)
ax1.text(4000, 550, r'$PS=500$', rotation=0)
ax1.text(0.15, 10, r'$GIP$', bbox=dict(boxstyle='round', facecolor='white', alpha=1),rotation=0)
ax1.text(0.15, 0.25, r'$GIP$', bbox=dict(boxstyle='round', facecolor='white', alpha=1),rotation=0)
ax1.text(2000, 3, r'$Kat.1$', bbox=dict(boxstyle='round', facecolor='white', alpha=1),rotation=0)
ax1.text(2000, 70, r'$Kat.2$', bbox=dict(boxstyle='round', facecolor='white', alpha=1),rotation=0)
ax1.text(2000, 1300, r'$Kat.3$', bbox=dict(boxstyle='round', facecolor='white', alpha=1),rotation=0)
specimen = plt.loglog(a, b, label="Specimen", color="red", marker="x", markersize=8)
ax2 = fig.gca()
ax2.legend(specimen, [r"$Specimen$"], loc='upper right')
match PS <= 0.5 and DN >= 0.1:
case True:
print('GIP / Diagram 8')
match PS > 0.5 and DN <= 25:
case True:
print('GIP / Diagram 8')
match (PS * DN) <=2000:
case True:
print('GIP / Diagram 8')
match (PS * DN) > 2000 and PS <= 10:
case True:
print('Category I / Module A / Diagram 8')
match (PS * DN) > 2000:
case True:
print('Category II / Module A2 / D1 / E1 / Diagram 8')
match PS > 10 and DN >=200:
case True:
print('Category II / Module A2 / D1 / E1 / Diagram 8')
match PS <= 500 and DN > 25:
case True:
print('Category II / Module A2 / D1 / E1 / Diagram 8')
match PS > 500 and DN > 25:
case True:
print('Category III / Module B+F / B+C2 / B+D / B+E / H / Diagram 8')
case 2:
match fluid_type:
case 'gas':
x1, y1 = (0.1, 11000), (0.5, 0.5)
x2, y2 = (32, 32, 2000), (11000, 31.25, 0.5)
x3, y3 = (100, 100, 8000), (11000, 35, 0.5)
x4, y4 = (250, 250, 10000), (11000, 20, 0.5)
a = DN
b = PS
plt.loglog(x1, y1, x2, y2, x3, y3, x4, y4, label="Diagram 7", color="blue", linewidth=1)
ax1 = fig.gca()
ax1.set_xlabel(r"$DN\ [mm]$")
ax1.set_ylabel(r"$PS\ [bar]$")
ax1.text(400, 0.55, r'$PS=0.5$', rotation=0)
ax1.text(25, 110, r'$DN=32$', rotation=90)
ax1.text(75, 110, r'$DN=100$', rotation=90)
ax1.text(185, 110, r'$DN=250$', rotation=90)
ax1.text(55, 3, r'$PS*DN=1000$', rotation=-45)
ax1.text(200, 3, r'$PS*DN=3500$', rotation=-45)
ax1.text(400, 3, r'$PS*DN=5000$', rotation=-45)
ax1.text(0.15, 10, r'$GIP$', bbox=dict(boxstyle='round', facecolor='white', alpha=1),rotation=0)
ax1.text(0.15, 0.25, r'$GIP$', bbox=dict(boxstyle='round', facecolor='white', alpha=1),rotation=0)
ax1.text(50, 1500, r'$Kat.1$', bbox=dict(boxstyle='round', facecolor='white', alpha=1),rotation=90)
ax1.text(140, 1500, r'$Kat.2$', bbox=dict(boxstyle='round', facecolor='white', alpha=1),rotation=90)
ax1.text(2000, 1500, r'$Kat.3$', bbox=dict(boxstyle='round', facecolor='white', alpha=1), rotation=0)
specimen = plt.loglog(a, b, label="Specimen", color="red", marker="x", markersize=8)
ax2 = fig.gca()
ax2.legend(specimen, [r"$Specimen$"], loc='upper right')
match PS <= 0.5 and DN >= 0.1:
case True:
print('GIP / Diagram 7')
match PS > 0.5 and DN <= 32:
case True:
print('GIP / Diagram 7')
match (PS * DN) <= 1000:
case True:
print('GIP / Diagram 7')
match (PS * DN) <= 3500:
case True:
print('Category I / Module A / Diagram 7')
match PS > 31.25 and DN <= 32:
case True:
print('Category I / Module A / Diagram 7')
match (PS * DN) <= 5000:
case True:
print('Category II / Module A2 / D1 / E1 / Diagram 7')
match PS > 35 and DN <= 100:
case True:
print('Category II / Module A2 / D1 / E1 / Diagram 7')
match (PS * DN) > 5000:
case True:
print('Category III / Module B+F / B+C2 / B+D / B+E / H / Diagram 7')
match PS > 250 and DN >20 :
case True:
print('Category III / Module B+F / B+C2 / B+D / B+E / H / Diagram 7')
case 'liquid':
x1, y1 = (0.1, 11000), (0.5, 0.5)
x2, y2 = (200, 200, 500, 11000), (11000, 25, 10, 10)
x3, y3 = (200, 11000), (500, 500)
a = DN
b = PS
plt.loglog(x1, y1, x2, y2, x3, y3, label="Diagram 9", color="blue", linewidth=1)
ax1 = fig.gca()
ax1.set_xlabel(r"$DN\ [mm]$")
ax1.set_ylabel(r"$PS\ [bar]$")
ax1.text(2500, 0.55, r'$PS=0.5$', rotation=0)
ax1.text(150, 110, r'$DN=200$', rotation=90)
ax1.text(110, 7, r'$PS*DN=5000$', rotation=-45)
ax1.text(2500, 11, r'$PS=10$', rotation=0)
ax1.text(2500, 505, r'$PS=500$', rotation=0)
ax1.text(0.15, 10, r'$GIP$', bbox=dict(boxstyle='round', facecolor='white', alpha=1),rotation=0)
ax1.text(0.15, 0.25, r'$GIP$', bbox=dict(boxstyle='round', facecolor='white', alpha=1),rotation=0)
ax1.text(2500, 100, r'$Kat.1$', bbox=dict(boxstyle='round', facecolor='white', alpha=1),rotation=0)
ax1.text(2500, 2000, r'$Kat.2$', bbox=dict(boxstyle='round', facecolor='white', alpha=1),rotation=0)
specimen = plt.loglog(a, b, label="Specimen", color="red", marker="x", markersize=8)
ax2 = fig.gca()
ax2.legend(specimen, [r"$Specimen$"], loc='upper right')
match PS <= 0.5 and DN >= 0.1:
case True:
print('GIP / Diagram 9')
match PS <= 10 and DN >= 0.1:
case True:
print('GIP / Diagram 9')
match (PS * DN) <= 5000:
case True:
print('GIP / Diagram 9')
match PS <= 0.1 and DN <= 200:
case True:
print('GIP / Diagram 9')
match PS > 10 and DN > 200:
case True:
print('Category I / Module A / Diagram 9')
match (PS * DN) >= 5000:
case True:
print('Category I / Module A / Diagram 9')
match PS > 500 and DN > 200:
case True:
print('Category II / Module A2 / D1 / E1 / Diagram 9')
match (PS * DN)<= 5000:
case True:
print('Category II / Module A2 / D1 / E1 / Diagram 9')
# Graphic design
plt.savefig(figurename, format="svg")
plt.show()
# Example usage
PS = 16 # bar
V = 20 # liters
DN = 32 # millimeter
TS = 120 #°C
fluid_group = 1 # number
fluid_type = 'gas' # string
device = 'pipe' # string
PED(device, fluid_group, fluid_type, PS, V, DN, TS)
print(PED)