Saturday, February 21, 2026

The Engineer in Me is Jubilant — Julia, A Language for System-Level Experimentation for engineers...



There are moments in an engineer’s life when a tool just clicks.

For me, that moment came while implementing a simple PID-controlled DC motor model in Julia.

Not because PID control is revolutionary.
Not because DC motors are exotic.

But because the process felt frictionless.

And that matters.


From Equation to Experiment — Without Friction

In classical control engineering, we begin with mathematics:


G(s) = K / (Js + b)(Ls + R) + K^2

This is not just a formula.
It represents inertia, friction, electrical dynamics — physics captured in Laplace space.

In many languages, translating this into working simulation code involves:

  • Verbose syntax

  • Data structure boilerplate

  • External tools for plotting

  • Type mismatches

  • Build steps

But in Julia, using ControlSystems.jl, the translation from equation to executable model feels almost poetic:

using ControlSystems

s = tf("s")
motor = K / ((J*s + b)*(L*s + R) + K^2)

pid = Kp + Ki/s + Kd*s
closed_loop = feedback(pid * motor, 1)

Look at that.

The code mirrors the mathematics.
No impedance mismatch between theory and implementation.

For an engineer, that is deeply satisfying.


System-Level Thinking — Not Just Coding

Engineering is not about syntax.

It is about:

  • Modeling

  • Interconnection

  • Feedback

  • Stability

  • Response

  • Iteration

Julia allows you to move from:

  • Transfer function

  • → Closed-loop interconnection

  • → Step response

  • → Parameter tuning

in minutes.

With Plots.jl, visualizing behavior is immediate:

y, t = step(closed_loop, 0:0.01:2)
plot(t, vec(y))

Change Kp.
Re-run.
Observe overshoot change.

Change Ki.
Re-run.
Observe steady-state error vanish.

This is experimentation at the speed of thought.


Why This Feels Different

Many ecosystems split engineering work across tools:

  • MATLAB for modeling

  • Python for data

  • C++ for performance

  • Simulink for block diagrams

Julia collapses these layers.

You can:

  • Write high-level control logic

  • Drop to numerical linear algebra

  • Move into differential equation solvers

  • Even implement custom integrators

All in one language.

For someone who enjoys digging into source code, understanding numerical methods, and experimenting at system scale — this coherence is powerful.


Engineers Think in Systems

When I modeled the PID loop, what struck me was not that it worked.

It was how naturally system interconnections are expressed:

feedback(pid * motor, 1)

That single line captures decades of control theory.

This is not scripting.

This is system architecture expressed symbolically.


Performance Without Compromise

Unlike prototyping languages that eventually require rewriting in C/C++, Julia compiles to efficient machine code.

That means:

  • Rapid experimentation

  • No performance guilt

  • No "rewrite later" tax

For control engineers dealing with:

  • High-order systems

  • State-space models

  • Optimization loops

  • Model predictive control

This matters enormously.


The Quiet Joy

There is a quiet joy when:

  • Mathematics maps directly to code

  • Systems behave as predicted

  • Tuning becomes interactive

  • The tool does not get in the way

That is what I felt implementing the PID example.

Not hype.
Not trendiness.

Just alignment between engineering thought and computational expression.


Julia as an Engineering Workbench

Julia is not just a language.

It feels like:

  • A modeling lab

  • A numerical toolbox

  • A systems sandbox

  • A research instrument

For engineers who think in equations, dynamics, and feedback loops — it feels native.


Final Thought

The engineer in me is jubilant.

Because experimentation should be easy.
Modeling should feel direct.
And computation should not stand between idea and insight.

With Julia, system-level experimentation feels natural again.

And that, for an engineer, is everything.

Here's the source code of the PID Control...

Enjoy...

using ControlSystems
using Plots

# ----------------------------
# Motor Parameters
# ----------------------------
J = 0.01 # inertia
b = 0.1 # friction
K = 0.01 # motor constant
R = 1.0 # resistance
L = 0.5 # inductance

# ----------------------------
# Transfer Function of Motor
# G(s) = K / [(Js + b)(Ls + R) + K^2]
# ----------------------------
s = tf("s")

motor = K / ((J*s + b)*(L*s + R) + K^2)

println("Motor Transfer Function:")
display(motor)

# ----------------------------
# PID Controller
# C(s) = Kp + Ki/s + Kd*s
# ----------------------------
Kp = 100
Ki = 200
Kd = 10

pid = Kp + Ki/s + Kd*s

# ----------------------------
# Closed-loop System
# ----------------------------
closed_loop = feedback(pid * motor, 1)

println("Closed Loop Transfer Function:")
display(closed_loop)

# ----------------------------
# Step Response
# ----------------------------
t = 0:0.01:2
y, t = step(closed_loop, t)

p = plot(t, vec(y),
xlabel="Time (s)",
ylabel="Speed",
title="Closed-Loop Step Response",
legend=false)

display(p)
wait()

And here's my PID study - an implementation using Java done many years ago.

One thing you will understand - Julia is a boon for engineers.

No comments: