From 61943686c4b6296ab9a377377211674037a34121 Mon Sep 17 00:00:00 2001 From: Paddle Date: Mon, 9 Oct 2023 16:56:43 +0200 Subject: [PATCH] Adds 'solve' function to ASMTAssembly. Simplify runSinglePendulumSuperSimplified() more --- OndselSolver/ASMTAssembly.cpp | 22 +++++++++++++++------- OndselSolver/ASMTAssembly.h | 4 ++++ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/OndselSolver/ASMTAssembly.cpp b/OndselSolver/ASMTAssembly.cpp index f8703f6..8b1eed9 100644 --- a/OndselSolver/ASMTAssembly.cpp +++ b/OndselSolver/ASMTAssembly.cpp @@ -64,18 +64,12 @@ void MbD::ASMTAssembly::runSinglePendulumSuperSimplified() mkr->setPosition3D(0.1, 0.1, 0.1); part->addMarker(mkr); - auto joint = CREATE::With(); + auto joint = CREATE::With(); joint->setName("Joint1"); joint->setMarkerI("/Assembly1/Marker1"); joint->setMarkerJ("/Assembly1/Part1/Marker1"); assembly->addJoint(joint); - auto motion = CREATE::With(); - motion->setName("Motion1"); - motion->setMotionJoint("/Assembly1/Joint1"); - motion->setRotationZ("0.0"); - assembly->addMotion(motion); - auto simulationParameters = CREATE::With(); simulationParameters->settstart(0.0); simulationParameters->settend(0.0); //tstart == tend Initial Conditions only. @@ -851,6 +845,20 @@ void MbD::ASMTAssembly::createMbD(std::shared_ptr mbdSys, std::shared_pt animationParameters = nullptr; } +void MbD::ASMTAssembly::solve() +{ + auto simulationParameters = CREATE::With(); + simulationParameters->settstart(0.0); + simulationParameters->settend(0.0); //tstart == tend Initial Conditions only. + simulationParameters->sethmin(1.0e-9); + simulationParameters->sethmax(1.0); + simulationParameters->sethout(0.04); + simulationParameters->seterrorTol(1.0e-6); + setSimulationParameters(simulationParameters); + + runKINEMATIC(); +} + void MbD::ASMTAssembly::runKINEMATIC() { auto mbdSystem = CREATE::With(); diff --git a/OndselSolver/ASMTAssembly.h b/OndselSolver/ASMTAssembly.h index cab0ab5..1351147 100644 --- a/OndselSolver/ASMTAssembly.h +++ b/OndselSolver/ASMTAssembly.h @@ -79,6 +79,10 @@ namespace MbD { std::shared_ptr>>markerMap(); void deleteMbD(); void createMbD(std::shared_ptr mbdSys, std::shared_ptr mbdUnits) override; + + /* This function performs a one shot solve of the assembly.*/ + void solve(); + void runKINEMATIC(); void initprincipalMassMarker(); std::shared_ptr spatialContainerAt(std::shared_ptr self, std::string& longname);