Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error in equality method for bearing elements #1102

Merged
merged 10 commits into from
Sep 19, 2024

Conversation

jguarato
Copy link
Contributor

Closes #1100


An AttributeError occurs when running the analysis of a rotor with ball bearings due to an issue in the __eq__ method of the BearingElement class. This method checks for equality between elements but fails when comparing instances of the BallBearingElement class. The error arises because some arguments used during the initialization of a BallBearingElement instance (such as n_balls, d_balls, fs, and alpha) are not stored as attributes of the object, leading to a mismatch in the comparison.

To resolve this issue, the list of attributes to be compared in the __eq__ method was refined. The comparison now uses the intersection of the initialization arguments and the object's attribute names, ensuring that only relevant attributes are considered when checking for equality.

@jguarato
Copy link
Contributor Author

I used this PR to fix an issue that arose when comparing bearing elements with attributes of different sizes (this error occurred when I tried to run the tutorial part 2).

Additionally, I noticed a similar error reported in issue #1100 was happening when attempting to save a rotor .toml file containing a BallBearingElement. As a result, some adjustments were made to the save() method of the BearingElement class.

@raphaeltimbo raphaeltimbo merged commit 21fc845 into petrobras:main Sep 19, 2024
9 checks passed
@jguarato jguarato deleted the fix/error-element-equality branch September 30, 2024 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BallBearing has no n_balls attribute error
2 participants