Skip to content

Issue with Wrapper sampling #147

@RemDelaporteMathurin

Description

@RemDelaporteMathurin

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()
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions