|
|
@@ -1,7 +1,5 @@
|
|
|
from dataclasses import dataclass
|
|
|
-
|
|
|
from matplotlib import patches
|
|
|
-
|
|
|
from cbd.core import CBD, Signal
|
|
|
from cbd.simulator import Simulator
|
|
|
from cbd.lib.std import ProductBlock, AdderBlock, IntegratorBlock, ConstantBlock
|
|
|
@@ -9,6 +7,7 @@ import matplotlib.pyplot as plt
|
|
|
import arklog
|
|
|
import logging
|
|
|
|
|
|
+
|
|
|
class SpringMassDamper(CBD):
|
|
|
"""
|
|
|
Causal Block Diagram of a Spring Mass Damper system.
|
|
|
@@ -60,6 +59,7 @@ class SpringMassDamper(CBD):
|
|
|
self.addConnection("const4", "int1", output_port_name="OUT1", input_port_name="IC")
|
|
|
self.addConnection("const4", "int2", output_port_name="OUT1", input_port_name="IC")
|
|
|
|
|
|
+
|
|
|
def plot_experiment(signals: [Signal]):
|
|
|
"""Show the plot of the experiment signals containing the mass position at a certain time."""
|
|
|
logging.debug("Generating experiment plot.")
|
|
|
@@ -81,6 +81,7 @@ def plot_experiment(signals: [Signal]):
|
|
|
ax.legend(handles=handles, loc="upper right")
|
|
|
plt.show()
|
|
|
|
|
|
+
|
|
|
@dataclass(frozen=True, slots=True)
|
|
|
class TimeFrame:
|
|
|
"""Experiment time frame. Denotes a start and stop time as floating point numbers representing seconds."""
|