Recently when trying to use the Wrapper block for our simulation tool, I realised that, in some cases, the sampling rate seems off.
Consider the following MWE
import pathsim
from pathsim import blocks
import matplotlib.pyplot as plt
dt = 0.005
wp = blocks.Wrapper(T=dt, tau=0.0, func=lambda x: x)
source = blocks.Source(func=lambda t: t)
sco = blocks.Scope()
connections = [pathsim.Connection(source, wp), pathsim.Connection(wp, sco)]
simulation = pathsim.Simulation(
blocks=[source, wp, sco], connections=connections, dt=dt
)
simulation.run(duration=0.1)
sim_time, data = sco.read()
plt.plot(sim_time, data[0], label="data")
plt.show()

Recently when trying to use the Wrapper block for our simulation tool, I realised that, in some cases, the sampling rate seems off.
Consider the following MWE