01-02-2024, 07:04 PM
Good day folks. Here is a python program I made to calculate the heaviside component of the one wire system.
Code:
import tkinter as tk
from math import pi, sqrt
def calculate_heaviside_component():
# Constants
mu = 1.25663706e-6 # Permeability of free space (H/m)
epsilon = 8.85e-12 # Permittivity of free space (F/m)
c = 1 / sqrt(mu * epsilon) # Speed of light in vacuum (m/s)
# User input
voltage = float(voltage_entry.get())
frequency = float(frequency_entry.get())
# Assume a certain distance from the wire (e.g., 1 meter)
distance = 1 # meters
# Calculate the peak electric field
electric_field_peak = voltage / distance
# Convert to RMS values
electric_field_rms = electric_field_peak / sqrt(2)
magnetic_field_rms = electric_field_rms / c
# RMS Heaviside component (Poynting vector magnitude)
heaviside_component_rms = electric_field_rms * magnetic_field_rms
# Display the result
result_label.config(text=f"RMS Heaviside Component: {heaviside_component_rms:.6f} W/m²")
# Create the main window
root = tk.Tk()
root.title("RMS Heaviside Component Calculator")
# Create widgets
voltage_label = tk.Label(root, text="Voltage (V):")
voltage_entry = tk.Entry(root)
frequency_label = tk.Label(root, text="Frequency (Hz):")
frequency_entry = tk.Entry(root)
calculate_button = tk.Button(root, text="Calculate", command=calculate_heaviside_component)
result_label = tk.Label(root, text="RMS Heaviside Component: ")
# Layout widgets
voltage_label.grid(row=0, column=0)
voltage_entry.grid(row=0, column=1)
frequency_label.grid(row=1, column=0)
frequency_entry.grid(row=1, column=1)
calculate_button.grid(row=2, column=0, columnspan=2)
result_label.grid(row=3, column=0, columnspan=2)
# Run the application
root.mainloop()