Vibe Coding Home

3-Phase Generators in the grid

This software was largely created by AI Vibe Coding
Created by YouMinds
This simulation provides a detailed visualization of how two 3-phase generators operate, producing synchronized sine waves that ultimately merge into the larger grid waveform.
It illustrates key electrical principles such as phase alignment, frequency synchronization, and waveform superposition—offering a compelling demonstration of real-world power generation dynamics.

Power Generation Synchronization and Losses

When two generators are connected to a power grid, they must operate synchronously - meaning they have the same frequency and phase alignment. If they fall out of sync, it leads to power oscillations between the generators rather than effective delivery to consumers.
Mismatches cause reactive power flow and losses, which can lead to inefficiencies, mechanical stress, and thermal dissipation.
The term circulating loss generally refers to losses due to circulating currents caused by phase and voltage discrepancies, leading to unwanted heat and mechanical wear.

Generator 1 (Plant A)


0.031 rad/frame

Generator 2 (Plant B)


0.031 rad/frame
Change the speed of each generator and watch the bus voltage, phase and power values below. Press Set Gen2 = Gen1 to synchronize generator 2 with generator 1. Press Pause to pause the simulation.

Common Bus Voltage

Phase Misalignment (δ1-δ2): 0.0°
Gen 1 Output
Power
0.000
GW
Gen 2 Output
Power
0.000
GW
Consumer
Power (Load)
0.000
GW
Total Reactive
Power
0.000
GVAR
Circulating
Current
0.000
kA (per-ph)
Circulating
Loss
0.000
GW
How do two 3-Phase Generators work together anyway
When two three-phase generators are connected to the same electrical grid, they must meet several key requirements to function properly:
Why this matters for power generation
This principle is widely used in power plants where multiple generators feed electricity into the same grid. The synchronization process is typically managed by automatic controllers that adjust generator speed and voltage to align with the grid’s existing waveform.
How was it built
This software was created using Vibe Coding by a Large Language Model LLM / chatbot and reworked in look & feel.
Some features had to be implemented manually and corrections and improvements had to be made.
The following Vibe Coding prompts were used on DeepSeek:
"create a single page html with javascript and a canvas. On the canvas show the sketch of a 3-phase generator. Make the rotor turn and also show the generated sine waves of the generator as it turns."
"add a second generator and show its sine waves. replace the speed up and speed down buttons by a slider for each motor, get rid of the reverse. also add a chart that shows the result waves of the combination of the two generators combined."
"add a number display for the phase misalignment. also compute the power that goes into a consumer, the power that dissipates in the grid lines and the power the dissipates in the generators. show the numbers."
"when the two generators cancel each other out due to phase misalignment the power must be consumed by the generators. Compute this power loss correctly. Also display all number values in a bar chart using one bar for each value. Use chart.js."

At this point a Gemini session was started with the previous code.
"correct the simulations so it the computed numbers are based on real physics. Add a in phase button. simulate two power plant generators with 500 gw power each."
"the total generated power always equals the consumer power that can not be. Also the bar show a load power which should be the consumer power, use common names. Also compute the circulating power. All computed numbers including phase should be represented in the chart with the correct name."

At this point a DeepSeek session was started with the previous code.
"remove the Total Output Power (Gen) value. Upon page load sync the generators and compute the values. add a horizontal bar chart for the phase missalignment. Add a pause button to pause and resume the simulation."