(testmodels-emptysystemtest)= # emptySystemTest.py You can view and download this file on Github: [emptySystemTest.py](https://github.com/jgerstmayr/EXUDYN/tree/master/python/TestModels/emptySystemTest.py) ```{code-block} python :linenos: #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # This is an EXUDYN example # # Details: A system without coordinates - only a ground, a sensor and a user function - is solved by every solver # (#2790): the time advances, the PreStepUserFunction is called in every step and the sensor records it; # with the dense and with the sparse linear solver. Such a system is a starting point that grows (items # added later), or a model whose motion is prescribed and only measured. # # Author: Johannes Gerstmayr # Date: 2026-10-02 # # 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 exudyn as exu from exudyn.utilities import * #includes itemInterface and rigidBodyUtilities import numpy as np testIsActive = exu.sys.get('testIsActive', False) DST = exu.DynamicSolverType testResult = 0 for linearSolverType in [exu.LinearSolverType.EXUdense, exu.LinearSolverType.EigenSparse]: for solver in [DST.ExplicitEuler, DST.RK44, DST.ODE23, DST.GeneralizedAlpha, DST.TrapezoidalIndex2, 'static']: SC = exu.SystemContainer() mbs = SC.AddSystem() mbs.AddObject(ObjectGround()) mbs.variables['steps'] = 0 def PreStepUserFunction(mbs, t): mbs.variables['steps'] += 1 return True mbs.SetPreStepUserFunction(PreStepUserFunction) sensor = mbs.AddSensor(SensorUserFunction(sensorUserFunction=lambda mbs, t, sensorNumbers, factors, configuration: [np.sin(t)], storeInternal=True)) mbs.Assemble() assert len(mbs.systemData.GetODE2Coordinates()) == 0 simulationSettings = exu.SimulationSettings() simulationSettings.timeIntegration.numberOfSteps = 10 simulationSettings.timeIntegration.endTime = 1 simulationSettings.solution.file.write = False simulationSettings.linearSolver.solverType = linearSolverType if solver == 'static': mbs.SolveStatic(simulationSettings) else: mbs.SolveDynamic(simulationSettings, solverType=solver) data = mbs.GetSensorStoredData(sensor) exu.Print(str(linearSolverType).split('.')[-1], str(solver).split('.')[-1], ': steps', mbs.variables['steps'], ', last time', data[-1, 0], ', rows', len(data)) testResult += data[-1, 0] + data[-1, 1] + mbs.variables['steps'] exu.Print('solution of emptySystemTest=', testResult) exu.sys['testResult'] = testResult ```