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
#!/usr/bin/env python #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)
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 #Bending Stiffness BS=0
#!/usr/bin/env python #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(
#!/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))
inout.write_file (fn, "Enthalpy of steam on inlet [kcal/kg]: ", Eni) inout.write_file (fn, "Enthalpy of steam on outlet [kcal/kg]: ", Eno) inout.write_file (fn, "Specific volume of Steam on inlet [cum/kg]: ", Spv) inout.write_file (fn, "Pipe inner Diameter [mm]: ", Idmm) inout.write_file (fn, "Pipe outer Diameter [mm]: ", Odmm) fn.close() #ubaciti Kws to Kho #common data - heat transfer coef. [kcal/(sqm*degC)] Kws=17 #shipside oil to sea Kwb=4 #bottom oil to sea Kas=15 #shipside oil to air Kad=5 #deck - oil to air Khw=15 #oil to water in ship (ballast) Kha=4 #oil to air in ship Kho=4 #oil to unheated oil in ship same_tanks_group=inout.get_integer("Number of same tanks groups - press '0' for 3: ", 3) fn=open(filename, 'a') for tank_group in range (0, same_tanks_group): ##pogledaj ovu petlju - da se ubaci u sledecu?! inout.write_file(fn, "Group number: ", tank_group) # inout.write_file(fn, "Number of same tanks in group: ", tk_grouped[tank_group]) fn.close() #tank input - all Area units in [sqm] #containers for tank bulkeads surface areas Aws=[] #Oil to sea area Awb=[] #bottom to sea area Aas=[] #Shipside oil to air area Aad=[] #deck - oil to air area Ahw=[] #oil to water in ship area Aha=[] #oil to air in ship area Aho=[] #oil to unheated oil in ship area
#!/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")
inout.write_file(fn, "Radius of gyration X-X axis [cm]: ", rx) inout.write_file(fn, "Radius of gyration Y-Y axis [cm]: ", ry) inout.write_file(fn, "Ixy [cm]: ", Ixy) inout.write_file(fn, "Ip [cm]: ", Ip) 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))
#!/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)