def __init__(self, standalone_subobject: StandaloneSubobject, embedded_subobject: EmbeddedSubobject, dynamic_dict: Dict[str, bool], static_dict: StaticDict, tuple_arg: Tuple[str, int], intarg: int, strarg: str, object_list: List[StandaloneSubobject], subobject_list: List[EmbeddedSubobject], builtin_list: List[int], union_arg: Union[StandaloneSubobject, EnhancedStandaloneSubobject], inheritance_list: List[Subclass[StandaloneSubobject]], name: str = 'Standalone Object Demo'): self.union_arg = union_arg self.builtin_list = builtin_list self.subobject_list = subobject_list self.object_list = object_list self.tuple_arg = tuple_arg self.strarg = strarg self.intarg = intarg self.static_dict = static_dict self.dynamic_dict = dynamic_dict self.standalone_subobject = standalone_subobject self.embedded_subobject = embedded_subobject self.inheritance_list = inheritance_list DessiaObject.__init__(self, name=name)
def __init__(self, cycle_speeds: List[float], car_mass: float, tire_radius: float, dt: float = 1, name: str = ''): self.cycle_speeds = cycle_speeds self.car_mass = car_mass self.tire_radius = tire_radius self.dt = dt DessiaObject.__init__(self, name=name) accelerations = [] for i in range(len(self.cycle_speeds[:-1])): acceleration = (self.cycle_speeds[i + 1] - self.cycle_speeds[i]) / dt # acceleration in m/s^2 if acceleration < 0: acceleration *= -1 accelerations.append(acceleration) cycle_torques = [] for acceleration in accelerations: torque = acceleration * car_mass * tire_radius / 2 #torque in Nm cycle_torques.append(torque) self.cycle_torques = cycle_torques
def __init__(self, engine_speeds: List[float], engine_torques: List[float], mass_flow_rate: List[List[float]], fuel_hv: float, name: str = ''): self.engine_speeds = engine_speeds # in rad/s self.engine_torques = engine_torques # in Nm self.mass_flow_rate = mass_flow_rate self.fuel_hv = fuel_hv # fuel lower heating value in J/kg DessiaObject.__init__(self, name=name) BSFC = [] for i, engine_speed in enumerate(self.engine_speeds): list_bsfc = [] for j, engine_torque in enumerate(self.engine_torques): bsfc = self.mass_flow_rate[i][j] / ( engine_speed * engine_torque) # in kg/J list_bsfc.append(bsfc) BSFC.append(list_bsfc) self.bsfc = BSFC efficiencies = [] for list_bsfc in BSFC: list_efficiencies = [] for bsfc in list_bsfc: efficiency = 1 / (bsfc * self.fuel_hv) list_efficiencies.append(efficiency) efficiencies.append(list_efficiencies) self.efficiencies = efficiencies
def __init__(self, gearbox: GearBox, wltp_cycle: WLTPCycle, first_gear_ratio_min_max: Tuple[float, float], coeff_between_gears: List[Tuple[float, float]] = None, name: str = ''): self.gearbox = gearbox self.wltp_cycle = wltp_cycle self.coeff_between_gears = coeff_between_gears self.first_gear_ratio_min_max = first_gear_ratio_min_max DessiaObject.__init__(self, name=name) if self.coeff_between_gears is None: self.coeff_between_gears = (len(self.gearbox.speed_ranges) - 1) * [[0.5, 1]] bounds = [] for i in range(len(self.gearbox.speed_ranges)): if i == 0: bounds.append([ self.first_gear_ratio_min_max[0], self.first_gear_ratio_min_max[1] ]) else: bounds.append([ self.coeff_between_gears[i - 1][0], self.coeff_between_gears[i - 1][1] ]) self.bounds = bounds
def __init__(self, frames: List[Frame], piping: Piping, housing: Housing, waypoints: List[vm.Point3D] = None, name: str = ''): DessiaObject.__init__(self, name=name) self.housing = housing self.piping = piping self.frames = frames if waypoints is None: self.waypoints = self.update_waypoints([0.5] * len(self.frames)) else: self.waypoints = waypoints self.routes = self.update_route(self.waypoints) rl = self.piping.genere_neutral_fiber(self.waypoints) self.length = self.piping.length(self.routes) radius = rl.radius min_radius = min(list(radius.values())) self.min_radius = min_radius max_radius = max(list(radius.values())) self.max_radius = max_radius self.distance_input = self.piping.start.point_distance(self.piping.end) length = 0 for primitive in rl.primitives: if not isinstance(primitive, vm.edges.Arc3D): length += primitive.length() self.straight_line = length
def __init__(self, gearbox: GearBox, wltp_cycle: WLTPCycle, engine_speeds: List[float], engine_torques: List[float], fuel_consumptions: List[float], gears: List[float], ratios: List[float], average_fuel_consumption: float, name: str = ''): self.gearbox = gearbox self.wltp_cycle = wltp_cycle self.engine_speeds = engine_speeds self.engine_torques = engine_torques self.fuel_consumptions = fuel_consumptions self.gears = gears self.ratios = ratios self.average_fuel_consumption = average_fuel_consumption DessiaObject.__init__(self, name=name) self.average_engine_speed = mean(self.engine_speeds) self.average_engine_torque = mean(self.engine_torques) self.ratio_min = min(self.gearbox.ratios) self.ratio_max = max(self.gearbox.ratios) self.average_ratio = mean(self.gearbox.ratios)
def __init__(self, minimized_attributes: Dict[str, bool], enabled: bool = True, name: str = ''): self.enabled = enabled self.minimized_attributes = minimized_attributes DessiaObject.__init__(self, name=name)
def __init__(self, length: float, height: float, thickness: float, mass: float = None, name: str = ''): self.thickness = thickness self.height = height self.length = length self.mass = 7800 * (thickness * height * length) # If you want to change the volumic mass, change the '7800'. DessiaObject.__init__(self, name=name)
def __init__(self, motor: Motor, length_gears: float = 0.01, name: str = ''): self.motor = motor self.length_gears = length_gears DessiaObject.__init__(self, name=name)
def __init__(self, diameter: float, length_connector: float, minimum_radius: float, routes: List[vm.edges.LineSegment3D] = None, name: str = ''): self.routes = routes self.length_connector = length_connector self.minimum_radius = minimum_radius self.diameter = diameter DessiaObject.__init__(self, name=name)
def __init__(self, start: vm.Point3D, end: vm.Point3D, position: vm.Point3D = None, name: str = ''): self.position = position self.start = start self.end = end self.line = vm.edges.LineSegment3D(start, end) DessiaObject.__init__(self, name=name)
def __init__(self, posx: List[float], posy: List[float], name: str = ''): DessiaObject.__init__(self, name=name) self.posx = posx self.posy = posy points = [] for x, y in zip(posx, posy): points.append({'x': x, 'y': y}) self.points = points
def __init__(self, amplitude: float, number: int, name: str = ''): DessiaObject.__init__(self, name=name) self.number = number self.amplitude = amplitude self.x = [i / (2 * math.pi) for i in range(number)] self.y1 = [self.amplitude * math.sin(i) for i in self.x] self.y2 = [self.amplitude * math.cos(i) for i in self.x]
def __init__(self, n_near_values: int = 4, enabled: bool = True, name: str = ''): self.n_near_values = n_near_values self.enabled = enabled DessiaObject.__init__(self, name=name)
def __init__(self, position: volmdlr.Point2D, diameter: float, name: str = ''): self.position = position self.diameter = diameter DessiaObject.__init__(self, name=name)
def __init__(self, elements:List[vmmesh.TriangularElement], non_contour_nodes:List[vm.Point2D], magnetization_vector:vm.Vector2D): self.elements = elements self.non_contour_nodes = non_contour_nodes self.magnetization_vector = magnetization_vector self.element_magnetization_vector = magnetization_vector / len(elements) DessiaObject.__init__(self, name='')
def __init__(self, color_fill: str = None, opacity: float = None, hatching: HatchingSet = None, name: str = ''): self.color_fill = color_fill self.opacity = opacity self.hatching = hatching DessiaObject.__init__(self, name=name)
def __init__(self, line_width: float = None, color_stroke: colors.Color = None, dashline: List[int] = None, name: str = ''): self.line_width = line_width self.color_stroke = color_stroke self.dashline = dashline DessiaObject.__init__(self, name=name)
def __init__(self, engine: Engine, speed_ranges: List[Tuple[float, float]] = None, name: str = ''): self.engine = engine self.speed_ranges = speed_ranges self.ratios = None DessiaObject.__init__(self, name=name)
def __init__(self, embedded_list: List[int] = None, name: str = 'Embedded Subobject'): if embedded_list is None: self.embedded_list = [1, 2, 3] else: self.embedded_list = embedded_list DessiaObject.__init__(self, name=name)
def __init__(self, efficiency_map: EfficiencyMap, setpoint_speed: float, setpoint_torque: float, name: str = ''): self.efficiency_map = efficiency_map self.setpoint_speed = setpoint_speed self.setpoint_torque = setpoint_torque DessiaObject.__init__(self, name=name)
def __init__(self, mesh:vmmesh.Mesh, element_loads:List[ConstantLoad], node_loads:List[SingleNodeLoad], magnet_loads:List[MagnetLoad], continuity_conditions:List[ContinuityCondition]): self.mesh = mesh self.element_loads = element_loads # current density J self.node_loads = node_loads self.magnet_loads = magnet_loads self.continuity_conditions = continuity_conditions self.nb_loads = len(node_loads) DessiaObject.__init__(self, name='')
def __init__(self, elements:List[vmmesh.TriangularElement], value:float): self.elements = elements self.value = value self.value_per_element = [] total_area = sum([elem.area for elem in self.elements]) for element in self.elements: self.value_per_element.append(value * element.area/total_area) DessiaObject.__init__(self, name='')
def __init__(self, frame: Frame, pipings: List[Piping], housing: Housing, waypoint: vm.Point3D = None, name: str = ''): DessiaObject.__init__(self, name=name) self.housing = housing self.pipings = pipings self.frame = frame graph = self.graph() self.analyze_pipings = self.analyze_graph(graph)
def __init__(self, maximum_x: float, maximum_y: float, name: str = ''): DessiaObject.__init__(self, name=name) self.maximum_x = maximum_x self.maximum_y = maximum_y points = [] for i in range(500): x = random.uniform(0, self.maximum_x) y = random.uniform(0, self.maximum_y) points.append({'x': x, 'y': y}) self.points = points
def __init__(self, gearbox: GearBox, number_inputs: int, max_number_shaft_assemblies: int, max_number_gears: int, name: str = ''): self.gearbox = gearbox self.number_inputs = number_inputs self.max_number_shaft_assemblies = max_number_shaft_assemblies self.max_number_gears = max_number_gears DessiaObject.__init__(self, name=name)
def __init__(self, diameter: float, length: float, shaft: Shaft, name: str = ''): self.diameter = diameter self.length = length self.name = name self.shaft = shaft self.z_position = 0 DessiaObject.__init__(self, name=name)
def __init__(self, rivet_diameter: float, rivet_length: float, head_diameter: float, head_length: float, mass: float = None, name: str = ''): self.head_diameter = head_diameter self.head_length = head_length self.rivet_diameter = rivet_diameter self.rivet_length = rivet_length self.mass = 7800 * (math.pi * (head_diameter ** 2) / 4 * head_length + math.pi * ( rivet_diameter ** 2) / 4 * rivet_length) DessiaObject.__init__(self, name=name)
def __init__(self, p0: vm.Point2D, p1: vm.Point2D, p2: vm.Point2D, p3: vm.Point2D, name: str = ''): DessiaObject.__init__(self, name=name) self.p3 = p3 self.p2 = p2 self.p1 = p1 self.p0 = p0 self.primitive = self._primitive()
def __init__(self, pos_x: float, pos_y: float, length: float, name: str = ''): self.pos_x = pos_x self.pos_y = pos_y self.length = length self.diameter = 0.04 self.z_position = self.length / 2 DessiaObject.__init__(self, name=name)