Skip to content

Commit

Permalink
MRG: Merge pull request #10 from AndreaBlengino/dev
Browse files Browse the repository at this point in the history
v0.7.0
  • Loading branch information
AndreaBlengino authored Apr 8, 2024
2 parents 0bad89a + 76ddd8b commit e9c5697
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ Powertrain Analysis
:alt: Open Issues

.. |license| image:: https://img.shields.io/badge/License-GPLv3-blue.svg
:target: https://github.com/AndreaBlengino/gearpy/blob/v0.1.0/LICENSE
:target: https://github.com/AndreaBlengino/gearpy/blob/master/LICENSE
:alt: License


Expand Down
4 changes: 2 additions & 2 deletions gearpy/mechanical_objects/helical_gear.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from gearpy.units import AngularPosition, AngularSpeed, AngularAcceleration, Angle, Force, InertiaMoment, Length, \
Stress, Time, Torque, UnitBase
from math import sin, cos, sqrt, atan, tan
from math import sqrt, atan
from .mechanical_object_base import RotatingObject, lewis_factor_function, Role
from .mating_roles import MatingMaster, MatingSlave
from .spur_gear import SpurGear
Expand Down Expand Up @@ -112,7 +112,7 @@ def __init__(self,
raise TypeError(f"Parameter 'helix_angle' must be an instance of {Angle.__name__!r}.")

if helix_angle >= Angle(90, 'deg'):
raise ValueError(f"Parameter 'helix_angle' cannot be greater than or equal to 90 degrees.")
raise ValueError("Parameter 'helix_angle' cannot be greater than or equal to 90 degrees.")

self.__helix_angle = helix_angle

Expand Down
2 changes: 1 addition & 1 deletion gearpy/mechanical_objects/mechanical_object_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ def __init__(self,
raise TypeError(f"Parameter 'elastic_modulus' must be an instance of {Stress.__name__!r}.")

if elastic_modulus.value <= 0:
raise ValueError(f"Parameter 'elastic_modulus' must be positive.")
raise ValueError("Parameter 'elastic_modulus' must be positive.")

self.__n_teeth = n_teeth
self.__driven_by = None
Expand Down
2 changes: 1 addition & 1 deletion gearpy/mechanical_objects/spur_gear.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from gearpy.units import AngularPosition, AngularSpeed, AngularAcceleration, Angle, Force, InertiaMoment, Length, \
Stress, Time, Torque, UnitBase
from math import sin, cos, sqrt
from math import sqrt
from .mechanical_object_base import RotatingObject, GearBase, lewis_factor_function, Role
from .mating_roles import MatingMaster, MatingSlave
from typing import Callable, Dict, List, Union, Optional
Expand Down
6 changes: 3 additions & 3 deletions gearpy/mechanical_objects/worm_gear.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ def __init__(self,
inertia_moment = inertia_moment)

if not isinstance(n_starts, int):
raise TypeError(f"Parameter 'n_starts' must be an integer.")
raise TypeError("Parameter 'n_starts' must be an integer.")

if n_starts < 1:
raise ValueError(f"Parameter 'n_starts' must be equal to or greater than one.")
raise ValueError("Parameter 'n_starts' must be equal to or greater than one.")

if not isinstance(helix_angle, Angle):
raise TypeError(f"Parameter 'helix_angle' must be an instance of {Angle.__name__!r}.")
Expand Down Expand Up @@ -273,7 +273,7 @@ def self_locking(self) -> bool:
@self_locking.setter
def self_locking(self, self_locking: bool):
if not isinstance(self_locking, bool):
raise TypeError(f"Parameter 'self_locking' must be a boolean.")
raise TypeError("Parameter 'self_locking' must be a boolean.")

self.__self_locking = self_locking

Expand Down
4 changes: 2 additions & 2 deletions gearpy/motor_control/rules/constant_pwm.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ def __init__(self,
raise TypeError(f"Parameter 'powertrain' must be an instance of {Powertrain.__name__!r}.")

if not isinstance(target_pwm_value, float) and not isinstance(target_pwm_value, int):
raise TypeError(f"Parameter 'target_pwm_value' must be a float or an integer.")
raise TypeError("Parameter 'target_pwm_value' must be a float or an integer.")

if (target_pwm_value < -1) or (target_pwm_value > 1):
raise ValueError(f"Parameter 'target_pwm_value' must be within -1 and 1.")
raise ValueError("Parameter 'target_pwm_value' must be within -1 and 1.")

self.__timer = timer
self.__powertrain = powertrain
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,17 +81,17 @@ def __init__(self,
raise TypeError(f"Parameter 'target_angular_position' must be an instance of {AngularPosition.__name__!r}.")

if not isinstance(pwm_min_multiplier, float) and not isinstance(pwm_min_multiplier, int):
raise TypeError(f"Parameter 'pwm_min_multiplier' must be a float or an integer.")
raise TypeError("Parameter 'pwm_min_multiplier' must be a float or an integer.")

if pwm_min_multiplier <= 1:
raise ValueError(f"Parameter 'pwm_min_multiplier' must be greater than 1.")
raise ValueError("Parameter 'pwm_min_multiplier' must be greater than 1.")

if pwm_min is not None:
if not isinstance(pwm_min, float) and not isinstance(pwm_min, int):
raise TypeError(f"Parameter 'pwm_min' must be a float or an integer.")
raise TypeError("Parameter 'pwm_min' must be a float or an integer.")

if pwm_min <= 0:
raise ValueError(f"Parameter 'pwm_min' must be positive.")
raise ValueError("Parameter 'pwm_min' must be positive.")

self.__encoder = encoder
self.__powertrain = powertrain
Expand Down
4 changes: 2 additions & 2 deletions gearpy/powertrain.py
Original file line number Diff line number Diff line change
Expand Up @@ -689,8 +689,8 @@ def plot(self,
'bending stress': stress_unit, 'contact stress': stress_unit, 'electric current': current_unit,
'pwm': ''}

fig, ax = plt.subplots(nrows = n_variables, ncols = n_elements, sharex = 'all',
layout = 'constrained', figsize = figsize)
_, ax = plt.subplots(nrows = n_variables, ncols = n_elements, sharex = 'all',
layout = 'constrained', figsize = figsize)

stress_legend_items = {}

Expand Down
4 changes: 2 additions & 2 deletions gearpy/utils/relations.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def add_gear_mating(master: GearBase,
raise TypeError(f"Parameter 'slave' must be an instance of {GearBase.__name__!r}.")

if master == slave:
raise ValueError(f"Parameters 'master' and 'slave' cannot be the same gear.")
raise ValueError("Parameters 'master' and 'slave' cannot be the same gear.")

if not isinstance(efficiency, float) and not isinstance(efficiency, int):
raise TypeError("Parameter 'efficiency' must be a float or an integer.")
Expand Down Expand Up @@ -319,7 +319,7 @@ def add_fixed_joint(master: RotatingObject,
raise TypeError(f"Parameter 'slave' is an instance of {MotorBase.__name__!r}, but motor can only be 'master'.")

if master == slave:
raise ValueError(f"Parameters 'master' and 'slave' cannot be the same rotating object.")
raise ValueError("Parameters 'master' and 'slave' cannot be the same rotating object.")

master.drives = slave
slave.driven_by = master
Expand Down

0 comments on commit e9c5697

Please sign in to comment.