def test_constructor3(self): fname = "Materials.txt" mat = materials.materials(fname) for k in range(0, len(mat)): self.assertTrue(mat[k] != None)
def test_constructor4(self): fname = "Materials.txt" mat = materials.materials(fname) for k in range(0, len(mat)): name, dens = mat[k] if k > 0: self.assertTrue(dens >= 0.0) else: self.assertTrue(dens < 0.0)
def importMaterials(school_id, branch_id, team_element_id): try: objectList = materialsApi.materials({ "school_id": school_id, "branch_id": branch_id, "team_element_id": team_element_id }) if objectList is None: error.log(__file__, False, "Unknown Object") return False if not "status" in objectList: error.log(__file__, False, "Unknown Object") return False if objectList["status"] == "ok": unique = { "school_id": str(school_id), "branch_id": str(branch_id), "team_element_id": str(team_element_id) } element = { "school_id": str(school_id), "branch_id": str(branch_id), "team_element_id": str(team_element_id), "materials": objectList["materials"] } status = sync.sync(db.team_elements, unique, element) return True else: if "error" in objectList: error.log(__file__, False, objectList["error"]) return False else: error.log(__file__, False, "Unknown error") return False except Exception, e: error.log(__file__, False, str(e)) return False
def init_fuselage(self): self._max_fuselage_iterations = None # Don't change without contacting Max self._Wfus_aft = 50 # weight of the aft section of the fuselage self.Wfus_aft_xbar = None # centroid of the aft section of the fuselage self._Wfus_aft_ybar = None # centroid of the aft section of the fuselage self.Wfus_aft_zbar = None # centroid of the aft section of the fuselage self._cockpitbulkhead = 2.2 + self.proplength # m, back of the cockpit self._framesamount = 8 # [-] amount of frames behind the cockpit bulkhead in the fuselage self.framelocs = np.array([ self._cockpitbulkhead + (self.fuselagelength - self.cockpitbulkhead) * n / (self.framesamount + 1) for n in range(self.framesamount + 1) ])[::-1] self.skin_t = 2.5 # 2.138574136 # 2.0 # [mm] thickness of the skin self.skin_t_func = None # Only change if a custom skin thickness function is required. Two arguments: First is skin_t, second is y position where the thickness should be taken. self.mats = materials() self.stringermod = 1.0 # 1.5 # 2.23937285795561 # 1.0 # one-dimensional scaling parameter for stringers, geometry stays the same. self.circstringermod = 1.0 # 1.5 # 2.62916210608877 # 1.0 # one-dimensional scaling parameter for stringers in circular area, geometry stays the same. self.longeronmod = 4. # 3.36724386380556 # 4.0 # one-dimensional scaling parameter for longerons, geometry stays the same. self.stringermat = self.mats['alu2024'] self.circstringermat = self.mats['alu2024'] self.longeronmat = self.mats['carbonfibre'] self._n_stiff = 6 # Amount of stiffeners per panel self.n_stiff_circ = 12 # Amount of stringers total for circular section self.n_longs = 4 # Can't change, only to 0 if longerons should be disabled self.n_stringers = np.ones(8, dtype=int) * self.n_stiff self.n_stringers[0] = self.n_stiff // 2 self.n_stringers[4] = self.n_stiff // 2 self.material_regular = self.mats['alu7075'] self.material_circular = self.mats['carbonfibre'] self.batteryinfuselage = True self._batteryoffset = 0.1 # [m] battery distance behind the cockpit aft bulkhead self._batterywidth = 0.2 # [m] distance of second attachment point of the battery from the first self.yout = None self._fuselage = None # Fuselage object, don't change without contacting Max self.loads = None # Loads acting on the fuselage if self.batteryinfuselage: self.xcgbat = self._cockpitbulkhead + self._batteryoffset + self._batterywidth * 0.5 else: self.xcgbat = 0.7 self.emergencyparachute = self.cockpitbulkhead + self.batteryoffset + self.batterywidth + 0.1 self.nosegearfraction = 0.08
def importMaterials ( school_id, branch_id, team_element_id ): try: objectList = materialsApi.materials({ "school_id" : school_id, "branch_id" : branch_id, "team_element_id" : team_element_id }) if objectList is None: error.log(__file__, False, "Unknown Object") return False if not "status" in objectList: error.log(__file__, False, "Unknown Object") return False if objectList["status"] == "ok": unique = { "school_id" : str(school_id), "branch_id" : str(branch_id), "team_element_id" : str(team_element_id) } element = { "school_id" : str(school_id), "branch_id" : str(branch_id), "team_element_id" : str(team_element_id), "materials" : objectList["materials"] } status = sync.sync(db.team_elements, unique, element) return True else: if "error" in objectList: error.log(__file__, False, objectList["error"]) return False else: error.log(__file__, False, "Unknown error") return False except Exception, e: error.log(__file__, False, str(e)) return False
def newRec(self, code=0, name='', priceForGramm=0): self.appendList(materials(code, name, priceForGramm))
setattr( vnew, parameter, change_parameter(minmax, baseval, False, amount=amountoptimize)[0]) else: increase_results.append(None) return save_fuselage(vnew) if __name__ == "__main__": from materials import materials t = np.vectorize(partial(skinthickness, 1)) Wbat = 256 * 9.81 mats = materials() stringerargs = constructstringerarg(1.0, mats['alu2024']) circstringerargs = constructstringerarg(1.0, mats['alu2024']) longargs = constructlongeronarg(4.0, mats['carbonfibre']) n_stringers = np.ones(8) * 5 n_stiff_circ = 6 n_longs = 8 class V: def __init__(self): self.cockpitbulkhead = 2.2 + 0.3 v = V() fus, framelocs = make_fuselage( v, t,
def test_constructor2(self): fname = "Materials.txt" mat = materials.materials(fname) self.assertTrue(len(mat) == 5)
def test_constructor(self): fname = "Materials.txt" mat = materials.materials(fname) self.assertTrue(mat.mats() != None)