Skip to main content

SimWeave / Continuous nodes

Phase 1 of the SimWeave integration ships a small set of nodes that wrap SimWeave's continuous-system primitives. These are enough to reproduce the canonical mass-spring-damper demo on the EdgeWeave canvas without writing Python.

SimWeave is an optional dependency. If simweave[viz] is not installed, the EdgeWeave backend still boots; these nodes will instead render an inline preview pointing the user at pip install simweave[viz].

Nodes​

simweave_msd — MassSpringDamper​

  • Category: SimWeave / Continuous
  • Inputs: none
  • Fields: mass, damping, stiffness
  • Output: a simweave.System representing mass·ẍ + damping·ẋ + stiffness·x = 0
  • Preview: prints the parameters, the natural frequency ω₀ = √(stiffness / mass) and the damping ratio ζ = damping / (2·√(mass·stiffness)).

simweave_pendulum — SimplePendulum​

  • Inputs: none
  • Fields: length (m), mass (kg), gravity (m/s²), damping
  • Output: simweave.System representing the nonlinear pendulum θ̈ + (c/(m·l²))·θ̇ + (g/l)·sin θ = 0.
  • Preview: prints the parameters and the small-angle natural frequency / period.

simweave_rlc — SeriesRLC​

  • Inputs: none
  • Fields: resistance (Ω), inductance (H), capacitance (F)
  • Output: simweave.System for the series RLC in charge–current form L·q̈ + R·q̇ + (1/C)·q = V(t).
  • Preview: prints ω₀ = 1/√(L·C) and ζ = (R/2)·√(C/L).

simweave_thermal_rc — ThermalRC​

  • Inputs: none
  • Fields: thermal_resistance (K/W), thermal_capacitance (J/K), ambient_temperature (K), initial_temperature (K)
  • Output: simweave.System for C·Ṫ = (T_inf − T)/R + Q_in(t).
  • Preview: time-constant τ = R·C.

simweave_thermal_two_mass — TwoMassThermal​

  • Inputs: none
  • Fields: C_core, C_sink, k_core_to_sink, R_sink_to_ambient, ambient_temperature, initial_core, initial_sink
  • Output: simweave.System for the two-lump core-→-sink-→-ambient thermal model.

simweave_quarter_car — QuarterCarModel​

  • Inputs: none
  • Fields: sprung_mass, unsprung_mass, suspension_stiffness, damping, tyre_stiffness
  • Output: simweave.System (4-state quarter-car suspension).
  • Preview: approximate body and wheel-hop natural frequencies.

simweave_simulate_continuous — Simulate (continuous)​

  • Inputs: system (required), x0 (optional — overrides the x0_string field when wired)
  • Fields: t_start, t_end, dt, x0_string (comma-separated initial state), method
  • Output: a SimulationResult
  • Preview: shows the system name, integration method, time span, number of samples, and per-state labels.

simweave_plot_state_trajectories — Plot state trajectories​

  • Inputs: result
  • Fields: none
  • Output: Plotly figure
  • always_preview: true — the figure renders even with the global preview toggle off.

simweave_plot_phase_portrait — Plot phase portrait​

  • Inputs: result
  • Fields: x_idx, y_idx (state indices to plot against each other)
  • Output: Plotly figure
  • always_preview: true

Demo wiring​

[ simweave_msd ] ──▶ [ simweave_simulate_continuous ] ─┬─▶ [ plot_state_trajectories ]
└─▶ [ plot_phase_portrait ]

Default field values reproduce demos/01_mass_spring_damper.py from the SimWeave repo: m=1, c=0.4, k=4, x0=[1, 0], t_span=(0, 12), dt=0.01, method='rk4'.

Codegen / Python export​

Each node carries a codegen.python hint, so exporting the canvas to a .py file produces the equivalent SimWeave script:

import numpy as np
import simweave as sw

system = sw.MassSpringDamper(m=1.0, c=0.4, k=4.0)
result = sw.simulate(
system,
t_span=(0.0, 12.0),
dt=0.01,
x0=np.array([1.0, 0.0]),
method='rk4',
)
fig_traj = sw.plot_state_trajectories(result)
fig_phase = sw.plot_phase_portrait(result, x_idx=0, y_idx=1)

.weave exemplars​

Five canvas-ready demos ship in projects/demo_project/:

  • simweave_msd.weave — mass-spring-damper free decay.
  • simweave_pendulum.weave — nonlinear pendulum with light damping.
  • simweave_rlc.weave — series RLC ringing down from q₀ = 1 C.
  • simweave_thermal_rc.weave — first-order thermal cool-down from 350 K to 293.15 K ambient.
  • simweave_quarter_car.weave — 5 cm step decay of the sprung mass.

What's not shipped yet​

  • ContinuousProcess — the hybrid (env-driven) wrapper. Will graduate when discrete + continuous co-driven demos land.
  • Forced-input nodes (driving inputs(t) on a system). Currently every demo runs free-decay or initial-condition tests; once a forced demo arrives we'll add a simweave_input_function node.