In this section, the onboard processing of the SWPIA is described in detail. The SWPIA has two main functions: perform calculations according to the algorithm of the SWPIA and perform a data dump from the MDR to the SDR. During the data dump, the SWPIA transfers the raw data generated by the cooperative instruments, stored in the raw data partition, to the SDR. The computational results of the SWPIA stored in the processed partition and the PWE burst data stored in the PWE partition of the MDR are also transferred to the SDR. Since the SWPIA processing requires considerable computation time, the SWPIA prioritizes the data dump process over the calculation process. Once the data dump starts, the calculation process of the SWPIA is interrupted, resuming automatically after the data dump ends.
Overview of processing in SWPIA
Figure 3 shows the main flow of SWPIA processing. The SWPIA computes physical quantities that express the energy exchange between waves and particles. As described in the previous section, the energy exchange is represented as the inner product of the electricwave field vector E and the individual particle velocity vector v. The integrated quantities \({W_\mathrm{int}}\) during time interval \(\Delta t\) are computed as follows:
$$\begin{aligned} W_\mathrm{int} = \sum _{i=1}^N q {{{\varvec{E}}}_\mathrm{w}(t_i)} \cdot {{{\varvec{v}}}_i}\, , \end{aligned}$$
(3)
where \({{{\varvec{E}}}_\mathrm{w}}\) denotes the wave electric field and \(t_i\) is the detection time for each particle. In addition, the SWPIA computes \({{{\varvec{B}}}_\mathrm{w}} \cdot {{{\varvec{v}}}}\) related to the frequency variation of chorus emissions (Omura and Nunn 2011). The result for \({W_\mathrm{int}}\) is output in the form of threedimensional (3D) arrays of \(W_\mathrm{int}\), comprising components of kinetic energy K, pitch angle \(\alpha\), and phase difference \(\zeta\), which denotes the phase difference between the wave magneticfield vector and the velocity vector of the particle on the perpendicular plane with respect to the ambient magnetic field.
The SWPIA requires the input of waveforms: two components of electric fields, detected by two pairs of wire probe antennae, which are extended on the spin plane of the spacecraft (Kasahara et al. 2018b), and three components of magnetic fields, detected by triaxial searchcoil magnetometers (Kasahara et al. 2018b; Ozaki et al. 2018). The signals that are detected by these sensors are passed through several bandpass filters and variablegain amplifiers. The observed waveform data contain the effects of phase distortion as well as the effects of the gain of the PWE receiver. The calibration process for the plasma wave observation is crucial because precise phase and amplitude data are essential for quantitative analyses of the SWPIA data.
To obtain the amplitudes and phases of plasma waves detected by the sensors, the calibration process is performed in the frequency domain. After applying a fast Fourier transform (FFT) to the output signals of the PWE receivers, the wave amplitudes and phases are calibrated according to the transfer functions of the PWE receivers. After the correction of the amplitude and phase, timeseries waveforms are obtained through an inverse FFT (IFFT). Since the SWPIA independently evaluates physical quantities in the parallel and perpendicular directions relative to the ambient magnetic field, the acquired electric and magnetic waveforms and particle data are converted to vectors with respect to the ambient magnetic field. The calculations of the SWPIA are applied to the above converted physical values.
SWPIA processing
Figure 4 shows the calculation flow of the SWPIA. Before starting the calculation, the tables needed to calibrate the data of the cooperative instruments are loaded in advance from the ground by specific commands. The functions of the SWPIA are flexible. The commands from the ground control the initial settings of the calculations, such as the number of data points used in FFT and the frequency bandwidth of plasma wave data. The SWPIA can also choose various combinations from among the cooperative instruments that are dedicated to the calculations.
The time period of the raw data used in the SWPIA calculations is specified by the TI, which is also sent from the ground. Since the buffer size of the onboard synchronous dynamic randomaccess memory (SDRAM) should be smaller than the size of the specified raw data, the SWPIA reads the data from the raw data partition for time periods that are shorter than the targeted time period. The duration of the read time is 10 s for particle data and 1 s for wave data. Since the MGF provides data that are sampled at a lower rate, all of its data are read from the raw data partition to the onboard SDRAM memory before the calculations.
Processing of wave data
One record of waveform data for the SWPIA contains the TI, SWPIA clock counter, data status, and 512 points of electricfield and magneticfield waveform data. The time interval for one record corresponds to 7.8 ms in the nominal mode for a sampling frequency equal to 65,536 Hz. The SWPIA clock counter represents the timing of the first data point. The data status contains information about the operation mode of the PWE, such as the receiver gain and observation frequency bands.
Transfer functions for wave calibration
The SWPIA requires endtoend transfer functions for the WFC receivers, including the sensors needed to calibrate the observed data. The transfer function for the magneticfield data of the WFC is provided by the PWE team, based on the results of testing on the ground. With respect to the transfer functions of the electricfield data of the WFC, the antenna impedance needs to be considered in addition to the calibration of the WFC receiver. The impedance of the electricfield antennae depends on plasma density and temperatures, which means that the antenna impedance varies along the path of the satellite’s orbit. Depending on the location of the satellite, the SWPIA can select the antenna impedance to be used in the calibration from among the typical impedance values that are registered in advance. The PWE has the function of measuring the antenna impedance by the onboard calibration system (Kasahara et al. 2018b). The results of the antenna impedance measurements provide the registered values in the SWPIA.
The PWE has various operation modes. The gains and observation frequency ranges of the receivers are controllable by the telemetry commands and the onboard PWE software. The SWPIA needs to perform the onboard calibration in consideration of the PWE operation modes. Onboard preparation of the calibration tables for every PWE operation mode is not realistic; therefore, the SWPIA reproduces the transfer function for each PWE operation mode using a cubic spline interpolation in Eq. (4).
$$\begin{aligned} S_j(x) = a_j(xx_j)^3 + b_j(xx_j)^2 + c_j(xx_j) + d_j (j=0,1,...,M1; x_j< x < x_{j+1})\, . \end{aligned}$$
(4)
where \(S_j(x)\) is the transfer function as a function of the frequency x on an interval \([x_j, x_{j+1}], x_j\) is the jth frequency at which the calibration data are available, \(a_j, b_j, c_j\), and \(d_j\) are the coefficients of the polynomials obtained by the cubic spline interpolation, and M is the number of data points of the calibration table.
Calibration
The SWPIA requires the onboard calibration of waveform data. The calibration of both wave amplitudes and phases is carried out in the frequency domain. First, the SWPIA converts the five components of observed waveforms (two components of the wave electric field and three components of the wave magnetic field) to complex spectra in the frequency domain using the complex FFT. The SWPIA calibrates the obtained complex spectra with respect to the reproduced transfer functions and converts the calibrated complex spectra to waveforms in the time domain using the inverse FFT. The FFT calculation is conducted for a frame containing a specific number of data points of the waveform. Its default number is 512, which can be changed using telemetry commands. The calibration process is repeated in the frame of the FFT calculation. Since the continuity of the calibrated waveforms in consecutive FFT frames is crucial to the SWPIA, the SWPIA applies window functions and frame overlapping to waveform data in the time domain. A detailed description is reported in Hikishima et al. (2014).
Processing of particle data
At the start of the calculations of the SWPIA, data from the specified particle instruments are transferred to the SDRAM from each instrument’s assigned partition on the MDR. The sizes of the particle buffers in the SDRAM are decided based on the assigned network bandwidth of each particle instrument. A packet of particle data commonly consists of a TI packet, event packet, and counterevent packet. The TI packet is produced each time the SWPIA clock counter is reset. The event packet is produced every time a single particle is detected and includes information on the SWPIA clock counter at the time of particle detection, such as the energy and arrival direction of a particle. The counterevent packet is produced every 250 ms and includes the number of particle detections that are not transferred to the MDR, due to high particle count rates. The SWPIA identifies the observation time of each particle using both TI and the SWPIA clock counter that is included in the event packet. Furthermore, the correction of the known time delay between each sensor and its electronic circuit is considered. Each instrument has a quality flag in the event packet. The SWPIA ignores the event packet when the quality flag shows badquality data.
Data handling
The use of multiple instruments increases the complexity of data handling. First of all, the data sizes between waves and particles are largely different. (The wave data size is approximately 10 times larger than that of the particle data.) In addition, for wave processing such as FFT and calibration, largesize buffers are required on the SDRAM. Since the data size of the MGF is relatively small, all of the data generated during the calculation are stored into the SDRAM.
The wave data size that the PWE produces per unit time is constant and is determined by the sampling frequency, while the particle data vary depending on the intensity of the electron flux in the magnetosphere. The maximum production size of the particle data is limited by the data transmission bandwidth of the internal network. During the processing of the SWPIA, while reading from the flash memory, the wave data are allocated on the SDRAM for each 1 s of data, while the particle data are allocated for each 10 s of data. The algorithm always checks the start/end time (given by the set of containing the TI and SWPIA clock) of WFC data allocated on the SDRAM buffer. During the SWPIA processing, when the time tag of a particleevent data exceeds the end time of a wave dataset, it then shifts to the processing of the next particle instrument dataset. When there are no particle datasets in the buffer, a new dataset is transferred from the MDR partition to the SDRAM buffer. The raw data used in the calculations are compressed and sent to the flash memory of the MDR as processed data to validate the calculation results on the ground. The handling of this data is managed using a flag set by the performing calculations. When there are no data in the MDR, the calculations for the instrument are excluded from the calculation sequence (controlled by the flag). When there are no more particle data on the SDRAM within the time range of the allocated wave data of SDRAM, then new wave data are transferred into the SDRAM from the MDR.
Computation of W
The SWPIA calculates \({{{\varvec{E}}}_\mathrm{w} \cdot {{\varvec{v}}}}\), \({{{\varvec{B}}}_\mathrm{w} \cdot {{\varvec{v}}}}\), and \(\sigma _\mathrm{w}\) using the wave and particle datasets for the specified time span. The calculation procedure of the SWPIA is as follows:

1.
The SWPIA extracts the SWPIA clock counter, energy, and arrival direction of a particle from each event packet. Then, the observation time of each particle is determined by combining the TI in the TI packet with the SWPIA clock counter in the event packet. The SWPIA processes the particle data in the following order: MEPe, HEPL, HEPH, and XEP. (process A in Fig. 4)

2.
The SWPIA searches the plasma wave data and MGF data by referring to the observation time of each particle. Because the time of detection of the particle is not synchronized with the sampling of the waveforms, the SWPIA interpolates the waveforms at the time tag of the particle. The interpolation is also applied to the MGF data to obtain an instantaneous background magneticfield vector. (process B)

3.
Since the electricfield sensor along the spin axis is not equipped in the Arase satellite (see Kasahara et al. 2018b), the SWPIA computes the third component of the wave electricfield vector oriented to the spin axis (\(E_\mathrm{z}\)), using the relation \({{\varvec{E}}}_\mathrm{w} \cdot {{\varvec{B}}}_\mathrm{w} = 0\) under the assumption that the electromagnetic wave arrives from one direction. (process C)

4.
The \(W = {{{\varvec{E}}}_\mathrm{w} \cdot {{\varvec{v}}}}\), \({{{\varvec{B}}}_\mathrm{w} \cdot {{\varvec{v}}}}\), pitch angle \(\alpha\), and phase difference \(\zeta\) are calculated for each individual particle. Details of the calculations are described below. (process D).
The SWPIA calculates the quantities of the parallel and perpendicular wave components with respect to the ambient magnetic field \({{{\varvec{B}}}_\mathrm{0}}\) by the following procedure. The parallel and perpendicular components of the wave electricfield vector (\({{\varvec{E}}}_\mathrm{w \parallel }\), \({{\varvec{E}}}_\mathrm{w \perp }\)) can be expressed by
$$\begin{aligned} {{{\varvec{E}}}_\mathrm{w \parallel }}&= ({{{\varvec{E}}}_\mathrm{w}} \cdot {{{\varvec{e}}}_\mathrm{B_0}}) \, {{{\varvec{e}}}_\mathrm{B_0}} \, , \\ {{{\varvec{E}}}_\mathrm{w \perp }}&= {{{\varvec{E}}}_\mathrm{w}}  {{{\varvec{E}}}_\mathrm{w\parallel }} \nonumber \, , \end{aligned}$$
(5)
where \({{{\varvec{e}}}_\mathrm{B_0}}\) is the unit vector of \({{{\varvec{B}}}_\mathrm{0}}\). The parallel and perpendicular components of both the wave magneticfield vector (\({{\varvec{B}}}_\mathrm{w \parallel }\), \({{\varvec{B}}}_\mathrm{w \perp }\)) and velocity vector (\({{{\varvec{v}}}_\parallel }\), \({{{\varvec{v}}}_\perp }\)) are obtained by the same procedure. The pitch angle \(\alpha\) is given by
$$\begin{aligned}&{{{\varvec{v}}}} \cdot {{{\varvec{e}}}_\mathrm{B_0}} = {{{\varvec{v}}}} \cdot {{{\varvec{e}}}_\mathrm{B_0}} \, \mathrm{cos} \, \alpha \, , \end{aligned}$$
(6)
$$\begin{aligned}&\alpha = \mathrm{cos}^{1} \frac{ {{{\varvec{v}}}} \cdot {{{\varvec{e}}}_\mathrm{B_0}} }{ {{{\varvec{v}}}} \cdot {{{\varvec{e}}}_\mathrm{B_0}} } \, . \end{aligned}$$
(7)
The arccosine is obtained by referring to a conversion table, without the use of mathematical operations. The phase difference \(\zeta\) between \({{{\varvec{v}}}_\perp }\) and \({{{\varvec{B}}}_\mathrm{w \perp }}\) is obtained by
$$\begin{aligned}&{{{\varvec{B}}}_\mathrm{w \perp }} \cdot {{{\varvec{v}}}_\perp } = {{{\varvec{B}}}_\mathrm{w \perp }} \cdot {{{\varvec{v}}}_\perp } \, \mathrm{cos} \zeta \, , \end{aligned}$$
(8)
$$\begin{aligned}&\zeta = \mathrm{cos}^{1} \frac{ {{{\varvec{B}}}_\mathrm{w \perp }} \cdot {{{\varvec{v}}}_\perp } }{ {{{\varvec{B}}}_\mathrm{w \perp }} \cdot {{{\varvec{v}}}_\perp } } \, . \end{aligned}$$
(9)
Since \(\zeta\) is defined from \(0^\circ\) to \(360^\circ\), we refer to the sign of
$$\begin{aligned} ( {{{\varvec{B}}}_\mathrm{w \perp }} \times {{{\varvec{v}}}_\perp } ) \cdot {{{\varvec{e}}}_\mathrm{B_0}} \end{aligned}$$
(10)
to determine the corresponding quadrant. The SWPIA collects the integrated data described above for each particle instrument, stores the data with an embedded header describing the integration and compression, and then transfers the data to the processed data partition of the MDR.
These quantities are integrated over a specific time interval (10 ms) in the form of 3D arrays \(W_\mathrm{int} (K, \alpha , \zeta )\), \(\sigma _\mathrm{w} (K, \alpha , \zeta )\), and \(N(K, \alpha , \zeta )\) to obtain the particle count. The time interval can be set arbitrarily using commands and is typically shorter than the time scale (typically 100 ms) of the frequency variation of a chorus element. This improves the signaltonoise ratio of the SWPIA because the frequency variation changes the energy and pitch angle ranges of electrons, satisfying the cyclotron resonance condition.
Verification of W calculation algorithm
Katoh et al. (2013) demonstrated the validity of the calculation method in the WPIA by conducting pseudocalculations of the WPIA using the data obtained by the particle simulations that represent the resonance between whistlermode chorus waves and energetic electrons. The simulation was a onedimensional (1D) electronhybrid code with a dipole magnetic field near the magnetic equator. The times for the wave fields and particle velocities were represented as discrete time steps. The accumulated \(W_\mathrm{int}\) (Eq. 3) showed a negative value exceeding the standard deviation \(\sigma _\mathrm{w}\) (Eq. 2) during the generation of whistlemode chorus elements. The variation in \(W_\mathrm{int}\) represented the energy transfer from particles to waves.
To verify the validity of the SWPIA implemented onboard the Arase, we calculated \(W_\mathrm{int}\) and \(\sigma _\mathrm{w}\) through the onboard SWPIA software, using the simulation data obtained by Katoh et al. (2013) instead of the observation data acquired by the Arase. The time resolution of a time tag in the simulation is constant because the simulation advances waves and particles in each discretized time step. The algorithm of the SWPIA is executed by referring the time tag. With respect to the time tag of individual particles in the simulation data, we calculated and accumulated W using wave fields with corresponding timing. The calculation results generated by the onboard SWPIA and by Katoh et al. (2013) are shown in Fig. 5. In the same manner as the simulation, particles with a pitch angle of \(100^\circ\)–\(110^\circ\) and energy values ranging from 200 to 400 keV were used in the SWPIA. The resolution of \(\zeta\) was \(15^\circ\) in the simulation, whereas the minimum resolution of \(\zeta\) in the onboard SWPIA is \(30^\circ\). The results of the time variation \(W_\mathrm{int}\) of integrated \({{{\varvec{E}}}_\mathrm{w} \cdot {{\varvec{v}}}}\) and the \(\zeta\) distribution obtained by the SWPIA show good agreement with those from the simulation obtained by Katoh et al. (2013). This agreement denotes that the onboard SWPIA software correctly works on the Arase.
Optional processing
The SWPIA is equipped with some optional processing modes to improve the statistical significance of its output.
Chorus emissions are characterized by narrowband spectra with rising or falling frequency tones over time. Other emissions (e.g., electron cyclotron harmonic waves, MSWs) appear with the chorus waves. When this happens, the waveform of chorus elements to be analyzed by the SWPIA is contaminated. Since the contamination reduces the statistical significance of the SWPIA output, a spectral extraction method is applied to remove the other emissions. During the calibration procedure for wave electromagnetic fields, after passband processing with fixed frequencies, the most intense spectral component and the adjacent two components are used to reconstruct the calibrated waveform. The other frequency components are set to zero. An appropriate frequency resolution and a window function are selected for the spectral extraction.
To improve the signaltonoise ratio of the SWPIA output, we can focus on particles with kinetic energies and pitch angles that satisfy the cyclotron resonance condition in chorus emissions. The resonance velocity \(V_\mathrm{R}\) for waves propagating purely parallel to the background magnetic field is given by
$$\begin{aligned} V_\mathrm{R} = \frac{ \omega  \Omega _\mathrm{e}/ \gamma }{ k_\parallel } \, , \end{aligned}$$
(11)
where \(\omega\) is the wave frequency, \(\Omega _\mathrm{e}\) is the local electron gyrofrequency, and \(k_\parallel\) is the parallel component of the wave number of whistlermode waves, given by
$$\begin{aligned} k_\parallel ^2 = \Bigl ( \frac{\omega }{c} \Bigr )^2 \Biggl \{ 1 + \frac{ \omega _\mathrm{pe}^2 }{ \omega (\Omega _\mathrm{e}  \omega )} \Biggr \} \, , \end{aligned}$$
(12)
where \(\omega _\mathrm{pe}\) is the electron plasma frequency. During the computation of resonance velocity, the wave frequency of the dominant mode is used, which is obtained in the FFT analysis for a time interval during which the chorus frequency does not vary largely over time. Since \(\omega _\mathrm{pe}\) is needed to compute the resonance velocity, we refer to the upper hybrid resonance frequency (\(\omega _\mathrm{UHR}\)) provided by the PWE highfrequency analyzer (Kumamoto et al. 2018) every second via the relay packet. The plasma frequency can be obtained from
$$\begin{aligned} \omega _\mathrm{UHR}^2 = \omega _\mathrm{pe}^2 + \Omega _\mathrm{e}^2 \, . \end{aligned}$$
(13)
With respect to the computed resonance velocity, we can select particles that satisfy the resonant condition with the observed chorus elements for the calculations of the SWPIA.
In the nominal observation mode, the PWE captures waveforms at a sampling frequency of 65 kHz. A higher sampling frequency of 120 kHz is available only for the wave electric field to obtain the amplitude and phase of the waveform with better time resolution. At this higher sampling rate, the waveform is intermittently transferred to the MDR due to the assignment of the transmission band. The frequency resolution of the spectra is determined by the number of data points used in the SWPIA calculation, and this number is automatically adjusted to match the frequency resolution of the 65 kHz sampling mode.