예제 #1
0
        def execute(self):
            """applying lifting line theory"""
        
            AR = self.AR
            N = self.N
            a0 = 2*pi  # Sectional lift curve slope
            theta = numpy.linspace(pi/2, pi-pi/2/N, N)  # locations of collocation points
            a_inf , a_zeroLift = convert_units(self.a_inf, 'deg', 'rad') , convert_units(self.a_zeroLift, 'deg', 'rad')

            M = numpy.zeros([N,N]) # coefficient matrix
            F = numpy.zeros([N,1]) # right hand side array
    
    
            for ii in range(N):   # loop over span-wise location
                                for jj in range(N): # loop over A_n unknowns
                   					M[ii,jj] = 4*AR/a0*sin((2*jj+1)*theta[ii]) + (2*jj+1)*sin((2*jj+1)*theta[ii])/sin(theta[ii]);   # filling the coefficient matrix
                        ####rectangular wing only#### otherwise AR = b**2/S = b/c
            
        
            
            
            F[:] = (a_inf - a_zeroLift)   # assuming no twist   
            
    
            A = numpy.linalg.solve(M,F) # solving the sys
    
            self.A = A
            ## OUTPUT
    
            #CL
            self.CL = pi*self.AR*A[0][0]
        
            #CDi & K

            sum = 0;
            for i in range(N):
                sum = sum + (2*i+1)*A[i][0]**2;
            

            Del = sum/A[0][0]**2 - 1
            e = 1/(1+Del)

            self.K = 1/(pi*AR*e)
            self.CDi = pi*self.AR*sum;


            print'CL', self.CL
            print'CDi', self.CDi
예제 #2
0
    def execute(self):
        """ Simulate the vehicle model at full throttle."""

        # Set initial throttle, gear, and velocity
        time = 0.0
        velocity = 0.0
        throttle = 1.0
        gear = 1

        while velocity < self.end_speed:

            self._velocity_str_expr.set(velocity)
            self._throttle_str_expr.set(throttle)
            self._gear_str_expr.set(gear)
            self.run_iteration()

            acceleration = self._acceleration_str_expr.evaluate(self.parent)
            overspeed = self._overspeed_str_expr.evaluate(self.parent)

            # If the next gear can produce more torque, let's shift.
            if gear < 5:
                self._gear_str_expr.set(gear + 1)
                self.run_iteration()

                acceleration2 = self._acceleration_str_expr.evaluate(
                    self.parent)
                if acceleration2 > acceleration:
                    gear += 1
                    acceleration = acceleration2
                    overspeed = self._overspeed_str_expr.evaluate(self.parent)

            # If RPM goes over MAX RPM, shift gears
            # (i.e.: shift at redline)
            if overspeed:
                gear += 1
                self._gear_str_expr.set(gear)
                self.run_iteration()
                acceleration = self._acceleration_str_expr.evaluate(
                    self.parent)
                overspeed = self._overspeed_str_expr.evaluate(self.parent)

                if overspeed:
                    self.raise_exception("Gearing problem in Accel test.",
                                         RuntimeError)

            acceleration = convert_units(acceleration, 'm/(s*s)', 'mi/(h*s)')

            if acceleration <= 0.0:
                self.raise_exception("Vehicle could not reach maximum speed "+\
                                     "in Acceleration test.", RuntimeError)

            velocity += (acceleration * self.timestep)

            time += self.timestep

        self.accel_time = time
    def execute(self):
        """ Simulate the vehicle model at full throttle."""
        
        # Set initial throttle, gear, and velocity
        time = 0.0
        velocity = 0.0
        throttle = 1.0
        gear = 1
        
        while velocity < self.end_speed:

            self.set_parameter_by_name('velocity', velocity)
            self.set_parameter_by_name('throttle', throttle)
            self.set_parameter_by_name('gear', gear)
            self.run_iteration()
            
            objectives = self.get_objectives()
            acceleration = objectives['acceleration'].evaluate(self.parent)
            overspeed = objectives['overspeed'].evaluate(self.parent)
            
            # If the next gear can produce more torque, let's shift.
            if gear < 5:
                self.set_parameter_by_name('gear', gear+1)
                self.run_iteration()
            
                acceleration2 = objectives['acceleration'].evaluate(self.parent)
                if acceleration2 > acceleration:
                    gear += 1
                    acceleration = acceleration2
                    overspeed = objectives['overspeed'].evaluate(self.parent)
                
            
            # If RPM goes over MAX RPM, shift gears
            # (i.e.: shift at redline)
            if overspeed:
                gear += 1
                self.set_parameter_by_name('gear', gear)
                self.run_iteration()
                acceleration = objectives['acceleration'].evaluate(self.parent)
                overspeed = objectives['overspeed'].evaluate(self.parent)
                
                if overspeed:
                    self.raise_exception("Gearing problem in Accel test.", 
                                             RuntimeError)

            acceleration = convert_units(acceleration, 'm/(s*s)', 'mi/(h*s)')
            
            if acceleration <= 0.0:
                self.raise_exception("Vehicle could not reach maximum speed "+\
                                     "in Acceleration test.", RuntimeError)
                
            velocity += (acceleration*self.timestep)
        
            time += self.timestep
                   
        self.accel_time = time
예제 #4
0
	 def execute(self):
	
	    Velocity = 35.0 #assume 35ft/s
	    Len_fuse = self.Len_fuse
	    Wid_fuse = self.Wid_fuse
	    Hgt_fuse = self.Hgt_fuse
	    S_ref = self.S_wing   # reference area = wing area for small twist & dihedral
	    c_wr = self.c_wr
	    c_ht = self.c_ht
	    c_vt = self.c_vt
	    Airfoil_t_over_c_wing = self.Airfoil_t_over_c_wing
	    Airfoil_t_over_c_tail = self.Airfoil_t_over_c_tail
	
		# Wetted surfaces
	    Swet_wing = self.S_wing*2.0*(1+0.2*Airfoil_t_over_c_wing) # wetted area for wing
	    Swet_ht = self.S_ht*2.0*(1+0.2*Airfoil_t_over_c_tail)
	    Swet_vt = self.S_vt*2.0*(1+0.2*Airfoil_t_over_c_tail)
	    Swet_fuse = Len_fuse * (Wid_fuse + Hgt_fuse)*2  # in**3
	    Swet_fuse = convert_units(Swet_fuse, 'inch**3', 'ft**3')
        


		# form factors
	    k_wing = 1 + 2*1.1*(Airfoil_t_over_c_wing) + 1.1**2*(Airfoil_t_over_c_wing)**2*(1+5)/2
	    k_tail = 1 + 2*1.1*(Airfoil_t_over_c_tail) + 1.1**2*(Airfoil_t_over_c_tail)**2*(1+5)/2
	    d = (Wid_fuse**2+Hgt_fuse**2)**0.5/Len_fuse
	    D = (1-d**2)**0.5
	    a = 2*d**2/(D**3*(math.atanh(D)-D))
	    k_fuse = (1 + 2.3*(a/(2-a)))**2



		# skin friction coefficient
	    cf_fuse = 1.328/((Len_fuse/12)*Velocity/(1.58*10**-4))**.5
	    cf_w = 1.328/((c_wr/12)*Velocity/(1.58*10**-4))**.5
	    cf_ht = 1.328/((c_ht/12)*Velocity/(1.58*10**-4))**.5
	    cf_vt = 1.328/((c_vt/12)*Velocity/(1.58*10**-4))**.5

	
	    self.Cd_p = (k_wing*cf_w*Swet_wing+k_fuse*cf_fuse*Swet_fuse+k_tail*cf_ht*Swet_ht+k_tail*cf_vt*Swet_vt)/S_ref


	    print 'cdp', self.Cd_p	
예제 #5
0
 def set(self, obj, name, value):
     """ Set all target values. """
     for wref, attr, indices in self._targets:
         if indices:
             obj = getattr(wref(), attr)
             for index in indices[:-1]:
                 obj = object[index]
             if isinstance(value, AttrWrapper):
                 src_units = value.metadata['units']
                 dst_units = obj.trait(name).units
                 if dst_units and src_units and src_units != dst_units:
                     obj[indices[-1]] = \
                         convert_units(value.value, src_units, dst_units)
                 else:
                     obj[indices[-1]] = value.value
             else:
                 obj[indices[-1]] = value
         else:
             setattr(wref(), attr, value)
예제 #6
0
 def set(self, obj, name, value):
     """ Set all target values. """
     for wref, attr, indices in self._targets:
         if indices:
             obj = getattr(wref(), attr)
             for index in indices[:-1]:
                 obj = object[index]
             if isinstance(value, AttrWrapper):
                 src_units = value.metadata['units']
                 dst_units = obj.trait(name).units
                 if dst_units and src_units and src_units != dst_units:
                     obj[indices[-1]] = \
                         convert_units(value.value, src_units, dst_units)
                 else:
                     obj[indices[-1]] = value.value
             else:
                 obj[indices[-1]] = value
         else:
             setattr(wref(), attr, value)
예제 #7
0
 def execute(self):
     """ The 5-speed manual transmission is simulated by determining the
     torque output and engine RPM via the gear ratios.
     """
     ratios = [0.0, self.ratio1, self.ratio2, self.ratio3, self.ratio4,
               self.ratio5]
     
     gear = self.current_gear
     differential = self.final_drive_ratio
     tire_circ = self.tire_circ
     velocity = convert_units(self.velocity, 'mi/h', 'inch/min')
     
     self.RPM = (ratios[gear]*differential \
                 *velocity)/(tire_circ)
     self.torque_ratio = ratios[gear]*differential
         
     # At low speeds, hold engine speed at 1000 RPM and
     # partially engage clutch
     if self.RPM < 1000.0 and self.current_gear == 1 :
         self.RPM = 1000.0
예제 #8
0
    def execute(self):
        """ Simulate the vehicle over a velocity profile."""
        
        # Set initial throttle, gear, and velocity
        throttle = 1.0
        gear = 1
        time1 = 0.0
        velocity1 = 0.0
        
        profile_stream = resource_stream('openmdao.examples.enginedesign',
                                         self.profilename)
        profile_reader = reader(profile_stream, delimiter=',')
        
        distance = 0.0
        fuelburn = 0.0
        
        self._gear_str_expr.set(gear)
        
        for row in profile_reader:
            
            time2 = float(row[0])
            velocity2 = float(row[1])
            converged = 0
            
            command_accel = (velocity2-velocity1)/(time2-time1)
            
            #------------------------------------------------------------
            # Choose the correct Gear
            #------------------------------------------------------------

            # First, if speed is less than 10 mph, put it in first gear.
            # Note: some funky gear ratios might not like this.
            # So, it's a hack for now.
            
            if velocity1 < self.shiftpoint1:
                gear = 1
                self._gear_str_expr.set(gear)
                
            # Find out min and max accel in current gear.
            
            throttle = self.throttle_min
            self._velocity_str_expr.set(velocity1)
            self._throttle_str_expr.set(throttle)
            gear = self._findgear(velocity1, throttle, gear)                    
            acceleration = self._acceleration_str_expr.evaluate(self.parent)
            accel_min = convert_units(acceleration, 'm/(s*s)', 'mi/(h*s)')
            
            # Upshift if commanded accel is less than closed-throttle accel
            # The net effect of this will often be a shift to a higher gear
            # when the vehicle stops accelerating, which is reasonable.
            # Note, this isn't a While loop, because we don't want to shift
            # to 5th every time we slow down.
            if command_accel < accel_min and gear < 5 and \
               velocity1 > self.shiftpoint1:
                
                gear += 1
                self._gear_str_expr.set(gear)
                gear = self._findgear(velocity1, throttle, gear)                    
                acceleration = self._acceleration_str_expr.evaluate(self.parent)
                accel_min = convert_units(acceleration, 'm/(s*s)', 'mi/(h*s)')
            
            throttle = self.throttle_max
            self._throttle_str_expr.set(throttle)
            self.run_iteration()
            acceleration = self._acceleration_str_expr.evaluate(self.parent)
            accel_max = convert_units(acceleration, 'm/(s*s)', 'mi/(h*s)')
            
            # Downshift if commanded accel > wide-open-throttle accel
            while command_accel > accel_max and gear > 1:
                
                gear -= 1
                self._gear_str_expr.set(gear)
                gear = self._findgear(velocity1, throttle, gear)                    
                acceleration = self._acceleration_str_expr.evaluate(self.parent)
                accel_max = convert_units(acceleration, 'm/(s*s)', 'mi/(h*s)')
            
            # If engine cannot accelerate quickly enough to match profile, 
            # then raise exception    
            if command_accel > accel_max:
                self.raise_exception("Vehicle is unable to achieve " \
                "acceleration required to match EPA driving profile.", 
                                                RuntimeError)
                    
            #------------------------------------------------------------
            # Bisection solution to find correct Throttle position
            #------------------------------------------------------------

            # Deceleration at closed throttle
            throttle = self.throttle_min
            self._throttle_str_expr.set(throttle)
            self.run_iteration()
            acceleration = self._acceleration_str_expr.evaluate(self.parent)
            
            if command_accel >= accel_min:
                
                min_acc = convert_units(acceleration, 'm/(s*s)', 'mi/(h*s)')
                max_acc = accel_max
                min_throttle = self.throttle_min
                max_throttle = self.throttle_max
                new_throttle = .5*(min_throttle + max_throttle)
                
                # Numerical solution to find throttle that matches accel
                while not converged:
                
                    throttle = new_throttle
                    self._throttle_str_expr.set(throttle)
                    self.run_iteration()
                    acceleration = self._acceleration_str_expr.evaluate(self.parent)
                    new_acc = convert_units(acceleration, 'm/(s*s)', 'mi/(h*s)')
                    
                    if abs(command_accel-new_acc) < self.tolerance:
                        converged = 1
                    else:
                        if new_acc < command_accel:
                            min_throttle = new_throttle
                            min_acc = new_acc
                            step = (command_accel-min_acc)/(max_acc-new_acc)
                            new_throttle = min_throttle + \
                                        step*(max_throttle-min_throttle)
                        else:
                            max_throttle = new_throttle
                            step = (command_accel-min_acc)/(new_acc-min_acc)
                            new_throttle = min_throttle + \
                                        step*(max_throttle-min_throttle)
                            max_acc = new_acc
                      
            distance += .5*(velocity2+velocity1)*(time2-time1)
            burn_rate = self._fuel_burn_str_expr.evaluate(self.parent)
            fuelburn += burn_rate*(time2-time1)
            
            velocity1 = velocity2
            time1 = time2
            
            #print "T = %f, V = %f, Acc = %f" % (time1, velocity1, 
            #command_accel)
            #print gear, accel_min, accel_max
            
        # Convert liter to gallon and sec/hr to hr/hr
        distance = convert_units(distance, 'mi*s/h', 'mi')
        fuelburn = convert_units(fuelburn, 'L', 'galUS')
        self.fuel_economy = distance/fuelburn
예제 #9
0
def example_218WD_3MW():
    example = optimizationSpar()
    tt = time.time()
    example.spar.number_of_sections = 4
    example.spar.outer_diameter = [5., 6., 6., 9.]
    example.spar.length = [6., 12., 15., 47.]
    example.spar.end_elevation = [7., -5., -20., -67.]
    example.spar.start_elevation = [13., 7., -5., -20.]
    example.spar.bulk_head = ['N', 'T', 'N', 'B']
    example.spar.water_depth = 218.
    example.spar.load_condition = 'N'
    example.spar.significant_wave_height = 10.820
    example.spar.significant_wave_period = 9.800
    example.spar.wind_reference_speed = 11.
    example.spar.wind_reference_height = 75.
    example.spar.alpha = 0.110
    example.spar.RNA_keel_to_CG = 142.
    example.spar.RNA_mass = 125000.
    example.spar.tower_mass = 127877.
    example.spar.tower_center_of_gravity =  23.948
    example.spar.tower_wind_force = 19950.529
    example.spar.RNA_wind_force = 391966.178
    example.spar.RNA_center_of_gravity_x = 4.1
    example.spar.mooring_total_cost = 810424.053596  
    example.spar.mooring_keel_to_CG = 54.000
    example.spar.mooring_vertical_load = 1182948.791
    example.spar.mooring_horizontal_stiffness = 3145.200
    example.spar.mooring_vertical_stiffness =7111.072
    example.spar.sum_forces_x = [7886.848,437.844,253.782,174.651,124.198,85.424,50.689,17.999,-13.222,-43.894,-74.245,-105.117,-136.959,-170.729,-207.969,-251.793,-307.638,-386.514,-518.734,-859.583,-11091.252]
    example.spar.offset_x = [-40.362,-35.033,-29.703,-24.373,-19.044,-13.714,-8.385,-3.055,2.274,7.604,12.933,18.263,23.593,28.922,34.252,39.581,44.911,50.240,55.570,60.900,66.229]
    example.spar.damaged_mooring = [-40.079,65.824]
    example.spar.intact_mooring = [-39.782,65.399]
    example.spar.run()
    example.run()
    yna = convert_units(example.spar.neutral_axis ,'m','inch')
    fullStiffeners = full_stiffeners_table()
    for i in range (0,len(fullStiffeners)-1):
        stiffener_bef = fullStiffeners[i]
        stiffener_aft = fullStiffeners[i+1]
        if yna > stiffener_bef[6] and yna<stiffener_aft[6]:
            opt_index = i+1
    
    second_fit = Spar()
    second_fit.wall_thickness = example.spar.wall_thickness
    second_fit.number_of_rings = example.spar.number_of_rings
    second_fit.stiffener_curve_fit = False
    second_fit.stiffener_index = opt_index
    second_fit.number_of_sections = example.spar.number_of_sections
    second_fit.outer_diameter = example.spar.outer_diameter 
    second_fit.length = example.spar.length 
    second_fit.end_elevation = example.spar.end_elevation 
    second_fit.start_elevation = example.spar.start_elevation 
    second_fit.bulk_head = example.spar.bulk_head 
    second_fit.water_depth = example.spar.water_depth 
    second_fit.load_condition = example.spar.load_condition 
    second_fit.significant_wave_height = example.spar.significant_wave_height
    second_fit.significant_wave_period = example.spar.significant_wave_period 
    second_fit.wind_reference_speed = example.spar.wind_reference_speed 
    second_fit.wind_reference_height = example.spar.wind_reference_height 
    second_fit.alpha = example.spar.alpha 
    second_fit.RNA_keel_to_CG = example.spar.RNA_keel_to_CG 
    second_fit.RNA_mass = example.spar.RNA_mass
    second_fit.tower_mass = example.spar.tower_mass
    second_fit.tower_center_of_gravity = example.spar.tower_center_of_gravity 
    second_fit.tower_wind_force = example.spar.tower_wind_force 
    second_fit.RNA_wind_force = example.spar.RNA_wind_force 
    second_fit.RNA_center_of_gravity_x = example.spar.RNA_center_of_gravity_x 
    second_fit.mooring_total_cost = example.spar.mooring_total_cost  
    second_fit.mooring_keel_to_CG = example.spar.mooring_keel_to_CG 
    second_fit.mooring_vertical_load = example.spar.mooring_vertical_load 
    second_fit.mooring_horizontal_stiffness = example.spar.mooring_horizontal_stiffness 
    second_fit.mooring_vertical_stiffness = example.spar.mooring_vertical_stiffness 
    second_fit.sum_forces_x = example.spar.sum_forces_x 
    second_fit.offset_x = example.spar.offset_x
    second_fit.damaged_mooring = example.spar.damaged_mooring 
    second_fit.intact_mooring = example.spar.intact_mooring 
    second_fit.run()

    cost = second_fit.total_cost
    index = opt_index
    best_index = opt_index
    unity = max(second_fit.web_compactness,second_fit.flange_compactness,max(second_fit.VAL),max(second_fit.VAG),max(second_fit.VEL),max(second_fit.VEG))   
    for i in range(opt_index,326):
        index += 1
        second_fit.stiffener_index = index
        second_fit.run()
        unity = max(second_fit.web_compactness,second_fit.flange_compactness,max(second_fit.VAL),max(second_fit.VAG),max(second_fit.VEL),max(second_fit.VEG)) 
        if unity < 1.0:
            if second_fit.total_cost < cost : 
                cost=second_fit.total_cost 
                best_index = i
                second_fit.stiffener_index = best_index
                second_fit.run()
    print '--------------example_218WD_3MW------------------'
    print "Elapsed time: ", time.time()-tt, " seconds"
    sys_print(second_fit)
예제 #10
0
    def execute(self):
        """ Simulate the vehicle over a velocity profile."""

        # Set initial throttle, gear, and velocity
        throttle = 1.0
        gear = 1
        time1 = 0.0
        velocity1 = 0.0

        profile_stream = resource_stream('openmdao.examples.enginedesign',
                                         self.profilename)
        profile_reader = reader(profile_stream, delimiter=',')

        distance = 0.0
        fuelburn = 0.0

        self._gear_str_expr.set(gear)

        for row in profile_reader:

            time2 = float(row[0])
            velocity2 = float(row[1])
            converged = 0

            command_accel = (velocity2 - velocity1) / (time2 - time1)

            #------------------------------------------------------------
            # Choose the correct Gear
            #------------------------------------------------------------

            # First, if speed is less than 10 mph, put it in first gear.
            # Note: some funky gear ratios might not like this.
            # So, it's a hack for now.

            if velocity1 < self.shiftpoint1:
                gear = 1
                self._gear_str_expr.set(gear)

            # Find out min and max accel in current gear.

            throttle = self.throttle_min
            self._velocity_str_expr.set(velocity1)
            self._throttle_str_expr.set(throttle)
            gear = self._findgear(velocity1, throttle, gear)
            acceleration = self._acceleration_str_expr.evaluate(self.parent)
            accel_min = convert_units(acceleration, 'm/(s*s)', 'mi/(h*s)')

            # Upshift if commanded accel is less than closed-throttle accel
            # The net effect of this will often be a shift to a higher gear
            # when the vehicle stops accelerating, which is reasonable.
            # Note, this isn't a While loop, because we don't want to shift
            # to 5th every time we slow down.
            if command_accel < accel_min and gear < 5 and \
               velocity1 > self.shiftpoint1:

                gear += 1
                self._gear_str_expr.set(gear)
                gear = self._findgear(velocity1, throttle, gear)
                acceleration = self._acceleration_str_expr.evaluate(
                    self.parent)
                accel_min = convert_units(acceleration, 'm/(s*s)', 'mi/(h*s)')

            throttle = self.throttle_max
            self._throttle_str_expr.set(throttle)
            self.run_iteration()
            acceleration = self._acceleration_str_expr.evaluate(self.parent)
            accel_max = convert_units(acceleration, 'm/(s*s)', 'mi/(h*s)')

            # Downshift if commanded accel > wide-open-throttle accel
            while command_accel > accel_max and gear > 1:

                gear -= 1
                self._gear_str_expr.set(gear)
                gear = self._findgear(velocity1, throttle, gear)
                acceleration = self._acceleration_str_expr.evaluate(
                    self.parent)
                accel_max = convert_units(acceleration, 'm/(s*s)', 'mi/(h*s)')

            # If engine cannot accelerate quickly enough to match profile,
            # then raise exception
            if command_accel > accel_max:
                self.raise_exception("Vehicle is unable to achieve " \
                "acceleration required to match EPA driving profile.",
                                                RuntimeError)

            #------------------------------------------------------------
            # Bisection solution to find correct Throttle position
            #------------------------------------------------------------

            # Deceleration at closed throttle
            throttle = self.throttle_min
            self._throttle_str_expr.set(throttle)
            self.run_iteration()
            acceleration = self._acceleration_str_expr.evaluate(self.parent)

            if command_accel >= accel_min:

                min_acc = convert_units(acceleration, 'm/(s*s)', 'mi/(h*s)')
                max_acc = accel_max
                min_throttle = self.throttle_min
                max_throttle = self.throttle_max
                new_throttle = .5 * (min_throttle + max_throttle)

                # Numerical solution to find throttle that matches accel
                while not converged:

                    throttle = new_throttle
                    self._throttle_str_expr.set(throttle)
                    self.run_iteration()
                    acceleration = self._acceleration_str_expr.evaluate(
                        self.parent)
                    new_acc = convert_units(acceleration, 'm/(s*s)',
                                            'mi/(h*s)')

                    if abs(command_accel - new_acc) < self.tolerance:
                        converged = 1
                    else:
                        if new_acc < command_accel:
                            min_throttle = new_throttle
                            min_acc = new_acc
                            step = (command_accel - min_acc) / (max_acc -
                                                                new_acc)
                            new_throttle = min_throttle + \
                                        step*(max_throttle-min_throttle)
                        else:
                            max_throttle = new_throttle
                            step = (command_accel - min_acc) / (new_acc -
                                                                min_acc)
                            new_throttle = min_throttle + \
                                        step*(max_throttle-min_throttle)
                            max_acc = new_acc

            distance += .5 * (velocity2 + velocity1) * (time2 - time1)
            burn_rate = self._fuel_burn_str_expr.evaluate(self.parent)
            fuelburn += burn_rate * (time2 - time1)

            velocity1 = velocity2
            time1 = time2

            #print "T = %f, V = %f, Acc = %f" % (time1, velocity1,
            #command_accel)
            #print gear, accel_min, accel_max

        # Convert liter to gallon and sec/hr to hr/hr
        distance = convert_units(distance, 'mi*s/h', 'mi')
        fuelburn = convert_units(fuelburn, 'L', 'galUS')
        self.fuel_economy = distance / fuelburn
예제 #11
0
        #Radiative area = surface area
        self.radArea = self.convArea
        check('radArea',self.radArea,3374876.115)
        #P/A = SB*emmisitivity*(T^4 - To^4)
        self.qRad = self.SBconst*self.tubeEmissivity*((self.tubeWallTemp**4) - (self.ambientTemp**4))
        check('qRad',self.qRad,59.7)
        #P = A * (P/A)
        self.qRadTot = self.radArea * self.qRad
        check('qRadTot',self.qRadTot,201533208)
        
        #------------
        #Sum Up
        self.Qout = self.qRadTot + self.naturalConvectionTot
        self.Qin = self.solarHeatTotal + self.podQTot
        check('Qout',self.Qout,394673364.)
       
#run stand-alone component
if __name__ == "__main__":

    from openmdao.main.api import set_as_top
    test = tubeModel()  
    set_as_top(test)
    print ""
    test.run()
    print "-----Completed Tube Heat Flux Model Calculations---"
    print ""
    print "Equilibrium Wall Temperature: {} K or {} F".format(test.tubeWallTemp, convert_units(test.tubeWallTemp,'degK','degF'))
    print "Ambient Temperature:          {} K or {} F".format(test.ambientTemp, convert_units(test.ambientTemp,'degK','degF'))
    print "Q Out = {} W  ==>  Q In = {} W ==> Error: {}%".format(test.Qout,test.Qin,((test.Qout-test.Qin)/test.Qout)*100)
    
예제 #12
0
	def execute(self):
		Len_fuse = convert_units(self.Len_fuse,'inch','ft')
		Wid_fuse = convert_units(self.Wid_fuse,'inch','ft')
		Hgt_fuse = convert_units(self.Hgt_fuse,'inch','ft')
		c_w = self.c_w
		c_ht = self.c_ht
		c_vt = self.c_vt
		x_wLE = self.x_wLE
		x_tLE = self.x_tLE
		x_cg = self.x_cg
		b_w = self.b_w
		b_ht = self.b_ht
		b_vt = self.b_vt
		#itername = self.itername
		count = self.exec_count



		fig1 = plt.figure(1)
		fig2 = plt.figure(2)

		ax1 = fig1.add_subplot(111,projection='3d')
		ax2 = fig2.add_subplot(111)
		ax1.cla()
		ax2.cla()

		# Fuselage
		x = [0.0 , 0.0 , 0.0 , 0.0 , 0.0 , Len_fuse , Len_fuse , Len_fuse , Len_fuse , Len_fuse]
		y = [-Wid_fuse/2 , -Wid_fuse/2 , Wid_fuse/2 , Wid_fuse/2 , -Wid_fuse/2 , -Wid_fuse/2 , -Wid_fuse/2 , Wid_fuse/2 , Wid_fuse/2 , -Wid_fuse/2]
		z = [-Hgt_fuse/2 , Hgt_fuse/2 , Hgt_fuse/2 , -Hgt_fuse/2 , -Hgt_fuse/2 , -Hgt_fuse/2 , Hgt_fuse/2 , Hgt_fuse/2 , -Hgt_fuse/2 , -Hgt_fuse/2]
		ax1.plot(x, y, z, 'k-')
		ax2.plot(x, y, 'k-')
		x = [0.0 , Len_fuse]
		y = [-Wid_fuse/2 , -Wid_fuse/2]
		z = [Hgt_fuse/2 , Hgt_fuse/2]
		ax1.plot(x, y, z, 'k-')
		ax2.plot(x, y, 'k-')
		x = [0.0 , Len_fuse]
		y = [Wid_fuse/2 , Wid_fuse/2]
		z = [-Hgt_fuse/2 , -Hgt_fuse/2]
		ax1.plot(x, y, z, 'k-')
		ax2.plot(x, y, 'k-')
		x = [0.0 , Len_fuse]
		y = [Wid_fuse/2 , Wid_fuse/2]
		z = [Hgt_fuse/2 , Hgt_fuse/2]
		ax1.plot(x, y, z, 'k-')
		ax2.plot(x, y, 'k-')



		# Wing
		x = [x_wLE , x_wLE , x_wLE+c_w , x_wLE+c_w]
		y = [Wid_fuse/2, b_w/2 , b_w/2 , Wid_fuse/2]
		z = [0.0 , 0.0 , 0.0 , 0.0]
		ax1.plot(x, y, z, 'b-')
		ax2.plot(x, y, 'b-')
		x = [x_wLE , x_wLE , x_wLE+c_w , x_wLE+c_w]
		y = [-Wid_fuse/2, -b_w/2 , -b_w/2 , -Wid_fuse/2]
		ax1.plot(x, y, z, 'b-')
		ax2.plot(x, y, 'b-')

		# Tailboom
		x = [x_wLE+c_w*0.25 , x_tLE]
		y = [0.0 , 0.0]
		z = [0.0 , 0.0]
		ax1.plot(x, y, z, 'r-')
		ax2.plot(x, y, 'r-')

		# HT
		x = [x_tLE , x_tLE , x_tLE+c_ht , x_tLE+c_ht , x_tLE]
		y = [b_ht/2 , -b_ht/2 , -b_ht/2 , b_ht/2 , b_ht/2]
		z = [0.0 , 0.0 , 0.0 , 0.0 , 0.0]
		ax1.plot(x, y, z, 'g-')
		ax2.plot(x, y, 'g-')

		# VT
		x = [x_tLE , x_tLE , x_tLE+c_vt , x_tLE+c_vt , x_tLE]
		y = [0.0 , 0.0 , 0.0 , 0.0 , 0.0]
		z = [0.0 , b_vt , b_vt , 0.0 , 0.0]
		ax1.plot(x, y, z, 'g-')
		ax2.plot(x, y, 'g-')


		# c.g.
		x = x_cg
		y = 0.0
		ax2.plot(x,y,'kx')

		# Wing ac location
		x = x_wLE+0.25*c_w
		y = 0.0
		ax2.plot(x,y,'b+')

		# H-tail ac location
		x = x_tLE+0.25*c_ht
		y = 0.0
		ax2.plot(x,y,'g+')


		#plt.xlim([-10,10])
		#plt.ylim([-10,10])


		ax1.auto_scale_xyz([-5,9],[-7,7],[-7,7])
		ax2.axis([-5,9,-7,7])
		
		ax1.view_init(35.27,225)
		
		ax1.set_xlabel('x')
		ax1.set_ylabel('y')
		ax1.set_zlabel('z')
		ax2.set_xlabel('x')
		ax2.set_ylabel('y')


		#fname1 = 'movie/3D/%10s_image3D.png' %itername
		#fname2 = 'movie/2D/%10s_image2D.png' %itername
		fname1 = 'movie/3D/%03d_image3D.png' %count
		fname2 = 'movie/2D/%03d_image2D.png' %count
		p = 'Payload: %.2f lbs' %self.W_payload
		ax1.text(2, -2, -7, p, color='red')
		#fig1.savefig('movie/image1.png')
		#fig2.savefig('movie/image2.png')
		fig1.savefig(fname1)
		fig2.savefig(fname2)
예제 #13
0
    def execute(self):
        ''' 
        '''
        # assign all varibles
        gravity = self.gravity
        air_density = self.air_density
        water_density = self.water_density
        water_depth = self.water_depth
        load_condition = self.load_condition
        significant_wave_height = self.significant_wave_height
        significant_wave_period = self.significant_wave_period
        if significant_wave_height != 0:
            significant_wave_height = 1.86 * significant_wave_height
            significant_wave_period = 0.71 * significant_wave_period
            WAVEL = gravity * significant_wave_period**2 / (2 * pi)
            WAVEN = 2 * pi / WAVEL
        wind_reference_speed = self.wind_reference_speed
        wind_reference_height = self.wind_reference_height
        alpha = self.alpha
        material_density = self.material_density
        E = self.E
        nu = self.nu
        yield_stress = self.yield_stress
        permanent_ballast_height = self.permanent_ballast_height
        permanent_ballast_density = self.permanent_ballast_density
        fixed_ballast_height = self.fixed_ballast_height
        fixed_ballast_density = self.fixed_ballast_density
        RNA_mass = self.RNA_mass
        RNA_kell_to_CG = self.RNA_keel_to_CG
        tower_mass = self.tower_mass
        tower_center_of_gravity = self.tower_center_of_gravity
        tower_wind_force = self.tower_wind_force
        RNA_wind_force = self.RNA_wind_force
        RNA_center_of_gravity_x = self.RNA_center_of_gravity_x
        mooring_vertical_load = self.mooring_vertical_load
        mooring_horizontal_stiffness = self.mooring_horizontal_stiffness
        mooring_vertical_stiffness = self.mooring_vertical_stiffness
        mooring_keel_to_CG = self.mooring_keel_to_CG
        outer_diameter_array = array(self.outer_diameter)
        base_outer_diameters = outer_diameter_array[-1]  # base outer diameter
        wall_thickness_array = array(self.wall_thickness)
        end_elevation = array(self.elevations[1:])  # end elevation
        ELS = array(self.elevations[0:-1])  # start elevation
        NSEC = self.number_of_sections
        for i in range(0, NSEC + 1):
            if self.elevations[i] > 0:
                ODTW = outer_diameter_array[i + 1]
        LB = ELS - end_elevation  # lengths of each section
        DRAFT = abs(min(end_elevation))
        FB = ELS[0]  # freeboard
        BH = self.bulk_head
        N = array(self.number_of_rings)
        if self.stiffener_curve_fit:  # curve fits
            YNA = self.neutral_axis
            D = 0.0029 + 1.3345977 * YNA
            IR = 0.051 * YNA**3.7452
            TW = exp(0.88132868 + 1.0261134 * log(IR) - 3.117086 * log(YNA))
            AR = exp(4.6980391 + 0.36049717 * YNA**0.5 - 2.2503113 / (TW**0.5))
            TFM = 1.2122528 * YNA**0.13430232 * YNA**1.069737
            BF = (0.96105249 * TW**-0.59795001 * AR**0.73163096)
            IR = 0.47602202 * TW**0.99500847 * YNA**2.9938134
        else:  # discrete, actual stiffener
            allStiffeners = full_stiffeners_table()
            stiffener = allStiffeners[self.stiffener_index]
            stiffenerName = stiffener[0]
            AR = convert_units(stiffener[1], 'inch**2', 'm**2')
            D = convert_units(stiffener[2], 'inch', 'm')
            TW = convert_units(stiffener[3], 'inch', 'm')
            BF = convert_units(stiffener[4], 'inch', 'm')
            TFM = convert_units(stiffener[5], 'inch', 'm')
            YNA = convert_units(stiffener[6], 'inch', 'm')
            self.neutral_axis = YNA
            IR = convert_units(stiffener[7], 'inch**4', 'm**4')
        HW = D - TFM  # web height
        SHM, RGM, BHM, SHB, SWF, SWM, SCF, SCM, KCG, KCB = calculateWindCurrentForces(
            0., 0., N, AR, BH, outer_diameter_array, NSEC,
            wall_thickness_array, LB, material_density, DRAFT, end_elevation,
            ELS, water_density, air_density, gravity, significant_wave_height,
            significant_wave_period, water_depth, wind_reference_speed,
            wind_reference_height, alpha)
        SHBUOY = sum(SHB)  # shell buoyancy
        SHMASS = sum(SHM) * self.shell_mass_factor  # shell mass - VALUE
        BHMASS = sum(BHM) * self.bulkhead_mass_factor  # bulkhead mass - VALUE
        RGMASS = sum(RGM) * self.ring_mass_factor  # ring mass - VALUE
        SHRMASS = SHMASS + BHMASS + RGMASS  # shell and bulkhead and ring mass - VALUE
        SHRM = array(SHM) + array(BHM) + array(
            RGM)  # # shell and bulkhead and ring mass - ARRAY
        percent_shell_mass = RGMASS / SHMASS * 100.
        outfitting_mass = SHRMASS * self.outfitting_factor
        SMASS = SHRMASS * self.spar_mass_factor + outfitting_mass
        KCG = dot(SHRM, array(KCG)) / SHRMASS  # keel to center of gravity
        KB = dot(array(SHB), array(KCB)) / SHBUOY  # keel to center of buoyancy
        BM = ((pi / 64) * ODTW**4) / (SHBUOY / water_density)
        SWFORCE = sum(SWF)  # shell wind force
        SCFORCE = sum(
            SCF
        )  # shell current force - NOTE: inaccurate; setting an initial value and reruns later
        BVL = pi / 4. * (base_outer_diameters - 2 * wall_thickness_array[-1]
                         )**2.  # ballast volume per length
        KGPB = (permanent_ballast_height / 2.) + wall_thickness_array[-1]
        PBM = BVL * permanent_ballast_height * permanent_ballast_density  # permanent ballast mass
        KGFB = (fixed_ballast_height /
                2.) + permanent_ballast_height + wall_thickness_array[-1]
        FBM = BVL * fixed_ballast_height * fixed_ballast_density  # fixed ballast mass
        WPA = pi / 4 * (ODTW)**2
        KGT = tower_center_of_gravity + FB + DRAFT  # keel to center of gravity of tower
        WBM = SHBUOY - SMASS - RNA_mass - tower_mass - mooring_vertical_load / gravity - FBM - PBM  # water ballast mass
        WBH = WBM / (water_density * BVL)  # water ballast height
        KGWB = WBH / 2. + permanent_ballast_height + fixed_ballast_height + wall_thickness_array[
            -1]
        KGB = (SMASS * KCG + WBM * KGWB + FBM * KGFB + PBM * KGPB +
               tower_mass * KGT + RNA_mass * RNA_kell_to_CG) / (
                   SMASS + WBM + FBM + PBM + tower_mass + RNA_mass)
        KG = (SMASS * KCG + WBM * KGWB + FBM * KGFB + PBM * KGPB +
              tower_mass * KGT + RNA_mass * RNA_kell_to_CG +
              mooring_vertical_load / gravity * mooring_keel_to_CG) / SHBUOY
        GM = KB + BM - KG
        self.platform_stability_check = KG / KB
        total_mass = SMASS + RNA_mass + tower_mass + WBM + FBM + PBM
        VD = (RNA_wind_force + tower_wind_force + SWFORCE +
              SCFORCE) / (SMASS + RNA_mass + tower_mass + FBM + PBM + WBM)
        SHM, RGM, BHM, SHB, SWF, SWM, SCF, SCM, KCG, KCB = calculateWindCurrentForces(
            KG, VD, N, AR, BH, outer_diameter_array, NSEC,
            wall_thickness_array, LB, material_density, DRAFT, end_elevation,
            ELS, water_density, air_density, gravity, significant_wave_height,
            significant_wave_period, water_depth, wind_reference_speed,
            wind_reference_height, alpha)
        SCFORCE = sum(SCF)
        # calculate moments
        RWM = RNA_wind_force * (RNA_kell_to_CG - KG)
        TWM = tower_wind_force * (KGT - KG)
        # costs
        columns_mass = sum(SHM[1::2]) + sum(RGM[1::2]) + sum(BHM[1::2])
        tapered_mass = sum(SHM[0::2]) + sum(RGM[0::2]) + sum(BHM[0::2])
        COSTCOL = self.straight_col_cost
        COSTTAP = self.tapered_col_cost
        COSTOUT = self.outfitting_cost
        COSTBAL = self.ballast_cost
        self.spar_cost = COSTCOL * columns_mass / 1000. + COSTTAP * tapered_mass / 1000.
        self.outfit_cost = COSTOUT * outfitting_mass / 1000.
        self.ballasts_cost = COSTBAL * (FBM + PBM) / 1000.
        self.total_cost = self.spar_cost + self.outfit_cost + self.ballasts_cost + self.mooring_total_cost

        ##### SIZING TAB #####
        # [TOP MASS(RNA+TOWER)]
        top_mass = RNA_mass + tower_mass
        KG_top = (RNA_mass * RNA_kell_to_CG + tower_mass * KGT)
        # [INERTIA PROPERTIES - LOCAL]
        I_top_loc = (1. / 12.) * top_mass * KG_top**2
        I_hull_loc = (1. / 12.) * SMASS * (DRAFT + FB)**2
        I_WB_loc = (1. / 12.) * WBM * WBH**2
        I_FB_loc = (1. / 12.) * FBM * fixed_ballast_height**2
        I_PB_loc = (1. / 12.) * PBM * permanent_ballast_height**2
        # [INERTIA PROPERTIES - SYSTEM]
        I_top_sys = I_top_loc + top_mass * (KG_top - KG)**2
        I_hull_sys = I_hull_loc + SMASS * (KCG - KG)**2
        I_WB_sys = I_WB_loc + WBM * (KGWB - KGB)**2
        I_FB_sys = I_FB_loc + FBM * (KGFB - KGB)**2
        I_PB_sys = I_PB_loc + PBM * (KGPB - KGB)**2
        I_total = I_top_sys + I_hull_sys + I_WB_sys + I_FB_sys + I_PB_sys
        I_yaw = total_mass * (base_outer_diameters / 2.)**2
        # [ADDED MASS]
        surge = (pi / 4.) * base_outer_diameters**2 * DRAFT * water_density
        heave = (1 / 6.) * water_density * base_outer_diameters**3
        pitch = (surge * ((KG - DRAFT) -
                          (KB - DRAFT))**2 + surge * DRAFT**2 / 12.) * I_total
        # [OTHER SYSTEM PROPERTIES]
        r_gyration = (I_total / total_mass)**0.5
        CM = (SMASS * KCG + WBM * KGWB + FBM * KGFB +
              PBM * KGPB) / (SMASS + WBM + FBM + PBM)
        surge_period = 2 * pi * (
            (total_mass + surge) / mooring_horizontal_stiffness)**0.5
        # [PLATFORM STIFFNESS]
        K33 = water_density * gravity * (
            pi / 4.)**ODTW**2 + mooring_vertical_stiffness  #heave
        K44 = abs(water_density * gravity *
                  ((pi / 4.) * (ODTW / 2.)**4 -
                   (KB - KG) * SHBUOY / water_density))  #roll
        K55 = abs(water_density * gravity *
                  ((pi / 4.) * (ODTW / 2.)**4 -
                   (KB - KG) * SHBUOY / water_density))  #pitch
        # [PERIOD]
        T_surge = 2 * pi * (
            (total_mass + surge) / mooring_horizontal_stiffness)**0.5
        T_heave = 2 * pi * ((total_mass + heave) / K33)**0.5
        K_pitch = GM * SHBUOY * gravity
        T_pitch = 2 * pi * (pitch / K_pitch)**0.5
        F_total = RNA_wind_force + tower_wind_force + sum(SWF) + sum(SCF)
        sum_FX = self.sum_forces_x
        X_Offset = self.offset_x
        if np.isnan(sum_FX).any() or sum_FX[-1] > (-F_total / 1000.):
            self.max_offset_unity = 10.
            self.min_offset_unity = 10.
        else:
            for j in range(1, len(sum_FX)):
                if sum_FX[j] < (-F_total / 1000.):
                    X2 = sum_FX[j]
                    X1 = sum_FX[j - 1]
                    Y2 = X_Offset[j]
                    Y1 = X_Offset[j - 1]
            max_offset = (Y1 + (-F_total / 1000. - X1) * (Y2 - Y1) /
                          (X2 - X1)) * self.offset_amplification_factor
            i = 0
            while sum_FX[i] > (F_total / 1000.):
                i += 1
            min_offset = (
                X_Offset[i - 1] + (F_total / 1000. - sum_FX[i - 1]) *
                (X_Offset[i] - X_Offset[i - 1]) /
                (sum_FX[i] - sum_FX[i - 1])) * self.offset_amplification_factor
            # unity checks!
            if self.load_condition == 'E':
                self.max_offset_unity = max_offset / self.damaged_mooring[1]
                self.min_offset_unity = min_offset / self.damaged_mooring[0]
            elif self.load_condition == 'N':
                self.max_offset_unity = max_offset / self.intact_mooring[1]
                self.min_offset_unity = min_offset / self.intact_mooring[0]
        M_total = RWM + TWM + sum(SWM) + sum(SCM) + (
            -F_total * (mooring_keel_to_CG - KG)) + (RNA_mass * gravity *
                                                     -RNA_center_of_gravity_x)
        self.heel_angle = (M_total / K_pitch) * 180. / pi
        ##### API BULLETIN #####
        # shell data
        RO = outer_diameter_array / 2.  # outer radius
        R = RO - wall_thickness_array / 2.  # radius to centerline of wall/mid fiber radius
        # ring data
        LR = LB / (N + 1.)  # number of ring spacing
        #shell and ring data
        RF = RO - HW  # radius to flange
        MX = LR / (R * wall_thickness_array)**0.5  # geometry parameter
        # effective width of shell plate in longitudinal direction
        LE = np.array([0.] * NSEC)
        for i in range(0, NSEC):
            if MX[i] <= 1.56:
                LE[i] = LR[i]
            else:
                LE = 1.1 * (2 * R * wall_thickness_array)**0.5 + TW
        # ring properties with effective shell plate
        AER = AR + LE * wall_thickness_array  # cross sectional area with effective shell
        YENA = (LE * wall_thickness_array * wall_thickness_array / 2 +
                HW * TW * (HW / 2 + wall_thickness_array) + TFM * BF *
                (TFM / 2 + HW + wall_thickness_array)) / AER
        IER = IR + AR * (
            YNA + wall_thickness_array / 2.
        )**2 * LE * wall_thickness_array / AER + LE * wall_thickness_array**3 / 12.  # moment of inertia
        RC = RO - YENA - wall_thickness_array / 2.  # radius to centroid of ring stiffener
        # set loads (0 mass loads for external pressure)
        MBALLAST = PBM + FBM + WBM  # sum of all ballast masses
        W = (RNA_mass + tower_mass + MBALLAST + SMASS) * gravity
        P = water_density * gravity * abs(
            end_elevation)  # hydrostatic pressure at depth of section bottom
        if significant_wave_height != 0:  # dynamic head
            DH = significant_wave_height / 2 * (
                np.cosh(WAVEN * (water_depth - abs(end_elevation))) /
                np.cosh(WAVEN * water_depth))
        else:
            DH = 0
        P = P + water_density * gravity * DH  # hydrostatic pressure + dynamic head
        GF = self.gust_factor
        #-----RING SECTION COMPACTNESS (SECTION 7)-----#
        self.flange_compactness = (0.5 * BF / TFM) / (0.375 *
                                                      (E / yield_stress)**0.5)
        self.web_compactness = (HW / TW) / ((E / yield_stress)**0.5)
        #-----PLATE AND RING STRESS (SECTION 11)-----#
        # shell hoop stress at ring midway
        Dc = E * wall_thickness_array**3 / (12 * (1 - nu**2))  # parameter D
        BETAc = (E * wall_thickness_array /
                 (4 * RO**2 * Dc))**0.25  # parameter beta
        TWS = AR / HW
        dum1 = BETAc * LR
        KT = 8 * BETAc**3 * Dc * (np.cosh(dum1) - np.cos(dum1)) / (
            np.sinh(dum1) + np.sin(dum1))
        KD = E * TWS * (RO**2 - RF**2) / (RO * ((1 + nu) * RO**2 +
                                                (1 - nu) * RF**2))
        dum = dum1 / 2.
        PSIK = 2 * (np.sin(dum) * np.cosh(dum) + np.cos(dum) *
                    np.sinh(dum)) / (np.sinh(dum1) + np.sin(dum1))
        PSIK = PSIK.clip(
            min=0)  # psik >= 0; set all negative values of psik to zero
        SIGMAXA = -W / (2 * pi * R * wall_thickness_array)
        PSIGMA = P + (nu * SIGMAXA * wall_thickness_array) / RO
        PSIGMA = np.minimum(PSIGMA, P)  # PSIGMA has to be <= P
        dum = KD / (KD + KT)
        KTHETAL = 1 - PSIK * PSIGMA / P * dum
        FTHETAS = KTHETAL * P * RO / wall_thickness_array
        # shell hoop stress at ring
        KTHETAG = 1 - (PSIGMA / P * dum)
        FTHETAR = KTHETAG * P * RO / wall_thickness_array
        #-----LOCAL BUCKLING (SECTION 4)-----#
        # axial compression and bending
        ALPHAXL = 9 / (300 + (2 * R) / wall_thickness_array)**0.4
        CXL = (1 + (150 / ((2 * R) / wall_thickness_array)) * (ALPHAXL**2) *
               (MX**4))**0.5
        FXEL = CXL * (pi**2 * E / (12 * (1 - nu**2))) * (wall_thickness_array /
                                                         LR)**2  # elastic
        FXCL = np.array(NSEC * [0.])
        for i in range(0, len(FXEL)):
            FXCL[i] = plasticityRF(FXEL[i], yield_stress)  # inelastic
        # external pressure
        BETA = np.array([0.] * NSEC)
        ALPHATHETAL = np.array([0.] * NSEC)
        global ZM
        ZM = 12 * (MX**2 * (1 - nu**2)**.5)**2 / pi**4
        for i in range(0, NSEC):
            f = lambda x: x**2 * (1 + x**2)**4 / (2 + 3 * x**2) - ZM[i]
            ans = roots(f, 0., 15.)
            ans_array = np.asarray(ans)
            is_scalar = False if ans_array.ndim > 0 else True
            if is_scalar:
                BETA[i] = ans
            else:
                BETA[i] = float(min(ans_array))
            if MX[i] < 5:
                ALPHATHETAL[i] = 1
            elif MX[i] >= 5:
                ALPHATHETAL[i] = 0.8
        n = np.round(BETA * pi * R / LR)  # solve for smallest whole number n
        BETA = LR / (pi * R / n)
        left = (1 + BETA**2)**2 / (0.5 + BETA**2)
        right = 0.112 * MX**4 / ((1 + BETA**2)**2 * (0.5 + BETA**2))
        CTHETAL = (left + right) * ALPHATHETAL
        FREL = CTHETAL * pi**2 * E * (wall_thickness_array / LR)**2 / (
            12 * (1 - nu**2))  # elastic
        FRCL = np.array(NSEC * [0.])
        for i in range(0, len(FREL)):
            FRCL[i] = plasticityRF(FREL[i], yield_stress)  # inelastic
        #-----GENERAL INSTABILITY (SECTION 4)-----#
        # axial compression and bending
        AC = AR / (LR * wall_thickness_array)  # Ar bar
        ALPHAX = 0.85 / (1 + 0.0025 *
                         (outer_diameter_array / wall_thickness_array))
        ALPHAXG = np.array([0.] * NSEC)
        for i in range(0, NSEC):
            if AC[i] >= 0.2:
                ALPHAXG[i] = 0.72
            elif AC[i] > 0.06 and AC[i] < 0.2:
                ALPHAXG[i] = (3.6 - 0.5 * ALPHAX[i]) * AC[i] + ALPHAX[i]
            else:
                ALPHAXG[i] = ALPHAX[i]
        FXEG = ALPHAXG * 0.605 * E * wall_thickness_array / R * (
            1 + AC)**0.5  # elastic
        FXCG = np.array(NSEC * [0.])
        for i in range(0, len(FXEG)):
            FXCG[i] = plasticityRF(FXEG[i], yield_stress)  # inelastic
        # external pressure
        ALPHATHETAG = 0.8
        LAMBDAG = pi * R / LB
        k = 0.5
        PEG = np.array([0.] * NSEC)
        for i in range(0, NSEC):
            t = wall_thickness_array[i]
            r = R[i]
            lambdag = LAMBDAG[i]
            ier = IER[i]
            rc = RC[i]
            ro = RO[i]
            lr = LR[i]

            def f(x, E, t, r, lambdag, k, ier, rc, ro, lr):
                return E * (t / r) * lambdag**4 / (
                    (x**2 + k * lambdag**2 - 1) *
                    (x**2 + lambdag**2)**2) + E * ier * (x**2 -
                                                         1) / (lr * rc**2 * ro)

            x0 = [2]
            m = float(
                fmin(f,
                     x0,
                     xtol=1e-3,
                     args=(E, t, r, lambdag, k, ier, rc, ro,
                           lr)))  # solve for n that gives minimum P_eG
            PEG[i] = f(m, E, t, r, lambdag, k, ier, rc, ro, lr)
        ALPHATHETAG = 0.8  #adequate for ring stiffeners
        FREG = ALPHATHETAG * PEG * RO * KTHETAG / wall_thickness_array  # elastic
        FRCG = np.array(NSEC * [0.])
        for i in range(0, len(FREG)):
            FRCG[i] = plasticityRF(FREG[i], yield_stress)  # inelastic
        # General Load Case
        NPHI = W / (2 * pi * R)
        NTHETA = P * RO
        K = NPHI / NTHETA
        #-----Local Buckling (SECTION 6) - Axial Compression and bending-----#
        C = (FXCL + FRCL) / yield_stress - 1
        KPHIL = 1
        CST = K * KPHIL / KTHETAL
        FTHETACL = np.array([0.] * NSEC)
        bnds = (0, None)
        for i in range(0, NSEC):
            cst = CST[i]
            fxcl = FXCL[i]
            frcl = FRCL[i]
            c = C[i]
            x = Symbol('x')
            ans = solve((cst * x / fxcl)**2 - c * (cst * x / fxcl) *
                        (x / frcl) + (x / frcl)**2 - 1, x)
            FTHETACL[i] = float(min([a for a in ans if a > 0]))
        FPHICL = CST * FTHETACL
        #-----General Instability (SECTION 6) - Axial Compression and bending-----#
        C = (FXCG + FRCG) / yield_stress - 1
        KPHIG = 1
        CST = K * KPHIG / KTHETAG
        FTHETACG = np.array([0.] * NSEC)
        for i in range(0, NSEC):
            cst = CST[i]
            fxcg = FXCG[i]
            frcg = FRCG[i]
            c = C[i]
            x = Symbol('x', real=True)
            ans = solve((cst * x / fxcg)**2 - c * (cst * x / fxcg) *
                        (x / frcg) + (x / frcg)**2 - 1, x)
            FTHETACG[i] = float(min([a for a in ans if a > 0]))
        FPHICG = CST * FTHETACG
        #-----Allowable Stresses-----#
        # factor of safety
        FOS = 1.25
        if load_condition == 'N' or load_condition == 'n':
            FOS = 1.65
        FAL = np.array([0.] * NSEC)
        F*G = np.array([0.] * NSEC)
        FEL = np.array([0.] * NSEC)
        FEG = np.array([0.] * NSEC)
        for i in range(0, NSEC):
            # axial load
            FAL[i] = FPHICL[i] / (FOS * calcPsi(FPHICL[i], yield_stress))
            F*G[i] = FPHICG[i] / (FOS * calcPsi(FPHICG[i], yield_stress))
            # external pressure
            FEL[i] = FTHETACL[i] / (FOS * calcPsi(FTHETACL[i], yield_stress))
            FEG[i] = FTHETACG[i] / (FOS * calcPsi(FTHETACG[i], yield_stress))
        # unity check
        self.VAL = abs(SIGMAXA / FAL)
        self.VAG = abs(SIGMAXA / F*G)
        self.VEL = abs(FTHETAS / FEL)
        self.VEG = abs(FTHETAS / FEG)
        self.water_ballast_height = WBH

        print 'surge period: ', T_surge
        print 'heave period: ', T_heave
        print 'pitch stiffness: ', K_pitch
        print 'pitch period: ', T_pitch
        print 'YNA: ', YNA
        print 'number of stiffeners: ', self.number_of_rings
        print 'wall thickness: ', self.wall_thickness
        print 'VAL: ', self.VAL
        print 'VAG: ', self.VAG
        print 'VEL: ', self.VEL
        print 'VEG: ', self.VEG
        print 'web compactness: ', self.web_compactness
        print 'flange compactness: ', self.flange_compactness
        print 'heel angle: ', self.heel_angle
        print 'outer diameters: ', self.outer_diameter
        self.spar_mass = SHRMASS
        self.ballast_mass = PBM + FBM + WBM
        self.system_total_mass = SHRMASS + PBM + FBM + WBM + self.mooring_mass
        self.shell_mass = SHMASS
        self.bulkhead_mass = BHMASS
        self.stiffener_mass = RGMASS
        print 'spar mass: ', self.spar_mass
        print 'shell mass: ', self.shell_mass
        print 'bulkhead mass: ', self.bulkhead_mass
        print 'stiffener mass: ', self.stiffener_mass


#-----------------------------------------------------------------
예제 #14
0
 def execute(self):
     ''' 
     '''
     def plasticityRF(F):
         dum = FY/F
         if F > FY/2:
             return F*dum*(1+3.75*dum**2)**(-0.25)
         else: 
             return F*1
     def frustrumVol(D1,D2,H): # array inputs
         l = len(D1)
         fV = np.array([0.]*l)
         r1 = D1/2.
         r2 = D2/2.
         fV = pi * (H / 3) * (r1**2 + r1*r2 + r2**2)
         return fV
     def frustrumCG(D1,D2,H):  # array inputs
         # frustrum vertical CG
         l = len(D1)
         fCG = np.array([0.]*l)
         r1 = D1/2.
         r2 = D2/2.    
         dum1 = r1**2 + 2.*r1*r2 + 3.*r2**2
         dum2 = r1**2 + r1 * r2 + r2**2
         fCG = H / 4. * (dum1/dum2)
         return fCG
     def ID(D,WALL):  # array inputs
         D = np.asarray(D)
         is_scalar = False if D.ndim>0 else True
         D.shape = (1,)*(1-D.ndim) + D.shape   
         l = len(D)
         ID = np.array([0.]*l)
         ID = D - 2.*WALL
         return ID if not is_scalar else (ID)
     def waveHeight(Hs): 
         return 1.1*Hs
     def wavePeriod(H):
         return 11.1*(H/G)**0.5   
     def waveNumber(T,D):
         k0 = 2 * pi / ( T * (G * D) **0.5)
         ktol =1 
         while ktol > 0.001:
             k = ( 2* pi/T) **2 / (G * np.tanh(k0*D))
             ktol = abs(k-k0)
             k0 = k
         return k
     def waveU(H,T,k,z,D,theta):
         return (pi*H/T)*(np.cosh(k*(z+D))/np.sinh(k*D))*np.cos(theta)
     def waveUdot(H,T,k,z,D,theta):
         return (2*pi**2*H/T**2)* (np.cosh(k*(z+D))/np.sinh(k*D))*np.sin(theta)
     def CD(U,D,DEN):
         RE = np.log10(abs(U) * D / DEN)
         if RE <= 5.:
             return 1.2
         elif RE < 5.301:
             return 1.1
         elif RE < 5.477:
             return  0.5
         elif RE < 6.:
             return 0.2
         elif RE < 6.301:
             return 0.4
         elif RE < 6.477:
             return 0.45
         elif RE < 6.699:
             return 0.5
         elif RE < 7.:
             return 0.6
         else:
             return 0.8
     def inertialForce(D,CA,L,A,VDOT,DEN):
         IF = 0.25 * pi * DEN * D** 2 * L * (A + CA * (A - VDOT))
         if A < 0:
             IF = -IF
         return IF
     def windPowerLaw(uref,href,alpha,H) :
         return uref*(H/href)**alpha
     def pipeBuoyancy(D):
         return pi/4 * D**2 *WDEN 
     def dragForce(D,CD,L,V,DEN):
         DF = 0.5 * DEN * CD * D * L * V**2
         if V < 0 :
             DF = -DF 
         return DF
     def calcPsi(F):
         dum = FY/2
         if F <= dum:
             return 1.2
         elif F > dum and F < FY:
             return 1.4 - 0.4*F/FY
         else: return 1
     def currentSpeed(XNEW):
         CDEPTH = [0.000, 61.000, 91.000, 130.000]
         CSPEED = [0.570, 0.570, 0.100, 0.100]
         return np.interp(abs(XNEW),CDEPTH,CSPEED)
     def curWaveDrag(Hs,Tp,WD,ODT,ODB,ELS,SL,CG,VDOT): 
         if Hs != 0: 
             H = waveHeight(Hs)
             k = waveNumber(Tp,WD) 
         # calculate current and wave drag 
         DL = SL /10.     # step sizes
         dtheta = pi/30. 
         S = (ODB - ODT)/SL 
         b = ODT 
         L = 0
         m = 0 
         for i in range(1,11):
             L2 = L + DL/2
             D2 = ELS -L2 
             D = S * L2 +b 
             fmax = 0.
             if (JMAX[i-1] == 0.):
                 JS = 1
                 JE = 31
             else: 
                 JS = JMAX[i-1]
                 JE = JMAX[i-1]
             for j in range(JS,JE+1):
                 V = currentSpeed(L2)
                 A = 0. 
                 if Hs != 0: 
                     V = V + waveU(H,Tp,k,D2,WD,dtheta*(j-1))
                     A = waveUdot(H,Tp,k,D2,WD,dtheta*(j-1))
                 if V != 0: 
                     CDT = CD(V,D,WDEN) 
                     f = dragForce(D,CDT,DL,V,WDEN) 
                 else:
                     f = 0
                 if Hs != 0:
                     f = f + inertialForce(D,1,DL,A,VDOT,WDEN) 
                 if f > fmax :
                     fmax = f
                     JMAX[i-1] =j
             m = m + fmax*L2 
             L = DL*i
         return m/(SL-CG)
     def calculateWindCurrentForces (flag): 
         if flag == 1: 
             VD = self.system_acceleration
         else: 
             VD = 0
         ODT = OD # outer diameter - top
         ODB = np.append(OD[1:NSEC],OD[-1]) # outer diameter - bottom
         WOD = (ODT+ODB)/2 # average outer diameter 
         COD = WOD # center outer diameter
         IDT = ID(ODT,T)
         IDB = ID(ODB,T)
         OV = frustrumVol(ODT,ODB,LB)
         IV = frustrumVol(IDT,IDB,LB)
         MV = OV - IV # shell volume 
         SHM = MV * MDEN # shell mass 
         SCG = frustrumCG(ODB,ODT,LB) # shell center of gravity
         KCG = DRAFT + ELE + SCG # keel to shell center of gravity
         KCB = DRAFT + ELE + SCG
         SHB = OV*WDEN #  outer volume --> displaced water mass
         coneH = np.array([0.]*NSEC)
         for i in range(0,len(LB)):
             if ODB[i]==ODT[i]:
                 coneH[i]=LB[i]
             else:
                 coneH[i] = -LB[i] * (ODB[i]/ODT[i]) / (1 - ODB[i]/ODT[i]) # cone height 
         # initialize arrays 
         SCF = np.array([0.]*NSEC)
         KCS = np.array([0.]*NSEC)
         SCM = np.array([0.]*NSEC)
         SWF = np.array([0.]*NSEC)
         KWS = np.array([0.]*NSEC)
         SWM = np.array([0.]*NSEC)
         BHM = np.array([0.]*NSEC)
         RGM = np.array([0.]*NSEC)
         for i in range (0,NSEC): 
         #for i in range(0,NSEC) :  # iterate through the sections
             if i <(NSEC-1) : # everything but the last section 
                 if ELE[i] <0 : # if bottom end underwater
                     HWL = abs(ELE[i]) 
                     if HWL >= LB[i]: # COMPLETELY UNDERWATER 
                         SCF[i] = curWaveDrag(Hs,Tp,WD,OD[i],OD[i+1],ELS[i],LB[i],SCG[i],VD)
                         KCS[i] = KCB[i]
                         if SCF[i] == 0: 
                             KCS[i] = 0.
                         SCM[i] = SCF[i] * (KCS[i]-KCGO)
                         SWF[i] = 0.
                         KWS[i] = 0.
                         SWM[i] = 0.
                     else: # PARTIALLY UNDER WATER 
                         if ODT[i] == ODB[i]:  # cylinder
                             SHB[i] = pipeBuoyancy(ODT[i])*HWL # redefine
                             SCG[i] = HWL/2 # redefine
                             KCB[i] = DRAFT + ELE[i] + SCG[i] # redefine 
                             ODW = ODT[i] # assign single variable
                         else: # frustrum
                             ODW = ODB[i]*(coneH[i]-HWL)/coneH[i] # assign single variable 
                             WOD[i] = (ODT[i]+ODW[i])/2  # redefine 
                             COD[i] = (ODW[i]+ODB[i])/2 # redefine 
                             SHB[i] = frustrumVol(ODW[i],ODB[i],HWL) # redefine 
                             SCG[i] = frustrumCG(ODW,ODB[i],HWL) # redefine 
                             KCB[i] = DRAFT + ELE[i] + SCG[i] # redefine 
                         SCF[i] = curWaveDrag(Hs,Tp,WD,ODW,ODB[i],0.,HWL,SCG[i],VD)
                         KCS[i] = KCB[i]
                         if SCF[i] == 0 : 
                             KCS[i] = 0.
                         SCM[i] = SCF[i]*(KCS[i]-KCGO)
                         if WREFS != 0: # if there is wind 
                             WSPEED = windPowerLaw(WREFS,WREFH,ALPHA,(LB[i]-HWL)/2) # assign single variable 
                             CDW = CD(WSPEED,WOD[i],ADEN) # assign single variable 
                             SWF[i] = dragForce(WOD[i],CDW,LB[i]-HWL,WSPEED,ADEN)
                             KWS[i]= KCG[i]
                             SWM[i] = SWF[i]*(KWS[i]-KCGO) 
                         else: # no wind 
                             SWF[i] = 0.
                             KWS[i] = 0.
                             SWM[i] = 0.
                 else: # FULLY ABOVE WATER 
                     SHB[i] = 0. # redefines 
                     KCB[i] = 0.
                     SCF[i] = 0.
                     KCS[i] = 0.
                     SCM[i] = 0.
                     if WREFS != 0: # if there is wind 
                         WSPEED = windPowerLaw(WREFS,WREFH,ALPHA,ELE[i]+LB[i]/2) # assign single variable 
                         CDW = CD(WSPEED,WOD[i],ADEN) # assign single variable 
                         SWF[i] = dragForce(WOD[i],CDW,LB[i],WSPEED,ADEN)
                         KWS[i]= KCG[i]
                         SWM[i] = SWF[i]*(KWS[i]-KCGO) 
                     else: # no wind 
                         SWF[i] = 0.
                         KWS[i] = 0.
                         SWM[i] = 0.
                 RGM[i] = N[i]*(pi*ID(WOD[i],T[i])*AR)*MDEN # ring mass
             else: # last section 
                 # SHM unchanged 
                 KCG[i] = DRAFT + ELE[i] + LB[i]/2  #redefine
                 # SHB already calculated 
                 # KCB already calculated 
                 SCF[i] = curWaveDrag(Hs,Tp,WD,OD[i],OD[i],ELS[i],LB[i],KCG[i],VD)
                 KCS[i] = KCG [i] # redefines
                 if SCF[i] ==0: 
                     KCS[i] = 0.
                 SCM[i] = SCF[i]*(KCS[i]-KCGO)
                 SWF[i] = 0.
                 KWS[i] = 0.
                 SWM[i] = 0.
                 RGM[i] = N[i]*(pi*ID(OD[i],T[i])*AR)*MDEN # ring mass
             if BH[i] == 'T':
                 BHM[i] = pi / 4 * IDT[i]**2 * T[i] * MDEN 
                 KCG[i] = (KCG[i] * SHM[i] + (DRAFT + ELS[i] - 0.5 * T[i]) * BHM[i]) / (SHM[i] + BHM[i])
             elif BH[i] == 'B' :
                 BHM[i] = pi / 4 * IDB[i]**2 * T[i] * MDEN
                 KCG[i] = (KCG[i] * SHM[i] + (DRAFT + ELE[i] + 0.5 * T[i]) * BHM[i]) / (SHM[i] + BHM[i])
             else: 
                 KCG[i] = KCG[i]
         return sum(SHM)+sum(RGM)+sum(BHM)
     def rootsearch(f,a,b,dx):
         x1 = a; f1 = f(a)
         x2 = a + dx; f2 = f(x2)
         while f1*f2 > 0.0:
             if x1 >= b:
                 return None,None
             x1 = x2; f1 = f2
             x2 = x1 + dx; f2 = f(x2)
         return x1,x2
     def bisect(f,x1,x2,switch=0,epsilon=1.0e-9):
         f1 = f(x1)
         if f1 == 0.0:
             return x1
         f2 = f(x2)
         if f2 == 0.0:
             return x2
         if f1*f2 > 0.0:
             print('Root is not bracketed')
             return None
         n = int(math.ceil(math.log(abs(x2 - x1)/epsilon)/math.log(2.0)))
         for i in range(n):
             x3 = 0.5*(x1 + x2); f3 = f(x3)
             if (switch == 1) and (abs(f3) >abs(f1)) and (abs(f3) > abs(f2)):
                 return None
             if f3 == 0.0:
                 return x3
             if f2*f3 < 0.0:
                 x1 = x3
                 f1 = f3
             else:
                 x2 =x3
                 f2 = f3
         return (x1 + x2)/2.0
     def roots(f, a, b, eps=1e-3):
         #print ('The roots on the interval [%f, %f] are:' % (a,b))
         while 1:
             x1,x2 = rootsearch(f,a,b,eps)
             if x1 != None:
                 a = x2
                 root = bisect(f,x1,x2,1)
                 if root != None:
                     pass
                     #print (round(root,-int(math.log(eps, 10))))
                     return root
             else:
                 #print ('\nDone')
                 break
     # assign all varibles so its easier to read later
     G = self.gravity
     ADEN = self.air_density 
     WDEN = self.water_density
     WD = self.water_depth
     LOADC = self.load_condition
     Hs = self.significant_wave_height
     Tp = self.significant_wave_period
     if Hs!= 0: 
         WAVEH = 1.86*Hs
         WAVEP = 0.71*Tp
         WAVEL = G*WAVEP**2/(2*pi)
         WAVEN = 2*pi/WAVEL
     KCG = self.keel_cg_mooring
     KCGO = self.keel_cg_operating_system
     WREFS = self.reference_wind_speed
     WREFH = self.reference_height
     ALPHA = self.alpha 
     MDEN = self.material_density
     E = self.E
     PR = self.nu
     FY = self.yield_stress
     RMASS = self.rotor_mass
     TMASS = self.tower_mass
     FB = self.free_board
     DRAFT = self.draft
     FBM = self.fixed_ballast_mass
     PBM = self.permanent_ballast_mass
     OD = np.array(self.outer_diameter)
     T = np.array(self.wall_thickness)
     LB = np.array(self.length)
     ELE = np.array(self.end_elevation)
     ELS = np.array(self.start_elevation)
     BH = self.bulk_head
     N = np.array(self.number_of_rings)
     NSEC = self.number_of_sections
     if self.initial_pass: # curve fits
         YNA=self.neutral_axis
         D = 0.0029+1.3345977*YNA
         IR =0.051*YNA**3.7452
         TW =np.exp(0.88132868+1.0261134*np.log(IR)-3.117086*np.log(YNA))
         AR =np.exp(4.6980391+0.36049717*YNA**0.5-2.2503113/(TW**0.5))
         TFM =1.2122528*YNA**0.13430232*YNA**1.069737
         BF = (0.96105249*TW**-0.59795001*AR**0.73163096)
         IR = 0.47602202*TW**0.99500847*YNA**2.9938134
         SMASS = self.hull_mass
     else: # discrete, actual stiffener
         SMASS = 1.11*self.shell_ring_bulkhead_mass
         allStiffeners = filtered_stiffeners_table()
         stiffener = allStiffeners[self.stiffener_index]
         stiffenerName = stiffener[0]
         AR = convert_units( stiffener[1],'inch**2','m**2')
         D = convert_units(stiffener[2],'inch','m')
         TW = convert_units(stiffener[3],'inch','m')
         BF=  convert_units(stiffener[4],'inch','m')
         TFM = convert_units(stiffener[5],'inch','m')
         YNA = convert_units(stiffener[6],'inch','m')
         IR = convert_units(stiffener[7],'inch**4','m**4')
     HW = D - TFM
     WBM = self.variable_ballast_mass
     # shell data
     RO = OD/2.  # outer radius 
     R = RO-T/2. # radius to centerline of wall/mid fiber radius 
     # ring data 
     LR = LB/(N+1.) # number of ring spacing
     #shell and ring data
     RF = RO - HW  # radius to flange
     MX = LR/(R*T)**0.5  # geometry parameter
     # effective width of shell plate in longitudinal direction 
     LE=np.array([0.]*NSEC)
     for i in range(0,NSEC):
         if MX[i] <= 1.56: 
             LE[i]=LR[i]
         else: 
             LE = 1.1*(2*R*T)**0.5+TW 
     # ring properties with effective shell plate
     AER = AR+LE*T  # cross sectional area with effective shell 
     YENA = (LE*T*T/2 + HW*TW*(HW/2+T) + TFM*BF*(TFM/2+HW+T))/AER 
     IER = IR+AR*(YNA+T/2.)**2*LE*T/AER+LE*T**3/12. # moment of inertia
     RC = RO-YENA-T/2. # radius to centroid of ring stiffener 
     # set loads (0 mass loads for external pressure) 
     MTURBINE = RMASS 
     MTOWER = TMASS 
     MBALLAST = PBM + FBM + WBM # sum of all ballast masses
     MHULL = SMASS 
     W = (MTURBINE + MTOWER + MBALLAST + MHULL) * G
     P = WDEN * G* abs(ELE)  # hydrostatic pressure at depth of section bottom 
     if Hs != 0: # dynamic head 
         DH = WAVEH/2*(np.cosh(WAVEN*(WD-abs(ELE)))/np.cosh(WAVEN*WD)) 
     else: 
         DH = 0 
     P = P + WDEN*G*DH # hydrostatic pressure + dynamic head
     #-----RING SECTION COMPACTNESS (SECTION 7)-----#
     self.flange_compactness = (0.5*BF/TFM)/(0.375*(E/FY)**0.5)
     self.web_compactness = (HW/TW)/((E/FY)**0.5)
     #-----PLATE AND RING STRESS (SECTION 11)-----#
     # shell hoop stress at ring midway 
     Dc = E*T**3/(12*(1-PR**2))  # parameter D 
     BETAc = (E*T/(4*RO**2*Dc))**0.25 # parameter beta 
     TWS = AR/HW
     dum1 = BETAc*LR
     KT = 8*BETAc**3 * Dc * (np.cosh(dum1) - np.cos(dum1))/ (np.sinh(dum1) + np.sin(dum1))
     KD = E * TWS * (RO**2 - RF**2)/(RO * ((1+PR) * RO**2 + (1-PR) * RF**2))
     dum = dum1/2. 
     PSIK = 2*(np.sin(dum) * np.cosh(dum) + np.cos(dum) * np.sinh(dum)) / (np.sinh(dum1) + np.sin(dum1))
     PSIK = PSIK.clip(min=0) # psik >= 0; set all negative values of psik to zero
     SIGMAXA = -W/(2*pi*R*T)
     PSIGMA = P + (PR*SIGMAXA*T)/RO
     PSIGMA = np.minimum(PSIGMA,P) # PSIGMA has to be <= P
     dum = KD/(KD+KT)
     KTHETAL = 1 - PSIK*PSIGMA/P*dum
     FTHETAS = KTHETAL*P*RO/T
     # shell hoop stress at ring 
     KTHETAG = 1 - (PSIGMA/P*dum)
     FTHETAR = KTHETAG*P*RO/T
     #-----LOCAL BUCKLING (SECTION 4)-----# 
     # axial compression and bending 
     ALPHAXL = 9/(300+(2*R)/T)**0.4
     CXL = (1+(150/((2*R)/T))*(ALPHAXL**2)*(MX**4))**0.5
     FXEL = CXL * (pi**2 * E / (12 * (1 - PR**2))) * (T/LR)**2 # elastic 
     FXCL=np.array(NSEC*[0.])
     for i in range(0,len(FXEL)):
         FXCL[i] = plasticityRF(FXEL[i]) # inelastic 
     # external pressure
     BETA = np.array([0.]*NSEC)
     ALPHATHETAL = np.array([0.]*NSEC)
     global ZM
     ZM = 12*(MX**2 * (1-PR**2)**.5)**2/pi**4
     for i in range(0,NSEC):
         f=lambda x:x**2*(1+x**2)**4/(2+3*x**2)-ZM[i]
         ans = roots(f, 0.,15.)
         ans_array = np.asarray(ans)
         is_scalar = False if ans_array.ndim>0 else True
         if is_scalar: 
             BETA[i] = ans 
         else: 
             BETA[i] = float(min(ans_array))
         if MX[i] < 5:
             ALPHATHETAL[i] = 1
         elif MX[i] >= 5:
             ALPHATHETAL[i] = 0.8  
     n = np.round(BETA*pi*R/LR) # solve for smallest whole number n 
     BETA = LR/(pi*R/n)
     left = (1+BETA**2)**2/(0.5+BETA**2)
     right = 0.112*MX**4 / ((1+BETA**2)**2*(0.5+BETA**2))
     CTHETAL = (left + right)*ALPHATHETAL 
     FREL = CTHETAL * pi**2 * E * (T/LR)**2 / (12*(1-PR**2)) # elastic
     FRCL=np.array(NSEC*[0.])
     for i in range(0,len(FREL)):
         FRCL[i] = plasticityRF(FREL[i]) # inelastic 
     #-----GENERAL INSTABILITY (SECTION 4)-----# 
     # axial compression and bending 
     AC = AR/(LR*T) # Ar bar 
     ALPHAX = 0.85/(1+0.0025*(OD/T))
     ALPHAXG = np.array([0.]*NSEC)
     for i in range(0,NSEC):
         if AC[i] >= 0.2 :
             ALPHAXG[i] = 0.72
         elif AC[i] > 0.06 and AC[i] <0.2:
             ALPHAXG[i] = (3.6-0.5*ALPHAX[i])*AC[i]+ALPHAX[i]
         else: 
             ALPHAXG[i] = ALPHAX[i]
     FXEG = ALPHAXG * 0.605 * E * T / R * (1 + AC)**0.5 # elastic
     FXCG = np.array(NSEC*[0.])
     for i in range(0,len(FXEG)):
         FXCG[i] = plasticityRF(FXEG[i]) # inelastic  
     # external pressure 
     ALPHATHETAG = 0.8
     LAMBDAG = pi * R / LB 
     k = 0.5 
     PEG = np.array([0.]*NSEC)
     for i in range(0,NSEC):
         t = T[i]
         r = R[i]
         lambdag = LAMBDAG[i]
         ier = IER[i]
         rc = RC[i]
         ro = RO[i]
         lr = LR[i]
         def f(x,E,t,r,lambdag,k,ier,rc,ro,lr):
             return E*(t/r)*lambdag**4/((x**2+k*lambdag**2-1)*(x**2+lambdag**2)**2) + E*ier*(x**2-1)/(lr*rc**2*ro)   
         x0 = [2]
         m = float(fmin(f, x0, xtol=1e-3, args=(E,t,r,lambdag,k,ier,rc,ro,lr))) # solve for n that gives minimum P_eG
         PEG[i] = f(m,E,t,r,lambdag,k,ier,rc,ro,lr)
     ALPHATHETAG = 0.8 #adequate for ring stiffeners 
     FREG = ALPHATHETAG*PEG*RO*KTHETAG/T # elastic 
     FRCG = np.array(NSEC*[0.])
     for i in range(0,len(FREG)):
         FRCG[i] = plasticityRF(FREG[i]) # inelastic  
     # General Load Case
     NPHI = W/(2*pi*R)
     NTHETA = P * RO 
     K = NPHI/NTHETA 
     #-----Local Buckling (SECTION 6) - Axial Compression and bending-----# 
     C = (FXCL + FRCL)/FY -1
     KPHIL = 1
     CST = K * KPHIL /KTHETAL 
     FTHETACL = np.array([0.]*NSEC)
     bnds = (0,None)
     #print FRCL
     for i in range(0,NSEC):
         cst = CST[i]
         fxcl = FXCL[i]
         frcl = FRCL[i]
         c = C[i]
         x = Symbol('x')
         ans = solve((cst*x/fxcl)**2 - c*(cst*x/fxcl)*(x/frcl) + (x/frcl)**2 - 1, x)
         FTHETACL[i] =  float(min([a for a in ans if a>0]))
     FPHICL = CST*FTHETACL
     #-----General Instability (SECTION 6) - Axial Compression and bending-----# 
     C = (FXCG + FRCG)/FY -1
     KPHIG = 1
     CST = K * KPHIG /KTHETAG 
     FTHETACG = np.array([0.]*NSEC)
     for i in range(0,NSEC):
         cst = CST[i]
         fxcg = FXCG[i]
         frcg = FRCG[i]
         c = C[i]
         x = Symbol('x',real=True)
         ans = solve((cst*x/fxcg)**2 - c*(cst*x/fxcg)*(x/frcg) + (x/frcg)**2 - 1, x)
         FTHETACG[i] =  float(min([a for a in ans if a>0]))
     FPHICG = CST*FTHETACG
     #-----Allowable Stresses-----# 
     # factor of safety
     FOS = 1.25
     if LOADC == 'N' or LOADC == 'n': 
         FOS = 1.65
     FAL = np.array([0.]*NSEC)
     F*G = np.array([0.]*NSEC)
     FEL = np.array([0.]*NSEC)
     FEG = np.array([0.]*NSEC)
     for i in range(0,NSEC):
         # axial load    
         FAL[i] = FPHICL[i]/(FOS*calcPsi(FPHICL[i]))
         F*G[i] = FPHICG[i]/(FOS*calcPsi(FPHICG[i]))
         # external pressure
         FEL[i] = FTHETACL[i]/(FOS*calcPsi(FTHETACL[i]))
         FEG[i] = FTHETACG[i]/(FOS*calcPsi(FTHETACG[i]))
     # unity check 
     self.VAL = abs(SIGMAXA / FAL)
     self.VAG = abs(SIGMAXA / F*G)
     self.VEL = abs(FTHETAS / FEL)
     self.VEG = abs(FTHETAS / FEG)
     global JMAX
     JMAX = np.array([0]*10)
     self.shell_ring_bulkhead_mass=calculateWindCurrentForces(0)
     self.shell_ring_bulkhead_mass=calculateWindCurrentForces(1)
예제 #15
0
def example_218WD_10MW():
    example = optimizationSpar()
    tt = time.time()
    example.water_depth = 218.
    example.load_condition = 'N'
    example.significant_wave_height = 10.820
    example.significant_wave_period = 9.800
    example.keel_cg_mooring = 45.
    example.keel_cg_operating_system = 30.730
    example.reference_wind_speed = 11.
    example.reference_height = 119.
    example.alpha = 0.110
    example.material_density = 7850.
    example.E = 200.e9
    example.nu = 0.3
    example.yield_stress = 345000000.
    example.rotor_mass = 677000.000
    example.tower_mass = 698235.000
    example.free_board = 13.
    example.draft = 92.
    example.fixed_ballast_mass = 6276669.794
    example.hull_mass = 2816863.293
    example.permanent_ballast_mass = 3133090.391
    example.variable_ballast_mass = 1420179.260
    example.number_of_sections = 4
    example.outer_diameter = [8.,9.,9.,15.]
    example.length = [6., 12., 15., 72.]
    example.end_elevation = [7., -5., -20., -92.]
    example.start_elevation = [13., 7., -5., -20.]
    example.bulk_head = ['N', 'T', 'N', 'B']
    #example.system_acceleration = 0.856545480516845
    example.gust_factor = 1.0
    example.tower_base_OD = 7.720
    example.tower_top_OD = 4.050
    example.tower_length = 102.63
    example.cut_out_speed = 25.
    example.turbine_size = '10MW'
    example.rotor_diameter = 194.0
    example.run()
    yna = convert_units(example.spar.neutral_axis ,'m','inch')
    filteredStiffeners = filtered_stiffeners_table()
    for i in range (0,len(filteredStiffeners)-1):
        stiffener_bef = filteredStiffeners[i]
        stiffener_aft = filteredStiffeners[i+1]
        if yna > stiffener_bef[6] and yna<stiffener_aft[6]:
            opt_index = i+1
    second_fit = Spar()
    second_fit.wall_thickness = example.spar.wall_thickness
    second_fit.number_of_rings = example.spar.number_of_rings
    second_fit.stiffener_index = opt_index
    second_fit.initial_pass = False

    second_fit.water_depth =  example.water_depth
    second_fit.load_condition = example.load_condition
    second_fit.significant_wave_height =  example.significant_wave_height
    second_fit.significant_wave_period = example.significant_wave_period
    second_fit.keel_cg_mooring = example.keel_cg_mooring
    second_fit.keel_cg_operating_system = example.keel_cg_operating_system
    second_fit.reference_wind_speed = example.reference_wind_speed
    second_fit.reference_height = example.reference_height
    second_fit.alpha = example.alpha
    second_fit.material_density = example.material_density
    second_fit.E = example.E
    second_fit.nu =example.nu
    second_fit.yield_stress = example.yield_stress
    second_fit.rotor_mass = example.rotor_mass
    second_fit.tower_mass = example.tower_mass
    second_fit.free_board = example.free_board
    second_fit.draft = example.draft
    second_fit.fixed_ballast_mass = example.fixed_ballast_mass
    second_fit.hull_mass = example.hull_mass
    second_fit.permanent_ballast_mass = example.permanent_ballast_mass
    second_fit.variable_ballast_mass = example.variable_ballast_mass
    second_fit.number_of_sections = example.number_of_sections
    second_fit.outer_diameter = example.outer_diameter
    second_fit.length = example.length
    second_fit.end_elevation = example.end_elevation
    second_fit.start_elevation = example.start_elevation
    second_fit.bulk_head = example.bulk_head
    #second_fit.system_acceleration=example.system_acceleration
    second_fit.gust_factor = example.gust_factor
    second_fit.tower_base_OD = example.tower_base_OD
    second_fit.tower_top_OD = example.tower_top_OD 
    second_fit.tower_length = example.tower_length 
    second_fit.cut_out_speed = example.cut_out_speed
    second_fit.turbine_size = example.turbine_size
    second_fit.rotor_diameter = example.rotor_diameter
    second_fit.run()
    index = opt_index
    unity = max(max(second_fit.VAL),max(second_fit.VAG),max(second_fit.VEL),max(second_fit.VEG))   
    while ((unity-1.0) > 1e-7):
        if index <124:
            index += 1
            second_fit.stiffener_index = index
            second_fit.run()
            unity = max(max(second_fit.VAL),max(second_fit.VAG),max(second_fit.VEL),max(second_fit.VEG)) 
            #print unity-1.0
        else:
            second_fit.stiffener_index = opt_index
            for i in range(0,second_fit.number_of_sections):
                if second_fit.VAL[i] >1. or second_fit.VAG[i]>1. or second_fit.VEL[i]>1. or second_fit.VEG[i]>1.:    
                    second_fit.number_of_rings[i] += 1 
                    second_fit.run()
                    unity = max(max(second_fit.VAL),max(second_fit.VAG),max(second_fit.VEL),max(second_fit.VEG)) 
                    #print second_fit.number_of_rings
    print '--------------example_218WD_10MW------------------'
    print "Elapsed time: ", time.time()-tt, " seconds"
    sys_print(second_fit)
예제 #16
0
def example_218WD_6MW():
    example = optimizationSpar()
    tt = time.time()
    example.water_depth = 218.
    example.load_condition = 'N'
    example.significant_wave_height = 10.820
    example.significant_wave_period = 9.800
    example.keel_cg_mooring = 37.177
    example.keel_cg_operating_system = 24.059
    example.reference_wind_speed = 11.
    example.reference_height = 97.
    example.alpha = 0.110
    example.material_density = 7850.
    example.E = 200.e9
    example.nu = 0.3
    example.yield_stress = 345000000.
    example.rotor_mass = 365500.000
    example.tower_mass = 366952.000
    example.free_board = 13.
    example.draft = 72.
    example.fixed_ballast_mass = 3659547.034
    example.hull_mass = 1593822.041
    example.permanent_ballast_mass = 1761475.914
    example.variable_ballast_mass = 820790.246
    example.number_of_sections = 4
    example.outer_diameter = [7., 8., 8., 13.]
    example.length = [6., 12., 15., 52.]
    example.end_elevation = [7., -5., -20., -72.]
    example.start_elevation = [13., 7., -5., -20.]
    example.bulk_head = ['N', 'T', 'N', 'B']
    #example.system_acceleration = 1.12124749328663
    example.gust_factor = 1.0
    example.tower_base_OD = 6.0
    example.tower_top_OD = 3.51
    example.tower_length = 80.5
    example.cut_out_speed = 25.
    example.turbine_size = '6MW'
    example.rotor_diameter = 154.0

    example.run()
    yna = convert_units(example.spar.neutral_axis ,'m','inch')
    filteredStiffeners = filtered_stiffeners_table()
    for i in range (0,len(filteredStiffeners)-1):
        stiffener_bef = filteredStiffeners[i]
        stiffener_aft = filteredStiffeners[i+1]
        if yna > stiffener_bef[6] and yna<stiffener_aft[6]:
            opt_index = i+1
    second_fit = Spar()
    second_fit.wall_thickness = example.spar.wall_thickness
    second_fit.number_of_rings = example.spar.number_of_rings
    second_fit.stiffener_index = opt_index
    second_fit.initial_pass = False

    second_fit.water_depth =  example.water_depth
    second_fit.load_condition = example.load_condition
    second_fit.significant_wave_height =  example.significant_wave_height
    second_fit.significant_wave_period = example.significant_wave_period
    second_fit.keel_cg_mooring = example.keel_cg_mooring
    second_fit.keel_cg_operating_system = example.keel_cg_operating_system
    second_fit.reference_wind_speed = example.reference_wind_speed
    second_fit.reference_height = example.reference_height
    second_fit.alpha = example.alpha
    second_fit.material_density = example.material_density
    second_fit.E = example.E
    second_fit.nu =example.nu
    second_fit.yield_stress = example.yield_stress
    second_fit.rotor_mass = example.rotor_mass
    second_fit.tower_mass = example.tower_mass
    second_fit.free_board = example.free_board
    second_fit.draft = example.draft
    second_fit.fixed_ballast_mass = example.fixed_ballast_mass
    second_fit.hull_mass = example.hull_mass
    second_fit.permanent_ballast_mass = example.permanent_ballast_mass
    second_fit.variable_ballast_mass = example.variable_ballast_mass
    second_fit.number_of_sections = example.number_of_sections
    second_fit.outer_diameter = example.outer_diameter
    second_fit.length = example.length
    second_fit.end_elevation = example.end_elevation
    second_fit.start_elevation = example.start_elevation
    second_fit.bulk_head = example.bulk_head
    second_fit.gust_factor = example.gust_factor
    second_fit.tower_base_OD = example.tower_base_OD
    second_fit.tower_top_OD = example.tower_top_OD 
    second_fit.tower_length = example.tower_length 
    second_fit.cut_out_speed = example.cut_out_speed
    second_fit.turbine_size = example.turbine_size
    second_fit.rotor_diameter = example.rotor_diameter
    #second_fit.system_acceleration=example.system_acceleration
    second_fit.run()
    index = opt_index
    unity = max(max(second_fit.VAL),max(second_fit.VAG),max(second_fit.VEL),max(second_fit.VEG))   
    while ((unity-1.0) > 1e-7):
        if index <124:
            index += 1
            second_fit.stiffener_index = index
            second_fit.run()
            unity = max(max(second_fit.VAL),max(second_fit.VAG),max(second_fit.VEL),max(second_fit.VEG)) 
        else:
            second_fit.stiffener_index = opt_index
            for i in range(0,second_fit.number_of_sections):
                if second_fit.VAL[i] >1. or second_fit.VAG[i]>1. or second_fit.VEL[i]>1. or second_fit.VEG[i]>1.:    
                    second_fit.number_of_rings[i] += 1 
                    second_fit.run()
                    unity = max(max(second_fit.VAL),max(second_fit.VAG),max(second_fit.VEL),max(second_fit.VEG)) 
    print '--------------example_218WD_6MW------------------'
    print "Elapsed time: ", time.time()-tt, " seconds"
    sys_print(second_fit)
예제 #17
0
def example_130WD_3MW():
    example = optimizationSpar()
    example.water_depth = 130.
    example.load_condition = 'N'
    example.significant_wave_height = 10.660
    example.significant_wave_period = 13.210
    example.keel_cg_mooring = 51.
    example.keel_cg_operating_system = 20.312
    example.reference_wind_speed = 11.
    example.reference_height = 75.
    example.alpha = 0.110
    example.material_density = 7850.
    example.E = 200.e9
    example.nu = 0.3
    example.yield_stress = 345000000.
    example.rotor_mass = 125000.
    example.tower_mass = 83705.
    example.free_board = 13.
    example.draft = 64.
    example.fixed_ballast_mass = 1244227.77
    example.hull_mass = 890985.086
    example.permanent_ballast_mass = 838450.256
    example.variable_ballast_mass = 418535.462
    example.number_of_sections = 4
    example.outer_diameter = [5., 6., 6., 9.]
    example.length = [6., 12., 15., 44.]
    example.end_elevation = [7., -5., -20., -64.]
    example.start_elevation = [13., 7., -5., -20.]
    example.bulk_head = ['N', 'T', 'N', 'B']
    #example.system_acceleration=1.2931
    example.run()

    yna = convert_units(example.spar.neutral_axis ,'m','inch')
    filteredStiffeners = filtered_stiffeners_table()
    for i in range (0,len(filteredStiffeners)-1):
        stiffener_bef = filteredStiffeners[i]
        stiffener_aft = filteredStiffeners[i+1]
        if yna > stiffener_bef[6] and yna<stiffener_aft[6]:
            opt_index = i+1
    second_fit = Spar()
    second_fit.wall_thickness = example.spar.wall_thickness
    second_fit.number_of_rings = example.spar.number_of_rings
    second_fit.stiffener_index = opt_index
    second_fit.initial_pass = False

    second_fit.water_depth =  example.water_depth
    second_fit.load_condition = example.load_condition
    second_fit.significant_wave_height =  example.significant_wave_height
    second_fit.significant_wave_period = example.significant_wave_period
    second_fit.keel_cg_mooring = example.keel_cg_mooring
    second_fit.keel_cg_operating_system = example.keel_cg_operating_system
    second_fit.reference_wind_speed = example.reference_wind_speed
    second_fit.reference_height = example.reference_height
    second_fit.alpha = example.alpha
    second_fit.material_density = example.material_density
    second_fit.E = example.E
    second_fit.nu =example.nu
    second_fit.yield_stress = example.yield_stress
    second_fit.rotor_mass = example.rotor_mass
    second_fit.tower_mass = example.tower_mass
    second_fit.free_board = example.free_board
    second_fit.draft = example.draft
    second_fit.fixed_ballast_mass = example.fixed_ballast_mass
    second_fit.hull_mass = example.hull_mass
    second_fit.permanent_ballast_mass = example.permanent_ballast_mass
    second_fit.variable_ballast_mass = example.variable_ballast_mass
    second_fit.number_of_sections = example.number_of_sections
    second_fit.outer_diameter = example.outer_diameter
    second_fit.length = example.length
    second_fit.end_elevation = example.end_elevation
    second_fit.start_elevation = example.start_elevation
    second_fit.bulk_head = example.bulk_head
    second_fit.system_acceleration=example.system_acceleration
    second_fit.run()
    index = opt_index
    unity = max(max(second_fit.VAL),max(second_fit.VAG),max(second_fit.VEL),max(second_fit.VEG))   
    while ((unity-1.0) > 1e-7):
        if index <124:
            index += 1
            second_fit.stiffener_index = index
            second_fit.run()
            unity = max(max(second_fit.VAL),max(second_fit.VAG),max(second_fit.VEL),max(second_fit.VEG)) 
        else:
            second_fit.stiffener_index = opt_index
            for i in range(0,second_fit.number_of_sections):
                if second_fit.VAL[i] >1. or second_fit.VAG[i]>1. or second_fit.VEL[i]>1. or second_fit.VEG[i]>1.:    
                    second_fit.number_of_rings[i] += 1 
                    second_fit.run()
                    unity = max(max(second_fit.VAL),max(second_fit.VAG),max(second_fit.VEL),max(second_fit.VEG)) 
    print '--------------example_130WD_3MW------------------'
    print "Elapsed time: ", time.time()-tt, " seconds"
    sys_print(second_fit)
예제 #18
0
파일: spar.py 프로젝트: WISDEM/FloatingSE
    def execute(self):
        ''' 
        '''
        # assign all varibles 
        G = self.gravity
        ADEN = self.air_density 
        WDEN = self.water_density
        WD = self.water_depth
        LOADC = self.load_condition
        Hs = self.significant_wave_height
        Ts = self.significant_wave_period
        if Hs!= 0: 
            WAVEH = 1.86*Hs
            WAVEP = 0.71*Ts
            WAVEL = G*WAVEP**2/(2*pi)
            WAVEN = 2*pi/WAVEL  
        WREFS = self.wind_reference_speed
        WREFH = self.wind_reference_height
        ALPHA = self.alpha 
        MDEN = self.material_density
        E = self.E
        PR = self.nu
        FY = self.yield_stress
        PBH = self.permanent_ballast_height 
        PBDEN = self.permanent_ballast_density
        FBH = self.fixed_ballast_height
        FBDEN = self.fixed_ballast_density
        RMASS = self.RNA_mass
        KGR = self.RNA_keel_to_CG
        TMASS = self.tower_mass
        TCG = self.tower_center_of_gravity
        TWF = self.tower_wind_force
        RWF = self.RNA_wind_force
        RCGX = self.RNA_center_of_gravity_x
        VTOP = self.mooring_vertical_load
        MHK = self.mooring_horizontal_stiffness
        MVK = self.mooring_vertical_stiffness
        KGM = self.mooring_keel_to_CG
        OD = np.array(self.outer_diameter)
        ODB = OD[-1] # base outer diameter
        T = np.array(self.wall_thickness)
        ELE = np.array(self.elevations[1:]) # end elevation
        ELS = np.array(self.elevations[0:-1]) # start elevation
        NSEC = self.number_of_sections
        for i in range(0,NSEC+1):
            if  self.elevations[i] >0:
                ODTW = OD[i+1]
        print ODTW
        LB = ELS-ELE # lengths of each section
        DRAFT = abs(min(ELE))
        FB = ELS [0] # freeboard
        BH = self.bulk_head 
        N = np.array(self.number_of_rings)
        if self.stiffener_curve_fit: # curve fits
            YNA=self.neutral_axis
            D = 0.0029+1.3345977*YNA
            IR =0.051*YNA**3.7452
            TW =np.exp(0.88132868+1.0261134*np.log(IR)-3.117086*np.log(YNA))
            AR =np.exp(4.6980391+0.36049717*YNA**0.5-2.2503113/(TW**0.5))
            TFM =1.2122528*YNA**0.13430232*YNA**1.069737
            BF = (0.96105249*TW**-0.59795001*AR**0.73163096)
            IR = 0.47602202*TW**0.99500847*YNA**2.9938134    
        else: # discrete, actual stiffener 
            allStiffeners = full_stiffeners_table()
            stiffener = allStiffeners[self.stiffener_index]
            stiffenerName = stiffener[0]
            AR = convert_units( stiffener[1],'inch**2','m**2')
            D = convert_units(stiffener[2],'inch','m')
            TW = convert_units(stiffener[3],'inch','m')
            BF=  convert_units(stiffener[4],'inch','m')
            TFM = convert_units(stiffener[5],'inch','m')
            YNA = convert_units(stiffener[6],'inch','m')
            self.neutral_axis=YNA
            IR = convert_units(stiffener[7],'inch**4','m**4')
        HW = D - TFM # web height
        SHM,RGM,BHM,SHB,SWF,SWM,SCF,SCM,KCG,KCB=calculateWindCurrentForces(0.,0.,N,AR,BH,OD,NSEC,T,LB,MDEN,DRAFT,ELE,ELS,WDEN,ADEN,G,Hs,Ts,WD,WREFS,WREFH,ALPHA)     
        SHBUOY = sum(SHB) # shell buoyancy
        SHMASS = sum(SHM)*self.shell_mass_factor # shell mass - VALUE
        BHMASS = sum(BHM)*self.bulkhead_mass_factor # bulkhead mass - VALUE
        RGMASS = sum(RGM)*self.ring_mass_factor # ring mass - VALUE
        SHRMASS = SHMASS + BHMASS + RGMASS # shell and bulkhead and ring mass - VALUE
        SHRM = np.array(SHM)+np.array(BHM)+np.array(RGM) # # shell and bulkhead and ring mass - ARRAY
        percent_shell_mass = RGMASS/SHMASS *100. 
        outfitting_mass = SHRMASS*self.outfitting_factor
        SMASS = SHRMASS*self.spar_mass_factor + outfitting_mass 
        KCG = np.dot(SHRM,np.array(KCG))/SHRMASS # keel to center of gravity
        KB = np.dot(np.array(SHB),np.array(KCB))/SHBUOY  # keel to center of buoyancy 
        BM = ((np.pi/64)*ODTW**4)/(SHBUOY/WDEN) 
        SWFORCE = sum(SWF) # shell wind force 
        SCFORCE = sum(SCF) # shell current force - NOTE: inaccurate; setting an initial value and reruns later
        BVL = np.pi/4.*(ODB-2*T[-1])**2.  # ballast volume per length
        KGPB = (PBH/2.)+T[-1] 
        PBM = BVL*PBH*PBDEN # permanent ballast mass
        KGFB = (FBH/2.)+PBH+T[-1] 
        FBM = BVL*FBH*FBDEN # fixed ballast mass
        WPA = np.pi/4*(ODTW)**2
        KGT = TCG+FB+DRAFT # keel to center of gravity of tower
        WBM = SHBUOY-SMASS-RMASS-TMASS-VTOP/G-FBM-PBM # water ballast mass
        WBH = WBM/(WDEN*BVL) # water ballast height
        KGWB = WBH/2.+PBH+FBH+T[-1]
        KGB = (SMASS*KCG+WBM*KGWB+FBM*KGFB+PBM*KGPB+TMASS*KGT+RMASS*KGR)/(SMASS+WBM+FBM+PBM+TMASS+RMASS)
        KG = (SMASS*KCG+WBM*KGWB+FBM*KGFB+PBM*KGPB+TMASS*KGT+RMASS*KGR+VTOP/G*KGM)/SHBUOY
        GM = KB+BM-KG
        self.platform_stability_check = KG/KB 
        total_mass = SMASS+RMASS+TMASS+WBM+FBM+PBM
        VD = (RWF+TWF+SWFORCE+SCFORCE)/(SMASS+RMASS+TMASS+FBM+PBM+WBM)
        SHM,RGM,BHM,SHB,SWF,SWM,SCF,SCM,KCG,KCB=calculateWindCurrentForces(KG,VD,N,AR,BH,OD,NSEC,T,LB,MDEN,DRAFT,ELE,ELS,WDEN,ADEN,G,Hs,Ts,WD,WREFS,WREFH,ALPHA)     
        SCFORCE = sum(SCF)
        # calculate moments 
        RWM = RWF*(KGR-KG)
        TWM = TWF*(KGT-KG)
        # costs
        columns_mass = sum(SHM[1::2])+sum(RGM[1::2])+sum(BHM[1::2])
        tapered_mass = sum(SHM[0::2])+sum(RGM[0::2])+sum(BHM[0::2])
        COSTCOL = self.straight_col_cost
        COSTTAP = self.tapered_col_cost
        COSTOUT = self.outfitting_cost
        COSTBAL = self.ballast_cost
        self.spar_cost = COSTCOL*columns_mass/1000. + COSTTAP*tapered_mass/1000.
        self.outfit_cost = COSTOUT*outfitting_mass/1000.
        self.ballasts_cost = COSTBAL*(FBM+PBM)/1000.
        self.total_cost =self.spar_cost+self.outfit_cost+self.ballasts_cost+self.mooring_total_cost

        ##### SIZING TAB #####    
        # [TOP MASS(RNA+TOWER)]
        top_mass = RMASS+TMASS 
        KG_top = (RMASS*KGR+TMASS*KGT)
        # [INERTIA PROPERTIES - LOCAL]
        I_top_loc = (1./12.)*top_mass*KG_top**2
        I_hull_loc = (1./12.)*SMASS*(DRAFT+FB)**2
        I_WB_loc = (1./12.)*WBM*WBH**2
        I_FB_loc = (1./12.)*FBM*FBH**2
        I_PB_loc = (1./12.)*PBM*PBH**2
        # [INERTIA PROPERTIES - SYSTEM]
        I_top_sys = I_top_loc + top_mass*(KG_top-KG)**2
        I_hull_sys = I_hull_loc + SMASS*(KCG-KG)**2
        I_WB_sys = I_WB_loc + WBM*(KGWB-KGB)**2 
        I_FB_sys = I_FB_loc + FBM*(KGFB-KGB)**2
        I_PB_sys = I_PB_loc + PBM*(KGPB-KGB)**2
        I_total = I_top_sys + I_hull_sys + I_WB_sys + I_FB_sys + I_PB_sys
        I_yaw =  total_mass*(ODB/2.)**2
        # [ADDED MASS]
        surge = (pi/4.)*ODB**2*DRAFT*WDEN
        heave = (1/6.)*WDEN*ODB**3
        pitch = (surge*((KG-DRAFT)-(KB-DRAFT))**2+surge*DRAFT**2/12.)*I_total
        # [OTHER SYSTEM PROPERTIES]
        r_gyration = (I_total/total_mass)**0.5
        CM = (SMASS*KCG+WBM*KGWB+FBM*KGFB+PBM*KGPB)/(SMASS+WBM+FBM+PBM)
        surge_period = 2*pi*((total_mass+surge)/MHK)**0.5
        # [PLATFORM STIFFNESS]
        K33 = WDEN*G*(pi/4.)**ODTW**2+MVK  #heave
        K44 = abs(WDEN*G*((pi/4.)*(ODTW/2.)**4-(KB-KG)*SHBUOY/WDEN)) #roll
        K55 = abs(WDEN*G*((pi/4.)*(ODTW/2.)**4-(KB-KG)*SHBUOY/WDEN)) #pitch
        # [PERIOD]
        T_surge = 2*pi*((total_mass+surge)/MHK)**0.5
        T_heave = 2*pi*((total_mass+heave)/K33)**0.5
        K_pitch = GM*SHBUOY*G
        T_pitch = 2*pi*(pitch/K_pitch)**0.5
        F_total = RWF+TWF+sum(SWF)+sum(SCF)
        sum_FX = self.sum_forces_x
        X_Offset = self.offset_x
        if np.isnan(sum_FX).any() or sum_FX[-1] > (-F_total/1000.):
            self.max_offset_unity = 10.
            self.min_offset_unity = 10.
        else:
            for j in range(1,len(sum_FX)): 
                if sum_FX[j]< (-F_total/1000.): 
                    X2 = sum_FX[j]
                    X1 = sum_FX[j-1]
                    Y2 = X_Offset[j]
                    Y1 = X_Offset[j-1]
            max_offset = (Y1+(-F_total/1000.-X1)*(Y2-Y1)/(X2-X1))*self.offset_amplification_factor
            i=0
            while sum_FX[i]> (F_total/1000.):
                i+=1
            min_offset = (X_Offset[i-1]+(F_total/1000.-sum_FX[i-1])*(X_Offset[i]-X_Offset[i-1])/(sum_FX[i]-sum_FX[i-1]))*self.offset_amplification_factor
        # unity checks! 
            if self.load_condition == 'E': 
                self.max_offset_unity = max_offset/self.damaged_mooring[1]
                self.min_offset_unity = min_offset/self.damaged_mooring[0]
            elif self.load_condition == 'N': 
                self.max_offset_unity = max_offset/self.intact_mooring[1]
                self.min_offset_unity = min_offset/self.intact_mooring[0]
        M_total = RWM+TWM+sum(SWM)+sum(SCM)+(-F_total*(KGM-KG))+(RMASS*G*-RCGX)
        self.heel_angle = (M_total/K_pitch)*180./pi
        ##### API BULLETIN #####    
        # shell data
        RO = OD/2.  # outer radius 
        R = RO-T/2. # radius to centerline of wall/mid fiber radius 
        # ring data 
        LR = LB/(N+1.) # number of ring spacing
        #shell and ring data
        RF = RO - HW  # radius to flange
        MX = LR/(R*T)**0.5  # geometry parameter
        # effective width of shell plate in longitudinal direction 
        LE=np.array([0.]*NSEC)
        for i in range(0,NSEC):
            if MX[i] <= 1.56: 
                LE[i]=LR[i]
            else: 
                LE = 1.1*(2*R*T)**0.5+TW 
        # ring properties with effective shell plate
        AER = AR+LE*T  # cross sectional area with effective shell 
        YENA = (LE*T*T/2 + HW*TW*(HW/2+T) + TFM*BF*(TFM/2+HW+T))/AER 
        IER = IR+AR*(YNA+T/2.)**2*LE*T/AER+LE*T**3/12. # moment of inertia
        RC = RO-YENA-T/2. # radius to centroid of ring stiffener 
        # set loads (0 mass loads for external pressure) 
        MBALLAST = PBM + FBM + WBM # sum of all ballast masses
        W = (RMASS + TMASS + MBALLAST + SMASS) * G
        P = WDEN * G* abs(ELE)  # hydrostatic pressure at depth of section bottom 
        if Hs != 0: # dynamic head 
            DH = WAVEH/2*(np.cosh(WAVEN*(WD-abs(ELE)))/np.cosh(WAVEN*WD)) 
        else: 
            DH = 0 
        P = P + WDEN*G*DH # hydrostatic pressure + dynamic head
        GF = self.gust_factor
        #-----RING SECTION COMPACTNESS (SECTION 7)-----#
        self.flange_compactness = (0.5*BF/TFM)/(0.375*(E/FY)**0.5)
        self.web_compactness = (HW/TW)/((E/FY)**0.5)
        #-----PLATE AND RING STRESS (SECTION 11)-----#
        # shell hoop stress at ring midway 
        Dc = E*T**3/(12*(1-PR**2))  # parameter D 
        BETAc = (E*T/(4*RO**2*Dc))**0.25 # parameter beta 
        TWS = AR/HW
        dum1 = BETAc*LR
        KT = 8*BETAc**3 * Dc * (np.cosh(dum1) - np.cos(dum1))/ (np.sinh(dum1) + np.sin(dum1))
        KD = E * TWS * (RO**2 - RF**2)/(RO * ((1+PR) * RO**2 + (1-PR) * RF**2))
        dum = dum1/2. 
        PSIK = 2*(np.sin(dum) * np.cosh(dum) + np.cos(dum) * np.sinh(dum)) / (np.sinh(dum1) + np.sin(dum1))
        PSIK = PSIK.clip(min=0) # psik >= 0; set all negative values of psik to zero
        SIGMAXA = -W/(2*pi*R*T)
        PSIGMA = P + (PR*SIGMAXA*T)/RO
        PSIGMA = np.minimum(PSIGMA,P) # PSIGMA has to be <= P
        dum = KD/(KD+KT)
        KTHETAL = 1 - PSIK*PSIGMA/P*dum
        FTHETAS = KTHETAL*P*RO/T
        # shell hoop stress at ring 
        KTHETAG = 1 - (PSIGMA/P*dum)
        FTHETAR = KTHETAG*P*RO/T
        #-----LOCAL BUCKLING (SECTION 4)-----# 
        # axial compression and bending 
        ALPHAXL = 9/(300+(2*R)/T)**0.4
        CXL = (1+(150/((2*R)/T))*(ALPHAXL**2)*(MX**4))**0.5
        FXEL = CXL * (pi**2 * E / (12 * (1 - PR**2))) * (T/LR)**2 # elastic 
        FXCL=np.array(NSEC*[0.])
        for i in range(0,len(FXEL)):
            FXCL[i] = plasticityRF(FXEL[i],FY) # inelastic 
        # external pressure
        BETA = np.array([0.]*NSEC)
        ALPHATHETAL = np.array([0.]*NSEC)
        global ZM
        ZM = 12*(MX**2 * (1-PR**2)**.5)**2/pi**4
        for i in range(0,NSEC):
            f=lambda x:x**2*(1+x**2)**4/(2+3*x**2)-ZM[i]
            ans = roots(f, 0.,15.)
            ans_array = np.asarray(ans)
            is_scalar = False if ans_array.ndim>0 else True
            if is_scalar: 
                BETA[i] = ans 
            else: 
                BETA[i] = float(min(ans_array))
            if MX[i] < 5:
                ALPHATHETAL[i] = 1
            elif MX[i] >= 5:
                ALPHATHETAL[i] = 0.8  
        n = np.round(BETA*pi*R/LR) # solve for smallest whole number n 
        BETA = LR/(pi*R/n)
        left = (1+BETA**2)**2/(0.5+BETA**2)
        right = 0.112*MX**4 / ((1+BETA**2)**2*(0.5+BETA**2))
        CTHETAL = (left + right)*ALPHATHETAL 
        FREL = CTHETAL * pi**2 * E * (T/LR)**2 / (12*(1-PR**2)) # elastic
        FRCL=np.array(NSEC*[0.])
        for i in range(0,len(FREL)):
            FRCL[i] = plasticityRF(FREL[i],FY) # inelastic 
        #-----GENERAL INSTABILITY (SECTION 4)-----# 
        # axial compression and bending 
        AC = AR/(LR*T) # Ar bar 
        ALPHAX = 0.85/(1+0.0025*(OD/T))
        ALPHAXG = np.array([0.]*NSEC)
        for i in range(0,NSEC):
            if AC[i] >= 0.2 :
                ALPHAXG[i] = 0.72
            elif AC[i] > 0.06 and AC[i] <0.2:
                ALPHAXG[i] = (3.6-0.5*ALPHAX[i])*AC[i]+ALPHAX[i]
            else: 
                ALPHAXG[i] = ALPHAX[i]
        FXEG = ALPHAXG * 0.605 * E * T / R * (1 + AC)**0.5 # elastic
        FXCG = np.array(NSEC*[0.])
        for i in range(0,len(FXEG)):
            FXCG[i] = plasticityRF(FXEG[i],FY) # inelastic  
        # external pressure 
        ALPHATHETAG = 0.8
        LAMBDAG = pi * R / LB 
        k = 0.5 
        PEG = np.array([0.]*NSEC)
        for i in range(0,NSEC):
            t = T[i]
            r = R[i]
            lambdag = LAMBDAG[i]
            ier = IER[i]
            rc = RC[i]
            ro = RO[i]
            lr = LR[i]
            def f(x,E,t,r,lambdag,k,ier,rc,ro,lr):
                return E*(t/r)*lambdag**4/((x**2+k*lambdag**2-1)*(x**2+lambdag**2)**2) + E*ier*(x**2-1)/(lr*rc**2*ro)   
            x0 = [2]
            m = float(fmin(f, x0, xtol=1e-3, args=(E,t,r,lambdag,k,ier,rc,ro,lr))) # solve for n that gives minimum P_eG
            PEG[i] = f(m,E,t,r,lambdag,k,ier,rc,ro,lr)
        ALPHATHETAG = 0.8 #adequate for ring stiffeners 
        FREG = ALPHATHETAG*PEG*RO*KTHETAG/T # elastic 
        FRCG = np.array(NSEC*[0.])
        for i in range(0,len(FREG)):
            FRCG[i] = plasticityRF(FREG[i],FY) # inelastic  
        # General Load Case
        NPHI = W/(2*pi*R)
        NTHETA = P * RO 
        K = NPHI/NTHETA 
        #-----Local Buckling (SECTION 6) - Axial Compression and bending-----# 
        C = (FXCL + FRCL)/FY -1
        KPHIL = 1
        CST = K * KPHIL /KTHETAL 
        FTHETACL = np.array([0.]*NSEC)
        bnds = (0,None)
        for i in range(0,NSEC):
            cst = CST[i]
            fxcl = FXCL[i]
            frcl = FRCL[i]
            c = C[i]
            x = Symbol('x')
            ans = solve((cst*x/fxcl)**2 - c*(cst*x/fxcl)*(x/frcl) + (x/frcl)**2 - 1, x)
            FTHETACL[i] =  float(min([a for a in ans if a>0]))
        FPHICL = CST*FTHETACL
        #-----General Instability (SECTION 6) - Axial Compression and bending-----# 
        C = (FXCG + FRCG)/FY -1
        KPHIG = 1
        CST = K * KPHIG /KTHETAG 
        FTHETACG = np.array([0.]*NSEC)
        for i in range(0,NSEC):
            cst = CST[i]
            fxcg = FXCG[i]
            frcg = FRCG[i]
            c = C[i]
            x = Symbol('x',real=True)
            ans = solve((cst*x/fxcg)**2 - c*(cst*x/fxcg)*(x/frcg) + (x/frcg)**2 - 1, x)
            FTHETACG[i] =  float(min([a for a in ans if a>0]))
        FPHICG = CST*FTHETACG
        #-----Allowable Stresses-----# 
        # factor of safety
        FOS = 1.25
        if LOADC == 'N' or LOADC == 'n': 
            FOS = 1.65
        FAL = np.array([0.]*NSEC)
        F*G = np.array([0.]*NSEC)
        FEL = np.array([0.]*NSEC)
        FEG = np.array([0.]*NSEC)
        for i in range(0,NSEC):
            # axial load    
            FAL[i] = FPHICL[i]/(FOS*calcPsi(FPHICL[i],FY))
            F*G[i] = FPHICG[i]/(FOS*calcPsi(FPHICG[i],FY))
            # external pressure
            FEL[i] = FTHETACL[i]/(FOS*calcPsi(FTHETACL[i],FY))
            FEG[i] = FTHETACG[i]/(FOS*calcPsi(FTHETACG[i],FY))
        # unity check 
        self.VAL = abs(SIGMAXA / FAL)
        self.VAG = abs(SIGMAXA / F*G)
        self.VEL = abs(FTHETAS / FEL)
        self.VEG = abs(FTHETAS / FEG)
        self.water_ballast_height = WBH
        print 'YNA: ', YNA
        print 'number of stiffeners: ',self.number_of_rings
        print 'wall thickness: ',self.wall_thickness
        print 'VAL: ',self.VAL
        print 'VAG: ',self.VAG
        print 'VEL: ',self.VEL
        print 'VEG: ',self.VEG
        print 'web compactness: ',self.web_compactness
        print 'flange compactness: ',self.flange_compactness
        print 'heel angle: ', self.heel_angle
        print 'outer diameters: ', self.outer_diameter
        self.spar_mass = SHRMASS
        self.ballast_mass = PBM + FBM + WBM
        self.system_total_mass = SHRMASS + PBM + FBM + WBM + self.mooring_mass
        self.shell_mass = SHMASS 
        self.bulkhead_mass = BHMASS
        self.stiffener_mass = RGMASS
        print 'spar mass: ', self.spar_mass
        print 'shell mass: ', self.shell_mass
        print 'bulkhead mass: ', self.bulkhead_mass
        print 'stiffener mass: ', self.stiffener_mass
#-----------------------------------------------------------------
예제 #19
0
def example_218WD_3MW():
    example = optimizationSpar()
    tt = time.time()
    example.spar.number_of_sections = 4
    example.spar.outer_diameter = [5., 6., 6., 9.]
    example.spar.length = [6., 12., 15., 47.]
    example.spar.end_elevation = [7., -5., -20., -67.]
    example.spar.start_elevation = [13., 7., -5., -20.]
    example.spar.bulk_head = ['N', 'T', 'N', 'B']
    example.spar.water_depth = 218.
    example.spar.load_condition = 'N'
    example.spar.significant_wave_height = 10.820
    example.spar.significant_wave_period = 9.800
    example.spar.wind_reference_speed = 11.
    example.spar.wind_reference_height = 75.
    example.spar.alpha = 0.110
    example.spar.RNA_keel_to_CG = 142.
    example.spar.RNA_mass = 125000.
    example.spar.tower_mass = 127877.
    example.spar.tower_center_of_gravity = 23.948
    example.spar.tower_wind_force = 19950.529
    example.spar.RNA_wind_force = 391966.178
    example.spar.RNA_center_of_gravity_x = 4.1
    example.spar.mooring_total_cost = 810424.053596
    example.spar.mooring_keel_to_CG = 54.000
    example.spar.mooring_vertical_load = 1182948.791
    example.spar.mooring_horizontal_stiffness = 3145.200
    example.spar.mooring_vertical_stiffness = 7111.072
    example.spar.sum_forces_x = [
        7886.848, 437.844, 253.782, 174.651, 124.198, 85.424, 50.689, 17.999,
        -13.222, -43.894, -74.245, -105.117, -136.959, -170.729, -207.969,
        -251.793, -307.638, -386.514, -518.734, -859.583, -11091.252
    ]
    example.spar.offset_x = [
        -40.362, -35.033, -29.703, -24.373, -19.044, -13.714, -8.385, -3.055,
        2.274, 7.604, 12.933, 18.263, 23.593, 28.922, 34.252, 39.581, 44.911,
        50.240, 55.570, 60.900, 66.229
    ]
    example.spar.damaged_mooring = [-40.079, 65.824]
    example.spar.intact_mooring = [-39.782, 65.399]
    example.spar.run()
    example.run()
    yna = convert_units(example.spar.neutral_axis, 'm', 'inch')
    fullStiffeners = full_stiffeners_table()
    for i in range(0, len(fullStiffeners) - 1):
        stiffener_bef = fullStiffeners[i]
        stiffener_aft = fullStiffeners[i + 1]
        if yna > stiffener_bef[6] and yna < stiffener_aft[6]:
            opt_index = i + 1

    second_fit = Spar()
    second_fit.wall_thickness = example.spar.wall_thickness
    second_fit.number_of_rings = example.spar.number_of_rings
    second_fit.stiffener_curve_fit = False
    second_fit.stiffener_index = opt_index
    second_fit.number_of_sections = example.spar.number_of_sections
    second_fit.outer_diameter = example.spar.outer_diameter
    second_fit.length = example.spar.length
    second_fit.end_elevation = example.spar.end_elevation
    second_fit.start_elevation = example.spar.start_elevation
    second_fit.bulk_head = example.spar.bulk_head
    second_fit.water_depth = example.spar.water_depth
    second_fit.load_condition = example.spar.load_condition
    second_fit.significant_wave_height = example.spar.significant_wave_height
    second_fit.significant_wave_period = example.spar.significant_wave_period
    second_fit.wind_reference_speed = example.spar.wind_reference_speed
    second_fit.wind_reference_height = example.spar.wind_reference_height
    second_fit.alpha = example.spar.alpha
    second_fit.RNA_keel_to_CG = example.spar.RNA_keel_to_CG
    second_fit.RNA_mass = example.spar.RNA_mass
    second_fit.tower_mass = example.spar.tower_mass
    second_fit.tower_center_of_gravity = example.spar.tower_center_of_gravity
    second_fit.tower_wind_force = example.spar.tower_wind_force
    second_fit.RNA_wind_force = example.spar.RNA_wind_force
    second_fit.RNA_center_of_gravity_x = example.spar.RNA_center_of_gravity_x
    second_fit.mooring_total_cost = example.spar.mooring_total_cost
    second_fit.mooring_keel_to_CG = example.spar.mooring_keel_to_CG
    second_fit.mooring_vertical_load = example.spar.mooring_vertical_load
    second_fit.mooring_horizontal_stiffness = example.spar.mooring_horizontal_stiffness
    second_fit.mooring_vertical_stiffness = example.spar.mooring_vertical_stiffness
    second_fit.sum_forces_x = example.spar.sum_forces_x
    second_fit.offset_x = example.spar.offset_x
    second_fit.damaged_mooring = example.spar.damaged_mooring
    second_fit.intact_mooring = example.spar.intact_mooring
    second_fit.run()

    cost = second_fit.total_cost
    index = opt_index
    best_index = opt_index
    unity = max(second_fit.web_compactness, second_fit.flange_compactness,
                max(second_fit.VAL), max(second_fit.VAG), max(second_fit.VEL),
                max(second_fit.VEG))
    for i in range(opt_index, 326):
        index += 1
        second_fit.stiffener_index = index
        second_fit.run()
        unity = max(second_fit.web_compactness, second_fit.flange_compactness,
                    max(second_fit.VAL), max(second_fit.VAG),
                    max(second_fit.VEL), max(second_fit.VEG))
        if unity < 1.0:
            if second_fit.total_cost < cost:
                cost = second_fit.total_cost
                best_index = i
                second_fit.stiffener_index = best_index
                second_fit.run()
    print '--------------example_218WD_3MW------------------'
    print "Elapsed time: ", time.time() - tt, " seconds"
    sys_print(second_fit)
예제 #20
0
    def execute(self):
		 
		 NumRibs = 26/8.9375* self.b_w/12
		 Airfoil_t_over_c_wing = self.Airfoil_t_over_c_wing
		 Airfoil_t_over_c_tail = self.Airfoil_t_over_c_tail
		 BalsaDens = self.BalsaDens
		 SpruceDens = self.SpruceDens
		 BassDens = self.BassDens
		 Len_fuse = self.Len_fuse
		 Wid_fuse = self.Wid_fuse
		 Hgt_fuse = self.Hgt_fuse
		 EngWeight = self.EngWeight
		 ESCWeight = self.ESCWeight
		 BatteryWeight = self.BatteryWeight
		 Alum2024Dens = self.Alum2024Dens
		 W_payload = self.W_payload
		 x_cg_payload = self.x_cg_payload
		 x_wLE = self.x_wLE
		 c_w = self.c_w
		 c_ht = self.c_ht
		 c_vt = self.c_vt
		 b_vt = self.b_vt


		 RibArea = Airfoil_t_over_c_wing*(self.c_w)**2   #inch**2
		 RibWeight = BalsaDens*RibArea*.125    #lb
		 
		 FrontWeight = EngWeight + BatteryWeight + ESCWeight
		 FrontCG = float(3)  

		 #FuseVolume = Len_fuse*Wid_fuse*Hgt_fuse #inch**3
		 #FuseWeight = (FuseVolume*BassDens)  #lb
		 FuseWeight = 1.7 
		 FuseCG = Len_fuse / 2  #inch
		 
		 TailBoomLen = self.x_tLE - (self.x_wLE+self.c_w*0.25)   #inch
		 TailBoomVol = TailBoomLen*(pi*(3.0/4.0)**2/4)   #in**3
		 SparLen = self.b_w * 0.25
		 SparVol = SparLen*(pi*(7.0/8.0)**2/4 + pi*(3.0/8.0)**2/4)
		 TailBoomSparAssemWeight = (TailBoomVol +  SparVol  ) * Alum2024Dens #lb
		 TailBoomSparAssemCG = ((TailBoomLen/2+(self.x_wLE+self.c_w*0.25))*TailBoomVol + (self.x_wLE+self.c_w*0.25)*SparLen*(pi*(7.0/8.0)**2/4) + (self.x_wLE+self.c_w*0.66)* SparLen*(pi*(3.0/8.0)**2/4))/(TailBoomVol + SparVol)

		 W_wing = (NumRibs*RibWeight+2*self.b_w*SpruceDens*.5*.25*2+self.b_w*BalsaDens*Airfoil_t_over_c_wing*(self.c_w)*.125)+.1080851064*self.S_wing
		 W_ht = self.S_ht*0.245614035
		 W_vt = self.S_vt*0.245614035
		 x_cg_w = self.x_wLE + 0.35*self.c_w  #inch
		 x_cg_ht = self.x_tLE + (0.35*self.c_ht)
		 x_cg_vt = self.x_tLE + (0.35*self.c_vt)
		 x_cg_t = self.x_tLE + (0.35*self.c_ht*W_ht+0.35*self.c_vt*W_vt)/(W_ht+W_vt)  #inch
		 
		 x_cg_payload = self.x_cg_payload  	#inch


		 self.W_empty = W_wing + W_ht + W_vt + FrontWeight + FuseWeight + TailBoomSparAssemWeight
	     
		 self.x_cg_empty = (FrontWeight*FrontCG + W_wing*x_cg_w + (W_ht+W_vt)*x_cg_t + FuseWeight*FuseCG + TailBoomSparAssemWeight*TailBoomSparAssemCG)/self.W_empty

		 self.W_0 = self.W_empty + self.W_payload

		 self.x_cg = x_cg = (self.W_empty*self.x_cg_empty + self.W_payload*x_cg_payload)/self.W_0





		 print 'W_wing', W_wing
		 print 'W_ht', W_ht
		 print 'W_vt', W_vt
		 print 'TailBoomLen', TailBoomLen
		 print 'TailBoomSparAssemWeight', TailBoomSparAssemWeight
		 print 'TailBoomSparAssemCG', TailBoomSparAssemCG
		 print 'FuseCG', FuseCG
		 print 'Len_fuse', Len_fuse
		 print 'Wid_fuse', Wid_fuse
		 print 'Hgt_fuse', Hgt_fuse
		 print 'W_empty', self.W_empty
		 print 'W_payload', self.W_payload
		 print 'W_0', self.W_0
		 print 'x_cg_w', x_cg_w
		 print 'x_cg_t', x_cg_t
		 print 'x_cg_payload', self.x_cg_payload
		 print 'x_cg', self.x_cg










		 # I_y calculation


		 FrontCG = convert_units(FrontCG, 'inch','ft')
		 FuseCG = convert_units(FuseCG,'inch','ft')
		 x_cg_w = convert_units(x_cg_w,'inch','ft')
		 x_cg_ht = convert_units(x_cg_ht,'inch','ft')
		 x_cg_vt = convert_units(x_cg_vt,'inch','ft')

		 
		 TailBoomLen = convert_units(TailBoomLen,'inch','ft')
		 x_cg_payload = convert_units(x_cg_payload,'inch','ft')
		 x_cg = convert_units(x_cg,'inch','ft')
		 c_w = convert_units(c_w,'inch','ft')
		 c_ht = convert_units(c_ht,'inch','ft')
		 c_vt = convert_units(c_vt,'inch','ft')
		 b_vt = convert_units(b_vt,'inch','ft')




		 # I_y_front
		 I_y_front = (FrontWeight/32.1740)*(FrontCG - x_cg)**2

		 # I_y_fuse
		 I_y_fuse = (1.0/12.0)*(FuseWeight/32.1740)*(Len_fuse**2+Hgt_fuse**2)+(FuseWeight/32.1740)*(FuseCG - x_cg)**2

		 #I_y_wing
		 I_y_wing = (1.0/12.0)*(W_wing/32.1740)*(c_w**2+(Airfoil_t_over_c_wing*c_w*0.5)**2)+(W_wing/32.1740)*(x_cg_w - x_cg)**2

		 #I_y_spar
		 I_y_spar = 0.5*(SparLen*(pi*(7.0/8.0)**2/4)*Alum2024Dens)/32.1740*((7.0/8.0)/12/2)**2 + (SparLen*(pi*(7.0/8.0)**2/4)*Alum2024Dens)/32.1740*((x_wLE+c_w*0.25) - x_cg)**2 + 0.5*(SparLen*(pi*(3.0/8.0)**2/4)*Alum2024Dens)/32.1740*((3.0/8.0)/12/2)**2 + (SparLen*(pi*(3.0/8.0)**2/4)*Alum2024Dens)/32.1740*((x_wLE+c_w*0.66) - x_cg)**2

		 #I_y_tail
		 I_y_tail = (1.0/12.0)*(W_ht/32.1740)*(c_ht**2+(Airfoil_t_over_c_tail*c_ht*0.5)**2)+(W_ht/32.1740)*(x_cg_ht - x_cg)**2 + (1.0/12.0)*(W_vt/32.1740)*(c_vt**2+b_vt**2)+(W_vt/32.1740)*((x_cg_vt - x_cg)**2+(b_vt/2)**2)

		 #I_y_tailboom
		 I_y_tailboom = (1.0/12.0)*(TailBoomVol*Alum2024Dens)/32.1740*(TailBoomLen)**2 + (TailBoomVol*Alum2024Dens)/32.1740*((TailBoomLen/2+(x_wLE+c_w*0.25)) - x_cg)**2






		 self.I_y = I_y = I_y_front + I_y_fuse + I_y_wing + I_y_spar + I_y_tail + I_y_tailboom
		 #self.I_y = I_y = W_payload/32.1740*(x_cg_payload - x_cg)**2 + FrontWeight/32.1740*(FrontCG - x_cg)**2 + W_wing/32.1740*(x_cg_w - x_cg)*2 + (W_ht+W_vt)/32.1740*(x_cg_t - x_cg)**2 + FuseWeight/32.1740*(FuseCG - x_cg)**2 + TailBoomSparAssemWeight/32.1740*(TailBoomSparAssemCG - x_cg)**2

		 print 'I_y', I_y