C

Supported Blocks

Algebraic
  • Constant
  • Amplifier (gain)
  • Adder (N-input, signed)
  • Multiplier (N-input)
  • Divider
Dynamic
  • Integrator
  • StateSpace (ABCD)
  • PT1, PT2, PID, LeadLag
  • TransferFunction
  • Butterworth, Allpass Filters
Math
  • Sin, Cos, Tan
  • Exp, Log, Log10
  • Sqrt, Abs, Pow
  • Clip, Atan2
  • Sinh, Cosh, Tanh
Sources
  • SinusoidalSource
  • StepSource
  • TriangleWave
  • SquareWave
  • Clock, GaussianPulse
Logic
  • GreaterThan, LessThan
  • Equal
  • LogicAnd, LogicOr
  • LogicNot
Events
  • SampleHold
  • Algebraic loops (delay-broken)

ODE Solvers

Euler
1st order, 1 stage. Fastest, lowest accuracy. Good for stiff real-time systems where dt is very small.
SSPRK22
2nd order, 2 stages. Strong stability preserving. Good balance of speed and accuracy.
RK4
4th order, 4 stages. Gold standard for ODE integration. Recommended for most applications.

Numeric Types

double
64-bit IEEE 754. Maximum precision. Default for desktop and modern embedded targets (Cortex-M4F+).
float
32-bit IEEE 754. Uses sinf, fabsf, etc. For targets with single-precision FPU.
Fixed-Point
Q-notation (Q7.8, Q15.16, etc.). Saturating or wrapping arithmetic. For targets without FPU.

Pipeline

1 — Model
Define your system in Python using PathSim's block diagram API.
2 — IR
Builder walks the DAG, extracts parameters, pre-computes all C snippets.
3 — Generate
Jinja2 templates iterate the IR and emit pure C99. No logic in templates.
4 — Validate
Compile with GCC, run against analytical solutions, verify accuracy.