Author: gladky_anton Date: 2009-07-27 17:00:20 +0200 (Mon, 27 Jul 2009) New Revision: 1887
Added: trunk/pkg/common/Engine/DeusExMachina/PressTestEngine.cpp trunk/pkg/common/Engine/DeusExMachina/PressTestEngine.hpp Modified: trunk/pkg/common/SConscript Log: 1. Added PressTestEngine for simulating presses. Can be used and for PointLoadTest simulations. Added: trunk/pkg/common/Engine/DeusExMachina/PressTestEngine.cpp =================================================================== --- trunk/pkg/common/Engine/DeusExMachina/PressTestEngine.cpp 2009-07-27 06:58:46 UTC (rev 1886) +++ trunk/pkg/common/Engine/DeusExMachina/PressTestEngine.cpp 2009-07-27 15:00:20 UTC (rev 1887) @@ -0,0 +1,68 @@ +/************************************************************************* +* Copyright (C) 2009 Anton Gladkyy gladky.an...@gmail.com * +* * +* This program is free software: you can redistribute it and/or modify* +* it under the terms of the GNU General Public License as published by* +* the Free Software Foundation, either version 3 of the License, or * +* (at your option) any later version. * +* * +* This program is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; without even the implied warranty of * +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +* GNU General Public License for more details. * +* * +* You should have received a copy of the GNU General Public License * +* along with this program. If not, see <http://www.gnu.org/licenses/>* +**************************************************************************/ + +#include"PressTestEngine.hpp" +#include<yade/pkg-common/ParticleParameters.hpp> +#include<yade/core/MetaBody.hpp> + + +void PressTestEngine::applyCondition(MetaBody * ncb){ + if (curentDirection != stop) { + if (curentDirection==forward) { //Forward direction of the press + FOREACH(body_id_t id, subscribedBodies){ + assert(ncb->bodies->exists(id)); + currentVerticalForce = ncb->bex.getForce(id)[2]; //Define current vertical force + minimalForce = maxVerticalForce*0.1; //Define minimal edge of te force (10% from Maximal) + if (currentVerticalForce > maxVerticalForce) { //Force increasing. Press is working normally + maxVerticalForce = currentVerticalForce; + } else if ((currentVerticalForce<=(minimalForce))&&(maxVerticalForce !=0)) { + /* + * Force is decreased lower, than minimal. The body seems "cracked". + * Starting the countdown + */ + currentIterationAfterDestruction++; + if (currentIterationAfterDestruction>=numberIterationAfterDestruction) { + /* + * The body definitly cracked. Change the direction of press and increase the velosity in 5 times. + */ + curentDirection=backward; + TranslationEngine::velocity *= -pressVelocityForw2Back; + currentIterationAfterDestruction = (Omega::instance().getCurrentIteration())/pressVelocityForw2Back; + } + } else if (((currentIterationAfterDestruction!=0)&&(maxVerticalForce !=0))) { + /* + * We have found, that it was not "Finish destruction" + * Abnulling currentIterationAfterDestruction + */ + currentIterationAfterDestruction=0; + } + } + TranslationEngine::applyCondition(ncb); + } else if (curentDirection==backward) { //The press returns back to the normal position + if (currentIterationAfterDestruction > 0) { + currentIterationAfterDestruction--; + TranslationEngine::applyCondition(ncb); + } else { + curentDirection=stop; //If the press is in normal position -> STOP + Omega::instance().stopSimulationLoop(); //Stop simulation loop + } + } + } +} + +CREATE_LOGGER(PressTestEngine); +YADE_PLUGIN("PressTestEngine"); Added: trunk/pkg/common/Engine/DeusExMachina/PressTestEngine.hpp =================================================================== --- trunk/pkg/common/Engine/DeusExMachina/PressTestEngine.hpp 2009-07-27 06:58:46 UTC (rev 1886) +++ trunk/pkg/common/Engine/DeusExMachina/PressTestEngine.hpp 2009-07-27 15:00:20 UTC (rev 1887) @@ -0,0 +1,42 @@ +/************************************************************************* +* Copyright (C) 2009 Anton Gladkyy gladky.an...@gmail.com * +* * +* This program is free software: you can redistribute it and/or modify* +* it under the terms of the GNU General Public License as published by* +* the Free Software Foundation, either version 3 of the License, or * +* (at your option) any later version. * +* * +* This program is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; without even the implied warranty of * +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +* GNU General Public License for more details. * +* * +* You should have received a copy of the GNU General Public License * +* along with this program. If not, see <http://www.gnu.org/licenses/>* +**************************************************************************/ + +#pragma once +#include"TranslationEngine.hpp" +#include<yade/core/DeusExMachina.hpp> + +class PressTestEngine: public TranslationEngine{ + /* + * This class simulates the simple press work + * When the press "cracks" the solid brittle material, + * it returns back to the initial position + * and stops the simulation loop. + */ + public: + enum motionDirection {forward, backward, stop}; + motionDirection curentDirection; + Real currentVerticalForce, maxVerticalForce, minimalForce; + long int numberIterationAfterDestruction, currentIterationAfterDestruction; + int pressVelocityForw2Back; + PressTestEngine(): curentDirection(forward), currentVerticalForce(0), maxVerticalForce(0), currentIterationAfterDestruction(0), pressVelocityForw2Back(25) {}; + virtual ~PressTestEngine(){}; + virtual void applyCondition(MetaBody*); + REGISTER_CLASS_AND_BASE(PressTestEngine,TranslationEngine); + REGISTER_ATTRIBUTES(TranslationEngine, (numberIterationAfterDestruction)); + DECLARE_LOGGER; +}; +REGISTER_SERIALIZABLE(PressTestEngine); Modified: trunk/pkg/common/SConscript =================================================================== --- trunk/pkg/common/SConscript 2009-07-27 06:58:46 UTC (rev 1886) +++ trunk/pkg/common/SConscript 2009-07-27 15:00:20 UTC (rev 1887) @@ -49,6 +49,8 @@ LIBS=env['LIBS']+['ParticleParameters']), env.SharedLibrary('CinemDNCEngine',['Engine/DeusExMachina/CinemDNCEngine.cpp'], LIBS=env['LIBS']+['ParticleParameters','RigidBodyParameters']), + env.SharedLibrary('PressTestEngine',['Engine/DeusExMachina/PressTestEngine.cpp'], + LIBS=env['LIBS']+['TranslationEngine']), env.SharedLibrary('CinemCNCEngine', ['Engine/DeusExMachina/CinemCNCEngine.cpp'], _______________________________________________ Mailing list: https://launchpad.net/~yade-dev Post to : yade-...@lists.launchpad.net Unsubscribe : https://launchpad.net/~yade-dev More help : https://help.launchpad.net/ListHelp _______________________________________________ yade-dev mailing list yade-dev@lists.berlios.de https://lists.berlios.de/mailman/listinfo/yade-dev