Skip to content

Commit

Permalink
Limits output issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
aiksiongkoh committed Apr 9, 2024
1 parent 55963ab commit 8d3aecb
Show file tree
Hide file tree
Showing 31 changed files with 47 additions and 38 deletions.
2 changes: 0 additions & 2 deletions OndselSolver/ASMTAllowRotation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ void MbD::ASMTAllowRotation::setMotionJoint(std::string motionJoint)
void MbD::ASMTAllowRotation::storeOnLevel(std::ofstream& os, size_t level)
{
storeOnLevelString(os, level, "AllowRotation");
storeOnLevelString(os, level + 1, "Name");
storeOnLevelString(os, level + 2, name);
ASMTItemIJ::storeOnLevel(os, level);
storeOnLevelString(os, level + 1, "MotionJoint");
storeOnLevelString(os, level + 2, motionJoint);
Expand Down
13 changes: 12 additions & 1 deletion OndselSolver/ASMTAssembly.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,8 @@ void MbD::ASMTAssembly::runDraggingTest2()
limit2->settol("1.0e-9");
assembly->addLimit(limit2);

assembly->outputFile("assembly.asmt");

auto& dragPart = assembly->parts->at(0);
auto dragParts = std::make_shared<std::vector<std::shared_ptr<ASMTPart>>>();
dragParts->push_back(dragPart);
Expand All @@ -519,7 +521,7 @@ void MbD::ASMTAssembly::runDraggingTest2()

void MbD::ASMTAssembly::runDraggingTest3()
{
auto assembly = ASMTAssembly::assemblyFromFile("../testapp/rackPinion2.asmt");
auto assembly = ASMTAssembly::assemblyFromFile("../testapp/rackPinion3.asmt");
auto dragPart = assembly->partNamed("/OndselAssembly/rackPinion#Box");
auto rotPart = assembly->partNamed("/OndselAssembly/rackPinion#Cylinder");
auto dragParts = std::make_shared<std::vector<std::shared_ptr<ASMTPart>>>();
Expand Down Expand Up @@ -1455,6 +1457,7 @@ void MbD::ASMTAssembly::storeOnLevelConstraintSets(std::ofstream& os, size_t lev
storeOnLevelString(os, level, "ConstraintSets");
storeOnLevelJoints(os, level + 1);
storeOnLevelMotions(os, level + 1);
storeOnLevelLimits(os, level + 1);
storeOnLevelGeneralConstraintSets(os, level + 1);
}

Expand Down Expand Up @@ -1482,6 +1485,14 @@ void MbD::ASMTAssembly::storeOnLevelMotions(std::ofstream& os, size_t level)
}
}

void MbD::ASMTAssembly::storeOnLevelLimits(std::ofstream& os, size_t level)
{
storeOnLevelString(os, level, "Limits");
for (auto& limit : *limits) {
limit->storeOnLevel(os, level + 1);
}
}

void MbD::ASMTAssembly::storeOnLevelGeneralConstraintSets(std::ofstream& os, size_t level)
{
storeOnLevelString(os, level, "GeneralConstraintSets");
Expand Down
1 change: 1 addition & 0 deletions OndselSolver/ASMTAssembly.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ namespace MbD {
void storeOnLevelForceTorques(std::ofstream& os, size_t level);
void storeOnLevelJoints(std::ofstream& os, size_t level);
void storeOnLevelMotions(std::ofstream& os, size_t level);
void storeOnLevelLimits(std::ofstream& os, size_t level);
void storeOnLevelGeneralConstraintSets(std::ofstream& os, size_t level);
void storeOnTimeSeries(std::ofstream& os) override;
void setFilename(std::string filename);
Expand Down
2 changes: 0 additions & 2 deletions OndselSolver/ASMTGeneralMotion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,6 @@ void MbD::ASMTGeneralMotion::createMbD(std::shared_ptr<System> mbdSys, std::shar
void MbD::ASMTGeneralMotion::storeOnLevel(std::ofstream& os, size_t level)
{
storeOnLevelString(os, level, "GeneralMotion");
storeOnLevelString(os, level + 1, "Name");
storeOnLevelString(os, level + 2, name);
ASMTItemIJ::storeOnLevel(os, level);
}

Expand Down
6 changes: 3 additions & 3 deletions OndselSolver/ASMTItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,10 @@ std::shared_ptr<Constant> MbD::ASMTItem::sptrConstant(double value)
return std::make_shared<Constant>(value);
}

void MbD::ASMTItem::storeOnLevel(std::ofstream&, size_t)
void MbD::ASMTItem::storeOnLevel(std::ofstream& os, size_t level)
{
noop();
assert(false);
storeOnLevelString(os, level + 1, "Name");
storeOnLevelString(os, level + 2, name);
}

void MbD::ASMTItem::storeOnLevelTabs(std::ofstream& os, size_t level)
Expand Down
1 change: 1 addition & 0 deletions OndselSolver/ASMTItemIJ.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ void MbD::ASMTItemIJ::readTZonIs(std::vector<std::string>& lines)

void MbD::ASMTItemIJ::storeOnLevel(std::ofstream& os, size_t level)
{
ASMTItem::storeOnLevel(os, level);
storeOnLevelString(os, level + 1, "MarkerI");
storeOnLevelString(os, level + 2, markerI);
storeOnLevelString(os, level + 1, "MarkerJ");
Expand Down
2 changes: 0 additions & 2 deletions OndselSolver/ASMTJoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ void MbD::ASMTJoint::storeOnLevel(std::ofstream& os, size_t level)
auto jointType = classname();
jointType = jointType.substr(4, jointType.size() - 4); //Remove ASMT in name
storeOnLevelString(os, level, jointType);
storeOnLevelString(os, level + 1, "Name");
storeOnLevelString(os, level + 2, name);
ASMTItemIJ::storeOnLevel(os, level);
}

Expand Down
10 changes: 9 additions & 1 deletion OndselSolver/ASMTLimit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,15 @@ void MbD::ASMTLimit::initMarkers()

void MbD::ASMTLimit::storeOnLevel(std::ofstream& os, size_t level)
{
assert(false);
ASMTItemIJ::storeOnLevel(os, level);
storeOnLevelString(os, level + 1, "MotionJoint");
storeOnLevelString(os, level + 2, motionJoint);
storeOnLevelString(os, level + 1, "Limit");
storeOnLevelString(os, level + 2, limit);
storeOnLevelString(os, level + 1, "Type");
storeOnLevelString(os, level + 2, type);
storeOnLevelString(os, level + 1, "Tol");
storeOnLevelString(os, level + 2, tol);
}

void MbD::ASMTLimit::readMotionJoint(std::vector<std::string>& lines)
Expand Down
12 changes: 1 addition & 11 deletions OndselSolver/ASMTRotationLimit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,5 @@ std::shared_ptr<ItemIJ> MbD::ASMTRotationLimit::mbdClassNew()
void MbD::ASMTRotationLimit::storeOnLevel(std::ofstream& os, size_t level)
{
storeOnLevelString(os, level, "RotationLimit");
storeOnLevelString(os, level + 1, "Name");
storeOnLevelString(os, level + 2, name);
ASMTItemIJ::storeOnLevel(os, level);
storeOnLevelString(os, level + 1, "MotionJoint");
storeOnLevelString(os, level + 2, motionJoint);
storeOnLevelString(os, level + 1, "Limit");
storeOnLevelString(os, level + 2, limit);
storeOnLevelString(os, level + 1, "Type");
storeOnLevelString(os, level + 2, type);
storeOnLevelString(os, level + 1, "Tol");
storeOnLevelString(os, level + 2, tol);
ASMTLimit::storeOnLevel(os, level);
}
2 changes: 0 additions & 2 deletions OndselSolver/ASMTRotationalMotion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,6 @@ void MbD::ASMTRotationalMotion::setRotationZ(std::string rotZ)
void MbD::ASMTRotationalMotion::storeOnLevel(std::ofstream& os, size_t level)
{
storeOnLevelString(os, level, "RotationalMotion");
storeOnLevelString(os, level + 1, "Name");
storeOnLevelString(os, level + 2, name);
ASMTItemIJ::storeOnLevel(os, level);
storeOnLevelString(os, level + 1, "MotionJoint");
storeOnLevelString(os, level + 2, motionJoint);
Expand Down
12 changes: 1 addition & 11 deletions OndselSolver/ASMTTranslationLimit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,5 @@ std::shared_ptr<ItemIJ> MbD::ASMTTranslationLimit::mbdClassNew()
void MbD::ASMTTranslationLimit::storeOnLevel(std::ofstream& os, size_t level)
{
storeOnLevelString(os, level, "TranslationLimit");
storeOnLevelString(os, level + 1, "Name");
storeOnLevelString(os, level + 2, name);
ASMTItemIJ::storeOnLevel(os, level);
storeOnLevelString(os, level + 1, "MotionJoint");
storeOnLevelString(os, level + 2, motionJoint);
storeOnLevelString(os, level + 1, "Limit");
storeOnLevelString(os, level + 2, limit);
storeOnLevelString(os, level + 1, "Type");
storeOnLevelString(os, level + 2, type);
storeOnLevelString(os, level + 1, "Tol");
storeOnLevelString(os, level + 2, tol);
ASMTLimit::storeOnLevel(os, level);
}
2 changes: 0 additions & 2 deletions OndselSolver/ASMTTranslationalMotion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ void MbD::ASMTTranslationalMotion::readTranslationZ(std::vector<std::string>& li
void MbD::ASMTTranslationalMotion::storeOnLevel(std::ofstream& os, size_t level)
{
storeOnLevelString(os, level, "TranslationalMotion");
storeOnLevelString(os, level + 1, "Name");
storeOnLevelString(os, level + 2, name);
ASMTItemIJ::storeOnLevel(os, level);
}

Expand Down
1 change: 1 addition & 0 deletions testapp/CrankSlider2debug1.asmt
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,7 @@ Assembly
/Assembly/joint_2
RotationZ
integral(time, rampstep(time, 0.0, 0.0, 1.0, 0.0 + 10.0*(1.0 - 0.0)))
Limits
GeneralConstraintSets
ForceTorques
ConstantGravity
Expand Down
1 change: 1 addition & 0 deletions testapp/CrankSlider2debug2.asmt
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,7 @@ Assembly
/Assembly/joint_2
RotationZ
integral(time, rampstep(time, 0.0, 0.0, 1.0, 0.0 + 10.0*(1.0 - 0.0)))
Limits
GeneralConstraintSets
ForceTorques
ConstantGravity
Expand Down
1 change: 1 addition & 0 deletions testapp/InitialConditionsdebug1.asmt
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ Assembly
ConstraintSets
Joints
Motions
Limits
GeneralConstraintSets
ForceTorques
ConstantGravity
Expand Down
1 change: 1 addition & 0 deletions testapp/InitialConditionsdebug2.asmt
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ Assembly
ConstraintSets
Joints
Motions
Limits
GeneralConstraintSets
ForceTorques
ConstantGravity
Expand Down
1 change: 1 addition & 0 deletions testapp/MBDynCase(Cosine-half drive)debug1.asmt
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ Assembly
/Assembly/structural_node_1/Marker1
MarkerJ
/Assembly/structural_node_2/Marker0
Limits
GeneralConstraintSets
ForceTorques
ConstantGravity
Expand Down
1 change: 1 addition & 0 deletions testapp/MBDynCase(Cosine-half drive)debug2.asmt
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ Assembly
/Assembly/structural_node_1/Marker1
MarkerJ
/Assembly/structural_node_2/Marker0
Limits
GeneralConstraintSets
ForceTorques
ConstantGravity
Expand Down
1 change: 1 addition & 0 deletions testapp/MBDynCase(Sine-forever drive)debug1.asmt
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ Assembly
/Assembly/structural_node_1/Marker1
MarkerJ
/Assembly/structural_node_2/Marker0
Limits
GeneralConstraintSets
ForceTorques
ConstantGravity
Expand Down
1 change: 1 addition & 0 deletions testapp/MBDynCase(Sine-forever drive)debug2.asmt
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ Assembly
/Assembly/structural_node_1/Marker1
MarkerJ
/Assembly/structural_node_2/Marker0
Limits
GeneralConstraintSets
ForceTorques
ConstantGravity
Expand Down
1 change: 1 addition & 0 deletions testapp/MBDynCase2debug1.asmt
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,7 @@ Assembly
/Assembly/joint_2
RotationZ
integral(time, rampstep(time, 0.0, 0.0, 1.0, 0.0 + 6.28*(1.0 - 0.0)))
Limits
GeneralConstraintSets
ForceTorques
ConstantGravity
Expand Down
1 change: 1 addition & 0 deletions testapp/MBDynCase2debug2.asmt
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,7 @@ Assembly
/Assembly/joint_2
RotationZ
integral(time, rampstep(time, 0.0, 0.0, 1.0, 0.0 + 6.28*(1.0 - 0.0)))
Limits
GeneralConstraintSets
ForceTorques
ConstantGravity
Expand Down
1 change: 1 addition & 0 deletions testapp/MBDynCase5origdebug1.asmt
Original file line number Diff line number Diff line change
Expand Up @@ -979,6 +979,7 @@ Assembly
/Assembly/joint_19
RotationZ
integral(time, rampstep(time, 0.25, 0.0, 2.0, 0.0 + 5.0*(2.0 - 0.25))/2)
Limits
GeneralConstraintSets
ForceTorques
ConstantGravity
Expand Down
1 change: 1 addition & 0 deletions testapp/MBDynCase5origdebug2.asmt
Original file line number Diff line number Diff line change
Expand Up @@ -979,6 +979,7 @@ Assembly
/Assembly/joint_19
RotationZ
integral(time, rampstep(time, 0.25, 0.0, 2.0, 0.0 + 5.0*(2.0 - 0.25))/2)
Limits
GeneralConstraintSets
ForceTorques
ConstantGravity
Expand Down
1 change: 1 addition & 0 deletions testapp/MBDynCase8origdebug1.asmt
Original file line number Diff line number Diff line change
Expand Up @@ -845,6 +845,7 @@ Assembly
/Assembly/joint_2
RotationZ
integral(time, rampstep(time, 0.25, 0.0, 3.0, 0.0 + 1.0*(3.0 - 0.25)))
Limits
GeneralConstraintSets
ForceTorques
ConstantGravity
Expand Down
1 change: 1 addition & 0 deletions testapp/MBDynCase8origdebug2.asmt
Original file line number Diff line number Diff line change
Expand Up @@ -845,6 +845,7 @@ Assembly
/Assembly/joint_2
RotationZ
integral(time, rampstep(time, 0.25, 0.0, 3.0, 0.0 + 1.0*(3.0 - 0.25)))
Limits
GeneralConstraintSets
ForceTorques
ConstantGravity
Expand Down
1 change: 1 addition & 0 deletions testapp/MBDynCase9origdebug1.asmt
Original file line number Diff line number Diff line change
Expand Up @@ -1595,6 +1595,7 @@ Assembly
/Assembly/joint_4
RotationZ
integral(time, rampstep(time, 0.25, 0.0, 2.0, 0.0 + 0.5*(2.0 - 0.25)))
Limits
GeneralConstraintSets
ForceTorques
ConstantGravity
Expand Down
1 change: 1 addition & 0 deletions testapp/MBDynCase9origdebug2.asmt
Original file line number Diff line number Diff line change
Expand Up @@ -1595,6 +1595,7 @@ Assembly
/Assembly/joint_4
RotationZ
integral(time, rampstep(time, 0.25, 0.0, 2.0, 0.0 + 0.5*(2.0 - 0.25)))
Limits
GeneralConstraintSets
ForceTorques
ConstantGravity
Expand Down
2 changes: 1 addition & 1 deletion testapp/OndselSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ void sharedptrTest();

int main()
{
ASMTAssembly::runDraggingTest3();
ASMTAssembly::runDraggingTest2();
ASMTAssembly::runDraggingTest3();
ASMTAssembly::runDraggingTest();
//ASMTAssembly::runFile("../testapp/pistonWithLimits.asmt");
ASMTAssembly::runFile("../testapp/pistonAllowZRotation.asmt");
Expand Down
1 change: 1 addition & 0 deletions testapp/SphericalHingedebug1.asmt
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ Assembly
MarkerJ
/Assembly/structural_node_1/Marker1
Motions
Limits
GeneralConstraintSets
ForceTorques
ConstantGravity
Expand Down
1 change: 1 addition & 0 deletions testapp/SphericalHingedebug2.asmt
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ Assembly
MarkerJ
/Assembly/structural_node_1/Marker1
Motions
Limits
GeneralConstraintSets
ForceTorques
ConstantGravity
Expand Down

0 comments on commit 8d3aecb

Please sign in to comment.