nmr-utils/Probe.ipynb
2024-07-04 22:09:20 +02:00

261 lines
6.3 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "731fc261",
"metadata": {},
"outputs": [],
"source": [
"from numpy import *"
]
},
{
"cell_type": "code",
"execution_count": 15,
"id": "fb15ea05",
"metadata": {},
"outputs": [],
"source": [
"%matplotlib inline\n",
"import matplotlib.pyplot as plt\n",
"e0 = 8.8541878188e-12"
]
},
{
"cell_type": "code",
"execution_count": 103,
"id": "ec2633de",
"metadata": {},
"outputs": [],
"source": [
"def capacitor(ri, ra, l, er=9):\n",
" C = 2*pi*er*e0*l/log(ra/ri)*1e12\n",
" #print(f\"{C:.2f}pF\")\n",
" return C*1e-12"
]
},
{
"cell_type": "code",
"execution_count": 104,
"id": "5193496d",
"metadata": {},
"outputs": [],
"source": [
"def capacitor_query(ri, ra, l, er=9):\n",
" C_min = capacitor(ri,ra,l,er=1)\n",
" C_mid = capacitor(ri,ra,l/2,er=1) + capacitor(ri,ra,l/2,er=er)\n",
" C_max = capacitor(ri,ra,l,er=er)\n",
" print(\"----Params----\")\n",
" print(f\"ri = {ri*1e3:.2f}mm\\nra = {ra*1e3:.2f}mm\\nl = {l*1e3:.2f}mm\\ner = {er:.1f}\")\n",
" print(\"----Result----\")\n",
" print(f\"C_min = {C_min*1e12:.2f}pF\")\n",
" print(f\"C_max = {C_max*1e12:.2f}pF\")\n",
" print(f\"C_mid = {C_mid*1e12:.2f}pF\")"
]
},
{
"cell_type": "markdown",
"id": "1517377f",
"metadata": {},
"source": [
"Capacitor\n",
"========\n",
"First we need to know the capacitor and the range we have available,\n",
"we need the inner and outer diameter $r_i$, $r_a$, length $l$, and $\\epsilon_r$"
]
},
{
"cell_type": "code",
"execution_count": 148,
"id": "e68edb6a",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"----Params----\n",
"ri = 4.00mm\n",
"ra = 8.00mm\n",
"l = 100.00mm\n",
"er = 2.0\n",
"----Result----\n",
"C_min = 8.03pF\n",
"C_max = 16.05pF\n",
"C_mid = 12.04pF\n"
]
}
],
"source": [
"capacitor_query(4e-3,8e-3,10e-2,2)"
]
},
{
"cell_type": "markdown",
"id": "1188809f",
"metadata": {},
"source": [
"Resonance frequency of an LC circuit:\n",
"$f_0 = \\frac{1}{2\\pi\\sqrt{LC}}$\n",
"\n",
"Solve for L:\n",
"\n",
"$L_{RF}= \\frac{1}{(2\\pi f_0)^2C}$"
]
},
{
"cell_type": "code",
"execution_count": 143,
"id": "5ceee5f8",
"metadata": {},
"outputs": [],
"source": [
"def probe_design(f0, C_mid=12e-12):\n",
" L_RF = 1e6/((2*pi*f0)**2*C_mid)\n",
" print(f\"L_RF={L_RF:.2f}µH\") \n",
" L_duplex = 50/(2*pi*f0)*1e6\n",
" print(f\"L_duplex={L_duplex:.2f}µH\") \n",
" C_duplex = 1/(2*pi*f0*50)*1e12\n",
" print(f\"C_duplex={C_duplex:.2f}pF\") \n",
" \n",
" return L_RF*1e6\n",
"\n",
"def probe_range(L_RF, C_min, C_max):\n",
" f_min = 1/(2*pi * sqrt(C_max*L_RF))\n",
" f_max = 1/(2*pi * sqrt(C_min*L_RF))\n",
" print(f\"f_min = {f_min:.1f}MHz\\nf_max = {f_max:.1f}MHz\")"
]
},
{
"cell_type": "markdown",
"id": "92577356",
"metadata": {},
"source": [
"Now we can calculate the needed coil inductance for the resonance circuit. Here, we also calculate the $\\Pi$-circuit C and L paramters for the duplexer (the \"$\\lambda/4$\" lumped circuit)"
]
},
{
"cell_type": "code",
"execution_count": 150,
"id": "44c4a308",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"L_RF=3.37µH\n",
"L_duplex=0.32µH\n",
"C_duplex=127.32pF\n"
]
}
],
"source": [
"L_RF = probe_design(25e6, C_mid=12.04e-12)"
]
},
{
"cell_type": "code",
"execution_count": 147,
"id": "181a4255",
"metadata": {
"scrolled": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"f_min = 21.7MHz\n",
"f_max = 30.6MHz\n"
]
}
],
"source": [
"probe_range(L_RF, 8e-12, 16e-12)"
]
},
{
"cell_type": "markdown",
"id": "cdecc4f3",
"metadata": {},
"source": [
"Coil64\n",
"=====\n",
"Calculate the coil windings:\n",
"\n",
"Give the wire diameter, incl. isolation thickness, former diameter (5mm)\n",
"\n",
"Coil64 v2.2.32 - One layer close-winding coil\n",
"\n",
"Input:\n",
"=====\n",
" Inductance L: 3.38 microH\n",
" Frequency f: 25 MHz\n",
" Former diameter D: 5 mm\n",
" Wire diameter d: 0.3 mm\n",
" Wire diameter with insulation k: 0.436 mm\n",
" Wire material Mt: Copper\n",
"\n",
"Result:\n",
"======\n",
"\n",
" Number of turns of the coil N = 56.719 \n",
" Length of wire without leads lw = 96.894 cm\n",
" Length of winding l = 25.165 mm\n",
" Weight of wire m = 0.614 g\n",
" DC resistance of the coil Rdc = 0.236 Ohm\n",
" Reactance of the coil X = 530.929 Ohm\n",
"\n",
" Self capacitance Cs = 0.356 pF\n",
" Coil self-resonance frequency Fsr = 218.021 MHz\n",
" Coil constructive Q-factor Q = 171 \n",
" Loss resistance ESR = 2.67 Ohm\n",
"\n",
" Additional results for parallel LC circuit at the working frequency:\n",
" => Circuit capacitance: Ck = 11.635 pF\n",
" => Characteristic impedance: ρ = 531 Ohm\n",
" => Equivalent resistance: Re = 77.531 kOhm\n",
" => Bandwidth: 3dBΔf = 171.199 kHz\n",
"\n",
" Input data for LTSpice:\n",
" Inductance: 3.380μ\n",
" Series resistance: 236.334m\n",
" Parallel resistance: 78.065k\n",
" Parallel capacitance: 0.356p\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "ff03bfb4",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.2"
}
},
"nbformat": 4,
"nbformat_minor": 5
}