-
Notifications
You must be signed in to change notification settings - Fork 5
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Description
When combining several inputs to an integrator or process block, negative inputs do not seem to be handled correctly. Using an adder block to combine inputs before the integrator restores expected behaviour.
Steps to Reproduce
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
PathSim Simulation
==================
Generated by PathView on 2026-01-22 14:43:32
https://view.pathsim.org
PathSim documentation: https://docs.pathsim.org
"""
# ────────────────────────────────────────────────────────────────────────────
# IMPORTS
# ────────────────────────────────────────────────────────────────────────────
import numpy as np
import matplotlib.pyplot as plt
from pathsim import Simulation, Connection
from pathsim.blocks import (
Adder,
Amplifier,
Delay,
Integrator,
PulseSource,
Scope
)
from pathsim.solvers import SSPRK22
# ────────────────────────────────────────────────────────────────────────────
# BLOCKS
# ────────────────────────────────────────────────────────────────────────────
# Sources
pulsesource = PulseSource(
amplitude=1,
T=1
)
# Dynamic
integrator = Integrator()
block_2 = Integrator()
delay = Delay(
tau=0.5
)
# Algebraic
x_10 = Amplifier(
gain=10
)
x_5 = Amplifier(
gain=-10
)
adder = Adder()
# Recording
scope = Scope()
blocks = [
pulsesource,
integrator,
block_2,
delay,
x_10,
x_5,
adder,
scope,
]
# ────────────────────────────────────────────────────────────────────────────
# CONNECTIONS
# ────────────────────────────────────────────────────────────────────────────
connections = [
Connection(pulsesource[0], x_10[0], delay[0]),
Connection(x_10[0], integrator[0], adder[0]),
Connection(x_5[0], integrator[1], adder[1]),
Connection(integrator[0], scope[0]),
Connection(adder[0], block_2[0]),
Connection(block_2[0], scope[1]),
Connection(delay[0], x_5[0]),
]
# ────────────────────────────────────────────────────────────────────────────
# SIMULATION
# ────────────────────────────────────────────────────────────────────────────
sim = Simulation(
blocks,
connections,
Solver=SSPRK22,
dt=0.01,
dt_min=1e-16,
tolerance_lte_rel=0.0001,
tolerance_lte_abs=1e-08,
tolerance_fpi=1e-10,
)
# ────────────────────────────────────────────────────────────────────────────
# MAIN
# ────────────────────────────────────────────────────────────────────────────
if __name__ == '__main__':
# Run simulation
sim.run(duration=10.0)
# Plot results
sim.plot()
plt.show()
Expected Behavior
No response
Version
Browser
Chrome
Additional Context
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working