def set_res_and_power_holtrop(self, speed=2): # Used in optimization Rv2 = h.calc_Rv_boat(self, self.V2) Rv5 = h.calc_Rv_boat(self, self.V5) Rw2 = h.calc_Rw_boat(self, self.V2) Rw5 = h.calc_Rw_boat(self, self.V5) Ra2 = h.calc_Ra_boat(self, self.V2) Ra5 = h.calc_Ra_boat(self, self.V5) self.Rd2 = Rv2 + Rw2 + Ra2 self.Rd5 = Rv5 + Rw5 + Ra5 self.P2 = (1 + self.power_margin ) * self.Rd2 * self.V2 / self.total_propulsive_efficiency self.P5 = (1 + self.power_margin ) * self.Rd5 * self.V5 / self.total_propulsive_efficiency # Used in querying resistances of converged hull V_speed = self.kts_2_mps(speed) Rv_speed = h.calc_Rv_boat(self, V_speed) Rw_speed = h.calc_Rw_boat(self, V_speed) Ra_speed = h.calc_Ra_boat(self, V_speed) # print(f'V_speed: {V_speed}') # print(f'Rv_speed: {Rv_speed}') # print(f'Rw_speed: {Rw_speed}') # print(f'Ra_speed: {Ra_speed}') Rd_speed = Rv_speed + Rw_speed + Ra_speed P_speed = (1 + self.power_margin ) * Rd_speed * V_speed / self.total_propulsive_efficiency return Rd_speed, P_speed
def calcWave(x, V, g, rho, LCB, Cwp, At, Abt, hb): LWL = x[0] B = x[1] Ta = x[2] Tf = x[2] Cb = x[3] Cm = x[4] T = h.calc_T(Ta, Tf) #m Vol = LWL*B*T*Cb Rw = h.calc_Rw(V, LWL, g, rho, Vol, B, Ta, Tf, Cm, LCB, Cwp, At, Abt, hb) return Rw
def calcCor(x, rho, V, Cwp, Abt): B = x[1] Cb = x[3] Ta = x[2] Tf = x[2] Cm = x[4] T = h.calc_T(Ta, Tf) #m S = h.calc_S(x[0], T, B, Cm, Cb, Cwp, Abt) Ca = h.calc_Ca(x[0]) Ra = h.calc_Ra(rho, V, Ca, S) return Ra
def calcVisc(x, V, g, rho, LCB, Cwp, At, Abt, u_k, Cstern): LWL = x[0] B = x[1] Ta = x[2] Tf = x[2] Cb = x[3] Cm = x[4] Cp = calcCp(x) T = h.calc_T(Ta, Tf) #m Vol = LWL*B*T*Cb Rv = h.calc_Rv(rho, V, LWL, u_k, B, T, Vol, Cp, LCB, Cstern, Cm, Cb, Cwp, Abt) return Rv
def calcVol(x): LWL = x[0] B = x[1] Ta = x[2] Tf = x[2] Cb = x[3] T = h.calc_T(Ta, Tf) #m Vol = LWL*B*T*Cb return Vol
Sapp = 50 # wetted area appendages m^2 Cstern = 10 # stern shape parameter D = 8 # propeller diameter m Z = 4 # number of propeUer blades Clearance = 0.2 # clearance propeller with keel line m V = 25 #knots V = V * 0.514444 # m/s g = 9.81 # m/s^2 rho = 1025 #kg/m^3 u_k = 9.37e7 #kinematic viscosity of seawater at 35 g/kg and 25 C # Bulb Bow Abt = 20 #m^2 hb = 4 #m LCB = h.LCB_LBP_2_LCB_LWL( LWL, LBP, LCB_LBP) # longitudinal centre of buoyancy % fwd of 1/2 LWL T = h.calc_T(Ta, Tf) #m Rw = h.calc_Rw(V, LWL, g, rho, Vol, B, Ta, Tf, Cm, LCB, Cwp, At, Abt, hb) Cb = h.calc_Cb(Vol, LWL, B, T) Cp = h.calc_Cp(Cb, Cm) Rv = h.calc_Rv(rho, V, LWL, u_k, B, T, Vol, Cp, LCB, Cstern, Cm, Cb, Cwp, Abt) Ca = h.calc_Ca(LWL) S = h.calc_S(LWL, T, B, Cm, Cb, Cwp, Abt) Ra = h.calc_Ra(rho, V, Ca, S) R = h.calc_R(Rv, Rw, Ra)
def constraintCpLow(x): Fn = h.calc_Fn(V, x[0], g) Cp = calcCp(x) return Cp - (1.0633-1.777*Fn)
def constraintCpHigh(x): Fn = h.calc_Fn(V, x[0], g) Cp = calcCp(x) return (1.12666-1.722*Fn) - Cp
def calcCp(x): Cm = x[4] Cb = x[3] Cp = h.calc_Cp(Cb, Cm) return Cp
waveOpt = calcWave(xOpt, 1.543, 9.81, 1025, -0.75, 0.75, 0, 0, 0) #x, V, g, rho, LCB, Cwp, At, Abt, u_k, Cstern viscOpt = calcVisc(xOpt, 1.543, 9.81, 1025, -0.75, 0.75, 16, 0, 9.37e7, 10) # x, rho, V, Cwp, Abt corOpt = calcCor(xOpt, 1025, 1.543, 0.75, 0) print('Length: ' + str(xOpt[0])) print('Width: ' + str(xOpt[1])) print('Draft: ' + str(xOpt[2])) print('Cb: ' + str(xOpt[3])) print('Cm: ' + str(xOpt[4])) print('Vol: ' + str(calcVol(xOpt))) print('Volcos: ' + str(constraintVol(xOpt))) print('CpLow: ' + str(constraintCpLow(xOpt))) print('CpHigh: ' + str(constraintCpHigh(xOpt))) print('Fn: ' + str(h.calc_Fn(V, xOpt[0], g))) # should be between 0.12-0.3 print('Cp: ' + str(calcCp(xOpt))) print('Rw: ' + str(waveOpt)) print('Rv: ' + str(viscOpt)) print('Ra: ' + str(corOpt)) print('Rt: ' + str(waveOpt + viscOpt + corOpt)) waveOpt = calcWave([205, 32, 10, 0.57, 0.98], 1.543, 9.81, 1025, -0.75, 0.75, 16, 0, 0) print('Rw: ' + str(waveOpt)) print('')
#x, V, g, rho, LCB, Cwp, At, Abt, u_k, Cstern viscOpt = calcVisc(xOpt, 1.543, 9.81, 1025, -0.75, 0.75, 16, 0, 9.37e-7, 10) # x, rho, V, Cwp, Abt corOpt = calcCor(xOpt, 1025, 1.543, 0.75, 0) print('Length: ' + str(xOpt[0])) print('Width: ' + str(xOpt[1])) print('Draft: ' + str(xOpt[2])) print('Cb: ' + str(xOpt[3])) print('Cm: ' + str(xOpt[4])) print('Vol: ' + str(calcVol(xOpt))) print('Volcos: ' + str(constraintVol(xOpt))) print('CpLow: ' + str(constraintCpLow(xOpt))) print('CpHigh: ' + str(constraintCpHigh(xOpt))) print('Fn: ' + str(h.calc_Fn(V, xOpt[0], g))) # should be between 0.12-0.3 print('Cp: ' + str(calcCp(xOpt))) print('Rv: ' + str(viscOpt)) print('Ra: ' + str(corOpt)) print('Rt: ' + str(viscOpt + corOpt)) k1_1 = h.calc_k1_1(xOpt[1], xOpt[0], xOpt[2], calcVol(xOpt), calcCp(xOpt), -0.75, 10) S = h.calc_S(xOpt[0], xOpt[2], xOpt[1], xOpt[4], xOpt[3], 0.75, 0) Ca = h.calc_Ca(xOpt[0]) Cf = h.calc_Cf(V, xOpt[0], u_k) print('k1_1: ' + str(k1_1)) print('S: ' + str(S)) print('Ca: ' + str(Ca))