Swd all detailed notes for physiotherapy

Reading File
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Searching the Web

short wave diathermy SWD physiotherapy detailed notes mechanism effects indications contraindications

Reading Web Page

https://www.goldmedalphysiotherapy.com/shortwave-diathermy-s…

Reading Web Page

https://www.cptrehab.com/wp-content/uploads/sites/60/2017/12…

Here are comprehensive, detailed notes on Short Wave Diathermy (SWD) for physiotherapy:

SHORT WAVE DIATHERMY (SWD) - Complete Physiotherapy Notes


1. INTRODUCTION & DEFINITION

Diathermy = "through heating" (Greek: dia = through; thermy = heat)
Short Wave Diathermy (SWD) is a therapeutic electrophysical agent that uses high-frequency electromagnetic energy (radiofrequency waves) to generate deep heat within body tissues for therapeutic purposes.
  • Operates at a frequency of 27.12 MHz (internationally standardized by FCC/ITU)
  • Wavelength: 11 meters
  • Frequency range of shortwave band: 3-30 MHz
  • Converts electromagnetic energy into thermal energy within biological tissues

2. TYPES OF DIATHERMY

TypeFrequency
Long Wave Diathermy0.5-1.5 MHz
Short Wave Diathermy (SWD)27.12 MHz (standardized)
Microwave Diathermy (MWD)915 MHz / 2450 MHz
Ultrasound Diathermy1-3 MHz

3. TYPES OF SWD

A. Continuous SWD (CSWD)

  • Continuous delivery of electromagnetic energy
  • Produces thermal effects (heat)
  • Used for chronic conditions
  • Higher risk of burns if improperly applied

B. Pulsed SWD (PSWD) - also called Pulsed Electromagnetic Energy (PEME)

  • Energy delivered in short pulses with rest periods between them
  • Produces athermal (non-thermal) effects at low doses
  • Thermal effects at higher doses
  • Safer, preferred for acute/subacute conditions
  • Also called PEMF (Pulsed Electromagnetic Field Therapy)

4. PHYSICS & PRINCIPLE

Electromagnetic Energy Conversion

SWD works by two mechanisms depending on the electrode type used:

A. Capacitive (Condenser/Electric Field) Method

  • Uses capacitor plates (electrodes placed on either side of the body part)
  • Generates an electric field between the plates
  • Tissues act as a dielectric medium
  • Dielectric absorption in insulating tissues (fat) generates heat
  • More heat in superficial fat layer
  • Ionic movement and molecular dipole rotation generate heat

B. Inductive (Coil/Magnetic Field) Method

  • Uses an induction coil/drum placed near the body part
  • Generates a magnetic field around the coil
  • Induces eddy currents in conducting tissues (muscle, fluids)
  • More heat generated in deeper, water-rich tissues (muscles)
  • Preferred for deeper heating

Thermal Mechanism Summary

  • Oscillating electromagnetic field causes ionic oscillation and molecular dipole rotation
  • Friction from this motion is converted to heat energy
  • Temperature rise of 40-45°C in target tissues

5. EQUIPMENT / CONSTRUCTION

Components:

  1. Oscillator circuit - generates high-frequency oscillations at 27.12 MHz
  2. Patient tuning circuit - tunes the patient circuit to resonate with the machine
  3. Power supply
  4. Treatment cables and electrodes
  5. Timer and intensity controls

Types of Electrodes:

  1. Condenser Plates (Capacitor Plates)
    • Rigid or flexible metallic plates
    • Come in various sizes
    • Used for capacitive field method
  2. Induction Coil (Drum Electrode / Monode)
    • Flat drum containing a coiled conductor
    • Placed directly on or near the body
    • Used for inductive field method
  3. Cable Electrode
    • Flexible cable wound around a limb
    • Creates inductive field
    • Used for cylindrical body parts

6. METHODS OF APPLICATION

A. Capacitive (Condenser Plate) Method

ArrangementDescriptionUse
ContraplanarElectrodes on opposite sides of the body partJoints, spine, neck
CoplanarElectrodes side by side on the same surfaceSuperficial or large areas
TransverseElectrodes at 90° to each other-
  • Electrode-skin gap: 1-3 cm (using felt pads or spacers)
  • Greater gap = more uniform heat, less concentration at surface

B. Inductive Method

  • Drum placed 1-2 cm from the skin
  • Coil wound around the limb
  • Produces deeper, more uniform heating in muscle tissue

7. DOSIMETRY (Dosage)

Schliephake's Dosage Scale (I-IV):

DoseLevelHeat PerceptionAvg PowerIndication
Dose ILowestNo heat perceived (Athermal)~0 WAcute conditions, athermal effects
Dose IILowSlight warmth barely felt~12 WSubacute conditions
Dose IIIMediumComfortable, pleasant warmth~24 WSubacute/chronic conditions
Dose IVHeavyStrong but tolerable heat~48 WChronic conditions

Standard Parameters (Pulsed SWD):

DosePulse WidthPulse FrequencyMax PowerTreatment Time
I65 µsec100 Hz150 W20 min
II100 µsec800 Hz150 W20 min
III200 µsec800 Hz150 W20 min
IV400 µsec800 Hz150 W20 min
Rule: Always start with a LOW initial dosage and increase based on patient response.

Treatment Time:

  • Small areas (hands, forearms, ankles): shorter times
  • Large areas (thighs, trunk, abdomen): longer times
  • Typical session: 15-30 minutes
  • Frequency: daily or alternate days
  • Course: 8-12 sessions typically

8. PHYSIOLOGICAL EFFECTS

A. Thermal Effects (Continuous SWD, High-Dose PSWD)

  1. Vasodilation & Increased Blood Flow
    • Causes hyperemia in treated tissues
    • Increases O2 and nutrient delivery
    • Accelerates removal of metabolic waste products
  2. Increased Tissue Metabolism
    • Rise in temperature increases enzymatic activity
    • 13% increase in metabolic rate per 1°C rise
  3. Muscle Relaxation
    • Decreases muscle spasm via:
      • Reducing pain (gate control)
      • Direct effect on muscle spindle activity
      • Improved blood flow to ischemic muscle
  4. Analgesia (Pain Relief)
    • Stimulates large-diameter nerve fibres (A-beta)
    • Gate control mechanism
    • Reduces secondary hyperalgesia
  5. Increased Tissue Extensibility
    • Increases collagen extensibility by 5-10 times
    • Enhances stretching of fibrotic tissue: tendons, scars, joint capsule
    • Best combined with stretching exercises performed immediately after SWD
  6. Reduced Joint Stiffness
    • Decreases synovial fluid viscosity
    • Increases range of motion
  7. Accelerated Healing
    • Enhanced blood supply brings more repair cells
    • Increased fibroblast and macrophage activity
  8. Control of Infection (Subacute)
    • Increased WBC activity
    • Enhanced immune response

B. Athermal/Non-thermal Effects (Low-Dose PSWD)

  1. Cellular membrane stabilization
  2. Enhanced protein synthesis and cell proliferation
  3. Reduced edema - acts on cellular pumps
  4. Reduced inflammation - modulates inflammatory mediators
  5. Accelerated bone healing (PEMF specifically effective)
  6. Nerve regeneration enhancement
  7. Reduced pain - direct effect on nociceptors

9. INDICATIONS

Musculoskeletal Conditions

  • Osteoarthritis (knee, hip, spine)
  • Rheumatoid arthritis (subacute/chronic phase)
  • Frozen shoulder (adhesive capsulitis)
  • Sprains and strains (subacute phase)
  • Muscle spasm and myofascial pain
  • Tennis elbow / lateral epicondylitis
  • Bursitis (subacute/chronic)
  • Tenosynovitis / tendinitis
  • Lumbar and cervical spondylosis
  • Disc prolapse (chronic)
  • Post-fracture rehabilitation (PSWD)
  • Joint stiffness

Inflammatory Conditions

  • Pelvic inflammatory disease (chronic)
  • Sinusitis
  • Otitis media (chronic)

Other Conditions

  • Post-surgical healing
  • Delayed wound healing (PSWD)
  • Peripheral nerve injuries (athermal PSWD)

10. CONTRAINDICATIONS

Absolute Contraindications

ContraindicationReason
Cardiac pacemakers / implanted electronic devicesEM field can cause ventricular fibrillation; pacemaker wearers must stay 20 ft (inductive) or 50 ft (capacitive) away
Metallic implants in the treatment fieldMetal concentrates EM field, causing excessive heat and 3rd-degree burns
PregnancyTeratogenic risk; poorly researched effects on fetus
MalignancyMay stimulate tumor cell growth
Active hemorrhage / recent hemorrhageVasodilation worsens bleeding
Venous thrombosis / DVTRisk of embolism from vasodilation
Tuberculosis (local)Can spread infection
Epiphyseal plates in growing childrenMay affect bone growth; skeletal maturity is ~15.5 yrs in females, ~17.5 yrs in males
Reproductive organs / menstruation / pregnant uterusHormonal disruption, thermal damage

Relative Contraindications / Precautions

  • Impaired thermal sensation / anesthesia - risk of burns (cannot detect overheating)
  • Recent radiotherapy - tissues have impaired sensation and vascularity
  • Wet dressings / damp clothing - excessive heat absorption risk
  • Severe edema / excessive fluid - fluid concentrates heat
  • Acute inflammation / pyrexia - may worsen inflammation
  • Infected open wounds / sepsis - risk of spreading infection
  • Osteomyelitis - may spread infection
  • Occlusive vascular disease (arteriosclerosis) - poor heat dissipation
  • Obesity - excessive fat heating
  • Unreliable patients (cognitively impaired, uncooperative)
  • Skin conditions (eczema, psoriasis over treatment area)
  • Blood-thinning medications (anticoagulants)
  • Bladder / spinal cord stimulators (implanted devices)

11. DANGERS / ADVERSE EFFECTS

  1. Burns - most common (thermal, due to metal, wet skin, or insensate areas)
  2. Scalds - from moisture trapped under electrodes
  3. Electric shock - faulty equipment or improper earthing
  4. Pacemaker malfunction - arrhythmias, ventricular fibrillation
  5. Increased pain / inflammation - with acute conditions or excessive dosage
  6. Nausea and fainting (autonomic response)
  7. Exacerbation of hemorrhage
  8. Rashes / skin reactions
  9. Death - reported in cases of severe malpractice (pacemaker patients, active hemorrhage)

12. PRECAUTIONS / SAFETY MEASURES

  1. Full skin examination before treatment; note any scars, implants, metal
  2. Test thermal sensation before every session (use test tubes of hot/cold water)
  3. Remove all metal objects from treatment area (jewellery, belt buckles, hearing aids, keys)
  4. No damp skin - dry the area thoroughly
  5. Electrode gap: maintain correct distance using felt pads or spacers
  6. Proper earthing of the machine
  7. Therapist distance: stay at least 1 metre from equipment, leads, and electrodes
  8. Patient position: comfortable, supported; patient must NOT touch the unit during treatment
  9. No other electrical equipment within 20 feet of SWD unit
  10. Warn pacemaker wearers - post warnings in treatment room
  11. Wait 2-3 minutes after setting before starting therapy to allow tuning
  12. Check patient continuously - ask about sensation during treatment
  13. Pregnant operators should not remain near the applicator when the unit is on

13. COMPARISON: CSWD vs PSWD

FeatureContinuous SWD (CSWD)Pulsed SWD (PSWD)
DeliveryContinuous EM wavesPulsed bursts with inter-pulse gaps
Primary effectThermalAthermal (low dose) / Thermal (high dose)
Heat generationHighLow to moderate
Use in acute conditionsContraindicatedSafe (low dose)
Use in chronic conditionsYesYes
Risk of burnsHigherLower
Tissue penetrationDeepDeep
Non-thermal biostimulationMinimalSignificant

14. TUNING THE MACHINE

  1. Set the required dosage (pulse rate, pulse width, power)
  2. Tune the patient circuit to resonance with the machine circuit
    • On most modern machines: auto-tuning
    • Manual tuning: adjust until maximum meter deflection (resonance)
  3. Allow warm-up period (2-3 minutes)
  4. Verify patient comfort continuously
  5. Never leave patient unattended

15. CLINICAL APPLICATION TIPS

  • For joint conditions: use contraplanar electrode placement
  • For muscle conditions: use inductive method (drum/monode)
  • Combine with exercise: apply SWD immediately before stretching or joint mobilization for maximum extensibility benefit
  • For post-fracture (with internal fixation): PSWD at athermal doses is safe and effective for promoting healing; CSWD is contraindicated over metal
  • Dose progression: start at Dose I-II; progress to III-IV over subsequent sessions as tolerated
  • PSWD for wound healing: use athermal doses (Dose I); promotes cellular repair without heating

16. COMPARISON: SWD vs OTHER DEEP HEATING AGENTS

FeatureSWDMicrowave DiathermyTherapeutic Ultrasound
Frequency27.12 MHz915/2450 MHz1-3 MHz
Energy typeElectromagneticElectromagneticAcoustic (mechanical)
Penetration depthUp to 3-5 cm3 cm3-5 cm
Metal implantsContraindicatedContraindicatedContraindicated
Area treatedLargeSmall-mediumSmall (focal)
Bone heatingYesMinimalYes

17. EVIDENCE BASE

  • SWD is supported for pain reduction in osteoarthritis and musculoskeletal conditions
  • PSWD has evidence for wound healing, fracture repair, and edema reduction
  • PEMF (pulsed form) has strong evidence for bone healing (non-union fractures)
  • Per PMC research: SWD can "promote vasodilation, tissue healing, decrease inflammation, decrease pain, increase tissue extensibility, decrease muscle spasm and spasticity, reduce swelling, decrease joint stiffness, and control infection"
  • Effectiveness varies with dosage, electrode placement, and patient selection

QUICK SUMMARY CARD

ParameterValue
Frequency27.12 MHz
Wavelength11 meters
PenetrationUp to 3-5 cm (deep)
Treatment time15-30 minutes
Dose levelsI (athermal) to IV (heavy heat)
Main effectsAnalgesia, muscle relaxation, increased extensibility, vasodilation
Key contraindicationsPacemaker, metal implants, pregnancy, malignancy, DVT, hemorrhage
Electrode typesCondenser plates (capacitive), drum/coil (inductive)

These notes cover the complete scope of SWD for physiotherapy examinations and clinical practice. Key exam points to remember: the 27.12 MHz frequency, Schliephake's dosage scale (I-IV), the two electrode methods (capacitive vs inductive), absolute contraindications (especially pacemakers and metal implants), and the difference between CSWD and PSWD in terms of thermal vs athermal effects.

Production of swd

Searching the Web

production of short wave diathermy SWD circuit oscillator tank circuit patient circuit physiotherapy

Reading Web Page

https://www.slideshare.net/slideshow/swd-short-wave-diatherm…

Here are complete, detailed notes on the Production of SWD:

PRODUCTION OF SHORT WAVE DIATHERMY (SWD)


1. BASIC PRINCIPLE OF PRODUCTION

The high-frequency current used in SWD is produced by discharging a condenser (capacitor) through an inductance (coil) of low ohmic resistance.
Key concept: When a charged condenser is discharged through an inductance, the electrons oscillate back and forth between the condenser and inductance, creating a high-frequency alternating current (AC). This oscillating current generates an electromagnetic field at the same frequency.

2. FUNDAMENTAL PHYSICS

Electromagnetic Phenomena (Basis of SWD)

  1. Static Charges: A stationary electric charge creates an electric field around it.
  2. Moving Charges (Current): When charges move, they form an electric current. Moving charges also create a magnetic field at right angles to the direction of current flow.
  3. Accelerating Charges: When an electric charge is accelerated (as in an oscillating circuit), it produces electromagnetic radiation that radiates outward from the source. These radiations include:
    • Radio waves (used in SWD)
    • Visible light
    • X-rays (all differ only in frequency)

Resonance Formula

The frequency of oscillation depends on the electrical size of the circuit:
Frequency (f) = 1 / (2π √LC)
Where:
  • L = Inductance of the coil (in Henries)
  • C = Capacitance of the condenser (in Farads)
To produce high-frequency current (27.12 MHz), both L (inductance) and C (capacitance) must be very small in value.

3. CONSTRUCTION: TWO CIRCUITS

The SWD machine consists of two coupled circuits:
MACHINE CIRCUIT  ←→  PATIENT CIRCUIT
(Oscillator)          (Resonator)

4. CIRCUIT 1 - THE MACHINE CIRCUIT (Oscillator Circuit)

Components:

A. Two Transformers

  1. Step-Down Transformer
    • Primary coil connected to mains AC supply
    • Secondary coil supplies low-voltage current to the filament heating circuit of the triode valve
    • Heats the cathode filament
  2. Step-Up Transformer
    • Connected to the anode circuit
    • Steps up voltage to approximately 1000-2000 volts to operate the circuit
    • Powers the triode valve and oscillator

B. Triode Valve (or Transistor in modern machines)

  • Acts as an electronic switch
  • When the grid is positive → allows current to flow
  • When the grid is negative → stops current flow
  • Maintains and amplifies the oscillations in the circuit
  • Modern machines use transistors instead of thermionic triode valves

C. Oscillator Circuit (Tank Circuit)

  • Consists of Condenser (XY) + Inductor/Oscillator Coil (CD)
  • The condenser charges and discharges repeatedly through the inductor
  • This produces a high-frequency oscillating current
  • The dimensions of C and L are chosen so electrons oscillate at exactly 27.12 MHz

D. Feedback Coil (Coil AB)

  • Lies close to the oscillator coil (CD)
  • One end connected to the grid of the triode valve
  • Other end connected through the grid-leak resistance (GL) to the filament/cathode
  • Feeds back a portion of the oscillating current to the grid to sustain oscillation

E. Grid-Leak Resistance (GL)

  • A resistance coil connecting the grid to the filament
  • Controls the feedback to maintain stable, regular oscillation

F. Amplifier Circuit

  • The raw oscillator produces low power
  • A separate amplifier circuit boosts the power to therapeutic levels
  • Without amplification, the current would be too weak to produce therapeutic effects

G. Ammeter / Neon Lamp

  • Monitors the oscillator circuit
  • When oscillator and resonator circuits are in resonance, ammeter shows maximum reading / neon lamp glows maximum
  • Some modern machines are auto-tuned

5. CIRCUIT 2 - THE PATIENT CIRCUIT (Resonator Circuit)

Components:

A. Resonator/Inductor Coil (EF)

  • Lies close to the oscillator coil (CD) in the machine circuit
  • Receives high-frequency current by electromagnetic induction (mutual induction)
  • This is how energy transfers from machine circuit to patient circuit

B. Variable Condenser (HK)

  • Connected in parallel to the patient terminal (electrodes)
  • Used to tune the patient circuit to resonance with the machine circuit
  • For resonance: L × C must be equal in both circuits
  • This is the "tuning" adjustment made before each treatment

C. Electrodes

  • The output of the machine is connected to the electrodes via cables
  • Electrodes apply the electromagnetic field to the patient

D. The Body Part Being Treated

  • Included as part of the resonator/patient circuit
  • In the condenser field method: the body part acts as the dielectric between the two capacitor plates
  • In the inductive/cable method: the body part is enclosed within the coil, and eddy currents are induced in it

6. HOW THE TWO CIRCUITS WORK TOGETHER

Mains AC Supply
      ↓
Step-up Transformer (1000-2000 V)
      ↓
Triode Valve / Transistor (Electronic Switch)
      ↓
Oscillator Circuit (Condenser XY + Coil CD)
[Produces high-frequency oscillating current at 27.12 MHz]
      ↓ (Electromagnetic Induction)
Patient Circuit / Resonator Circuit (Coil EF + Variable Condenser HK)
[Resonates at the same frequency]
      ↓
Electrodes
      ↓
Body Part (field applied here → heat generated)

Resonance Condition:

  • Machine circuit and patient circuit must be in resonance
  • Resonance means: L₁ × C₁ = L₂ × C₂
  • At resonance, maximum energy transfer occurs from machine to patient
  • The variable condenser in the patient circuit is adjusted until tuning indicator (ammeter/neon lamp) reads maximum

7. STEP-BY-STEP PRODUCTION SEQUENCE

StepEvent
1Mains AC supply enters the machine
2Step-down transformer heats cathode filament of triode valve
3Step-up transformer raises voltage to 1000-2000 V for anode circuit
4Triode valve allows current to flow in the oscillator circuit
5Condenser (XY) charges up via the step-up transformer
6Condenser discharges through inductor coil (CD) of low ohmic resistance
7Electrons oscillate back and forth between condenser and inductor (LC oscillation)
8Feedback coil (AB) feeds oscillation back to grid of triode valve
9Triode valve adds current in phase with oscillations to maintain them
10Amplifier boosts the power to therapeutic levels
11Oscillating current in coil (CD) electromagnetically induces current in resonator coil (EF)
12Variable condenser (HK) is adjusted until both circuits are in resonance
13Maximum current flows in patient circuit at 27.12 MHz
14Electromagnetic field delivered to body via electrodes
15EM energy absorbed by tissues → converted to heat

8. KEY TECHNICAL PARAMETERS

ParameterValue
Standard Frequency27.12 MHz
Wavelength11 meters
Alternative frequencies40.68 MHz (7.5 m); 13.56 MHz (22 m)
Operating voltage1000-2000 V (internal)
Maximum output powerup to 500 W
Therapeutic outputup to ~150 W average (pulsed)

9. CONDENSER vs INDUCTOR HEATING MECHANISM

Once the EM field reaches the tissues, heat is generated differently based on the method:

Condenser Field Method (Capacitive)

  • Electric field (E-field) is dominant
  • Tissues act as a dielectric between the two plates
  • Dielectric absorption: insulating tissues (fat) absorb more energy
  • Ionic oscillation: charged ions in tissue fluid oscillate with the field
  • Dipole rotation: polar molecules (especially water) rotate with each cycle
  • Friction from this motion → heat

Inductive/Cable Method (Magnetic)

  • Magnetic field (H-field) is dominant
  • Changing magnetic field induces eddy currents in conducting tissues
  • Eddy currents encounter tissue resistance → Joule heating (I²R)
  • Preferentially heats muscle and fluid-rich tissues (high conductivity)

10. WHY 27.12 MHz?

  • Allocated by the Federal Communications Commission (FCC) and International Telecommunication Union (ITU) as an industrial, scientific, and medical (ISM) band
  • At this frequency, EM energy penetrates tissues deeply
  • Provides the best balance between:
    • Tissue penetration depth
    • Selective heating of deeper structures
    • Avoiding interference with communication signals
  • Wavelength of 11 m is large enough to interact uniformly with body tissues

11. MODERN vs CLASSICAL MACHINES

FeatureClassical (Valve)Modern (Transistor)
Electronic switchThermionic triode valveTransistor / Solid-state
SizeLarge, bulkyCompact
Warm-up timeRequired (2-5 min)Minimal
TuningManualAutomatic (auto-tuning)
Power outputFixedVariable, precise
Pulsed outputDifficultEasily achieved

SUMMARY - KEY EXAM POINTS

  1. SWD current is produced by discharging a condenser through an inductance of low ohmic resistance
  2. Two circuits: Machine (oscillator) circuit + Patient (resonator) circuit
  3. Energy transfers from machine to patient via electromagnetic induction between coils CD and EF
  4. Resonance condition: L₁C₁ = L₂C₂; at resonance, maximum energy transfer occurs
  5. The triode valve/transistor acts as an electronic switch to sustain oscillations
  6. Amplifier is needed to boost power to therapeutic levels
  7. Machine voltage: 1000-2000 V internally
  8. Standard frequency: 27.12 MHz (wavelength 11 m)
  9. Frequency formula: f = 1/(2π√LC) - small L and C = high frequency
  10. The variable condenser in the patient circuit is adjusted for tuning (resonance)

Create a detailed circuit diagram document for SWD production

Reading File
Running Command

mkdir -p /tmp/workspace/swd-document && ls /tmp/workspace/

Writing File

~/swd-document/create_swd_doc.py

from docx import Document
from docx.shared import Pt, Inches, RGBColor, Cm
from docx.enum.text import WD_ALIGN_PARAGRAPH
from docx.enum.table import WD_TABLE_ALIGNMENT, WD_ALIGN_VERTICAL
from docx.oxml.ns import qn
from docx.oxml import OxmlElement
import copy

doc = Document()

# ── Page margins ──────────────────────────────────────────────────────────────
section = doc.sections[0]
section.page_width  = Inches(8.27)   # A4
section.page_height = Inches(11.69)
section.left_margin   = Inches(1.0)
section.right_margin  = Inches(1.0)
section.top_margin    = Inches(1.0)
section.bottom_margin = Inches(1.0)

# ── Default font ──────────────────────────────────────────────────────────────
normal = doc.styles["Normal"]
normal.font.name = "Calibri"
normal.font.size = Pt(11)

# ── Helper: set paragraph shading ────────────────────────────────────────────
def shade_paragraph(para, hex_color):
    pPr = para._p.get_or_add_pPr()
    shd = OxmlElement("w:shd")
    shd.set(qn("w:val"), "clear")
    shd.set(qn("w:color"), "auto")
    shd.set(qn("w:fill"), hex_color)
    pPr.append(shd)

# ── Helper: shade table cell ──────────────────────────────────────────────────
def shade_cell(cell, hex_color):
    tc   = cell._tc
    tcPr = tc.get_or_add_tcPr()
    shd  = OxmlElement("w:shd")
    shd.set(qn("w:val"), "clear")
    shd.set(qn("w:color"), "auto")
    shd.set(qn("w:fill"), hex_color)
    tcPr.append(shd)

# ── Helper: bold run ──────────────────────────────────────────────────────────
def add_bold_run(para, text, color=None):
    run = para.add_run(text)
    run.bold = True
    if color:
        run.font.color.rgb = RGBColor.from_string(color)
    return run

# ══════════════════════════════════════════════════════════════════════════════
# COVER / TITLE
# ══════════════════════════════════════════════════════════════════════════════
title_para = doc.add_paragraph()
title_para.alignment = WD_ALIGN_PARAGRAPH.CENTER
shade_paragraph(title_para, "1B3A6B")
run = title_para.add_run("SHORT WAVE DIATHERMY (SWD)")
run.bold  = True
run.font.size  = Pt(22)
run.font.color.rgb = RGBColor(0xFF, 0xFF, 0xFF)
run.font.name = "Calibri"

sub_para = doc.add_paragraph()
sub_para.alignment = WD_ALIGN_PARAGRAPH.CENTER
shade_paragraph(sub_para, "1B3A6B")
run2 = sub_para.add_run("Circuit Diagram & Production — Detailed Physiotherapy Notes")
run2.bold = True
run2.font.size = Pt(14)
run2.font.color.rgb = RGBColor(0xCC, 0xE5, 0xFF)
run2.font.name = "Calibri"

doc.add_paragraph()  # spacer

# ══════════════════════════════════════════════════════════════════════════════
# SECTION 1 – INTRODUCTION
# ══════════════════════════════════════════════════════════════════════════════
doc.add_heading("1.  Introduction", level=1)
intro = doc.add_paragraph(
    "Short Wave Diathermy (SWD) is a deep-heating electrophysical agent that converts "
    "high-frequency electromagnetic energy into thermal energy within biological tissues. "
    "The standard operating frequency is "
)
add_bold_run(intro, "27.12 MHz")
intro.add_run(
    " (wavelength 11 m), allocated internationally as an ISM band. "
    "Production of SWD current relies on an LC oscillator circuit whose output is "
    "inductively coupled to a resonant patient circuit."
)

# Key facts box (table 1-col)
doc.add_paragraph()
kf_tbl = doc.add_table(rows=1, cols=2)
kf_tbl.style = "Table Grid"
kf_tbl.alignment = WD_TABLE_ALIGNMENT.CENTER
hdr = kf_tbl.rows[0].cells
shade_cell(hdr[0], "1B3A6B"); shade_cell(hdr[1], "1B3A6B")
r0 = hdr[0].paragraphs[0].add_run("Parameter")
r0.bold = True; r0.font.color.rgb = RGBColor(0xFF,0xFF,0xFF)
r1 = hdr[1].paragraphs[0].add_run("Value")
r1.bold = True; r1.font.color.rgb = RGBColor(0xFF,0xFF,0xFF)

rows_data = [
    ("Standard Frequency",      "27.12 MHz"),
    ("Wavelength",              "11 metres"),
    ("Alternative Frequencies", "40.68 MHz (7.5 m)  |  13.56 MHz (22 m)"),
    ("Internal Operating Voltage", "1,000 – 2,000 V"),
    ("Max Therapeutic Output",  "Up to 500 W (continuous); ~150 W avg (pulsed)"),
    ("Circuit Type",            "LC Oscillator (Tank Circuit)"),
    ("Energy Transfer Method",  "Electromagnetic Induction (mutual induction between coils)"),
]
alt = False
for k, v in rows_data:
    row = kf_tbl.add_row().cells
    bg  = "EBF3FF" if alt else "FFFFFF"
    shade_cell(row[0], bg); shade_cell(row[1], bg)
    row[0].paragraphs[0].add_run(k).bold = True
    row[1].paragraphs[0].add_run(v)
    alt = not alt

doc.add_paragraph()

# ══════════════════════════════════════════════════════════════════════════════
# SECTION 2 – PRINCIPLE OF PRODUCTION
# ══════════════════════════════════════════════════════════════════════════════
doc.add_heading("2.  Principle of Production", level=1)

p = doc.add_paragraph()
add_bold_run(p, "Core Principle:  ")
p.add_run(
    "A high-frequency alternating current is obtained by "
    "discharging a condenser (capacitor) through an inductance (coil) of "
    "LOW ohmic resistance.  The electrons oscillate back and forth between "
    "the capacitor and the inductor, generating an electromagnetic field "
    "at the resonant frequency of the LC circuit."
)

doc.add_paragraph()
doc.add_heading("Resonance Frequency Formula", level=2)
frm = doc.add_paragraph()
frm.alignment = WD_ALIGN_PARAGRAPH.CENTER
shade_paragraph(frm, "F0F4FF")
run_frm = frm.add_run("f  =  1 / ( 2π √LC )")
run_frm.bold = True; run_frm.font.size = Pt(14); run_frm.font.name = "Courier New"

legend = doc.add_paragraph()
legend.add_run("Where:  ").bold = True
legend.add_run("f = frequency (Hz)  |  L = Inductance (H)  |  C = Capacitance (F)\n")
legend.add_run(
    "To achieve 27.12 MHz, both L and C must be very small values.  "
    "The physical dimensions of the capacitor and inductor are precisely "
    "engineered to allow electron oscillation at exactly 27.12 MHz."
)

# ══════════════════════════════════════════════════════════════════════════════
# SECTION 3 – OVERVIEW OF THE TWO CIRCUITS
# ══════════════════════════════════════════════════════════════════════════════
doc.add_heading("3.  Overview: Two Coupled Circuits", level=1)

ov = doc.add_paragraph(
    "The complete SWD machine is built around two inductively coupled circuits:"
)

# Overview table
ov_tbl = doc.add_table(rows=3, cols=2)
ov_tbl.style = "Table Grid"
ov_tbl.alignment = WD_TABLE_ALIGNMENT.CENTER
ov_hdr = ov_tbl.rows[0].cells
for c in ov_hdr:
    shade_cell(c, "1B3A6B")
ov_hdr[0].paragraphs[0].add_run("Circuit").bold = True
ov_hdr[0].paragraphs[0].runs[0].font.color.rgb = RGBColor(0xFF,0xFF,0xFF)
ov_hdr[1].paragraphs[0].add_run("Role").bold = True
ov_hdr[1].paragraphs[0].runs[0].font.color.rgb = RGBColor(0xFF,0xFF,0xFF)

mc = ov_tbl.rows[1].cells
shade_cell(mc[0], "D6E4FF"); shade_cell(mc[1], "D6E4FF")
mc[0].paragraphs[0].add_run("Machine Circuit\n(Oscillator Circuit)").bold = True
mc[1].paragraphs[0].add_run(
    "Generates high-frequency (27.12 MHz) oscillating current using a triode "
    "valve / transistor and an LC tank circuit.  Contains transformers, amplifier, "
    "and feedback coil."
)

pc = ov_tbl.rows[2].cells
shade_cell(pc[0], "FFFFFF"); shade_cell(pc[1], "FFFFFF")
pc[0].paragraphs[0].add_run("Patient Circuit\n(Resonator Circuit)").bold = True
pc[1].paragraphs[0].add_run(
    "Receives energy from the machine circuit by electromagnetic induction.  "
    "Contains resonator coil, variable condenser, cables, and electrodes.  "
    "Delivers therapeutic EM field to the patient."
)
doc.add_paragraph()

# ══════════════════════════════════════════════════════════════════════════════
# SECTION 4 – DETAILED CIRCUIT DIAGRAM (ASCII)
# ══════════════════════════════════════════════════════════════════════════════
doc.add_heading("4.  Complete SWD Circuit Diagram", level=1)

doc.add_paragraph(
    "The diagram below represents the complete production circuit of SWD.  "
    "Component labels correspond to the descriptions in Section 5."
)

# ── Main Circuit ASCII diagram ─────────────────────────────────────────────
circuit_lines = [
    "╔══════════════════════════════════════════════════════════════════════════════╗",
    "║                     MACHINE CIRCUIT  (Oscillator)                           ║",
    "╠══════════════════════════════════════════════════════════════════════════════╣",
    "║                                                                              ║",
    "║   MAINS AC SUPPLY (230 V)                                                    ║",
    "║         │                                                                    ║",
    "║         ├─────────────────────────┐                                          ║",
    "║         │                         │                                          ║",
    "║   ┌─────┴─────┐             ┌─────┴──────┐                                  ║",
    "║   │ STEP-DOWN │             │  STEP-UP   │                                  ║",
    "║   │TRANSFORMER│             │TRANSFORMER │                                  ║",
    "║   │  (T1)     │             │   (T2)     │                                  ║",
    "║   └─────┬─────┘             └─────┬──────┘                                  ║",
    "║         │                         │  1000–2000 V                             ║",
    "║   Filament heating                │                                          ║",
    "║   (heats cathode)           ┌─────┴──────────────────┐                      ║",
    "║         │                   │    TRIODE VALVE / TRANSISTOR                  ║",
    "║         │                   │    ┌──────────────────┐ │                     ║",
    "║         └──────────────────►│    │  Grid (G)  ◄─────┼─┼─ Coil AB           ║",
    "║                             │    │  Plate (A) ──────┼─┼──► Anode Circuit   ║",
    "║                             │    │  Cathode (K)◄────┼─┼── Grid-Leak (GL)   ║",
    "║                             │    └──────────────────┘ │                     ║",
    "║                             └─────┬──────────────────┘                      ║",
    "║                                   │                                          ║",
    "║                    ┌──────────────┴──────────────┐                          ║",
    "║                    │     OSCILLATOR CIRCUIT       │                          ║",
    "║                    │     (LC Tank Circuit)        │                          ║",
    "║                    │                              │                          ║",
    "║                    │   ┌────────┐   ┌────────┐   │                          ║",
    "║                    │   │CONDENSER│  │INDUCTOR│   │                          ║",
    "║                    │   │  (XY)  │──│  (CD)  │   │                          ║",
    "║                    │   │  Cap.  │  │Osc.Coil│   │                          ║",
    "║                    │   └────────┘  └───┬────┘   │                          ║",
    "║                    │                   │        │                          ║",
    "║                    │          Coil AB (Feedback)│                          ║",
    "║                    │              ↑             │                          ║",
    "║                    │         Feeds back to Grid │                          ║",
    "║                    └──────────────┬──────────────┘                          ║",
    "║                                   │                                          ║",
    "║                          AMPLIFIER CIRCUIT                                   ║",
    "║                    (Boosts power to therapeutic levels)                      ║",
    "║                                   │                                          ║",
    "╠═══════════════════════╦═══════════╧══════════════════════════════════════════╣",
    "║                       ║   ELECTROMAGNETIC INDUCTION                          ║",
    "║                       ║   (Energy Transfer via Mutual Induction)             ║",
    "║                       ║   Coil CD  ←──────────────→  Coil EF                ║",
    "╠══════════════════════════════════════════════════════════════════════════════╣",
    "║                   PATIENT CIRCUIT  (Resonator)                               ║",
    "╠══════════════════════════════════════════════════════════════════════════════╣",
    "║                                                                              ║",
    "║   ┌──────────────────────────────────────────────────────┐                  ║",
    "║   │           RESONATOR / PATIENT CIRCUIT                │                  ║",
    "║   │                                                       │                  ║",
    "║   │   ┌────────┐     ┌──────────┐     ┌──────────────┐  │                  ║",
    "║   │   │INDUCTOR│     │ VARIABLE │     │   ELECTRODES │  │                  ║",
    "║   │   │  (EF)  │─────│CONDENSER │─────│   (Output)   │  │                  ║",
    "║   │   │Res.Coil│     │  (HK)    │     │    + Cable   │  │                  ║",
    "║   │   └────────┘     └──────────┘     └──────┬───────┘  │                  ║",
    "║   │                                          │           │                  ║",
    "║   │   (HK adjusted until LC₁C₁ = LC₂C₂ → RESONANCE)    │                  ║",
    "║   └──────────────────────────────────────────────────────┘                  ║",
    "║                                   │                                          ║",
    "║                         ┌─────────┴──────────┐                              ║",
    "║                         │   BODY PART / TISSUE│                              ║",
    "║                         │  (between electrodes│                              ║",
    "║                         │  acts as dielectric)│                              ║",
    "║                         └────────────────────┘                              ║",
    "║                                   │                                          ║",
    "║                    ELECTROMAGNETIC FIELD ABSORBED                            ║",
    "║                    → Ionic oscillation + dipole rotation                     ║",
    "║                    → Friction → HEAT (thermal energy)                        ║",
    "║                                                                              ║",
    "╚══════════════════════════════════════════════════════════════════════════════╝",
]

diag_para = doc.add_paragraph()
diag_para.alignment = WD_ALIGN_PARAGRAPH.LEFT
shade_paragraph(diag_para, "F5F5F5")
run_diag = diag_para.add_run("\n".join(circuit_lines))
run_diag.font.name = "Courier New"
run_diag.font.size = Pt(7)

doc.add_paragraph()

# ══════════════════════════════════════════════════════════════════════════════
# SECTION 5 – MACHINE CIRCUIT COMPONENTS
# ══════════════════════════════════════════════════════════════════════════════
doc.add_heading("5.  Machine Circuit – Component Details", level=1)

# ── 5A Step-down transformer ──────────────────────────────────────────────────
doc.add_heading("5A.  Step-Down Transformer (T1)", level=2)
p = doc.add_paragraph()
p.add_run("Function: ").bold = True
p.add_run(
    "Reduces mains voltage to a low, safe level.  "
    "Its secondary coil supplies current to the filament heating circuit of the "
    "triode valve, raising the cathode temperature so it emits electrons (thermionic emission)."
)

# ── 5B Step-up transformer ────────────────────────────────────────────────────
doc.add_heading("5B.  Step-Up Transformer (T2)", level=2)
p = doc.add_paragraph()
p.add_run("Function: ").bold = True
p.add_run(
    "Steps mains voltage UP to 1,000–2,000 V.  "
    "Connected to the anode circuit of the triode valve.  "
    "This high voltage is necessary to drive current through the oscillator circuit "
    "at sufficient power for therapeutic output."
)

# ── 5C Triode Valve / Transistor ──────────────────────────────────────────────
doc.add_heading("5C.  Triode Valve / Transistor (Electronic Switch)", level=2)
p = doc.add_paragraph()
p.add_run("Classical machines: ").bold = True
p.add_run("Use a thermionic triode valve (vacuum tube) with three electrodes:\n")

parts = [
    ("Cathode (K)", "Emits electrons when heated by T1."),
    ("Anode/Plate (A)", "Collects electrons; connected to high-voltage anode circuit via T2."),
    ("Grid (G)", "Controls electron flow.  When POSITIVE → current flows.  When NEGATIVE → current blocked."),
]
for name, desc in parts:
    bp = doc.add_paragraph(style="List Bullet")
    add_bold_run(bp, name + ":  ")
    bp.add_run(desc)

p2 = doc.add_paragraph()
p2.add_run("Modern machines: ").bold = True
p2.add_run(
    "Use solid-state transistors instead of valves.  "
    "The transistor acts as the same electronic switch, allowing current "
    "to flow in phase with the oscillations to sustain and amplify them."
)
p2.add_run("\n")
p2.add_run("Key role: ").bold = True
p2.add_run(
    "Without the valve/transistor, oscillations would rapidly decay (damped oscillation).  "
    "The valve adds energy on each cycle to produce CONTINUOUS (undamped) oscillation."
)

# ── 5D Oscillator (Tank) Circuit ──────────────────────────────────────────────
doc.add_heading("5D.  Oscillator Circuit — LC Tank Circuit", level=2)

# Small sub-diagram for LC tank
tank_lines = [
    "     ┌──────────────────────────────────┐",
    "     │        LC TANK CIRCUIT           │",
    "     │                                  │",
    "     │    ┌─────────┐  ┌───────────┐   │",
    "     │    │         │  │  )))  ))) │   │",
    "     │    │ CONDENSER│  │  INDUCTOR │   │",
    "     │    │   (XY)  │  │    (CD)   │   │",
    "     │    │  ─┤├─   │──│  Coil     │   │",
    "     │    │         │  │           │   │",
    "     │    └────┬────┘  └─────┬─────┘   │",
    "     │         └──────┬──────┘         │",
    "     │                │                │",
    "     │     Electrons oscillate at      │",
    "     │     f = 1/(2π√LC) = 27.12 MHz   │",
    "     └──────────────────────────────────┘",
]
tp = doc.add_paragraph()
shade_paragraph(tp, "FFFBF0")
tp.add_run("\n".join(tank_lines)).font.name = "Courier New"
tp.runs[0].font.size = Pt(9)

p = doc.add_paragraph()
p.add_run("How it works:\n").bold = True
p.add_run(
    "1. Condenser (XY) charges via the step-up transformer.\n"
    "2. Condenser discharges through inductor coil (CD) of low ohmic resistance.\n"
    "3. Energy stored in the inductor's magnetic field charges the condenser again (reversed polarity).\n"
    "4. The condenser discharges back through the inductor — this cycle repeats.\n"
    "5. Electrons oscillate back and forth, generating an alternating EM field at 27.12 MHz.\n"
    "6. The triode valve adds energy each cycle to prevent damping → sustained oscillation."
)

# ── 5E Feedback Coil AB ──────────────────────────────────────────────────────
doc.add_heading("5E.  Feedback Coil (Coil AB) and Grid-Leak Resistance (GL)", level=2)
p = doc.add_paragraph()
p.add_run("Coil AB: ").bold = True
p.add_run(
    "Lies physically close to the oscillator coil (CD).  "
    "One end connects to the grid (G) of the triode valve; "
    "the other connects via grid-leak resistance (GL) to the cathode/filament.\n"
)
p.add_run("Grid-Leak Resistance (GL): ").bold = True
p.add_run(
    "Controls the voltage fed back to the grid, ensuring the valve switches "
    "in phase with the oscillation.  This feedback loop is essential for "
    "maintaining stable, regular, undamped oscillation."
)

# ── 5F Amplifier ──────────────────────────────────────────────────────────────
doc.add_heading("5F.  Amplifier Circuit", level=2)
p = doc.add_paragraph()
p.add_run("Why needed: ").bold = True
p.add_run(
    "The raw oscillator produces current at the correct frequency but at LOW POWER.  "
    "The amplifier circuit boosts this to therapeutic power levels (up to 500 W).  "
    "The mains voltage is stepped up to ~1,000–2,000 V to operate the amplifier stage."
)

doc.add_paragraph()

# ══════════════════════════════════════════════════════════════════════════════
# SECTION 6 – PATIENT CIRCUIT COMPONENTS
# ══════════════════════════════════════════════════════════════════════════════
doc.add_heading("6.  Patient Circuit — Component Details", level=1)

# ── 6A Resonator coil EF ──────────────────────────────────────────────────────
doc.add_heading("6A.  Resonator Coil (Coil EF)", level=2)
p = doc.add_paragraph()
p.add_run("Function: ").bold = True
p.add_run(
    "Lies physically close to the oscillator coil (CD) in the machine.  "
    "When high-magnitude current flows through CD, it creates a changing magnetic field.  "
    "By MUTUAL ELECTROMAGNETIC INDUCTION, a matching high-frequency current is "
    "induced in coil EF.  This is the primary means of energy transfer from the "
    "machine circuit to the patient circuit."
)

# ── 6B Variable condenser HK ──────────────────────────────────────────────────
doc.add_heading("6B.  Variable Condenser (HK) — Tuning Control", level=2)
p = doc.add_paragraph()
p.add_run("Position: ").bold = True
p.add_run("Connected in PARALLEL to the patient terminal (electrodes).\n")
p.add_run("Function: ").bold = True
p.add_run(
    "Adjusts the capacitance of the patient circuit so that its resonant frequency "
    "matches the machine circuit exactly.\n"
)
p.add_run("Resonance Condition: ").bold = True
rp = doc.add_paragraph()
rp.alignment = WD_ALIGN_PARAGRAPH.CENTER
shade_paragraph(rp, "F0F4FF")
rp.add_run("L₁ × C₁  =  L₂ × C₂").bold = True
rp.runs[0].font.name = "Courier New"; rp.runs[0].font.size = Pt(13)

p2 = doc.add_paragraph()
p2.add_run("Where: ").bold = True
p2.add_run(
    "L₁C₁ = machine circuit inductance × capacitance; "
    "L₂C₂ = patient circuit inductance × capacitance.\n"
    "When both products are equal, the circuits are in resonance and MAXIMUM "
    "energy transfer occurs.  The ammeter/neon lamp indicator shows maximum "
    "deflection/brightness at resonance.\n"
)
p2.add_run("Modern machines: ").bold = True
p2.add_run("Auto-tuning achieves resonance automatically.")

# ── 6C Electrodes ─────────────────────────────────────────────────────────────
doc.add_heading("6C.  Electrodes (Output Terminals)", level=2)
p = doc.add_paragraph(
    "The output of the machine is connected to the electrodes via high-frequency "
    "coaxial cables.  Two main types are used:"
)

elec_tbl = doc.add_table(rows=3, cols=3)
elec_tbl.style = "Table Grid"
elec_hdr = elec_tbl.rows[0].cells
for c in elec_hdr:
    shade_cell(c, "2E5AA8")
elec_hdr[0].paragraphs[0].add_run("Electrode Type").bold = True
elec_hdr[0].paragraphs[0].runs[0].font.color.rgb = RGBColor(0xFF,0xFF,0xFF)
elec_hdr[1].paragraphs[0].add_run("Method").bold = True
elec_hdr[1].paragraphs[0].runs[0].font.color.rgb = RGBColor(0xFF,0xFF,0xFF)
elec_hdr[2].paragraphs[0].add_run("Field / Heating").bold = True
elec_hdr[2].paragraphs[0].runs[0].font.color.rgb = RGBColor(0xFF,0xFF,0xFF)

elec_data = [
    ("Condenser Plates\n(Capacitor Plates)", "Capacitive Field Method\n(Contra-planar / Coplanar)", "Electric field (E-field) dominant.\nDielectric absorption heats fat.\nIonic oscillation & dipole rotation."),
    ("Induction Coil\n(Drum / Monode / Cable)", "Inductive Field Method\n(Coil wound around limb or drum on surface)", "Magnetic field (H-field) dominant.\nEddy currents induced in muscle.\nPreferentially heats deep muscle."),
]
for i, (a, b, c_) in enumerate(elec_data):
    row = elec_tbl.rows[i+1].cells
    bg = "EBF3FF" if i % 2 == 0 else "FFFFFF"
    for cl in row: shade_cell(cl, bg)
    row[0].paragraphs[0].add_run(a).bold = True
    row[1].paragraphs[0].add_run(b)
    row[2].paragraphs[0].add_run(c_)

doc.add_paragraph()

# ── 6D Body Part ──────────────────────────────────────────────────────────────
doc.add_heading("6D.  The Body Part (as Circuit Element)", level=2)
p = doc.add_paragraph()
p.add_run("Condenser Field Method: ").bold = True
p.add_run(
    "The body part placed between the two condenser plates acts as the "
    "DIELECTRIC of a capacitor.  Tissues (fat, muscle, fluid) have different "
    "dielectric constants, causing selective heating.\n"
)
p.add_run("Cable / Inductive Method: ").bold = True
p.add_run(
    "The body part is enclosed within the coil.  Eddy currents are induced "
    "in the conducting tissues, and Joule heating (I²R) occurs predominantly "
    "in high-conductivity tissues (muscle, blood)."
)

doc.add_paragraph()

# ══════════════════════════════════════════════════════════════════════════════
# SECTION 7 – ENERGY FLOW STEP BY STEP
# ══════════════════════════════════════════════════════════════════════════════
doc.add_heading("7.  Step-by-Step Energy Flow", level=1)

steps = [
    ("Step 1",  "Mains AC supply (230 V) enters the machine."),
    ("Step 2",  "Step-DOWN transformer (T1) heats the triode cathode filament → thermionic emission."),
    ("Step 3",  "Step-UP transformer (T2) raises voltage to 1,000–2,000 V for the anode circuit."),
    ("Step 4",  "High voltage charges condenser XY in the LC tank circuit."),
    ("Step 5",  "Condenser (XY) discharges through inductor coil (CD) of low ohmic resistance."),
    ("Step 6",  "Electrons oscillate between XY and CD → high-frequency LC oscillation at 27.12 MHz."),
    ("Step 7",  "Feedback coil (AB) senses oscillation → feeds signal to grid (G) of triode valve."),
    ("Step 8",  "Triode valve adds current IN PHASE with oscillations → prevents damping → sustained undamped oscillation."),
    ("Step 9",  "Amplifier circuit boosts power to therapeutic levels."),
    ("Step 10", "Oscillating current in coil CD generates a changing magnetic field."),
    ("Step 11", "Changing magnetic field induces current in resonator coil (EF) by mutual induction (electromagnetic induction)."),
    ("Step 12", "Variable condenser (HK) is adjusted → L₁C₁ = L₂C₂ → RESONANCE achieved → maximum current in patient circuit."),
    ("Step 13", "High-frequency current (27.12 MHz) flows through cables to electrodes."),
    ("Step 14", "Electromagnetic field is applied to the body part via electrodes."),
    ("Step 15", "EM energy is absorbed by tissues → ionic oscillation + dipole rotation → friction → HEAT (thermal energy)."),
]

step_tbl = doc.add_table(rows=len(steps)+1, cols=2)
step_tbl.style = "Table Grid"
step_tbl.alignment = WD_TABLE_ALIGNMENT.CENTER
s_hdr = step_tbl.rows[0].cells
for c in s_hdr: shade_cell(c, "1B3A6B")
s_hdr[0].paragraphs[0].add_run("Step").bold = True
s_hdr[0].paragraphs[0].runs[0].font.color.rgb = RGBColor(0xFF,0xFF,0xFF)
s_hdr[1].paragraphs[0].add_run("Event").bold = True
s_hdr[1].paragraphs[0].runs[0].font.color.rgb = RGBColor(0xFF,0xFF,0xFF)

for i, (sn, sv) in enumerate(steps):
    row = step_tbl.rows[i+1].cells
    bg = "EBF3FF" if i % 2 == 0 else "FFFFFF"
    shade_cell(row[0], bg); shade_cell(row[1], bg)
    row[0].paragraphs[0].add_run(sn).bold = True
    row[1].paragraphs[0].add_run(sv)

doc.add_paragraph()

# ══════════════════════════════════════════════════════════════════════════════
# SECTION 8 – TUNING THE MACHINE
# ══════════════════════════════════════════════════════════════════════════════
doc.add_heading("8.  Tuning the Machine", level=1)

tuning_para = doc.add_paragraph(
    "Tuning ensures the patient circuit resonates with the machine circuit "
    "for maximum energy transfer.  Poor tuning results in reduced therapeutic "
    "effect and possible damage to the machine."
)

tuning_steps = [
    "Set the required dosage (pulse frequency, pulse width, output power).",
    "Position electrodes correctly on the patient.",
    "Switch on the machine and allow warm-up (2–3 minutes for valve machines).",
    "Adjust the variable condenser (HK) — the TUNING CONTROL:",
    "    ▸  Ammeter shows MAXIMUM reading  →  Resonance achieved",
    "    ▸  Neon lamp glows BRIGHTEST  →  Resonance achieved",
    "Modern machines: auto-tuning adjusts HK automatically.",
    "Begin treatment.  Monitor patient throughout.",
    "Re-tune if patient moves or position changes.",
]
for ts in tuning_steps:
    doc.add_paragraph(ts, style="List Bullet" if not ts.startswith("    ") else "List Bullet 2")

doc.add_paragraph()

# ══════════════════════════════════════════════════════════════════════════════
# SECTION 9 – CONDENSER VS INDUCTIVE METHOD (Circuit Perspective)
# ══════════════════════════════════════════════════════════════════════════════
doc.add_heading("9.  Capacitive vs Inductive Method — Circuit Perspective", level=1)

# Capacitive sub-diagram
doc.add_heading("9A.  Capacitive (Condenser Plate) Method", level=2)
cap_diag = [
    "   PATIENT CIRCUIT OUTPUT",
    "         │         │",
    "   ┌─────┴──┐   ┌──┴─────┐",
    "   │ELECTRODE│   │ELECTRODE│",
    "   │  Plate  │   │  Plate  │",
    "   │  (+)   │   │  (-)   │",
    "   └────┬────┘   └────┬────┘",
    "        │   E-field   │",
    "        │ ←─────────→ │",
    "        │             │",
    "   ╔════╧═════════════╧════╗",
    "   ║     BODY PART         ║",
    "   ║  (acts as dielectric) ║",
    "   ║  Fat / Muscle / Fluid ║",
    "   ╚═══════════════════════╝",
    "   Ionic oscillation + dipole",
    "   rotation → friction → HEAT",
]
cp = doc.add_paragraph()
shade_paragraph(cp, "FFFBF0")
cp.add_run("\n".join(cap_diag)).font.name = "Courier New"
cp.runs[0].font.size = Pt(9)

doc.add_paragraph()
doc.add_heading("9B.  Inductive (Coil / Cable) Method", level=2)
ind_diag = [
    "   PATIENT CIRCUIT OUTPUT",
    "            │",
    "   ┌────────┴────────┐",
    "   │  INDUCTION COIL │",
    "   │  or DRUM        │",
    "   │   )))  )))  ))) │  ← coil wound around limb",
    "   │   )))  )))  ))) │     or drum placed on surface",
    "   └────────┬────────┘",
    "            │",
    "   Changing magnetic field",
    "   induces EDDY CURRENTS in",
    "   ╔═══════════════════════╗",
    "   ║      BODY PART        ║",
    "   ║  (high-conductivity   ║",
    "   ║   muscle & fluid)     ║",
    "   ╚═══════════════════════╝",
    "   Eddy currents × resistance",
    "   = I²R (Joule) heating",
    "   → Deep muscle heating",
]
ip = doc.add_paragraph()
shade_paragraph(ip, "F0FFF0")
ip.add_run("\n".join(ind_diag)).font.name = "Courier New"
ip.runs[0].font.size = Pt(9)

doc.add_paragraph()

# ══════════════════════════════════════════════════════════════════════════════
# SECTION 10 – CLASSICAL vs MODERN MACHINES
# ══════════════════════════════════════════════════════════════════════════════
doc.add_heading("10.  Classical (Valve) vs Modern (Transistor/Solid-State) Machines", level=1)

comp_tbl = doc.add_table(rows=7, cols=3)
comp_tbl.style = "Table Grid"
comp_hdr = comp_tbl.rows[0].cells
for c in comp_hdr: shade_cell(c, "2E5AA8")
for txt, cell in zip(["Feature", "Classical (Valve)", "Modern (Solid-State)"], comp_hdr):
    cell.paragraphs[0].add_run(txt).bold = True
    cell.paragraphs[0].runs[0].font.color.rgb = RGBColor(0xFF,0xFF,0xFF)

comp_data = [
    ("Electronic switch", "Thermionic triode valve (vacuum tube)", "Transistor / solid-state components"),
    ("Size", "Large, bulky", "Compact, portable"),
    ("Warm-up time", "2–5 minutes (heats cathode)", "Minimal (<1 min)"),
    ("Tuning", "Manual (adjust variable condenser)", "Automatic (auto-tuning circuit)"),
    ("Pulsed output (PSWD)", "Difficult to achieve precisely", "Easily programmable"),
    ("Power control", "Limited adjustment", "Precise digital control"),
]
for i, (a, b, c_) in enumerate(comp_data):
    row = comp_tbl.rows[i+1].cells
    bg = "EBF3FF" if i % 2 == 0 else "FFFFFF"
    for cl in row: shade_cell(cl, bg)
    row[0].paragraphs[0].add_run(a).bold = True
    row[1].paragraphs[0].add_run(b)
    row[2].paragraphs[0].add_run(c_)

doc.add_paragraph()

# ══════════════════════════════════════════════════════════════════════════════
# SECTION 11 – KEY EXAM POINTS
# ══════════════════════════════════════════════════════════════════════════════
doc.add_heading("11.  Key Exam Points (Quick Revision)", level=1)

exam_box = doc.add_paragraph()
shade_paragraph(exam_box, "FFF3CD")
exam_box.add_run(
    "★  SWD current is produced by DISCHARGING A CONDENSER through an INDUCTANCE of LOW OHMIC RESISTANCE.\n"
    "★  Standard frequency: 27.12 MHz  |  Wavelength: 11 m\n"
    "★  Frequency formula: f = 1/(2π√LC)  →  small L and C = high frequency\n"
    "★  Two circuits: Machine (Oscillator) + Patient (Resonator)\n"
    "★  Energy transfer from machine to patient: ELECTROMAGNETIC INDUCTION (coil CD → coil EF)\n"
    "★  Resonance condition: L₁C₁ = L₂C₂  →  maximum energy transfer\n"
    "★  Tuning indicator: ammeter reads maximum / neon lamp glows brightest at resonance\n"
    "★  Triode valve / transistor: maintains UNDAMPED OSCILLATION\n"
    "★  Amplifier: boosts power from oscillator to therapeutic levels\n"
    "★  Grid-leak resistance (GL): stabilises feedback to grid\n"
    "★  Variable condenser (HK): tuning element in patient circuit\n"
    "★  Capacitive method → E-field → heats FAT (dielectric absorption)\n"
    "★  Inductive method → H-field → eddy currents → heats MUSCLE (Joule heating)\n"
    "★  Modern machines: transistors replace valves; auto-tuning replaces manual tuning\n"
    "★  Internal operating voltage: 1,000–2,000 V"
).bold = False
exam_box.runs[0].font.name = "Calibri"
exam_box.runs[0].font.size = Pt(10.5)

doc.add_paragraph()

# ══════════════════════════════════════════════════════════════════════════════
# FOOTER
# ══════════════════════════════════════════════════════════════════════════════
footer_para = doc.add_paragraph()
footer_para.alignment = WD_ALIGN_PARAGRAPH.CENTER
shade_paragraph(footer_para, "1B3A6B")
fr = footer_para.add_run("SWD Production — Physiotherapy Reference Notes  |  For Educational Use")
fr.bold = True; fr.font.size = Pt(9)
fr.font.color.rgb = RGBColor(0xCC, 0xE5, 0xFF)

# ── Save ──────────────────────────────────────────────────────────────────────
out = "/tmp/workspace/swd-document/SWD_Production_Circuit_Diagram.docx"
doc.save(out)
print(f"Saved: {out}")
Running Command

cd /tmp/workspace/swd-document && python3 create_swd_doc.py

Running Command

python3 -c " from docx import Document doc = Document('/tmp/workspace/swd-document/SWD_Production_Circuit_Diagram.docx') count = 0 for p in doc.paragraphs: if p.text.strip(): print(f'[{p.style.name}] {p.text[:80]}') count += 1 if count > 40: print('...(more content)...') break print('Total paragraphs:', len(doc.paragraphs)) print('Total tables:', len(doc.tables)) "

Your document is ready. Here's what's inside:

SWD Production Circuit Diagram

Word Document · DOCX


Document Contents (11 Sections)

SectionContent
1. IntroductionDefinition, key technical parameters table (frequency, voltage, power, etc.)
2. Principle of ProductionCore LC discharge principle, resonance frequency formula (f = 1/2π√LC)
3. OverviewTwo-circuit overview table — Machine vs Patient circuit roles
4. Complete Circuit DiagramFull ASCII circuit diagram showing the entire SWD production path from mains supply to tissue heating
5. Machine Circuit ComponentsDetailed breakdown of T1, T2, triode valve/transistor, LC tank circuit (with sub-diagram), feedback coil AB, grid-leak resistance, amplifier
6. Patient Circuit ComponentsResonator coil EF, variable condenser HK + resonance condition (L₁C₁=L₂C₂), electrodes table, body part as circuit element
7. Step-by-Step Energy Flow15-step table tracing energy from mains AC → tissue heat
8. Tuning the MachineProcedure for achieving resonance, tuning indicators
9. Capacitive vs Inductive MethodSeparate ASCII sub-diagrams for each electrode method with heating mechanisms
10. Classical vs Modern MachinesComparison table: valve vs transistor/solid-state
11. Key Exam PointsHighlighted revision box with all 15 critical facts
The document uses colour-coded headings, shaded tables, and monospaced ASCII circuit diagrams throughout.
This is a shared conversation. Sign in to Orris to start your own chat.