# Copyright:This file is part of Exudyn. Exudyn is free software. You can redistribute it and/or modify it under the terms of the Exudyn license. See 'LICENSE.txt' for more details. # #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ import sys sys.path.append('../TestModels') #for modelUnitTest as this example may be used also as a unit test import exudyn as exu from exudyn.itemInterface import * from modelUnitTests import ExudynTestStructure, exudynTestGlobals SC = exu.SystemContainer() mbs = SC.AddSystem() exu.Print("\n\n++++++++++++++++++++++++++\nStart EXUDYN version "+exu.GetVersionString()+"\n") #background rect = [-2,-2,2,2] #xmin,ymin,xmax,ymax background0 = {'type':'Line', 'color':[0.1,0.1,0.8,1], 'data':[rect[0],rect[1],0, rect[2],rect[1],0, rect[2],rect[3],0, rect[0],rect[3],0, rect[0],rect[1],0]} #background background1 = {'type':'Circle', 'radius': 0.1, 'position': [-1.5,0,0]} background2 = {'type':'Text', 'position': [-1,-1,0], 'text':'Example with text\nin two lines:.=!'} #background oGround=mbs.AddObject(ObjectGround(referencePosition= [0,0,0], visualization=VObjectGround(graphicsData= [background0, background1, background2]))) #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #cable: mypi = 3.141592653589793 L=2. # length of ANCF element in m #L=mypi # length of ANCF element in m E=2.07e11*1e-5 # Young's modulus of ANCF element in N/m^2
# #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ import sys sys.path.append('../TestModels') #for modelUnitTest as this example may be used also as a unit test import exudyn as exu from exudyn.itemInterface import * from exudyn.utilities import * from modelUnitTests import ExudynTestStructure, exudynTestGlobals #for testing import time import numpy as np SC = exu.SystemContainer() mbs = SC.AddSystem() print('EXUDYN version='+exu.GetVersionString()) m = 2 #mass in kg r = 0.5 #radius for disc mass distribution lRotor = 0.2 #length of rotor disk k = 8000 #stiffness of (all/both) springs in rotor in N/m Jxx = 0.5*m*r**2 #polar moment of inertia Jyyzz = 0.25*m*r**2 + 1/12.*m*lRotor**2 #moment of inertia for y and z axes omega0=np.sqrt(2*k/m) #linear system D0 = 0.002 #dimensionless damping d = 2*omega0*D0*m #damping constant in N/(m/s) omegaInitial = 0.1*omega0 #initial rotation speed in rad/s
fileInfo = os.stat(workingReleasePath + '\\exudyn\\exudynCPP.pyd') exuDate = datetime.fromtimestamp( fileInfo.st_mtime ) #mtime=modified time; ctime=created time, but contains time of first creation (2019...) exuDateStr = str(exuDate.year) + '-' + NumTo2digits( exuDate.month) + '-' + NumTo2digits(exuDate.day) + ' ' + NumTo2digits( exuDate.hour) + ':' + NumTo2digits( exuDate.minute) + ':' + NumTo2digits(exuDate.second) #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ platformString = platform.architecture()[0] #'32bit' platformString += 'P' + str(sys.version_info.major) + '.' + str( sys.version_info.minor) logFileName = '../TestSuiteLogs/testSuiteLog_V' + exu.GetVersionString( ) + '_' + platformString + '.txt' exu.SetWriteToFile(filename=logFileName, flagWriteToFile=True, flagAppend=False) #write all testSuite logs to files #exu.SetWriteToFile(filename='testOutput.log', flagWriteToFile=True, flagAppend=False) exu.Print('\n+++++++++++++++++++++++++++++++++++++++++++') exu.Print('+++++ EXUDYN TEST SUITE +++++') exu.Print('+++++++++++++++++++++++++++++++++++++++++++') exu.Print('EXUDYN version = ' + exu.GetVersionString()) exu.Print('EXUDYN build date = ' + exuDateStr) exu.Print('platform = ' + platform.architecture()[0]) exu.Print('Windows binary path = ', workingReleasePath) exu.Print('python version = ' + str(sys.version_info.major) + '.' + str(sys.version_info.minor) + '.' + str(sys.version_info.micro)) exu.Print('test tolerance = ', testTolerance)
plotBelt() plotOmegaDisk0() plotOmegaDisk1() plotTorque() plotCrankPos() #if __name__ is "__main__": # init() # plot_all() vishelperInit() print("Exudyn used:", exu.GetVersionString()) #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #SYSTEM SETTINGS # 0 - belt-drive-system # 1 - crank system 2D # 2 - crank system 3D # 3 - belt-drive-system + crank system 2D # 4 - belt-drive-system + crank system 3D sys_set = 4 export_images = True PLOTS_PATH = "plots/"
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ import sys sys.path.append( '../TestModels' ) #for modelUnitTest as this example may be used also as a unit test import exudyn as exu from exudyn.itemInterface import * from exudyn.utilities import * from modelUnitTests import ExudynTestStructure, exudynTestGlobals SC = exu.SystemContainer() mbs = SC.AddSystem() exu.Print('DYNAFLEX version=' + exu.GetVersionString()) #testInterface = TestInterface(dynaflex = df, systemContainer = SC, useGraphics=False) #RunAllModelUnitTests(mbs, testInterface) exu.SimulationSettings #background rect = [-0.5, -1, 2.5, 1] #xmin,ymin,xmax,ymax background0 = { 'type': 'Line', 'color': [0.1, 0.1, 0.8, 1], 'data': [ rect[0], rect[1], 0, rect[2], rect[1], 0, rect[2], rect[3], 0, rect[0], rect[3], 0, rect[0], rect[1], 0 ]
import sys sys.path.append( '../TestModels' ) #for modelUnitTest as this example may be used also as a unit test import exudyn as exu from exudyn.itemInterface import * from modelUnitTests import ExudynTestStructure, exudynTestGlobals SC = exu.SystemContainer() mbs = SC.AddSystem() exu.Print("\n\n++++++++++++++++++++++++++\nStart EXUDYN version " + exu.GetVersionString() + "\n") #background rect = [-2, -2, 2, 2] #xmin,ymin,xmax,ymax background0 = { 'type': 'Line', 'color': [0.1, 0.1, 0.8, 1], 'data': [ rect[0], rect[1], 0, rect[2], rect[1], 0, rect[2], rect[3], 0, rect[0], rect[3], 0, rect[0], rect[1], 0 ] } #background background1 = {'type': 'Circle', 'radius': 0.1, 'position': [-1.5, 0, 0]} background2 = { 'type': 'Text',
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # This is an EXUDYN example import exudyn as exu from exudyn.itemInterface import * from exudyn.utilities import * from exudyn.graphicsDataUtilities import * #import numpy as np SC = exu.SystemContainer() mbs = SC.AddSystem() print("version=", exu.GetVersionString()) #nBodiesList = [10,20,50,100,200,500,1000,2000,5000,10000] nBodiesList = [20,40,100,400,1000,5000] #nBodiesList = [10,100,1000,10000] results = [] for nBodies in nBodiesList: mbs.Reset() a=0.03 gBody = GraphicsDataOrthoCube(-a, -a, -a, a, a, a, color=color4steelblue) m = 1 #mass J=[1,2,3,0,0,0] #inertia