Skip to content

Commit

Permalink
Merge branch 'main' into fix/plot-modes
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaeltimbo authored Oct 10, 2024
2 parents 3ab8098 + 92b522f commit 411b649
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 10 deletions.
54 changes: 48 additions & 6 deletions ross/bearing_seal_element.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@
and 2 element options with 8 or 12 degrees of freedom.
"""

import os
import warnings
from inspect import signature

import numpy as np
import toml
import warnings
from inspect import signature
from numpy.polynomial import Polynomial
from plotly import graph_objects as go
from scipy import interpolate as interpolate
Expand Down Expand Up @@ -984,6 +982,19 @@ def __init__(
scale_factor=1.0,
color="#355d7a",
):
self.nz = nz
self.ntheta = ntheta
self.length = length
self.omega = omega
self.p_in = p_in
self.p_out = p_out
self.radius_rotor = radius_rotor
self.radius_stator = radius_stator
self.visc = visc
self.rho = rho
self.eccentricity = eccentricity
self.load = load

K = np.zeros((4, len(omega)))
C = np.zeros((4, len(omega)))

Expand Down Expand Up @@ -1130,6 +1141,7 @@ def __init__(
color="#77ACA2",
**kwargs,
):
self.seal_leakage = seal_leakage

super().__init__(
n=n,
Expand All @@ -1150,7 +1162,7 @@ def __init__(
n_link=n_link,
color=color,
)
self.seal_leakage = seal_leakage

# make seals with half the bearing size as a default
self.scale_factor = scale_factor if scale_factor else self.scale_factor / 2

Expand Down Expand Up @@ -1233,6 +1245,11 @@ def __init__(
scale_factor=1,
color="#355d7a",
):
self.n_balls = n_balls
self.d_balls = d_balls
self.fs = fs
self.alpha = alpha

Kb = 13.0e6
kyy = (
Kb
Expand Down Expand Up @@ -1353,6 +1370,11 @@ def __init__(
scale_factor=1,
color="#355d7a",
):
self.n_rollers = n_rollers
self.l_rollers = l_rollers
self.fs = fs
self.alpha = alpha

Kb = 1.0e9
kyy = Kb * n_rollers**0.9 * l_rollers**0.8 * fs**0.1 * (np.cos(alpha)) ** 1.9

Expand Down Expand Up @@ -1602,6 +1624,15 @@ class CylindricalBearing(BearingElement):
Bore assembly radial clearance (m).
oil_viscosity : float, pint.Quantity
Oil viscosity (Pa.s).
tag : str, optional
A tag to name the element
Default is None.
scale_factor : float, optional
The scale factor is used to scale the bearing drawing.
Default is 1.
color : str, optional
A color to be used when the element is represented.
Default is '#355d7a'.
Returns
-------
Expand Down Expand Up @@ -1640,6 +1671,9 @@ def __init__(
journal_diameter=None,
radial_clearance=None,
oil_viscosity=None,
tag=None,
scale_factor=1,
color="#355d7a",
**kwargs,
):
self.n = n
Expand Down Expand Up @@ -1729,7 +1763,15 @@ def __init__(
weight / (radial_clearance * spd) * term
)

super().__init__(self.n, frequency=self.speed, **coefficients_dict, **kwargs)
super().__init__(
n,
frequency=self.speed,
tag=tag,
scale_factor=scale_factor,
color=color,
**coefficients_dict,
**kwargs,
)


class BearingElement6DoF(BearingElement):
Expand Down
10 changes: 6 additions & 4 deletions ross/element.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import inspect
from inspect import signature
from abc import ABC, abstractmethod
from collections import namedtuple
from pathlib import Path
Expand Down Expand Up @@ -42,8 +42,7 @@ def save(self, file):
>>> disk.save(file)
"""
# get __init__ arguments
signature = inspect.signature(self.__init__)
args_list = list(signature.parameters)
args_list = list(signature(self.__init__).parameters)
args = {arg: getattr(self, arg) for arg in args_list}
try:
data = toml.load(file)
Expand Down Expand Up @@ -85,7 +84,10 @@ def read_toml_data(cls, data):
>>> bearing1 == bearing1_loaded
True
"""
return cls(**data)
args_list = set(signature(cls.__init__).parameters).intersection(data.keys())
required_data = {arg: data[arg] for arg in args_list}

return cls(**required_data)

@classmethod
def load(cls, file):
Expand Down
1 change: 1 addition & 0 deletions ross/rotor_assembly.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
MagneticBearingElement,
RollerBearingElement,
SealElement,
CylindricalBearing,
)
from ross.faults import Crack, MisalignmentFlex, MisalignmentRigid, Rubbing
from ross.disk_element import DiskElement, DiskElement6DoF
Expand Down

0 comments on commit 411b649

Please sign in to comment.