Mass Spring Damper
Overview
The mass spring damper digital twin (DT) has two mass spring dampers. It shows how to use a co-simulation based DT within the DTaaS.
Example Diagram

Example Structure
The study includes two simulators, each representing a mass spring damper system. The first simulator calculates the displacement and speed of mass \(m_1\) for a given force \(F_k\) acting on \(m_1\). The second simulator calculates the force \(F_k\) from a given displacement and speed of mass \(m_1\). Coupling the two simulators computes how the positions of the two masses evolve.

Digital Twin Configuration
This example uses two models and one tool:
| Asset Type | Names of Assets | Visibility | Reuse in Other Examples |
|---|---|---|---|
| Models | MassSpringDamper1.fmu | Private | Yes |
| MassSpringDamper2.fmu | Private | Yes | |
| Tool | maestro-4.1.0-jar-with-dependencies.jar | Common | Yes |
The DT is executed with two configuration files, cosim.json and
time.json. Edit them to customise the DT.
Lifecycle Phases
| Lifecycle Phase | Completed Tasks |
|---|---|
| Create | Installs Java Development Kit for Maestro tool |
| Execute | Produces and stores output in data/mass-spring-damper/output directory |
| Clean | Clears run logs and outputs |
Run the example
To run the example, change to the example directory.
If required, make the lifecycle scripts executable, for example:
Then run the following scripts.
Create
Installs Open Java Development Kit 21 in the workspace.
Execute
Runs the digital twin. Because this is a co-simulation based digital twin, the Maestro co-simulation tool runs a co-simulation of the two FMU models.
Examine the Results
The results are in the /workspace/examples/data/mass-spring-damper/output directory.
The run logs are in /workspace/examples/digital_twins/mass-spring-damper.
Terminate phase
Removes the debug files and co-simulation output files.
References
More information about co-simulation techniques and the mass spring damper case study is available in:
The source code for the models used in this DT is in the mass spring damper GitHub repository.