SIMULATION SOFTWARE FOR MEDICAL LINACS

BACKSTORY

SIMAC Backstory

The purpose of this backstory is to explain the linac physics, the idea, and the purpose of the models used in SIMAC at an intuitive level.
The simulator allows the user to play around with operating parameters in ways that are not possible on a real machine.

Doctor's desk with laptop and equipment Backstory

Medical Linear Accelerators (linacs), those accelerators that are used in medicine for radiotherapy, are complicated devices. Other particle accelerators, such as the ones at CERN, SLAC or other large laboratories are at the forefront of physics and have an entire journal devoted just to the their physics of accelerators and beams. Medical linacs are in many ways even more complicated due to the size constraints put on these devices (since they must operate in a hospital as opposed to large laboratories). To understand medical linacs, one must understand the accelerator physics, but also the electronics, mechanics, as well as things specific to these accelerators, such as the safety systems and regulatory issues.

Teaching medical linac physics has been difficult traditionally since there are really two areas to understand: (1) the fundamental physics of beam acceleration and (2) the application of these physical principles to a practical device that exists in a hospital environment and used for therapeutic benefit. The link between the basic physics in terms of waveguide theory, charged particles acceleration, microwave devices, etc, and clinical beam properties such as depth dose, flatness, symmetry is difficult to teach since the basic physical principles, such as Maxwell’s equations, do not readily capture the physics relevant to clinically important parameters. This problem is made even more difficult since the two professional groups that often collaborate to ensure the correct functioning of the linac, the medical physicist and the linac service engineer, often have different technical backgrounds, and may refer to the same physical phenomena using different terminology and language, which makes collaboration between these two groups more difficult.

The idea behind SIMAC (SIMulate LinAC) is to try to address teaching issues with medical linacs by allowing the real-time simulation of linac functioning using a simulated environment. The simulated environment has several purposes: It allows access to a software learning environment without needing access to the actual physical device, which is often limited. As well, the simulator allows the user to play around with operating parameters in ways that are not possible on a real machine. Real linacs can be easily damaged if they are set up incorrectly. Lastly, SIMAC allows the users to vary operating parameters over a wide range so that the user can get an intuitive feel for the response of the linac to changes in operating parameters.

To create a simulated linac environment, SIMAC uses “applied” linac physics models. These models use simplified physics that is more conducive to understanding linac engineering (as opposed to linac physics). For example, the heart of SIMAC uses the load line model to predict the acceleration properties of the accelerator. The load line model is a simple equation that boils down very complicated microwave physics and charged particle acceleration into a simple linear equation. The simplicity should not be confused with lack of accuracy. The load line, along with the concept of the linac shunt impedance, is a very accurate way of modelling linacs and is based on very intricate physical modelling using what is called lumped element models. If the resulting equation is used with a realistic value for the linac shunt impedance, then very reasonable beam currents and energies can be calculated with very minimal computational power.

SIMAC uses this simple beam acceleration model, along with other simplified (but accurate) models for other linac components such as the electron gun, klystron amplifier, bending magnet, target, and flattening filter) to allow a user to simulate linac physics. It has a user interface that is meant to be similar to the service mode of clinical linacs. Within its GUI, the user can enter different physical parameters (voltages). The program then propagates these setup parameters through its series of models to predict the dose rate at the central axis of the linac as well as the beam profiles and depth dose. A detailed theory of SIMAC has been published. The purpose of this overview is to explain the linac physics in SIMAC at an intuitive level which depends less on mathematics, and more on explaining the idea and purpose of the models used in SIMAC.

In the history of radiotherapy, one of the first engineering problems was that of obtaining a high energy photon beam that was capable of deep penetration into tissues and superficial tissue sparing. In this regard, the development of cobalt teletherapy units was instrumental in advancing the practice of external beam radiotherapy in that it allowed deep penetration of tissues, with reduced skin doses. Despite the advantages of cobalt based radiotherapy, there was also a need to create an electronic means of megavoltage photon beam production, one that did not rely on radioactive sources. The problem of a high energy beam is made even more difficult in the medical environment where a useful device would not only be able to produce a high energy photon beam, but must also be a device suitable for installation in a hospital environment, as opposed to a high energy physics environment where space requirements are very different than in a hospital.

The early accelerators that were available in the 1940’s were typically Van derGraaf Accelerators which could create beams in the MeV range. The only other acceleration techniques were the so called “direct” acceleration techniques. Direct acceleration, shown below, has a practical upper bound of about 0.5 MeV, after which, dielectric breakdown and electron arching problems cause this method to become impractical. As well, at larger acceleration energies, the electrical components required for direct acceleration become non-proportionally large, making this approach unsuitable for clinical applications. It is possible to use a staggered approach concurrent with direct acceleration, where several cathode and anode stages are mounted in series using a single power source. However, this solution is also impractical in that the control circuits required to switch the applied high voltage to alternate accelerating plates can be very complicated since the electron transit times are very quick, and that considerable power must be passed through high voltage switches.

Current, cathode, electron motion, anode

The solution that has been employed is to use microwave power in a suitably designed waveguide such that an electric field is created that can accelerate charged particles to high energies. In a suitable designed waveguide with a corresponding microwave field and sufficient power, energy can be effectively transferred from the microwave field to the charged particles (in our case these are electrons). As an example, a cylindrical waveguide operating in a TM01 mode has an electric field pattern similar to this:

Tube equation

The electric field pattern originates for the waveguide walls, and is oriented such that part of it is collinear with the central axis of the waveguide. This portion of the electric field is therefore useful for electron acceleration in that if the electrons were suitably positioned so as the see the accelerating field, they could be accelerated in a direction that was not physically blocked by the waveguide. There is one important problem with this arrangement, which is that the speed electrons would have to travel to become attached, or bound, to the microwaves, is greater than the speed of light for energies, sizes and frequencies that are used in radiotherapy linacs. As an example, for a cylindrical waveguide with diameter 10 cm being excited by microwaves of frequency 3 GHz, the guide wavelength, λg, is about 14.1 cm. The cycle time for this wave is 1/3GHz, or about 0.33 ns, and so the velocity that an electron would have to travel to continually see a positive electric field is the guide wavelength divided by the cycle time, or about 4.2 x 108 m/s, or about 40% higher than the speed of light. (This is called the phase velocity, which can be evaluated by calculating the ratio of the wave number to frequency. For the physics and formulas about waveguide, you can look at this webpage.) This is a problem in that a simple cylindrical waveguide such as the one above cannot accelerate electrons since the electrons can never reach the required phase velocity due to their upper limit of the speed of light, and so the electrons cannot become bound to the accelerating microwaves.

It turns out that when building linear accelerator waveguides, the engineer has a lot of freedom to change the internal shape of the waveguide without affecting the basic waveguide propagation mode. As an example, the waveguide above can be adjusted by adding spacers with holes in them, called irises or septum, as shown in the figure below.

Another picture of an equation

By introducing these septa, the waveguide designer has quite a bit of control over the microwave field, and the guide wavelength in particular. In fact, for the waveguide discussed above, the guide wavelength can made to be 10.0 cm, and so the phase velocity then becomes 3 x 108 m/s, which matches the speed of light, and electrons are now able to bind to the microwaves, and be effectively accelerated. The physics of the matching guide wavelengths to electron trajectories is quite complicated. We have explained it at a reasonably high level here. For more details, the reader can consult other books, such as these ones listed at the bibliography.

The waveguide design with periodically spaced septa, allows effective electron acceleration to high energies. The septum has the added benefit of concentrating the electric field near the axis of the waveguide, which increased the accelerating potential for a given length of waveguide. In the waveguide septum orientation shown above, the septa are evenly spaced and the electric field pattern from the pure cylindrical waveguide is more or less reproduced, where there is electric field is concentrated in alternating cavities (for π/2 phase shift per cavity). Not shown in this diagram is the magnetic field orientation, which is dominant in the other cavities, where there is less electric field. Not only can the waveguide septum be used to adjust the guide wavelength, but for a given guide wavelength, the relative amounts of stored electric and magnetic energy can also be adjusted relatively easily by adjusting the position of waveguide septum. The diagram below shows different septum orientation which increase the accelerating potential of the linear accelerator for a given accelerator length.

Picture of Equation

In the above diagram, the guide wavelength, λg, is the same for all three septum orientations, so the phase velocity will be the same. However, the cavities that have magnetic energy have been changed in size in order for the cavities with electric field to dominate, and allow a greater length of the waveguide to be used for electron acceleration. In the bottom design, the magnetic field cavities have been removed from the axis of the accelerator altogether, and moved to the side, which is the standing wave side-coupled cavity waveguide design that is very common in radiotherapy today. These cavity dimension changes have two physical effects on the waveguide. Firstly, the resonant frequency, in the case of the standing wave accelerator, changes since this is the frequency where the electric and magnetic field energy density are equivalent. Secondly, the impedance of the waveguide is also changes. The microwave impedance is the ratio of the transverse components of the electric to magnetic fields. The impedance of a wave in free space is, which is essentially the ratio of field strengths of an unconstrained wave (μ0 and ε0 are physical constants called the permeability and permittivity of free space, and are used to calculate electric and magnetic field strength). Within the waveguide, the wave in constrained, which affects the ratio of electric to magnetic field, and so the wave impedance is also changed. The waveguide shunt impedance is closely related to this concept. Most importantly, it is a measure of the ability of a waveguide to transfer energy from the microwave field to the charged particles, which are electrons for medical linacs. The concept of shunt impedance is one of the most important physical concepts to understand in understanding how SIMAC simulates linear accelerator since it turns out that the relationship between linac beam energy and beam current can be described very simply, using a linear relationship. This relationship can be quickly and easily calculated, making it possible to compute, even with low power computing, the response of a linear accelerator to changes in beam parameters. To understand the concept, consider the circuit shown in Figure 5.

Equation

Figure 5

In this figure, we show a simple series electrical circuit, with a power source, whose value is  , where PKLY is the microwave power coming from the klystron or magnetron, and Z is the linac shunt impedance. The expression has units of Volts. The accelerator structure, VACC , is represented by a simple resistor, and the accelerator beam current, is also represented by simple variable  resistor. Solving for the value of VACC, we obtain an equation that has the same form as the well-known beam loading expressions for linacs:

Simac_equationWe arrived at this equation very simply. The technique used is known as “lumped circuit modelling” for linear accelerators. It can be simple, as we have done here, or the technique can be made very complicated and expanded to use capacitive elements to model electric field energy storage, and inductive elements to model magnetic field energy storage as well as AC circuit analysis, to model the effects of the microwave power source. This method predicts that the accelerating beam voltage depends linearly on the beam current, with highest energy at zero current, and a linear decrease in energy with increasing beam current that depends on the linac shunt impedance. When plotted, beam energy – beam current relationships like this are obtained:

Beam Characteristic Curves

So using the beam loading model, it is a fairly simple task to calculate the beam energy if the beam current and microwave power are known. In SIMAC, the idea is to use as simple physical model as possible in order to keep the computational requirements low for a real time calculation. For beam current and microwave power, we use two simple models, one for the linac gun (the electron source) and in the second, we model a klyston, which is an amplifier of microwave power.

A klystron is a microwave device in which electrons drift along a drift tube going through a series of microwave cavities. A representation of one is shown below in Figure 7. In the first cavity a low power microwave field is injected. This field is arranged so that the electric component decelerates the electron beam. The deceleration is done so that the net effect is that the steady stream of electrons is “bunched,” i.e. electron velocities are reduced so that over a microwave cycle, the electron phase is narrowed. The electron bunches, when passing through subsequent microwave cavities, generate more retarding electric fields, which further enhance the electron bunching. The last cavity in the klystron is designed to have a large shunt impedance, so that the energy of the electron that drift through it is most effectively converted to microwave energy, which is then coupled out of the klystron to a transmission waveguide. The electrons, with their remaining energy are collected in a collector where they are stopped.

Figure 7

Figure 7. Schematic drawing of a klystron amplifier

This device can have gains on the order of 105, so that microwave inputs with power of about 50 W can be amplified to about 5 MW. The gain is dependent on the degree of bunching achieved in the device. Well defined bunches with a small spread in phase (over the microwave cycle) will produce higher output power. As the input microwave power is increased, the bunching effectiveness also increases, and a linear increase in power is observed. However, if the input microwave power is increased too high, the electron bunching can be negatively affected since the retarding electric field can push electrons over too wide a phase angle. The result is deterioration of the electron bunches, and reduced RF output power. The effect is known as “klystron saturation.” In SIMAC, this was modelled using Bessel functions, which have been found to reproduce the klystron saturation effect reasonably well. This modeling is shown in Figure 8 below, where the microwave amplification is plotted. As shown in this figure, the klystron saturation curve also depends on the voltage applied to the klystron cathode. It turns out that the maximum microwave power obtainable from the klystron at a given low microwave power input is linearly dependant on the cathode voltage applied. This relationship, along with the saturation curve is used in SIMAC. The formula and details of the model for this are found within the SIMAC paper.

Figure 8

Figure 8. Klystron saturation curves modelled using Bessel functions

In order to inject electrons into the accelerating waveguide, an electron source is needed. In SIMAC, we modelled a Pierce-type electron gun. This type of gun is limited by space charge effects. An illustration of a dispenser cathode type of electron gun is shown in Figure 9. When these electron sources, or “guns” operate in space charge limited mode, electrons have to compete in order to fit through the small hole in the since electrons repel each other. So, what space charge limited means is that the electron current that can be passed through the small anode hole is limited by the concentration of charge within the space charge region. This is very different from the “temperature limited” mode, where the current that can be passed through the anode is limited by the number of electrons emitted from the cathode, which depends on the temperature of the cathode.

Cathode, Grid, Anode, Space Charge Region, Beam Forming Electrode, Heater

Figure 9

For a type of electron gun as shown in figure 9, if the grid is ignored, the Child-Langmuir law, which describes space charge limited mode, says that the beam current passed through the anode into the accelerator is proportional to the cathode potential to the power 3/2.

Simac_equation2The constant p is known as the gun perveance. This relationship allows a simple means of computing the beam current entering the linear accelerator waveguide, and this is what is used in SIMAC. At present, SIMAC ignores the effect of a grid, used in triode type guns, and shown in Figure 9. The grid allows space-charge to accumulate between it and the cathode, and can be modulated to release the space charge in a manner such that a precise amount of electrons can be injected into the waveguide. The perveance equation can be simply modified to account for this, however SIMAC does not do this in this version.

With the linear accelerator model (load line) and inputs of beam current (electron gun model) and microwave power (klystron model), we can model the electron beam that emerges from the linac base on voltages to the electron gun, klystron cathode, and microwave input power to the klystron. Many clinical linacs employ a bending magnet to redirect this electron beam towards the patient in order for the linac to be as small as possible since bending magnets can typically be built to have smaller physical dimensions that accelerating waveguides. A typical medical linac arrangement is shown in Figure 10 below.

Figure 10

Figure 10. Linac schematic used in SIMAC

The bending magnet is modelled in SIMAC in a similar simplified fashion as the other linac components. The bending magnet is essentially a dipole magnet which bends the electron path around the magnetic field. Assuming that this magnet behaves like a solenoid, we can model this quite simply. The result is a linear function between bending magnet current and pass through energy, the energy of electrons that emerge from the bending magnet and are directed towards the patient. Figure 11 shows an example of the function that can model the bending magnet behaviour, which is linear with energy for most of the current range, except for a non-linear component at the low energy range due to relativity effects.

Figure 11. Bending magnet energy response, showing a linear response at high energies.

Figure 11. Bending magnet energy response, showing a linear response at high energies.

The last components to be modelled in SIMAC are the target and flattening filter, which convert an electron current on the target into a photon distribution in a water tank. This is an area where many medical physicists have good knowledge and understanding, and where there are many tools available to simulate this. For SIMAC, the important aspect is that that this model retain the real-time aspect of the program. In other words, one of the goals of SIMAC is to act like a real time simulator, which enhances the teaching value of the simulation package. Monte Carlo methods for dose transport through a target, flattening filter and water tank are computationally intensive, and very difficult to implement so that results can be displayed in real-time. SIMAC uses a table look up method as well as simple mass attenuation theory to calculate bremsstrahlung production, photon transport and the resulting x-ray beam shaping. The specific theory is explained in sections E and F of the SIMAC paper.

As described above, Medical Linear Accelerators have two independent components when it comes to the electron beam current at the target. The first is the characteristics of the electron beam as it emerges from the accelerating waveguide, which can be determined by the linac load line, as shown in Figure 6. The second, and independent component, is the bending magnet, which acts as a filter, and lets electrons pass through which have a specific energy, as set by the bending magnet energy response, as described in Figure 11. The dose rate to the patient is maximised when the electron beam current is maximised at the target, which is in turn maximised when the electron energy produced by the accelerating waveguide is the same as the pass through energy set by the bending magnet. So the principle of linac “Beam tuning” is to set up the operating parameters of the linac such that the electron energy gain in the waveguide is matched to the bending magnet current setting. In this sense the word “tuning” is different form the physical sense where a frequency is adjusted to match some resonant property. Rather it implies a matching of physical characteristics (the electron beam energies) of two distinct components in the linac.

Beam tuning in a linac is done for a variety of different reasons. When a machine is first built, the operating parameters must be set in order for the linac’s performance to be optimised and baseline operating specifications to be determined. This process sets the linacs voltages in order to set the microwave power and electron beam current so that the accelerated electron beam can pass through the bending magnet and reach the target. Once the machine set up is done, it is still required to adjust the setup of a linac from time to time for two reasons: electronic control circuits do change slowly with time, and so the actual linac voltages and currents may change slowly as a control circuit degrades over time. Secondly, after any repair on a linac, and new control electronics are used, the inputs to the control circuits may be different than from the original components, which will require some adjustments in order to produce the same beam current and energy at the linac target.

Unfortunately, teaching beam tuning is not as easy we would like. The challenges for teaching this practice are that:

  1. There is a risk to damaging the accelerator if the electron path does not match the bending magnet path, and the electron beam strikes the wall of the bending magnet instead of reaching the target. The target is made to absorb the power within the electron beam (which can be considerable), whereas the bending chamber walls are not. Because the electron beam motion is done under a vacuum, perforation of any part of the vacuum system will cause a catastrophic failure, and potentially irreversible damage to the vacuum system and therefore the linear accelerator system itself. An example of a bending chamber perforation is shown in Figure 12.
  2. In order to maintain operation of a medical linac, beam operating parameters can typically only be adjusted over a narrow range. Thus, there is little opportunity for a student to learn the macro effect of parameter and voltage adjustments since the range where the linac can operate is very small.
  3. Ideally, in teaching beam tuning, the student would have access to a functioning linac. This is not always possible since linacs are dedicated to patient treatments, and so are usually not available for teaching. As well, the possibility that the clinical properties of the linac beam will change during a teaching session are real, and so appropriate quality assurance may be required after the training session, which can be a barrier to teaching.
Electron Beam Perforating the Bending Chamber

Figure 12

For these reasons, SIMAC can improve access to training on linac beam adjustments. This web page provides access to the SIMAC software itself, as well as to training materials (instructions, labs, and worksheets) to help anyone interested in either learning about linac physics, or in teaching it. A short demo of the SIMAC program can be found at this link.

SIMAC BETA

Continue to check back to get updates on the SIMAC software.
DOWNLOAD THE BETA VERSION NOW