Skip to content

Commit

Permalink
Check rackpin and gear for zero radii
Browse files Browse the repository at this point in the history
  • Loading branch information
aiksiongkoh committed Jun 26, 2024
1 parent 041fa1c commit 233eb56
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 5 deletions.
2 changes: 2 additions & 0 deletions OndselSolver/ASMTGearJoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#include "ASMTGearJoint.h"
#include "GearJoint.h"
#include "SimulationStoppingError.h"

using namespace MbD;

Expand Down Expand Up @@ -57,6 +58,7 @@ void MbD::ASMTGearJoint::readRadiusJ(std::vector<std::string>& lines)

void MbD::ASMTGearJoint::createMbD(std::shared_ptr<System> mbdSys, std::shared_ptr<Units> mbdUnits)
{
if (radiusI == 0.0 || radiusJ == 0.0) throw SimulationStoppingError("Gear radius is zero.");
ASMTJoint::createMbD(mbdSys, mbdUnits);
auto gearJoint = std::static_pointer_cast<GearJoint>(mbdObject);
gearJoint->radiusI = radiusI;
Expand Down
2 changes: 2 additions & 0 deletions OndselSolver/ASMTRackPinionJoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#include "ASMTRackPinionJoint.h"
#include "RackPinJoint.h"
#include "SimulationStoppingError.h"

using namespace MbD;

Expand Down Expand Up @@ -44,6 +45,7 @@ void MbD::ASMTRackPinionJoint::readPitchRadius(std::vector<std::string>& lines)

void MbD::ASMTRackPinionJoint::createMbD(std::shared_ptr<System> mbdSys, std::shared_ptr<Units> mbdUnits)
{
if (pitchRadius == 0.0) throw SimulationStoppingError("Rack pinion radius is zero.");
ASMTJoint::createMbD(mbdSys, mbdUnits);
auto rackPinJoint = std::static_pointer_cast<RackPinJoint>(mbdObject);
rackPinJoint->pitchRadius = pitchRadius;
Expand Down
2 changes: 1 addition & 1 deletion OndselSolver/AccNewtonRaphson.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ void AccNewtonRaphson::incrementIterNo()
str = ss.str();
system->logString(str);

throw SimulationStoppingError("");
throw SimulationStoppingError("iterNo > iterMax");
}
}

Expand Down
2 changes: 1 addition & 1 deletion OndselSolver/PosNewtonRaphson.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ void PosNewtonRaphson::incrementIterNo()
str = ss.str();
system->logString(str);

throw SimulationStoppingError("");
throw SimulationStoppingError("iterNo > iterMax");
}
}

Expand Down
6 changes: 3 additions & 3 deletions OndselSolver/QuasiIntegrator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ void QuasiIntegrator::run()
ss << "MbD: Check to see if a curve-curve is about to have multiple contact points." << std::endl;
auto str = ss.str();
this->logString(str);
throw SimulationStoppingError("");
throw SimulationStoppingError("singular matrix");
}
}
catch (TooSmallStepSizeError ex) {
Expand All @@ -61,15 +61,15 @@ void QuasiIntegrator::run()
ss << "MbD: If they are not, lower the permitted minimum step size." << std::endl;
auto str = ss.str();
this->logString(str);
throw SimulationStoppingError("");
throw SimulationStoppingError("stepSize < stepSizeMin");
}
}
catch (TooManyTriesError ex) {
std::stringstream ss;
ss << "MbD: Check to see if the error tolerance is too demanding." << std::endl;
auto str = ss.str();
this->logString(str);
throw SimulationStoppingError("");
throw SimulationStoppingError("iTry > iTryMax");
}

}
Expand Down

0 comments on commit 233eb56

Please sign in to comment.