예제 #1
0
#!/bin/env python
import inout
import math

def BL(c):
	BL=c*Dmm**2*(44-0.08*Dmm)
	return (BL)
def VL(a):
	VL=1.1346*10**(-5)*Dmm**2
	return VL

print("Calculating Properties of Mooring Chain")
print("Use results as preliminary data, only! Wherever possible use manufacturer's data instead.")
Dmm=inout.get_float("Input Diameter of chain link in mm or '0' for default of 90mm: ", 90.0)
D=Dmm/1000
print("1 - Studless Chain")
print("2 - Studlink Chain")
choice1=inout.get_integer("Choose option 1 or 2: ", 1)
if choice1==1:
	print ("Calculating properties of Studless Chain")
	#Outer Diameter
	ODmm=1.80*Dmm
	OD=ODmm/1000
	#Contact Diameter
	CDmm=3.35*Dmm
	#mass per length [te/m]
	ML=19.9*D**2  
	#Submerged weight of chain [te/m]:
	SW=0.87*ML
	#Axial Stiffness [kN]
	AS=0.854*10**8*D**2 
예제 #2
0
#Copyright (c) 2013 D. Djokic <deki.djokic at gmail.com>
#This code is released under the [GPL], version 2 or later
# pump hand calculations
import inout
import math
import numpy as np
import warnings
import matplotlib.pyplot as plt

print ("1 - Shaft power")
print ("2 - NPSHa and Cavitation")
print ("3 - Centrifugal Pump Curve")
calc = inout.get_integer("Input 1, 2 or 3: ", 0)
if calc==1:
	print ("Calculating shaft power")
	density=inout.get_float("Input density of fluid in [kg/cum] or '0' for fresh water: ", 1000)
	flow=inout.get_float("Input flow of the pump [cum/h] or '0' for 150 cum/h: ", 150)
	head=inout.get_float("Input differental head [m] or '0' for 30 m: ",30)
	efficiency=inout.get_float("Input pump efficiency or '0' for 0.6: ", 0.6)
	rpm = inout.get_float("Input pump speed (rpm) or '0' for 1500", 1500)
	power=9.81*flow*head*density/(3.6*10**6)
	shaft_power=power/efficiency
	print ("Power = %f kW") %power
	print ("Shaft Power = %f kW") %shaft_power
	
elif calc==2:
	print ("Calculating Net Positive Suction Head available - NPSHa")
	density=inout.get_float("Input density of fluid in [kg/cum] or '0' for fresh water: ", 1000)
	abs_pressure=inout.get_float("Input absolute pressure on surface (atmnosferic+gauge) [kPa a] or '0' for 101.3: ",101.3)
	head_loss=inout.get_float("Input headloss in suction pipe [m] or '0' for 1.2 m: ", 1.2)
	flow=inout.get_float("Input flow of the pump [cum/h] or '0' for 150 cum/h: ", 150)
예제 #3
0
#!/usr/bin/env 
import inout

print("Calculating Mooring Rope/Wire Charachteristics")
print("Use results as preliminary, only. Wherever possible, use maker's data!")
Dmm = inout.get_float("Input Rope/Wire Nominal Diameter [mm] or '0' for 90mm: ", 90)
D = Dmm/1000
# Weight in Air per meter of length[kN/m] and weight in water
#Nylon Rope - WLN 
WLN = 0.676*D**2*9.81
WLNw=WLN*(1.14-1.025)/1.14
#Polyester rope - WLP
WLP = 0.7978*D**2*9.81
WLPw=WLP*(1.38-1.025)/1.38
#Polypropylene -WLPp
WLPp = 0.4526*D**2*9.81
WLPpw=WLPp*(0.91-1.025)/0.91
#Wire rope with fibre core - WLWf
WLWf = 3.6109*D**2*9.81
WLWfw=WLWf*(6.81-1.025)/6.81
#Wire rope with wire core - WLWw
WLWw = 3.9897*D**2*9.81
WLWww=WLWw*(7.85-1.025)/7.85
#Nylon Rope - WLN
#Outer Diameter [mm]
#Nylon rope - ODN
ODN = 0.85*Dmm
#Polyester rope - ODP
ODP = 0.86*Dmm
#Polypropylene rope - ODPp
ODPp = 0.8*Dmm
예제 #4
0
#!/usr/bin/env python
import inout
import math
print ("Sharp edge orifice calculation - orifice coeficient (C)=0.62 is default")
C=inout.get_float("Enter orifice coeficient or 0 for default of 0.62: ", 0.61)
g=9.81  #m/s^2
print("1-Solving for Flow Through Orifice")
print("2-Solving for Orifice Diameter")
print("3-Solving for Headloss through Orifice")
problem = int(raw_input("Input 1, 2 or 3: "))
if problem ==1:
	print ("Solving for Flow")
	d=inout.get_float("Enter orifice hole diameter [mm] or 0 fo 10mm: ", 10)
	H=inout.get_float("Enter head loss in orifice [m] or 0 for 1.5m: ", 1.5)
	dm=float(d/1000)
	A=dm*dm*math.pi/4
	Qs=float(C*A*(2*g*H)**0.5)
	Q=round(float(Qs*3600),3)
	print ("Q=%r cum/h") %Q
	print ("End of execution")
elif problem==2:
	print ("Solving for diameter")
	Qh=inout.get_float("Enter Flow [cum/h] or 0 for 120 cum/h: ", 120)
	Qs=float(Qh/3600)  #in cum/s
	H=inout.get_float("Enter head loss in orifice [m] or 0 for 1.5m: ", 1.5)
	Am=float(Qs/(C*(2*g*H)**0.5))
	Amm=round(Am*(1000**2),3)
	d=round((4*Amm/math.pi)**0.5,3)
	print ("Oriffice hole area = %r mm**2") %Amm
	print ("Oriffice hole dia =%r mm") %d
	print ("End of execution")
#!/usr/bin/env python
import inout
print("Calculating time to flood a jacket leg from diaphragm rupture")
print("Script downloaded long time ago and modified to my liking. Credits to (unknown) author") 
rb1 = inout.get_float("Input Reserve buoyancy - intact [t] or '0' for 50: ", 50)
rb2=inout.get_float("Input Reserve buoyancy - damaged [t] or '0' for 30: ",30)
rbt = (rb1+rb2)/2
n = inout.get_integer("Input number of jacket legs or '0' for 3: ", 3)
A=inout.get_float("Input Average area of rupture [sqm] or '0' for 0.25: ", 0.25)
Vol=inout.get_float("Input inner volume of jacket leg [cum] or '0' for 10: ", 10)
#Gravity acceleration
g = 9.81
#Seawater density (MN/m**3)
Y = 0.01025
E = 2.1E+5
#Average reserve buoyancy per jacket leg:
rb = rbt * g /n
# Y in kg/m^3
# Hydostatic head (m)
h = rb / (2.0 * g * Y * 1000.**2 / g)
# Velocity of water ingress (m/s)
V = (2. * g * h)**0.5
# Flow of water into the jacket leg (m^3/s)
Q = V * A
#Vol = input("Enter inner volume of the jacket leg (m^3): ")
# Time to flood jacket leg completely (s)
t = Vol / Q
print("Water flow into jacket leg [cum/s]: ", round (Q,3))
print ("Time to flood [hours]: ", round(t/3600., 3))
예제 #6
0
#Copyright (c) 2013 D. Djokic <deki.djokic at gmail.com>
#This code is released under the [GPL], version 2 or later
# pump hand calculations
import inout
import math
import numpy as np
import warnings
import matplotlib.pyplot as plt

print("1 - Shaft power")
print("2 - NPSHa and Cavitation")
print("3 - Centrifugal Pump Curve")
calc = inout.get_integer("Input 1, 2 or 3: ", 0)
if calc == 1:
    print("Calculating shaft power")
    density = inout.get_float(
        "Input density of fluid in [kg/cum] or '0' for fresh water: ", 1000)
    flow = inout.get_float(
        "Input flow of the pump [cum/h] or '0' for 150 cum/h: ", 150)
    head = inout.get_float("Input differental head [m] or '0' for 30 m: ", 30)
    efficiency = inout.get_float("Input pump efficiency or '0' for 0.6: ", 0.6)
    rpm = inout.get_float("Input pump speed (rpm) or '0' for 1500", 1500)
    power = 9.81 * flow * head * density / (3.6 * 10**6)
    shaft_power = power / efficiency
    print("Power = %f kW") % power
    print("Shaft Power = %f kW") % shaft_power

elif calc == 2:
    print("Calculating Net Positive Suction Head available - NPSHa")
    density = inout.get_float(
        "Input density of fluid in [kg/cum] or '0' for fresh water: ", 1000)
    abs_pressure = inout.get_float(
예제 #7
0
	
def tk_in (arr_name):
## input groups of same tanks
	arr_name=[]
	for groups in range (0, same_tanks_group):
		print ("Tank group: ", groups+1)
		tk=inout.get_integer("Number of Tanks within group - press '0' for 4: ", 4)
		tk_grouped.append (tk)
		tks_tot = sum_list_int(tk_grouped)
	 	arr_name.append(tk)
	return int(tks_tot)
	return arr_name
	
pname=raw_input("Project Name: ")
#general data input
Ks=inout.get_float("Heat Transfer Coef of Heating Pipe [kcal/(sqm*degC)] - press '0' for 100 or input: ", 100)
Ats=inout.get_float("Average Steam Temperature [degC] - press '0' for 170 or input: ", 170)
Dw=inout.get_float("Temperature of Sea Water [degC] - press '0' for 5 degC or input: ", 5)
Dai=inout.get_float("Temperature of Outer air [degC] - press '0' for 2 degC or input: ", 2)
Ds=inout.get_float("Temperature of air in Ship [degC] - press '0' for 10 degC or input: ", 10)
Da=inout.get_float("Temperature of Oil after heating [degC] - press '0' for 45 degC or input: ",45)
Dh=inout.get_float("Temperature of Oil before heating [degC] - press '0' for 15 degC or input: ", 15)
Spwt=inout.get_float("Specific weight of Oil before heating [kg/cum] - press '0' for 800 kg/cum or input: :", 800)
Sph=inout.get_float("Specific Heat of Oil [kcal/(kg*degC)] - press '0' for 0.45 kcal/(kg*degC): ", 0.45)
Tr=inout.get_float("Heating Period [h] - press '0' for 96 h: ", 96)
Sin=inout.get_float("Steam pressure on inlet [kg/sqm] - press '0' for 80000 kg/sqm or input: ", 80000) 
Sout=inout.get_float("Steam pressure on outlet [kg/sqm] - press '0' for 50000 kg/sqm or input: ", 50000) 
Eni=inout.get_float("Enthalpy of steam on inlet [kcal/kg] - press '0' for 660 kcal/kg or input: ", 660)
Eno=inout.get_float("Enthalpy of steam on outlet [kcal/kg] - press '0' for 150 kcal/kg or input: ", 150)
Spv=inout.get_float("Specific volume of Steam on inlet [cum/kg] - press '0' for 0.24 cum/kg: ", 0.24)
Idmm=inout.get_float("Pipe inner Diameter [mm] - press '0' for 54mm: ", 54)
예제 #8
0
#!/usr/bin/env python
import inout
import math
print(
    "Sharp edge orifice calculation - orifice coeficient (C)=0.62 is default")
C = inout.get_float("Enter orifice coeficient or 0 for default of 0.62: ",
                    0.61)
g = 9.81  #m/s^2
print("1-Solving for Flow Through Orifice")
print("2-Solving for Orifice Diameter")
print("3-Solving for Headloss through Orifice")
problem = int(raw_input("Input 1, 2 or 3: "))
if problem == 1:
    print("Solving for Flow")
    d = inout.get_float("Enter orifice hole diameter [mm] or 0 fo 10mm: ", 10)
    H = inout.get_float("Enter head loss in orifice [m] or 0 for 1.5m: ", 1.5)
    dm = float(d / 1000)
    A = dm * dm * math.pi / 4
    Qs = float(C * A * (2 * g * H)**0.5)
    Q = round(float(Qs * 3600), 3)
    print("Q=%r cum/h") % Q
    print("End of execution")
elif problem == 2:
    print("Solving for diameter")
    Qh = inout.get_float("Enter Flow [cum/h] or 0 for 120 cum/h: ", 120)
    Qs = float(Qh / 3600)  #in cum/s
    H = inout.get_float("Enter head loss in orifice [m] or 0 for 1.5m: ", 1.5)
    Am = float(Qs / (C * (2 * g * H)**0.5))
    Amm = round(Am * (1000**2), 3)
    d = round((4 * Amm / math.pi)**0.5, 3)
    print("Oriffice hole area = %r mm**2") % Amm
#!/bin/env python
import inout

print("Hoses and Umbilical Properties")
print("Use maker's data, if available, instead of this calculation")
print("1 - Hoses")
print("2 - Umbilcals")
opt1 = inout.get_integer("Choose 1 or 2: ", 0)
if opt1 == 1:
    print("Calculating Hoses Properties")
    IDmm = inout.get_float("Enter hose inner diameter in mm or '0' for default of 100mm: ", 100.0)
    ID = IDmm / 1000
    # calculating Outer Diameter
    HPod = 1.40 * IDmm  # high pressure hoses
    LPod = 1.28 * IDmm  # low pressure hoses
    FFod = 1.34 * IDmm  # fold-flat hoses
    # calculating mass per meter
    HPmass = 0.73253 * ID  # high pressure hoses
    LPmass = 0.3642 * ID  # low pressure hoses
    FFmass = 0.1844 * ID  # fold-flat hoses
    # calculating Axial Stiffness
    HPas = ID * 2.8 * 10 ** 6  # high pressure hoses
    LPas = ID * 3.4 * 10 ** 6  # low pressure hoses
    FFas = ID * 6.56 * 10 ** 6  # fold-flat hoses
    # calculating Bending Stiffness
    HPbs = 30000 * ID ** 4  # high pressure hoses
    LPbs = 600 * ID ** 3  # low pressure hoses
    FFbs = 100 * ID ** 3  # fold-flat hoses
    # writing results to a file "hoses.txt"
    fname = "hoses.txt"
    fn = open(fname, "a")
예제 #10
0
	inout.write_file(fn, "xc [cm]: ", xc)
	inout.write_file(fn, "yc [cm]: ", yc)	
	return

print("Choose section type as follows:")
print("1- Angle Section (L)")
print("2-Pipe Section")
print("3-Hollow box")
print("4-Channel ('C', 'U')")
print("5-T shape")  
print("6-Equal I shape")
shape=inout.get_integer("Enter 1, 2, 3, 4, 5 or 6: ", 1)
if shape==1:
	print ("Calculating Angle (L) section")
	fname="angle.txt"
	b=inout.get_float("Length of the short leg (b) or '0' for 8cm: ", 8.0)
	t=inout.get_float("Thickness of the steel (t) or '0' for 1.5cm: ", 1.5)
	h=inout.get_float("Length of the long leg (d) or '0' for 10cm: ", 10.0)
	if h<b:
		print("Wrong input")
	else:
		a=b-t
		c=h-t
		x=(b**2+c*t)/(2*(b+c))
		y=(h**2+a*t)/(2*(b+c))
		A=(h-t)*t+b*t
		Ix=-t*(4*t**4-10*h*t**3-14*b*t**3+9*h*h*t*t+28*b*h*t**2+(b*t)**2-4*h**3*t-18*b*h*h*t+h**4+4*b*h**3)/(12*(t-h-b))
		Iy=-t*(t**4-2*h*t**3+(h**2)*(t**2)+4*b*h*t*t+6*b*b*h*t**2-6*b*b*h*t-4*t*b**3+4*h*b**3+b**4)/(12*(t-h-b))
		A=(h-t)*t+b*t
		Sx=Ix/(h-y)
		Sy=Iy/(b-x)
예제 #11
0
#!/usr/bin/env python
import inout

def area(corners, n):
    area = 0.0
    for i in range(n):
        j = (i + 1) % n
        area += corners[i][0] * corners[j][1]
        area -= corners[j][0] * corners[i][1]
    area = abs(area) / 2.0
    return area
print("Corners must be ordered in Clockwise or Counter-Clockwise Direction!")
n=inout.get_integer("Number of corners or '0' for 3: ", 3)
corners=[]
for corner_nr in range(0, n,1):
	print ("Corner: "), corner_nr
	x=inout.get_float("Enter X coordinate: ", corner_nr)
	y=inout.get_float("Enter Y coordinate: ", corner_nr)
	coords=(x, y)
	corners.append(coords)
print("Polygon Area: "), area(corners,n)