fix runDragStep

This commit is contained in:
Aik-Siong Koh
2024-06-11 17:33:40 -05:00
parent fb4d7daae2
commit a36daffb8d
17 changed files with 609 additions and 45 deletions

View File

@@ -51,6 +51,10 @@ set(ONDSELSOLVER_SRC
OndselSolver/ASMTAngleJoint.cpp
OndselSolver/ASMTAnimationParameters.cpp
OndselSolver/ASMTAssembly.cpp
OndselSolver/ASMTConeConeContact.cpp
OndselSolver/ASMTContact.cpp
OndselSolver/ASMTCylConeContact.cpp
OndselSolver/ASMTCylCylContact.cpp
OndselSolver/ASMTCompoundJoint.cpp
OndselSolver/ASMTConstantGravity.cpp
OndselSolver/ASMTConstantVelocityJoint.cpp
@@ -421,6 +425,10 @@ set(ONDSELSOLVER_HEADERS
OndselSolver/CADSystem.h
OndselSolver/CartesianFrame.h
OndselSolver/CompoundJoint.h
OndselSolver/ASMTConeConeContact.h
OndselSolver/ASMTContact.h
OndselSolver/ASMTCylConeContact.h
OndselSolver/ASMTCylCylContact.h
OndselSolver/Constant.h
OndselSolver/ConstantGravity.h
OndselSolver/ConstantVelocityJoint.h

View File

@@ -443,18 +443,30 @@ void MbD::ASMTAssembly::runFile(const char* fileName)
void MbD::ASMTAssembly::runDraggingLogTest()
{
auto assembly = ASMTAssembly::assemblyFromFile("../testapp/runPreDrag.asmt");
assembly->runDraggingLog("../testapp/dragging.log");
//auto assembly = ASMTAssembly::assemblyFromFile("../temp/runPreDrag.asmt");
//assembly->setDebug(true);
//assembly->runDraggingLog("../temp/dragging.log");
//assembly->setDebug(false);
runDraggingTest();
auto assembly = ASMTAssembly::assemblyFromFile("runPreDrag.asmt");
assembly->runDraggingLog("dragging.log");
}
void MbD::ASMTAssembly::runDraggingLogTest2()
{
runDraggingTest2();
auto assembly = ASMTAssembly::assemblyFromFile("runPreDrag.asmt");
assembly->runDraggingLog("dragging.log");
}
void MbD::ASMTAssembly::runDraggingLogTest3()
{
runDraggingTest3();
auto assembly = ASMTAssembly::assemblyFromFile("runPreDrag.asmt");
assembly->runDraggingLog("dragging.log");
}
void MbD::ASMTAssembly::runDraggingTest()
{
//auto assembly = ASMTAssembly::assemblyFromFile("../testapp/pistonWithLimits.asmt");
auto assembly = ASMTAssembly::assemblyFromFile("../testapp/dragCrankSlider.asmt");
assembly->setDebug(true);
auto limit1 = ASMTRotationLimit::With();
limit1->setName("Limit1");
@@ -494,6 +506,7 @@ void MbD::ASMTAssembly::runDraggingTest2()
{
//auto assembly = ASMTAssembly::assemblyFromFile("../testapp/pistonWithLimits.asmt");
auto assembly = ASMTAssembly::assemblyFromFile("../testapp/dragCrankSlider.asmt");
assembly->setDebug(true);
auto limit1 = ASMTRotationLimit::With();
limit1->setName("Limit1");
@@ -532,6 +545,7 @@ void MbD::ASMTAssembly::runDraggingTest2()
void MbD::ASMTAssembly::runDraggingTest3()
{
auto assembly = ASMTAssembly::assemblyFromFile("../testapp/rackPinion3.asmt");
assembly->setDebug(true);
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>>>();
@@ -1318,7 +1332,9 @@ void MbD::ASMTAssembly::runDragStep(std::shared_ptr<std::vector<std::shared_ptr<
mbdSystem->runDragStep(dragMbDParts);
}
catch (...) {
runPreDrag();
//Do not use
//runPreDrag();
//Assembly breaks up too easily because of redundant constraint removal.
}
}

View File

@@ -41,6 +41,8 @@ namespace MbD {
static std::shared_ptr<ASMTAssembly> assemblyFromFile(const char* chars);
static void runFile(const char* chars);
static void runDraggingLogTest();
static void runDraggingLogTest2();
static void runDraggingLogTest3();
static void runDraggingTest();
static void runDraggingTest2();
static void runDraggingTest3();

View File

@@ -0,0 +1 @@
#include "ASMTConeConeContact.h"

View File

@@ -0,0 +1,21 @@
/***************************************************************************
* Copyright (c) 2023 Ondsel, Inc. *
* *
* This file is part of OndselSolver. *
* *
* See LICENSE file for details about copyright. *
***************************************************************************/
#pragma once
#include "ASMTContact.h"
namespace MbD {
class ASMTConeConeContact : public ASMTContact
{
//
public:
};
}

View File

@@ -0,0 +1 @@
#include "ASMTContact.h"

View File

@@ -0,0 +1,29 @@
/***************************************************************************
* Copyright (c) 2023 Ondsel, Inc. *
* *
* This file is part of OndselSolver. *
* *
* See LICENSE file for details about copyright. *
***************************************************************************/
#pragma once
#include "ASMTConstraintSet.h"
namespace MbD {
class ForceTorqueData;
class ASMTContact : public ASMTConstraintSet
{
//
public:
static std::shared_ptr<ASMTContact> With();
void readJointSeries(std::vector<std::string>& lines);
void storeOnLevel(std::ofstream& os, size_t level) override;
void storeOnTimeSeries(std::ofstream& os) override;
void createMbD(std::shared_ptr<System> mbdSys, std::shared_ptr<Units> mbdUnits) override;
std::shared_ptr<std::vector<std::shared_ptr<ForceTorqueData>>> jointSeries;
};
}

View File

@@ -0,0 +1 @@
#include "ASMTCylConeContact.h"

View File

@@ -0,0 +1,21 @@
/***************************************************************************
* Copyright (c) 2023 Ondsel, Inc. *
* *
* This file is part of OndselSolver. *
* *
* See LICENSE file for details about copyright. *
***************************************************************************/
#pragma once
#include "ASMTContact.h"
namespace MbD {
class ASMTCylConeContact : public ASMTContact
{
//
public:
};
}

View File

@@ -0,0 +1 @@
#include "ASMTCylCylContact.h"

View File

@@ -0,0 +1,26 @@
/***************************************************************************
* Copyright (c) 2023 Ondsel, Inc. *
* *
* This file is part of OndselSolver. *
* *
* See LICENSE file for details about copyright. *
***************************************************************************/
#pragma once
#include "ASMTContact.h"
namespace MbD {
class ASMTCylCylContact : public ASMTContact
{
//
public:
void parseASMT(std::vector<std::string>& lines) override;
void readDistanceIJ(std::vector<std::string>& lines);
void createMbD(std::shared_ptr<System> mbdSys, std::shared_ptr<Units> mbdUnits) override;
void storeOnLevel(std::ofstream& os, size_t level) override;
double distancexyIJ = 0.0;
};
}

View File

@@ -163,9 +163,13 @@
<ClCompile Include="ASMTAssembly.cpp" />
<ClCompile Include="ASMTAtPointJoint.cpp" />
<ClCompile Include="ASMTCompoundJoint.cpp" />
<ClCompile Include="ASMTConeConeContact.cpp" />
<ClCompile Include="ASMTConstantGravity.cpp" />
<ClCompile Include="ASMTConstantVelocityJoint.cpp" />
<ClCompile Include="ASMTConstraintSet.cpp" />
<ClCompile Include="ASMTContact.cpp" />
<ClCompile Include="ASMTCylConeContact.cpp" />
<ClCompile Include="ASMTCylCylContact.cpp" />
<ClCompile Include="ASMTCylindricalJoint.cpp" />
<ClCompile Include="ASMTCylSphJoint.cpp" />
<ClCompile Include="ASMTExtrusion.cpp" />
@@ -478,9 +482,13 @@
<ClInclude Include="ASMTAssembly.h" />
<ClInclude Include="ASMTAtPointJoint.h" />
<ClInclude Include="ASMTCompoundJoint.h" />
<ClInclude Include="ASMTConeConeContact.h" />
<ClInclude Include="ASMTConstantGravity.h" />
<ClInclude Include="ASMTConstantVelocityJoint.h" />
<ClInclude Include="ASMTConstraintSet.h" />
<ClInclude Include="ASMTContact.h" />
<ClInclude Include="ASMTCylConeContact.h" />
<ClInclude Include="ASMTCylCylContact.h" />
<ClInclude Include="ASMTCylindricalJoint.h" />
<ClInclude Include="ASMTCylSphJoint.h" />
<ClInclude Include="ASMTExtrusion.h" />

View File

@@ -954,6 +954,18 @@
<ClCompile Include="AngleZConstraintIqcJqc.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="ASMTContact.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="ASMTCylCylContact.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="ASMTConeConeContact.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="ASMTCylConeContact.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Array.h">
@@ -1901,6 +1913,18 @@
<ClInclude Include="AngleZConstraintIqcJqc.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="ASMTContact.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="ASMTCylCylContact.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="ASMTConeConeContact.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="ASMTCylConeContact.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="OndselSolver.rc">

View File

@@ -1 +1,20 @@
runPreDrag
runDragStep
Name
Part1
Position3D
4.801714581503802e-15 0.099999999999995245 0.19999999999999998
RotationMatrix
1 -4.7573992180162559e-14 0
4.7573992180162559e-14 1 0
0 0 1
runDragStep
Name
Part1
Position3D
0.2633974596215562 0.063397459621556157 0
RotationMatrix
0.86602540378443871 -0.49999999999999994 0
0.49999999999999994 0.86602540378443871 0
0 0 1
runPostDrag

File diff suppressed because one or more lines are too long

View File

@@ -25,11 +25,9 @@ void sharedptrTest();
int main()
{
ASMTAssembly::runDraggingLogTest3();
ASMTAssembly::runDraggingLogTest2();
ASMTAssembly::runDraggingLogTest();
ASMTAssembly::runDraggingTest2();
ASMTAssembly::runDraggingTest3();
ASMTAssembly::runDraggingTest();
//ASMTAssembly::runFile("../testapp/pistonWithLimits.asmt");
ASMTAssembly::runFile("../testapp/pistonAllowZRotation.asmt");
ASMTAssembly::runFile("../testapp/Schmidt_Coupling_Ass_1-1.asmt");
ASMTAssembly::runFile("../testapp/RevRevJt.asmt");

203
testapp/__cubes.asmt Normal file
View File

@@ -0,0 +1,203 @@
OndselSolver
Assembly
Notes
(Text string: '' runs: (Core.RunArray runs: #() values: #()))
Name
OndselAssembly
Position3D
0 0 0
RotationMatrix
1 0 0
0 1 0
0 0 1
Velocity3D
0 0 0
Omega3D
0 0 0
RefPoints
RefPoint
Position3D
0 0 0
RotationMatrix
1 0 0
0 1 0
0 0 1
Markers
Marker
Name
marker-__cubes#Box001
Position3D
-15.44875431060791 -5.7149038314819336 3.9632759094238281
RotationMatrix
1 0 0
0 1 0
0 0 1
RefCurves
RefSurfaces
Parts
Part
Name
__cubes#Box001
Position3D
-15.44875431060791 -5.7149038314819336 3.9632759094238281
RotationMatrix
1 0 0
0 1 0
0 0 1
Velocity3D
0 0 0
Omega3D
0 0 0
FeatureOrder
PrincipalMassMarker
Name
MassMarker
Position3D
0 0 0
RotationMatrix
1 0 0
0 1 0
0 0 1
Mass
1
MomentOfInertias
1 1 1
Density
1
RefPoints
RefPoint
Position3D
0 0 0
RotationMatrix
1 0 0
0 1 0
0 0 1
Markers
Marker
Name
FixingMarker
Position3D
0 0 0
RotationMatrix
1 0 0
0 1 0
0 0 1
RefPoint
Position3D
0 0 0
RotationMatrix
1 0 0
0 1 0
0 0 1
Markers
Marker
Name
__cubes#Angle
Position3D
0 0 5
RotationMatrix
1 0 0
0 1 0
0 0 1
RefCurves
RefSurfaces
Part
Name
__cubes#Box002
Position3D
-9.9629693031311035 -3.2665310316877054 17.9748312545318
RotationMatrix
1 0 0
0 1 0
0 0 1
Velocity3D
0 0 0
Omega3D
0 0 0
FeatureOrder
PrincipalMassMarker
Name
MassMarker
Position3D
0 0 0
RotationMatrix
1 0 0
0 1 0
0 0 1
Mass
1
MomentOfInertias
1 1 1
Density
1
RefPoints
RefPoint
Position3D
0 0 0
RotationMatrix
1 0 0
0 1 0
0 0 1
Markers
Marker
Name
__cubes#Angle
Position3D
0 0 5
RotationMatrix
1 0 0
0 1 0
0 0 1
RefCurves
RefSurfaces
KinematicIJs
ConstraintSets
Joints
FixedJoint
Name
__cubes#GroundedJoint
MarkerI
/OndselAssembly/marker-__cubes#Box001
MarkerJ
/OndselAssembly/__cubes#Box001/FixingMarker
AngleJoint
Name
__cubes#Angle
MarkerI
/OndselAssembly/__cubes#Box001/__cubes#Angle
MarkerJ
/OndselAssembly/__cubes#Box002/__cubes#Angle
theIzJz
0.17453292519943295
Motions
Limits
GeneralConstraintSets
ForceTorques
ConstantGravity
0 0 0
SimulationParameters
tstart
0
tend
1
hmin
1.0000000000000001e-09
hmax
1000000000
hout
0.10000000000000001
errorTol
9.9999999999999995e-07
AnimationParameters
nframe
1000000
icurrent
1
istart
1
iend
1000000
isForward
true
framesPerSecond
30