Author Topic: Control Systems Simulator  (Read 1508 times)

0 Members and 1 Guest are viewing this topic.

Offline PicuinoTopic starter

  • Super Contributor
  • ***
  • Posts: 1463
  • Country: es
    • Picuino
Control Systems Simulator
« on: July 10, 2026, 12:04:08 pm »
I'm starting to develop an online control systems simulator.
It's written in vanilla JavaScript (without libraries) with open-source license (GPL v3).

So far, I've only implemented the basic blocks and one system to control (the Ball-and-Beam system), but it can already run simulations.

Any comments or suggestions (especially regarding errors or possible improvements) are welcome.

The only thing I don't want to change is the editing system. It's very basic, but it lets me see how well the students design their diagrams (it's intended for secondary education), and it prevents them from copying and pasting from one window to another.

Here's the link to the Ball-and-Beam system with non tunning PID:

https://www.picuino.com/simulators/control.html?loadFile=ballbeam.txt


EDIT: To simulate, clic in the "Simulate" menu and then "Init"
« Last Edit: July 10, 2026, 12:18:57 pm by Picuino »
 

Offline Fire Doger

  • Frequent Contributor
  • **
  • Posts: 287
  • Country: gr
  • Stefanos
Re: Control Systems Simulator
« Reply #1 on: July 10, 2026, 03:44:02 pm »
It's just my opinion, but I don't agree with custom tools during education.
It's much more beneficial in the long run to learn from the beginning an industry standard tool like simulink (to get familiar with creating systems) or skip completely the drawing part and provide systems and let them tweak the values to understand how they corelate to the result.

Either way, I believe education should be interesting and fun. If you worry about copy paste the issue is somewhere else...

If I was a student, I would prefer the industry standard tool, ready made examples, and a way to visualize the result (not just a plot)
I would probably spend hours trying to make the pendulum act as a helicopter or catapult the ball, it would be fun and probably learn a lot more than drawing lines and figuring out why it doesn't run...
Even now I would probably spend hours on it...
 

Offline PicuinoTopic starter

  • Super Contributor
  • ***
  • Posts: 1463
  • Country: es
    • Picuino
Re: Control Systems Simulator
« Reply #2 on: July 10, 2026, 03:49:32 pm »
You're right. Especially in college.
My problem is that Simulink is a paid tool, and I don't have the budget for it. On the other hand, both Simulink and the open-source alternatives are too complex for the average 14-16 year old student to use.
 

Offline synccond

  • Regular Contributor
  • *
  • Posts: 51
  • Country: us
Re: Control Systems Simulator
« Reply #3 on: July 10, 2026, 08:24:58 pm »
I had the paid Home version of Matlab for a few years.  Matlab, Simulink, Control Systems Toolbox, and System Identification.  Wasn't that much money at all for what it can do.  Look into it.
Since then I have purchased the commercial version, and yes, that is pricey.
 

Offline PicuinoTopic starter

  • Super Contributor
  • ***
  • Posts: 1463
  • Country: es
    • Picuino
Re: Control Systems Simulator
« Reply #4 on: July 11, 2026, 02:53:19 pm »
« Last Edit: July 11, 2026, 04:02:20 pm by Picuino »
 

Offline JimRemington

  • Regular Contributor
  • *
  • Posts: 229
  • Country: us
Re: Control Systems Simulator
« Reply #5 on: July 11, 2026, 06:42:09 pm »
Quote
both Simulink and the open-source alternatives are too complex for the average 14-16 year old student to use.

I'm curious about the term "average". What percentage of 14-16 year old schoolchildren have mastered the math background needed to learn Control Theory, let alone simulate control systems?
« Last Edit: July 11, 2026, 06:44:03 pm by JimRemington »
 

Offline PicuinoTopic starter

  • Super Contributor
  • ***
  • Posts: 1463
  • Country: es
    • Picuino
Re: Control Systems Simulator
« Reply #6 on: July 11, 2026, 07:13:19 pm »
In the introductory levels (14–16), only the simplest fundamentals are covered. Distinguishing and recognizing sensors, actuators, controllers, and systems. Open-loop and closed-loop control, Etc.

At the highest levels like high school and vocational training (ages 16 to 18), control systems are covered in greater depth, but the mathematical fundamentals are not taught with rigor (differential equations, laplace transformations, etc.). Nor are those fundamentals necessary to know how to tune a PID controller or operate an on-off control with hysteresis, or to understand the difference between the two.

« Last Edit: July 11, 2026, 07:20:35 pm by Picuino »
 

Offline synccond

  • Regular Contributor
  • *
  • Posts: 51
  • Country: us
Re: Control Systems Simulator
« Reply #7 on: July 11, 2026, 07:15:54 pm »
That's a good point.  At 16 I had sufficient knowledge of exponentials and polynomials such that I could handle the algebra of control systems.  But it wasn't until 18 (if I recall) that I had enough understanding of imaginary numbers.

Laplace and feedback was not even available to me until college, and control systems was an elective, not required for electrical engineering.  Matlab was first introduced to me in my 2nd year, running on Unix.  I strongly suspect I would have had little understanding of how an 's' term in the denominator is a pole, which creates a first order lag without my engineering degree.

So as a 16-year-old one could provide me the Cliff's notes about control systems, and I could do the algebra, but would have almost no understanding.  And this is from someone who works with root locus on machinery control systems rated in Mega-voltamperes today.
 

Offline PicuinoTopic starter

  • Super Contributor
  • ***
  • Posts: 1463
  • Country: es
    • Picuino
Re: Control Systems Simulator
« Reply #8 on: July 11, 2026, 07:27:27 pm »
You can start to understand control systems at a very basic level without math.

For example, the differences between a closed loop and an open loop.
Open-loop: Hair dryer, microwave oven, glass-ceramic cooktop, light dimmer, toaster.
Closed-loop: Electric oven, thermostat-controlled heating, water kettle.

Closed-loop control has a sensor that ensures we reach the desired value. An open-loop system can only adjust “blindly” to reach the desired value.
« Last Edit: July 11, 2026, 07:29:38 pm by Picuino »
 

Offline PicuinoTopic starter

  • Super Contributor
  • ***
  • Posts: 1463
  • Country: es
    • Picuino
Re: Control Systems Simulator
« Reply #9 on: July 11, 2026, 07:32:51 pm »
I want to create a simulator that displays diagrams of the elements to be controlled (without equations) and is easy to use, like the previous Ball-and-Beam system.

But I also want it to be powerful enough to run more interesting simulations for advanced levels, like the previous Lorenz system.
 

Offline PicuinoTopic starter

  • Super Contributor
  • ***
  • Posts: 1463
  • Country: es
    • Picuino
Re: Control Systems Simulator
« Reply #10 on: July 12, 2026, 08:21:15 am »
 

Offline PlainName

  • Super Contributor
  • ***
  • Posts: 8825
  • Country: 00
Re: Control Systems Simulator
« Reply #11 on: July 12, 2026, 01:24:29 pm »
Chua Oscillator (chaotic oscillator) simulation:

Great toys education aids :)

Perhaps they need a button to get the trace back in view. This one - Chua - I changed a couple of things and the trace zoomed off into hyperspace leaving a blank graph.
 

Offline PicuinoTopic starter

  • Super Contributor
  • ***
  • Posts: 1463
  • Country: es
    • Picuino
Re: Control Systems Simulator
« Reply #12 on: July 12, 2026, 03:52:34 pm »
Great Idea!!. AutoZoom button.

Right now I'm really struggling with the integration method. I'm currently using the simplest one (Euler's method) and wanted to switch to Runge-Kutta 4. But, surprisingly, no matter how I adjust it, I can't get a simple oscillator with two integrators to be stable. Either the signal grows indefinitely or it decays to zero.

I've changed the RK4 implementation several times and also adjusted the Voltage propagation in various ways, but there's no way to achieve greater stability than with the simple Euler method. I give up. Euler with a step size of 0.001 second works well, and for now, I'll leave it at that.

« Last Edit: July 12, 2026, 03:57:37 pm by Picuino »
 

Offline PicuinoTopic starter

  • Super Contributor
  • ***
  • Posts: 1463
  • Country: es
    • Picuino
Re: Control Systems Simulator
« Reply #13 on: July 12, 2026, 05:31:14 pm »
Ok, AutoZoom Button added.

 
The following users thanked this post: PlainName

Offline PicuinoTopic starter

  • Super Contributor
  • ***
  • Posts: 1463
  • Country: es
    • Picuino
Re: Control Systems Simulator
« Reply #14 on: July 14, 2026, 07:35:48 pm »
Simple lissajous figures.

https://www.picuino.com/simulators/control.html?loadFile=lissajous-2.txt

I should add a time delay (phase), but that would make the interface too complicated—it already has two parameters. Maybe I could add more parameters in a pop-up menu? I'm not sure if it's worth doing all the programming required for that.
 

Offline PicuinoTopic starter

  • Super Contributor
  • ***
  • Posts: 1463
  • Country: es
    • Picuino
Re: Control Systems Simulator
« Reply #15 on: July 16, 2026, 10:37:15 am »
Electric kitchen oven (or reflow oven) simulator with on/off control and 10°C hysteresis.

https://www.picuino.com/simulators/control.html?loadFile=electric-oven.txt

I have already added an oscilloscope with time-base control and manual range and offset controls for each trace (as well as automatic zoom).
 

Offline PicuinoTopic starter

  • Super Contributor
  • ***
  • Posts: 1463
  • Country: es
    • Picuino
Re: Control Systems Simulator
« Reply #16 on: July 16, 2026, 07:49:58 pm »
Simulation of a 100-kW DC motor (with speed reduced by a factor of 0.1 to better appreciate the dynamics).

https://www.picuino.com/simulators/control.html?loadFile=motor-dc.txt

We still need to show a flywheel that rotates at a speed proportional to the motor, but for now the simulated model is sufficient. The motor has two conjugate poles, which makes it particularly interesting for observing the PID response to changes in parameters.

The PID is correctly sintonized with Kp = 3, Ki = 20 and Kd = 0.11
« Last Edit: July 17, 2026, 09:21:05 am by Picuino »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

-->