## 2 Materials and Method  
Figure 1 shows the overall setup that contains a small size four stroke power unit attached to a 1 kW single phase 230 V AC generator. Table 1 also lists the main characteristics of the engine-generator assembly. Compared to the previous study that entailed developing the actual spark duration measurement method [37], engine load was extended at 0.0, 0.3, 0.5, 0.8, and 1.0 kW, and a module was added for online evaluations. All other conditions (e.g., commercial RON95 gasoline was used) were practically the same. \begin{table}
\begin{tabular}{c c} \hline \hline
**Parameter** & **Description** \\ \hline Engine displacement & 50 cm\({}^{3}\) \\ Bore \(\times\) Stroke & 41.8 \(\times\) 36 mm \\ Net power & 1.6 kW @ 7000 rpm \\ Compression ratio & 8 \\ Number of valves & 2 \\ Ignition & fixed 30 deg bTDC \\ Fuel system & carburetor \\ Generator rated voltage & 230 V at 50 Hz \\ Rated electric power & 0.9 kVA (1.0 kVA peak) \\ Voltage regulator & Inverter—throttle connection \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Engine and generator specifications. Secondary current measurements featured an accuracy of \(\pm 1\%\) and were performed on a 50 Ohm resistance. The converted voltage signal was acquired using a device that featured an accuracy better than 2 \(\upmu\)V at the \(\pm 10\) V full scale. The data acquisition frequency was 50 kHz, equivalent to 0.48 and 0.62 deg crank angle resolution at the minimum and maximum engine speed of 4000 and 5200 rpm, respectively. In-cylinder pressure data was recorded with the same device as for secondary current traces and featured an accuracy of \(\pm 1\%\) (given by the piezo-electric transducer and amplifier chain); the resolution was 0.5 deg. The charge amplifier was operated in cyclic reset mode and no pressure referencing was performed. Besides the PCIe6361 (National Instruments) data acquisition card (DAQ) used for recording the secondary current and in-cylinder pressure traces, the PCI6143 board (National Instruments) was added for implementing the algorithm. The secondary current signal was routed to both DAQs, and the output of the algorithm was recorded with the PCIe6361 module. Figure 2 shows the core of the LabVIEW code that was built as a virtual instrument (VI), with specific sub-components highlighted. Its basic operation entails reading an analog input (AI) channel and generating a square signal as a digital output (DO). The two tasks are running in parallel, and their synchronization is implemented through the flat sequence structure that contains the actual read and write components of the AI and DO tasks, respectively. This was necessary as the PCI6143 card can generate digital outputs only on demand (i.e., software timed). The user interface contains the stop button for ending the application, the enable/disable control that starts/ends the generation of the identification (ID) signal, a monitor for confirming synchronized data acquisition, as well as monitors for the odd/even state of the TDC ID, number of samples read each loop iteration, the shift with respect to the period between two spark events, and an XY graph that shows the acquired raw and filtered signals (a median filter with left/right ranks set at 2 was used for reducing noise effects, especially at the initiation of sparks). Figure 1: Schematic illustration of the experimental setup and acquired/control signals. The sample rate of the AI task was set at 50 kHz to ensure high enough accuracy of spark duration assessments and to allow engine crankshaft revolution velocity (rpm) measurements (e.g., the chosen frequency ensures an accuracy of around 0.2% at 6000 rpm). As a basic concept, the code starts with a certain number of samples \(N\) (shown as 10,000 in Figure 2) to be acquired each loop. The data analysis sub-VI identifies all the rising edges in the recorded waveform (with a threshold set at 0.1 V, equivalent to 2 mA secondary current [37]) and stores their index location in an array.