## Intro
- Simulates the physics of DRSSTC (Dual Resonant Solid State Tesla Coil), a coupled series RLC resonator system
## Showcase (code below)
```bash
primary: R: 100 mΩ, L: 6 uH, C: 50 nF, f0: 291 kHz, Q: 110
secondary: R: 500 Ω, L: 50 mH, C: 6 pF, f0: 291 kHz, Q: 183
coupling (k): 0.1
resonant poles: ['277 kHz', '306 kHz']
```
- **Note:** the simulation below doesn't consider `over current protection`, but it can be easily added by modifying the code blow.
<img src="https://raw.githubusercontent.com/TeslaCoilResearch/tesla-coil-simulator/main/test/primary_current_feedback_square_Uin.png" style="max-width: 500px">


## Usage
```bash
pip install tesla-coil-simulator
```
```py
from typing import Dict
import matplotlib.pyplot as plt
import numpy as np
from tesla_coil_simulator.DRSSTC import RLC, find_resonant_poles, simulate_coupled_RLC
from tesla_coil_simulator.utils import format_num
def fixed_freq_square_Uin(f, amp):
def fixed_freq_square_Uin(t, sol_t):
return amp * np.sign(np.sin(2 * np.pi * f * t))
return fixed_freq_square_Uin
def primary_current_feedback_square_Uin(amp):
def primary_current_feedback_square_Uin(t, sol_t):
Vx, Ix, Vy, Iy = sol_t
if t == 0:
return amp # kickstart!
return amp * np.sign(Ix) # following primary current Ix
return primary_current_feedback_square_Uin
def max_voltage_vs_driving_freq(x: RLC, y: RLC, k, time, f_list_dic: Dict, amp):
for key, f_list in f_list_dic.items():
Vy_max, Vy_idx = [], 2
for f in f_list:
Uin = fixed_freq_square_Uin(f, amp)
sol = simulate_coupled_RLC(x, y, k, time, Uin, plot=False)
Vy_max.append(np.max(sol.y[Vy_idx]))
if len(f_list) < 10:
plt.scatter(f_list, Vy_max, s=20, label=key)
else:
plt.plot(f_list, Vy_max, label=key)
plt.legend()
plt.title("max secondary voltage VS driving freq")
plt.savefig("max_voltage_vs_driving_freq")
plt.close()
def max_voltage_vs_coupling(x: RLC, y: RLC, k_list, time, amp):
Vy_max, Vy_idx = [], 2
for k in k_list:
Uin = primary_current_feedback_square_Uin(amp)
sol = simulate_coupled_RLC(x, y, k, time, Uin, plot=False)
Vy_max.append(np.max(sol.y[Vy_idx]))
plt.plot(k_list, Vy_max)
plt.title("max secondary voltage VS coupling coefficient")
plt.savefig("max_voltage_vs_coupling")
plt.close()
x = RLC(R=0.1, L=6e-6, C=50e-9)
y = RLC(R=500, L=50e-3, C=6e-12)
k = 0.1 # coupling coefficient
amp = 300 # amplitude of driving voltage Uin (V)
f_poles = find_resonant_poles(x, y, k)
info = f"""
primary: {x}
secondary: {y}
coupling (k): {k}
resonant poles: {[f"{format_num(f)}Hz" for f in f_poles]}
"""
print(info)
time = np.linspace(0, 200e-6, 1000)
Uin = fixed_freq_square_Uin(250e3, amp)
simulate_coupled_RLC(x, y, k, time, Uin, plot=True)
Uin = primary_current_feedback_square_Uin(amp)
simulate_coupled_RLC(x, y, k, time, Uin, plot=True)
f_list_dic = dict(freq=np.linspace(200e3, 400e3, 100).tolist(), f_poles=f_poles)
max_voltage_vs_driving_freq(x, y, k, time, f_list_dic, amp)
k_list = np.logspace(np.log10(0.005), np.log10(0.2), 100)
max_voltage_vs_coupling(x, y, k_list, time, amp)
```
Raw data
{
"_id": null,
"home_page": "https://github.com/TeslaCoilResearch/tesla-coil-simulator",
"name": "tesla-coil-simulator",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "tesla coil, DRSSTC, resonant circuit, RLC simulator, high voltage physics, electrical engineering, physics simulation, coupled resonators",
"author": "Ricky Ding",
"author_email": "e0134117@u.nus.edu",
"download_url": "https://files.pythonhosted.org/packages/be/8b/71da3bb4be47c2f8eb3258ea3879479fdb88f59d337bdd673a26f8ed2373/tesla_coil_simulator-0.1.0.tar.gz",
"platform": null,
"description": "\n## Intro\n\n- Simulates the physics of DRSSTC (Dual Resonant Solid State Tesla Coil), a coupled series RLC resonator system\n\n## Showcase (code below)\n\n```bash\nprimary: R: 100 m\u03a9, L: 6 uH, C: 50 nF, f0: 291 kHz, Q: 110 \nsecondary: R: 500 \u03a9, L: 50 mH, C: 6 pF, f0: 291 kHz, Q: 183 \ncoupling (k): 0.1\nresonant poles: ['277 kHz', '306 kHz']\n```\n\n- **Note:** the simulation below doesn't consider `over current protection`, but it can be easily added by modifying the code blow.\n\n<img src=\"https://raw.githubusercontent.com/TeslaCoilResearch/tesla-coil-simulator/main/test/primary_current_feedback_square_Uin.png\" style=\"max-width: 500px\">\n\n\n\n\n\n## Usage\n\n```bash\npip install tesla-coil-simulator\n```\n\n```py\nfrom typing import Dict\n\nimport matplotlib.pyplot as plt\nimport numpy as np\n\nfrom tesla_coil_simulator.DRSSTC import RLC, find_resonant_poles, simulate_coupled_RLC\nfrom tesla_coil_simulator.utils import format_num\n\n\ndef fixed_freq_square_Uin(f, amp):\n def fixed_freq_square_Uin(t, sol_t):\n return amp * np.sign(np.sin(2 * np.pi * f * t))\n\n return fixed_freq_square_Uin\n\n\ndef primary_current_feedback_square_Uin(amp):\n def primary_current_feedback_square_Uin(t, sol_t):\n Vx, Ix, Vy, Iy = sol_t\n if t == 0:\n return amp # kickstart!\n return amp * np.sign(Ix) # following primary current Ix\n\n return primary_current_feedback_square_Uin\n\n\ndef max_voltage_vs_driving_freq(x: RLC, y: RLC, k, time, f_list_dic: Dict, amp):\n for key, f_list in f_list_dic.items():\n Vy_max, Vy_idx = [], 2\n for f in f_list:\n Uin = fixed_freq_square_Uin(f, amp)\n sol = simulate_coupled_RLC(x, y, k, time, Uin, plot=False)\n Vy_max.append(np.max(sol.y[Vy_idx]))\n if len(f_list) < 10:\n plt.scatter(f_list, Vy_max, s=20, label=key)\n else:\n plt.plot(f_list, Vy_max, label=key)\n plt.legend()\n plt.title(\"max secondary voltage VS driving freq\")\n plt.savefig(\"max_voltage_vs_driving_freq\")\n plt.close()\n\n\ndef max_voltage_vs_coupling(x: RLC, y: RLC, k_list, time, amp):\n Vy_max, Vy_idx = [], 2\n for k in k_list:\n Uin = primary_current_feedback_square_Uin(amp)\n sol = simulate_coupled_RLC(x, y, k, time, Uin, plot=False)\n Vy_max.append(np.max(sol.y[Vy_idx]))\n plt.plot(k_list, Vy_max)\n plt.title(\"max secondary voltage VS coupling coefficient\")\n plt.savefig(\"max_voltage_vs_coupling\")\n plt.close()\n\n\nx = RLC(R=0.1, L=6e-6, C=50e-9)\ny = RLC(R=500, L=50e-3, C=6e-12)\nk = 0.1 # coupling coefficient\namp = 300 # amplitude of driving voltage Uin (V)\nf_poles = find_resonant_poles(x, y, k)\ninfo = f\"\"\"\nprimary: {x}\nsecondary: {y}\ncoupling (k): {k}\nresonant poles: {[f\"{format_num(f)}Hz\" for f in f_poles]}\n\"\"\"\nprint(info)\n\ntime = np.linspace(0, 200e-6, 1000)\n\nUin = fixed_freq_square_Uin(250e3, amp)\nsimulate_coupled_RLC(x, y, k, time, Uin, plot=True)\n\nUin = primary_current_feedback_square_Uin(amp)\nsimulate_coupled_RLC(x, y, k, time, Uin, plot=True)\n\nf_list_dic = dict(freq=np.linspace(200e3, 400e3, 100).tolist(), f_poles=f_poles)\nmax_voltage_vs_driving_freq(x, y, k, time, f_list_dic, amp)\n\nk_list = np.logspace(np.log10(0.005), np.log10(0.2), 100)\nmax_voltage_vs_coupling(x, y, k_list, time, amp)\n\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Physics simulator for DRSSTC (Dual Resonant Solid State Tesla Coils) with coupled RLC circuit analysis",
"version": "0.1.0",
"project_urls": {
"Homepage": "https://github.com/TeslaCoilResearch/tesla-coil-simulator"
},
"split_keywords": [
"tesla coil",
" drsstc",
" resonant circuit",
" rlc simulator",
" high voltage physics",
" electrical engineering",
" physics simulation",
" coupled resonators"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "85fb41a8f65c5f002c7466cb4aede127de757a26a16f3fcf54777bd99753d4b6",
"md5": "2f9a8acfc335a7da451ce64bd4d242a6",
"sha256": "9f13c2a8a6642109abf1cd84fcb25b3f7375cbb093dcf44787b58b1fdeefcb70"
},
"downloads": -1,
"filename": "tesla_coil_simulator-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "2f9a8acfc335a7da451ce64bd4d242a6",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 4595,
"upload_time": "2025-08-11T23:21:24",
"upload_time_iso_8601": "2025-08-11T23:21:24.524265Z",
"url": "https://files.pythonhosted.org/packages/85/fb/41a8f65c5f002c7466cb4aede127de757a26a16f3fcf54777bd99753d4b6/tesla_coil_simulator-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "be8b71da3bb4be47c2f8eb3258ea3879479fdb88f59d337bdd673a26f8ed2373",
"md5": "1f562b41e70efbc27b2bf17720f6e228",
"sha256": "95c5205fed49a2d2a088d58117b1e8dbaac66ccf34701d17622d04f3d474f794"
},
"downloads": -1,
"filename": "tesla_coil_simulator-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "1f562b41e70efbc27b2bf17720f6e228",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 4236,
"upload_time": "2025-08-11T23:21:25",
"upload_time_iso_8601": "2025-08-11T23:21:25.966628Z",
"url": "https://files.pythonhosted.org/packages/be/8b/71da3bb4be47c2f8eb3258ea3879479fdb88f59d337bdd673a26f8ed2373/tesla_coil_simulator-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-11 23:21:25",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "TeslaCoilResearch",
"github_project": "tesla-coil-simulator",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "matplotlib",
"specs": []
},
{
"name": "numpy",
"specs": []
},
{
"name": "scipy",
"specs": []
}
],
"lcname": "tesla-coil-simulator"
}