你已经派生过 gprMax
镜像自地址
https://gitee.com/sunhf/gprMax.git
已同步 2025-08-07 04:56:51 +08:00
Updates to wire dipole example.
这个提交包含在:
@@ -22,6 +22,21 @@ This example demonstrates a model of a half-wavelength wire dipole antenna in fr
|
|||||||
|
|
||||||
The antenna is fed using the ``#tranmission_line`` command. The one-dimensional transmission line model virtually attaches to the dipole at the gap between the arms. The antenna has an input impedance :math:`Z_0` of 73 Ohms specified in the ``#tranmission_line`` command. The transmission line uses a Gaussian waveform with a centre frequency of 1GHz.
|
The antenna is fed using the ``#tranmission_line`` command. The one-dimensional transmission line model virtually attaches to the dipole at the gap between the arms. The antenna has an input impedance :math:`Z_0` of 73 Ohms specified in the ``#tranmission_line`` command. The transmission line uses a Gaussian waveform with a centre frequency of 1GHz.
|
||||||
|
|
||||||
|
Results
|
||||||
|
-------
|
||||||
|
|
||||||
|
.. _antenna_wire_dipole_fs_tl_params:
|
||||||
|
|
||||||
|
.. figure:: images/antenna_wire_dipole_fs_tl_params.png
|
||||||
|
|
||||||
|
Time and frequency domain plots of the incident and reflected (scattered) voltages in the transmission line.
|
||||||
|
|
||||||
|
.. _antenna_wire_dipole_fs_ant_params:
|
||||||
|
|
||||||
|
.. figure:: images/antenna_wire_dipole_fs_ant_params.png
|
||||||
|
|
||||||
|
s11 parameter and input impedance (resistance and reactance) of the antenna.
|
||||||
|
|
||||||
|
|
||||||
Bowtie antenna model
|
Bowtie antenna model
|
||||||
====================
|
====================
|
||||||
|
二进制文件未显示。
之后 宽度: | 高度: | 大小: 146 KiB |
二进制文件未显示。
之后 宽度: | 高度: | 大小: 195 KiB |
@@ -58,6 +58,7 @@ if 'E' in args.field:
|
|||||||
cb.set_label('Field strength [V/m]')
|
cb.set_label('Field strength [V/m]')
|
||||||
elif 'H' in args.field:
|
elif 'H' in args.field:
|
||||||
cb.set_label('Field strength [A/m]')
|
cb.set_label('Field strength [A/m]')
|
||||||
|
|
||||||
plt.show()
|
plt.show()
|
||||||
#fig.savefig(os.path.splitext(os.path.abspath(file))[0] + '.pdf', dpi=None, format='pdf', bbox_inches='tight', pad_inches=0.1)
|
#fig.savefig(os.path.splitext(os.path.abspath(file))[0] + '.pdf', dpi=None, format='pdf', bbox_inches='tight', pad_inches=0.1)
|
||||||
f.close()
|
f.close()
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with gprMax. If not, see <http://www.gnu.org/licenses/>.
|
# along with gprMax. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import argparse
|
import os, argparse
|
||||||
import h5py
|
import h5py
|
||||||
import numpy as np
|
import numpy as np
|
||||||
np.seterr(divide='ignore', invalid='ignore')
|
np.seterr(divide='ignore', invalid='ignore')
|
||||||
@@ -25,10 +25,10 @@ import matplotlib.gridspec as gridspec
|
|||||||
|
|
||||||
from gprMax.exceptions import CmdInputError
|
from gprMax.exceptions import CmdInputError
|
||||||
|
|
||||||
"""Plots the s11 scattering parameter (input port voltage reflection coefficient) from an output file containing a transmission line source."""
|
"""Plots antenna parameters (s11 parameter and input impedance) from an output file containing a transmission line source."""
|
||||||
|
|
||||||
# Parse command line arguments
|
# Parse command line arguments
|
||||||
parser = argparse.ArgumentParser(description='Plots the s11 scattering parameter (input port voltage reflection coefficient) from an output file containing a transmission line source.', usage='cd gprMax; python -m tools.plot_s11 outputfile')
|
parser = argparse.ArgumentParser(description='Plots antenna parameters (s11 parameter and input impedance) from an output file containing a transmission line source.', usage='cd gprMax; python -m tools.plot_antenna_params outputfile')
|
||||||
parser.add_argument('outputfile', help='name of output file including path')
|
parser.add_argument('outputfile', help='name of output file including path')
|
||||||
parser.add_argument('-tln', default=1, type=int, help='transmission line number')
|
parser.add_argument('-tln', default=1, type=int, help='transmission line number')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
@@ -44,6 +44,7 @@ time = time / 1e-9
|
|||||||
path = '/tls/tl' + str(args.tln) + '/'
|
path = '/tls/tl' + str(args.tln) + '/'
|
||||||
Vinc = f[path + 'Vinc'][:]
|
Vinc = f[path + 'Vinc'][:]
|
||||||
Vscat = f[path + 'Vscat'][:]
|
Vscat = f[path + 'Vscat'][:]
|
||||||
|
Iscat = f[path + 'Iscat'][:]
|
||||||
Vtotal = f[path +'Vtotal'][:]
|
Vtotal = f[path +'Vtotal'][:]
|
||||||
|
|
||||||
# Calculate magnitude of frequency spectra
|
# Calculate magnitude of frequency spectra
|
||||||
@@ -51,6 +52,8 @@ Vincp = np.abs(np.fft.fft(Vinc))**2
|
|||||||
freqs = np.fft.fftfreq(Vincp.size, d=dt)
|
freqs = np.fft.fftfreq(Vincp.size, d=dt)
|
||||||
Vscatp = np.abs(np.fft.fft(Vscat))**2
|
Vscatp = np.abs(np.fft.fft(Vscat))**2
|
||||||
s11 = Vscatp / Vincp
|
s11 = Vscatp / Vincp
|
||||||
|
zin = np.zeros(iterations, dtype=np.complex)
|
||||||
|
zin = np.abs(np.fft.fft(Vscat)) / np.abs(np.fft.fft(Iscat))
|
||||||
|
|
||||||
# Convert to decibels
|
# Convert to decibels
|
||||||
Vincp = 10 * np.log10(Vincp)
|
Vincp = 10 * np.log10(Vincp)
|
||||||
@@ -62,55 +65,92 @@ pltrange = np.where((np.amax(Vincp) - Vincp) > 60)[0][0] + 1
|
|||||||
pltrange = np.s_[0:pltrange]
|
pltrange = np.s_[0:pltrange]
|
||||||
|
|
||||||
# Plot incident voltage
|
# Plot incident voltage
|
||||||
plt.subplots(num='Transmission line voltages & s11 parameter', figsize=(20, 10), facecolor='w', edgecolor='w')
|
fig1, ax = plt.subplots(num='Transmission line parameters', figsize=(20, 10), facecolor='w', edgecolor='w')
|
||||||
gs = gridspec.GridSpec(3, 2)
|
gs1 = gridspec.GridSpec(2, 2, hspace=0.3)
|
||||||
ax1 = plt.subplot(gs[0, 0])
|
ax1 = plt.subplot(gs1[0, 0])
|
||||||
ax1.plot(time, Vinc, 'r', lw=2, label='Vinc')
|
ax1.plot(time, Vinc, 'r', lw=2, label='Vinc')
|
||||||
|
ax1.set_title('Incident voltage')
|
||||||
ax1.set_xlabel('Time [ns]')
|
ax1.set_xlabel('Time [ns]')
|
||||||
ax1.set_ylabel('Incident voltage [V]')
|
ax1.set_ylabel('Voltage [V]')
|
||||||
ax1.set_xlim([0, np.amax(time)])
|
ax1.set_xlim([0, np.amax(time)])
|
||||||
ax1.grid()
|
ax1.grid()
|
||||||
|
|
||||||
# Plot frequency spectra of incident voltage
|
# Plot frequency spectra of incident voltage
|
||||||
ax2 = plt.subplot(gs[0, 1])
|
ax2 = plt.subplot(gs1[0, 1])
|
||||||
markerline, stemlines, baseline = ax2.stem(freqs[pltrange]/1e9, Vincp[pltrange], '-.')
|
markerline, stemlines, baseline = ax2.stem(freqs[pltrange]/1e9, Vincp[pltrange], '-.')
|
||||||
plt.setp(baseline, 'linewidth', 0)
|
plt.setp(baseline, 'linewidth', 0)
|
||||||
plt.setp(stemlines, 'color', 'r')
|
plt.setp(stemlines, 'color', 'r')
|
||||||
plt.setp(markerline, 'markerfacecolor', 'r', 'markeredgecolor', 'r')
|
plt.setp(markerline, 'markerfacecolor', 'r', 'markeredgecolor', 'r')
|
||||||
ax2.plot(freqs[pltrange]/1e9, Vincp[pltrange], 'r', lw=2)
|
ax2.plot(freqs[pltrange]/1e9, Vincp[pltrange], 'r', lw=2)
|
||||||
|
ax2.set_title('Incident voltage')
|
||||||
ax2.set_xlabel('Frequency [GHz]')
|
ax2.set_xlabel('Frequency [GHz]')
|
||||||
ax2.set_ylabel('Incident voltage spectra [dB]')
|
ax2.set_ylabel('Power [dB]')
|
||||||
ax2.grid()
|
ax2.grid()
|
||||||
|
|
||||||
# Plot scattered (field) voltage
|
# Plot scattered (field) voltage
|
||||||
ax3 = plt.subplot(gs[1, 0])
|
ax3 = plt.subplot(gs1[1, 0])
|
||||||
ax3.plot(time, Vscat, 'r', lw=2, label='Vscat')
|
ax3.plot(time, Vscat, 'r', lw=2, label='Vscat')
|
||||||
|
ax3.set_title('Reflected voltage')
|
||||||
ax3.set_xlabel('Time [ns]')
|
ax3.set_xlabel('Time [ns]')
|
||||||
ax3.set_ylabel('Scattered (field) voltage [V]')
|
ax3.set_ylabel('Voltage [V]')
|
||||||
ax3.set_xlim([0, np.amax(time)])
|
ax3.set_xlim([0, np.amax(time)])
|
||||||
ax3.grid()
|
ax3.grid()
|
||||||
|
|
||||||
# Plot frequency spectra of scattered voltage
|
# Plot frequency spectra of scattered voltage
|
||||||
ax4 = plt.subplot(gs[1, 1])
|
ax4 = plt.subplot(gs1[1, 1])
|
||||||
markerline, stemlines, baseline = ax4.stem(freqs[pltrange]/1e9, Vscatp[pltrange], '-.')
|
markerline, stemlines, baseline = ax4.stem(freqs[pltrange]/1e9, Vscatp[pltrange], '-.')
|
||||||
plt.setp(baseline, 'linewidth', 0)
|
plt.setp(baseline, 'linewidth', 0)
|
||||||
plt.setp(stemlines, 'color', 'r')
|
plt.setp(stemlines, 'color', 'r')
|
||||||
plt.setp(markerline, 'markerfacecolor', 'r', 'markeredgecolor', 'r')
|
plt.setp(markerline, 'markerfacecolor', 'r', 'markeredgecolor', 'r')
|
||||||
ax4.plot(freqs[pltrange]/1e9, Vscatp[pltrange], 'r', lw=2)
|
ax4.plot(freqs[pltrange]/1e9, Vscatp[pltrange], 'r', lw=2)
|
||||||
|
ax4.set_title('Reflected voltage')
|
||||||
ax4.set_xlabel('Frequency [GHz]')
|
ax4.set_xlabel('Frequency [GHz]')
|
||||||
ax4.set_ylabel('Scattered (field) voltage spectra [dB]')
|
ax4.set_ylabel('Power [dB]')
|
||||||
ax4.grid()
|
ax4.grid()
|
||||||
|
|
||||||
# Plot frequency spectra of s11
|
# Plot frequency spectra of s11
|
||||||
ax5 = plt.subplot(gs[2, 1])
|
fig2, ax = plt.subplots(num='Antenna parameters', figsize=(20, 10), facecolor='w', edgecolor='w')
|
||||||
|
gs2 = gridspec.GridSpec(3, 1, hspace=0.5)
|
||||||
|
ax5 = plt.subplot(gs2[0, 0])
|
||||||
markerline, stemlines, baseline = ax5.stem(freqs[pltrange]/1e9, s11[pltrange], '-.')
|
markerline, stemlines, baseline = ax5.stem(freqs[pltrange]/1e9, s11[pltrange], '-.')
|
||||||
plt.setp(baseline, 'linewidth', 0)
|
plt.setp(baseline, 'linewidth', 0)
|
||||||
plt.setp(stemlines, 'color', 'r')
|
plt.setp(stemlines, 'color', 'r')
|
||||||
plt.setp(markerline, 'markerfacecolor', 'r', 'markeredgecolor', 'r')
|
plt.setp(markerline, 'markerfacecolor', 'r', 'markeredgecolor', 'r')
|
||||||
ax5.plot(freqs[pltrange]/1e9, s11[pltrange], 'r', lw=2)
|
ax5.plot(freqs[pltrange]/1e9, s11[pltrange], 'r', lw=2)
|
||||||
|
ax5.set_title('s11 parameter')
|
||||||
ax5.set_xlabel('Frequency [GHz]')
|
ax5.set_xlabel('Frequency [GHz]')
|
||||||
ax5.set_ylabel('s11 [dB]')
|
ax5.set_ylabel('Power [dB]')
|
||||||
ax5.grid()
|
ax5.grid()
|
||||||
|
|
||||||
|
# Plot input resistance (real part of impedance)
|
||||||
|
ax6 = plt.subplot(gs2[1, 0])
|
||||||
|
markerline, stemlines, baseline = ax6.stem(freqs[pltrange]/1e9, zin[pltrange].real, '-.')
|
||||||
|
plt.setp(baseline, 'linewidth', 0)
|
||||||
|
plt.setp(stemlines, 'color', 'r')
|
||||||
|
plt.setp(markerline, 'markerfacecolor', 'r', 'markeredgecolor', 'r')
|
||||||
|
ax6.plot(freqs[pltrange]/1e9, zin[pltrange].real, 'r', lw=2)
|
||||||
|
ax6.set_title('Input impedance')
|
||||||
|
ax6.set_xlabel('Frequency [GHz]')
|
||||||
|
ax6.set_ylabel('Resistance [Ohms]')
|
||||||
|
ax6.set_ylim(bottom=0)
|
||||||
|
ax6.grid()
|
||||||
|
|
||||||
|
# Plot input reactance (imaginery part of impedance)
|
||||||
|
ax7 = plt.subplot(gs2[2, 0])
|
||||||
|
markerline, stemlines, baseline = ax7.stem(freqs[pltrange]/1e9, zin[pltrange].imag, '-.')
|
||||||
|
plt.setp(baseline, 'linewidth', 0)
|
||||||
|
plt.setp(stemlines, 'color', 'r')
|
||||||
|
plt.setp(markerline, 'markerfacecolor', 'r', 'markeredgecolor', 'r')
|
||||||
|
ax7.plot(freqs[pltrange]/1e9, zin[pltrange].imag, 'r', lw=2)
|
||||||
|
ax7.set_title('Input impedance')
|
||||||
|
ax7.set_xlabel('Frequency [GHz]')
|
||||||
|
ax7.set_ylabel('Reactance [Ohms]')
|
||||||
|
ax7.set_ylim(bottom=0)
|
||||||
|
ax7.grid()
|
||||||
|
|
||||||
plt.show()
|
plt.show()
|
||||||
|
fig1.savefig(os.path.splitext(os.path.abspath(file))[0] + '_tl_params.png', dpi=150, format='png', bbox_inches='tight', pad_inches=0.1)
|
||||||
|
fig2.savefig(os.path.splitext(os.path.abspath(file))[0] + '_ant_params.png', dpi=150, format='png', bbox_inches='tight', pad_inches=0.1)
|
||||||
|
#fig1.savefig(os.path.splitext(os.path.abspath(file))[0] + '_tl_params.pdf', dpi=None, format='pdf', bbox_inches='tight', pad_inches=0.1)
|
||||||
|
#fig2.savefig(os.path.splitext(os.path.abspath(file))[0] + '_ant_params.pdf', dpi=None, format='pdf', bbox_inches='tight', pad_inches=0.1)
|
||||||
f.close()
|
f.close()
|
在新工单中引用
屏蔽一个用户