Recent Releases of PathSim - A System Simulation Framework

PathSim - A System Simulation Framework - v0.8.3

What's Changed

  • LUT blocks by @RemDelaporteMathurin in https://github.com/milanofthe/pathsim/pull/69
  • Fixing inconsistency of stick slip example with docs and block diagram by @milanofthe in https://github.com/milanofthe/pathsim/pull/72
  • Restart Pulse source cycle at time t by @RemDelaporteMathurin in https://github.com/milanofthe/pathsim/pull/71
  • refactor StepSource to accept vectorial parameters by @milanofthe in https://github.com/milanofthe/pathsim/pull/74

Full Changelog: https://github.com/milanofthe/pathsim/compare/v0.8.2...v0.8.3

Scientific Software - Peer-reviewed - Python
Published by milanofthe 6 months ago

PathSim - A System Simulation Framework - v0.8.2

What's Changed

  • Algebraic Loop Solver Improvements by @milanofthe in https://github.com/milanofthe/pathsim/pull/67

Full Changelog: https://github.com/milanofthe/pathsim/compare/v0.8.1...v0.8.2

Scientific Software - Peer-reviewed - Python
Published by milanofthe 6 months ago

PathSim - A System Simulation Framework - v0.8.1

What's Changed

  • Patch ScheduleList bug by @RemDelaporteMathurin in https://github.com/milanofthe/pathsim/pull/66
  • added support for port aliases more explicitly to subsystems by @milanofthe in https://github.com/milanofthe/pathsim/pull/65

Full Changelog: https://github.com/milanofthe/pathsim/compare/v0.8.0...v0.8.1

Scientific Software - Peer-reviewed - Python
Published by milanofthe 7 months ago

PathSim - A System Simulation Framework - v0.8.0

Port Aliases

Block input and output ports are now accessible via string aliases in addition to integer indices. These aliases can be defined for custom blocks. For SISO blocks they are the default in and out keys.

Extension of Block Library

Added many new blocks to the block library in the pathsim.blocks.math module. These are elementary functions and are purely algebraic.

What's Changed

  • Minor fix in docs by @RemDelaporteMathurin in https://github.com/milanofthe/pathsim/pull/61
  • Strings as Block Port aliases by @milanofthe in https://github.com/milanofthe/pathsim/pull/62
  • Math Blocks by @milanofthe in https://github.com/milanofthe/pathsim/pull/63

Full Changelog: https://github.com/milanofthe/pathsim/compare/v0.7.2...v0.8.0

Scientific Software - Peer-reviewed - Python
Published by milanofthe 7 months ago

PathSim - A System Simulation Framework - v0.7.2

What's Changed

  • Block metadata by @milanofthe in https://github.com/milanofthe/pathsim/pull/58
  • Scope labels default value by @RemDelaporteMathurin in https://github.com/milanofthe/pathsim/pull/60

Full Changelog: https://github.com/milanofthe/pathsim/compare/v0.7.1...v0.7.2

Scientific Software - Peer-reviewed - Python
Published by milanofthe 7 months ago

PathSim - A System Simulation Framework - v0.7.1

What's Changed

  • Algebraic Loop Accelerator by @milanofthe in https://github.com/milanofthe/pathsim/pull/50
  • ODE Solver Overhaul by @milanofthe in https://github.com/milanofthe/pathsim/pull/52
  • Adding ScheduleList event type by @milanofthe in https://github.com/milanofthe/pathsim/pull/54

Full Changelog: https://github.com/milanofthe/pathsim/compare/v0.7.0...v0.7.1

Scientific Software - Peer-reviewed - Python
Published by milanofthe 7 months ago

PathSim - A System Simulation Framework - v0.7.0

Refactor

This release comes with performance improvements for scheduled events and a refactor of the block library.

This changes the import hierarchy of the blocks and eliminates the rf and mixed submodules. The goal was to have a coherent block library that shows intention for block usage and remove ambiguity about what block to use from what module for what purpose.

Performance improvements for the Schedule events is realized by a new estimate method that truncates the timestep when in danger of overshooting the event time of scheduled events. This is very noticable (expect about 10-30% when scheduled events are present in the simulation), as it leads to a big reduction in discarded simulation steps.

What's Changed

  • event estimation by @milanofthe in https://github.com/milanofthe/pathsim/pull/47
  • refactor block library by @milanofthe in https://github.com/milanofthe/pathsim/pull/48

Full Changelog: https://github.com/milanofthe/pathsim/compare/v0.6.10...v0.7.0

Scientific Software - Peer-reviewed - Python
Published by milanofthe 9 months ago

PathSim - A System Simulation Framework - v0.6.10

Port definitions with tuples

Enable port definitions to accept lists / tuples of int:

python C = Connection(B1[0, 1], B2[1, 2])

where previously you could do slicing

python C = Connection(B1[0:2], B2[1:3])

or had to define multiple connections.

But now you can define the connections arbitrarily, for example like this:

python C = Connection(B1[3, 5, 8, 2], B2[4, 3, 2, 5])

Performance

The intention was to remove unnecessary function calls during data transfer between blocks for performance (brings 5 to 10% performance gains, which is always nice) and to make things more concise. Specifically this means removing the Block.get and Block.set methods and instead directly using the inputs and outputs registers for data transfer. For the Subsystem, this is realized by using @property to access the inputs and outputs of the internal Interface block, which also makes this block definition much more concise.

What's Changed

  • examples and tests by @milanofthe in https://github.com/milanofthe/pathsim/pull/41
  • added bouncing ball as testcase to tests/evals by @milanofthe in https://github.com/milanofthe/pathsim/pull/42
  • example and testcase for purely algebraic signal chain by @milanofthe in https://github.com/milanofthe/pathsim/pull/43
  • Refactor Connection and Port management by @milanofthe in https://github.com/milanofthe/pathsim/pull/46

Full Changelog: https://github.com/milanofthe/pathsim/compare/v0.6.9...v0.6.10

Scientific Software - Peer-reviewed - Python
Published by milanofthe 9 months ago

PathSim - A System Simulation Framework - v0.6.9

Performance again

This is a big one. Fully reworking how system function evaluation works using directed graphs brings BIG performance gains. Expect from 20% up to 300% gains for systems with long algenraic paths. For details go here.

What's Changed

  • DAG and broken loop DAGs for fast system evaluation by @milanofthe in https://github.com/milanofthe/pathsim/pull/26
  • better docs by @milanofthe in https://github.com/milanofthe/pathsim/pull/30
  • refactor tests, clear testing philosophy by @milanofthe in https://github.com/milanofthe/pathsim/pull/31
  • Wrapper class for wrapping external code and making discrete blocks by @Pimss in https://github.com/milanofthe/pathsim/pull/24
  • Bugfix to examplepidvs_discretePID.py by @Pimss in https://github.com/milanofthe/pathsim/pull/35
  • Reworked LTI blocks to use Scipy methods by @milanofthe in https://github.com/milanofthe/pathsim/pull/36
  • updated docs by @milanofthe in https://github.com/milanofthe/pathsim/pull/37
  • added docs example testing as item to the roadmap by @milanofthe in https://github.com/milanofthe/pathsim/pull/38

Full Changelog: https://github.com/milanofthe/pathsim/compare/v0.6.8...v0.6.9

Scientific Software - Peer-reviewed - Python
Published by milanofthe 10 months ago

PathSim - A System Simulation Framework - v0.6.8

Performance

  • Improved simulation performance by cutting unnecessary branching from the main simulaiton loop. This was achieved by assembling lists of active system components (blocks, connections, events) dynamically before the timestep and then using only those for iterations within the timestep. In most cases, this improves performance by about 10%.
  • Refactor of the timestepping methods in ´Simulation´ to be more readable and better separate implicit/explicit and fixed/adaptive solvers.

What's Changed

  • simulation loop by @milanofthe in https://github.com/milanofthe/pathsim/pull/22
  • added and improved tests for Simulation by @milanofthe in https://github.com/milanofthe/pathsim/pull/23

Full Changelog: https://github.com/milanofthe/pathsim/compare/v0.6.7...v0.6.8

Scientific Software - Peer-reviewed - Python
Published by milanofthe 10 months ago

PathSim - A System Simulation Framework - v0.6.7

What's Changed

  • Examples by @milanofthe in https://github.com/milanofthe/pathsim/pull/16
  • better docstrings by @milanofthe in https://github.com/milanofthe/pathsim/pull/17
  • Ports by @milanofthe in https://github.com/milanofthe/pathsim/pull/18
  • better documentation by @milanofthe in https://github.com/milanofthe/pathsim/pull/19
  • Roadmap by @milanofthe in https://github.com/milanofthe/pathsim/pull/20

Full Changelog: https://github.com/milanofthe/pathsim/compare/v0.6.6...v0.6.7

Scientific Software - Peer-reviewed - Python
Published by milanofthe 10 months ago

PathSim - A System Simulation Framework - v0.6.6

What's Changed

  • Pulse source with scheduled events by @milanofthe in https://github.com/milanofthe/pathsim/pull/11
  • better validations by @milanofthe in https://github.com/milanofthe/pathsim/pull/12
  • Improved progresstracking by @milanofthe in https://github.com/milanofthe/pathsim/pull/13
  • defaults and constants by @milanofthe in https://github.com/milanofthe/pathsim/pull/14
  • Connection Port Slicing by @milanofthe in https://github.com/milanofthe/pathsim/pull/15

Full Changelog: https://github.com/milanofthe/pathsim/compare/v0.6.5...v0.6.6

Scientific Software - Peer-reviewed - Python
Published by milanofthe 10 months ago

PathSim - A System Simulation Framework - v0.6.5

another minor releas with some fixes and some handy new features

Packaging thanks to @RemDelaporteMathurin

  • moving all the source code to a src directory
  • replace outdated setup.py and requirements.txt files by a pyproject.toml file
  • remove the _version.py file (which btw should not be under version control) and have it dynamically written by setuptools

Fixes

  • fixed __len__ method of mixed signal blocks, most of them have no algebraic passthrough

Blocks

  • added special AntiWindupPID block in pathsim/blocks/ctrl.py which is a PID controller with a mechanism for anti-windup using backcalculation that inherits from the standard PID block

Plotting

  • added .plot2D() method to the Scope block as a quality of life method for fast phase portrait visualizaiton
  • added .plot3D() method to the Scope block as a quality of life method for fast visualizations three dimensional solution trajectories

Solvers

  • added a 2nd order Runge-Kutta-Fehlberg adaprive solver RKF21 as a very cheap explicit adaptive option

Docs

  • improved docstrings of all solvers to give users more background on how to choose an appropriate solver for their problem

Testing

  • added mixed signal examples under tests/models/_models as model files to testing for CI

Scientific Software - Peer-reviewed - Python
Published by milanofthe 10 months ago

PathSim - A System Simulation Framework - v0.6.4

minor release with some new blocks and some fixes

New Blocks

  • new PID block in pathsim/blocks/ctrl.py to simplify control system simulations
  • ideal DAC and ADC blocks in pathsim/blocks/mixed/converters.py to simplify mixed signal simulations, driven by scheduled events
  • finite impulse response FIR block for digital filters in pathsim/blocks/mixed/fir.py, driven by scheduled events

Fixes

  • fixed AllpassFilter block in pathsim/blocks/rf/filters.py, now implements a 1st order allpass or a cascade of n 1st order allpass filters

Plotting

  • the Scope block now has a plot2D method to directly visualize phase diagrams (quality of life)

Scientific Software - Peer-reviewed - Python
Published by milanofthe 11 months ago

PathSim - A System Simulation Framework - v0.6.3

Simulation

  • updated default args for Simulation.run() so it doesnt reset the simulation by default anymore

Blocks

  • updated blocks.rf.sources.ChirpSource with optional internal phase noise (white, cumulative) contributions, basically the same as in the blocks.rf.noise.PhaseNoise block

Uncertainty Quantification

  • updated the Value class to hold a standard deviation sig next to the numerical value
  • added classmethod var to the Value class to automatically compute the variance of a parameter from the sensitivities using a first order taylor approximation

Scientific Software - Peer-reviewed - Python
Published by milanofthe 11 months ago

PathSim - A System Simulation Framework - v0.6.2

Again some minor updates and fixes

Refactors

  • renamed utils.debugging to utils.analysis since its not only used for debugging anymore
  • Timer context manager is more concise
  • Special operator input for Adder more robust for weird cases

Serialization

  • more robust serialization, saves module of blocks and PathSim objects
  • more robust deserialization, uses importlib to import block from saved module if available, otherwise falls back to hierarchy traversal to ensure backwards compatibility for models saved in previous versions

Fixes

  • fixed linearization of dynamic blocks with only a single state by checking if engine exists
  • fixed jacobian of dynamic operator of Differentiator

Scientific Software - Peer-reviewed - Python
Published by milanofthe 11 months ago

PathSim - A System Simulation Framework - v0.6.1

This is a minor release

Features

  • updated the Adder block to now accept operations to be applied at the inputs as a string, i.e. '+-' for convenience, default remains regular sum

Fixes

  • fixed linearization of Multiplier block, was missing numpy import

Docs

  • much improved docstrings of all blocks and events with examples and math

Scientific Software - Peer-reviewed - Python
Published by milanofthe 11 months ago

PathSim - A System Simulation Framework - v0.6.0

Overview

This is a big one.

At the core of this release stands linearization which required some major refactors of the ode solver interface (through Solver and its subclasses) and internal structure of the blocks. The newly introduced callable Operator and DynamicOperator classes wrap functions and enable automatic linearization in an operating point. This reduces block- and system-level linearization to the linearization of the internal operators of the blocks which is now handled by the operators themself.

What this enables is the linearization (and delinearization) of individual blocks, subsystems or the full system at runtime. This can even be triggered through events.

Operators

  • Introduced new pathsim.optim.operator module that defines the Operator and DynamicOperator classes
  • Can wrap callables / functions and have built in methods for linearization in an operating point, using a first order taylor approximation
  • Automatic jacobian evaluation (op.jac(x) or op.jac_x(x, u, t), op.jac_u(x, u, t)) through either user specified jacobians, automatic differentiation or numerical differentiation (in this order)
  • When linearized, subsequent calls with op() use the internal taylor approximation (linear surrogate model)

Refactoring

  • Solver now doesnt take func and jac as callables anymore, step and solve methods now take the value of the evaluated function and the value of the evaluated Jacobian, shifting the responsibility of the function and jacobian evaluation away from the ODE solvers and towards the blocks
  • Adjusted core simulation loop to reflect this shift in responsibility
  • Block now has attributes op_dyn and op_alg which are either None or instances of the Operator or DynamicOperator classes, they define the behaviour of algebraic and dynamic blocks and ultimately enable runtime linearization

Linearization

  • Added linearize and delinearize methods to Simulation, Subsystem and Block to automaticalls linearize and delinearize these components

Serialization

  • Streamlined serialization, zerializable objects have the option to add metadata

AD

  • Improved Value class performance by 10% for arithmetic operations by using defaultdict(float) for sparse gradient tracking

Scientific Software - Peer-reviewed - Python
Published by milanofthe 11 months ago

PathSim - A System Simulation Framework - v0.5.9

  • Switch block now has a select method to select the input port
  • Condition event now uses bisection method for event time location instead of resolving directly
  • constant nameing in _constants.py now more streamlined
  • Improved serialization of PathSim objects with optional metadata, robust function and complex object serialization using dill
  • Global plotting method for the simulation Simulation.plot() that calls the all plot methods of blocks that implement it (quality of life, just open all the plots at once)

Scientific Software - Peer-reviewed - Python
Published by milanofthe 11 months ago

PathSim - A System Simulation Framework - v0.5.8

  • moved all constants and default tolerances to pathsim/_constants.py
  • moved numerical differentiation methods to pathsim/optim/numerical.py
  • numerical differentiation now uses relative perturbations for stepsize
  • minor fixes in backtracking for event system in conjunction with adaptive ODE solvers in pathsim/simulation.py

note: numerical differntiation is not used currently but might be useful to compute jacobians in the future when AD is not feasible

Scientific Software - Peer-reviewed - Python
Published by milanofthe 12 months ago

PathSim - A System Simulation Framework - v0.5.7

  • New Switch block that selects input depending on internal state
  • Fixed backtracking for event location with adaptive solvers, specifically reevaluating after refert, to ensure the correct values are buffered for the events

Scientific Software - Peer-reviewed - Python
Published by milanofthe 12 months ago

PathSim - A System Simulation Framework - v0.5.6

Scientific Software - Peer-reviewed - Python
Published by milanofthe 12 months ago

PathSim - A System Simulation Framework - v0.5.5

  • Minor fixes and cleanup
  • Algebraic path length estimation now considers if blocks are active, inactive blocks break signal path
  • Generic block will be deprecated in next release due to naming conflict

Scientific Software - Peer-reviewed - Python
Published by milanofthe 12 months ago

PathSim - A System Simulation Framework - v0.5.4

This release is all in the name of serialization. The pathsim.utils.serialization module offers a base class that adds serializability and deserializability to most objects in pathsim as a human readable json string. This adds the to_dict method to the Simulation class and to all the available blocks, the Connection class and the events to convert them to their json representation, and a from_dict classmethod that enables the construction of blocks, etc. from json. The __str__ method now also secretly calls the to_dict method.

Simple example: ```python import numpy as np import matplotlib.pyplot as plt

from pathsim import Simulation, Connection from pathsim.blocks import ( Source, Integrator, Amplifier, Adder, Scope )

1st ORDER SYSTEM ======================================================================

simulation timestep

dt = 0.02

step delay

tau = 3

blocks that define the system

Src = Source(lambda t: int(t>tau)) Int = Integrator() Amp = Amplifier(-1) Add = Adder() Sco = Scope(labels=["step", "response"])

blocks = [Src, Int, Amp, Add, Sco]

the connections between the blocks

connections = [ Connection(Src, Add[0], Sco[0]), Connection(Amp, Add[1]), Connection(Add, Int), Connection(Int, Amp, Sco[1]) ]

initialize simulation with the blocks, connections, timestep and logging enabled

Sim = Simulation(blocks, connections, dt=dt, log=True)

print(Sim) ```

becomes this:

code { "metadata": { "name": "Model", "description": "", "created": "2025-02-28T21:13:42.847434" }, "blocks": [ { "id": "2037130594352", "type": "Source", "params": { "func": { "type": "lambda", "name": "<lambda>", "source": "lambda t: int(t>tau))", "globals": { "tau": 3 }, "closures": {} } } }, { "id": "2037130594688", "type": "Integrator", "params": { "initial_value": 0.0 } }, { "id": "2037130595024", "type": "Amplifier", "params": { "gain": -1 } }, { "id": "2037130595360", "type": "Adder", "params": {} }, { "id": "2037130595696", "type": "Scope", "params": { "sampling_rate": null, "t_wait": 0.0, "labels": [ "step", "response" ] } } ], "connections": [ { "id": "2037130596032", "source": { "block": "2037130594352", "port": 0 }, "targets": [ { "block": "2037130595360", "port": 0 }, { "block": "2037130595696", "port": 0 } ] }, { "id": "2037129492624", "source": { "block": "2037130595024", "port": 0 }, "targets": [ { "block": "2037130595360", "port": 1 } ] }, { "id": "2037129493584", "source": { "block": "2037130595360", "port": 0 }, "targets": [ { "block": "2037130594688", "port": 0 } ] }, { "id": "2037130549568", "source": { "block": "2037130594688", "port": 0 }, "targets": [ { "block": "2037130595024", "port": 0 }, { "block": "2037130595696", "port": 1 } ] } ], "events": [], "simulation": { "dt": 0.02, "dt_min": 1e-16, "dt_max": null, "solver": "SSPRK22", "tolerance_fpi": 1e-12, "iterations_min": 2, "iterations_max": 200 } }

In the future this will be utilized for saving simulations and models to and loading them from external files that are readable and editable.

Scientific Software - Peer-reviewed - Python
Published by milanofthe 12 months ago

PathSim - A System Simulation Framework - v0.5.3

New docstrings that align with the numpy standard

Scientific Software - Peer-reviewed - Python
Published by milanofthe 12 months ago

PathSim - A System Simulation Framework - v0.5.2

Reduced complexity of event definition. Now events dont watch blocks explicitly but this is handled by arbitrary event functions by leveraging the object oriented and decentralized nature of the blocks in pathsim.

For example, reading the inputs, outputs and internal state of a block is done with the __call__ method of the block. Like this:

```python from pathsim.blocks import Integrator

A = Integrator()

inputs, outputs, state = A() ```

This can be utilized for events in the event detection function directly. For example like this:

```python from pathsim.events import ZeroCrossing

def f(t): inputs, outputs, state = A() return state

E = ZeroCrossing(func_evt=f) ```

Which is much cleaner as compared to previously:

```python from pathsim.events import ZeroCrossing

def f(blocks, t): inputs, outputs, state = blocks0 return state

E = ZeroCrossing(blocks=[A], func_evt=f) ```

Scientific Software - Peer-reviewed - Python
Published by milanofthe about 1 year ago

PathSim - A System Simulation Framework - v0.5.1

improved management of active and inactive system components during simulation

Scientific Software - Peer-reviewed - Python
Published by milanofthe about 1 year ago

PathSim - A System Simulation Framework - v0.5.0

Minor fixes, primarily the Duplex connection now works properly.

Scientific Software - Peer-reviewed - Python
Published by milanofthe about 1 year ago

PathSim - A System Simulation Framework - v0.4.9

This release adds the capability to solve for the time independent Steady State - adds special SteadyState subclass of ImplicitSolver, utilizing the existing optimizers - bidirectional connnections called Duplex that couple two IO pairs as a subclass of Connection, useful for RF systems with ports

Scientific Software - Peer-reviewed - Python
Published by milanofthe about 1 year ago

PathSim - A System Simulation Framework - v0.4.8

This release mostly handles a better integration of the AD framework into the solver suite.

  • reworked event handling system to act on blocks directly for monitoring and resoution, makes it more versatile
  • simulation initialization now utilizes the add_xx methods and is therefore more streamlined
  • introduced optim module that houses the AD framework and the solvers for the implicit update equation s for implicit solvers
  • the AD framework now has functions for jacobian evaluation and a decorator to compute jacobians automatically
  • extended the implicit update equation solver suite by newton-type methods that leverage the AD framework to get the jacobians (experimental and not used currently)
  • implicit integrators now support the Value class from the AD framework, this makes stiff systems fully differentiable

Scientific Software - Peer-reviewed - Python
Published by milanofthe about 1 year ago

PathSim - A System Simulation Framework - v0.4.7

  • Event handling system with zero-crossing detection and handling of scheduled events with error control, compatible with all integrators
  • 25% faster AD by using integer indexing for gradient references in Value class
  • blocks, connections and events are the three major system components that are managed by the Simulation class now
  • blocks, connections and events have on and off methods that enable activating and deactivating them (dynamically, based on events or for debugging purposes) in the simulation

Scientific Software - Peer-reviewed - Python
Published by milanofthe about 1 year ago

PathSim - A System Simulation Framework - v0.4.6

  • reworked error controllers for the adaptive timestep integrators
  • added GEAR type integrators to the solver library (multistep methods with adaptive timestep and adaptive order selection)

Scientific Software - Peer-reviewed - Python
Published by milanofthe over 1 year ago

PathSim - A System Simulation Framework - v0.4.5

  • fixed path length estimation for nested subsystems and added tests and an example
  • renamed utils.funcs to utils.utils, which makes more sense

Scientific Software - Peer-reviewed - Python
Published by milanofthe over 1 year ago

PathSim - A System Simulation Framework - v0.4.4

  • minor fixes
  • fixed RKDP54 butcher table
  • test coverage for Value and Parameter classes for AD framework

Scientific Software - Peer-reviewed - Python
Published by milanofthe over 1 year ago

PathSim - A System Simulation Framework - v0.4.3

  • refactoring of numerical integrators (solvers), separate parent classes for diagonally implicit and explicit runge kutta methods simplifies the specific methods significantly
  • performance of runge kutta methods improved >10% by using explicit loops with indexing to construct slope instead of sum comprehension

Scientific Software - Peer-reviewed - Python
Published by milanofthe over 1 year ago

PathSim - A System Simulation Framework - Enhanced AD and Fixes

  • created interface for automatic differentiation framework to numpy ufuncs
  • updated testsuite
  • general bugfixing regarding implicit solvers (jacobian computation)

Scientific Software - Peer-reviewed - Python
Published by milanofthe over 1 year ago

PathSim - A System Simulation Framework - AD

Lots of refactors, improvements and new features since the last release including:

  • Added rudimentary automatic differentiation (AD) framework in pathsim.diff to make the simulations differentiable w.r.t. predefined parameters
  • Refactoring of numerical integrators to be compatible with AD framework for transient simulation
  • Added lots of test, initial coverage was above 85%, more coming in the future
  • Overall cleanup

Scientific Software - Peer-reviewed - Python
Published by milanofthe over 1 year ago