Simulation and analysis of transition processes in linear electrical circuits using MatLab software package

. The research work considers the simulation and analysis of transition processes in linear electrical circuits using the MatLab software package. The transition processes occurring in the following linear electrical circuits were analyzed: RL equivalent circuit in case of connecting the relay control winding to a DC voltage source; RC equivalent circuit in case of connecting a capacitor through a limiting resistor to a DC voltage source and disconnecting it from the source; RLC equivalent circuit in case of capacitor discharge to an inductor; this capacitor shall be pre-charged from a DC voltage source; a branched electrical circuit of the first order where its topology changes after switching. As a result of the research, the transition process graphs were obtained for which the simulated completion time of the transient process does not differ from the calculated values with an error of less than 2%. The analysis of transition processes revealed the following: the winding inductance effect on the time of relay switching; the effect of the additional resistance value on the charge (discharge) of the capacitor; the effect of the resistance value change when the capacitor is discharged in a circuit with two reactive elements; the effect of changes in the topology of the electrical circuit on the intensity of the transient process after switching.


Introduction
The processes occurring in the electrical circuit during the transition from one steady-state energy regime to another steady-state energy regime are called transition processes (modes) [1]. The cause of transition processes is switching, i.e., a sudden change in the circuit structure, the parameters of its elements as well as the connection or disconnection of energy sources [2].
At the same time, if the electric circuit contains inductive and capacitive elements, the energy of the electric or magnetic field stored in the corresponding element cannot change abruptly during switching [3]. Therefore, if the inductance (capacitance) of the element does not change during switching, the current value in the inductance (voltage on the capacitance) immediately after switching is equal to the corresponding value before switching; further, it can smoothly change from this value [4]. The current and voltage on the resistance, the voltage on the inductance and the current flowing through the capacitance can change abruptly during switching [5]. These values are defined by the circuit state after switching [6].
As a rule, switching leads to the occurrence of temporary or permanent transiency of the processes in the circuit which can be expressed in the form of changes in the parameters such as current and voltage in different circuit parts. Such transiency is manifested in the form of the following laws [7]: -aperiodic (smooth parameter change at the absence of fluctuations); -damped periodic oscillations; -undamped periodic oscillations with an amplitude that stabilizes or increases over time.
In terms of the stability of the system parameters, the course of an aperiodic transition process during circuit switching is preferable. At the same time, as a rule, it is also desirable to reduce the duration of the transition process [8].
The relevance of the transition process analysis in the course of switching in electrical circuits is beyond any doubt since today high-speed switching devices are more and more often used in power supply systems: vacuum and gas-operated switches, magnetic starters (mostly applied in electric drive systems to control asynchronous motors) [9].
The calculations of transition processes in electrical circuits are based on the current flow laws: Ohm's law and Kirchhoff's laws. The equations developed on their basis are integrodifferential equations [10]. For an electrical circuit consisting of an L-or C-element, the differential equation will have the first order. Accordingly, for two energy storage devices in the form of L-or C-elements, the differential equation will have the second order. For n reactive elements included in the electrical circuit, the differential equation will correspondingly have the n-th order. Various methods have been developed to solve such equations, and the most widely used one is computer simulation [11][12][13][14][15].

Brief theory
In this paper, transition processes occurring in the following linear electrical circuits will be analyzed ( Figure 1): -RL equivalent circuit in case of connection of the relay control winding to a DC voltage source E (Figure 1, a); -RC equivalent circuit in the case of connecting a capacitor through a limiting resistor to a DC voltage source E and disconnecting it from the source (Figure 1, b); -RLC equivalent circuit in case of a capacitor (pre-charged from a DC voltage source E) discharge to an inductor (with the parameters R and L) (Figure 1, c); -a branched electrical circuit of the first order where its topology changes after switching (Figure 1, d). In general, the instantaneous value of the current or voltage in the circuit after switching depends on the roots of the circuit characteristic equation which is determined from the equation Z(p)=0 where Z(p) is the numerator of the input circuit resistance in the operator form of notation.
The instantaneous value of the current through the inductance in the circuit shown in Figure 1 (a) can be obtained by the formula: (1) where τ=L/R is the time constant of the RL circuit.
The instantaneous voltage value across the capacitance in the circuit shown in Figure 1 (b) can be obtained by the formula: (2) where τ=R·C is the time constant of the RC circuit.
The roots of the characteristic equation for the circuit shown in Figure 1 (c) are equal to: where The critical resistance of the circuit is determined by the condition that the discriminant is equal to zero and is equal to: The nature of the transition process in the circuit shown in Figure 1 (c) depends on the ratio of resistances R and R K: E3S Web of Conferences 389, 01045 (2023) https://doi.org/10.1051/e3sconf/202338901045 UESF-2023 -at R>R K, the transition process will be aperiodic; -at R=R K, the transition process will be aperiodic critical; -at R<RK, the transition process will be oscillating with the frequency of free oscillations equal to: (4) The operator resistance for the circuit shown in Figure 1 (d) is equal to: Where p is the root of the characteristic equation (5).
Since equation (5) has one root, a free component defining the transition process will be equal to Ae pt where the integration constant A is determined on the basis of independent initial conditions before switching.

Research methods and techniques
The calculation of the transition process course during the switching of an electrical circuit is possible with special software products such as Micro-Cap, DesignLab, ORCAD, PCAD, NI Multisim, Symica, AutoCAD Electrical, etc. [16][17][18]. However, these programs have a number of disadvantages. The main of them are the lack of the clear physical meaning of the processes underway which is clear from the equations made and solved as well as, as a rule, a high cost of commercial software products.
The universal packages that provide, inter alia, the analysis of transition processes in linear electrical circuits include the MatLab software package [19,20]. This package is designed for analytical and numerical solutions of various mathematical problems and the study of dynamical systems, including discrete, continuous, and hybrid models. The system includes the Maple computer algebra core and the Simulink extension package as well as dozens of other extension packages [21]. The Simulink mathematical simulating system is currently one of the most popular numerical calculation tools and used in various fields of knowledge [22].
The MatLab workspace provides mathematical simulation while the Simulink block library with the SimPowerSystem subdirectory provides structural and physical simulation for complex electrical circuits and the analysis of processes occurring in them, respectively [23][24][25].
As an example of the research methodology, we will simulate an equivalent circuit in the case of connecting the relay control winding to a DC voltage source E (Figure 1, a).
Add the necessary blocks from the SimPowerSystem library to the model window ( Figure  2): the DC Voltage Source block (from the Electrical Sources section), two Series RLC Branch blocks (from the Elements section), the Multimeter block (from the Measurements section) and the Powergui block (from the root section of the SimPowerSystem library). When placing and rotating elements in the model window, attention should be paid to the coordinated connection of the elements by current (by the red marker); otherwise in the future the obtained graphs of the studied quantities may be in antiphase. To study the transition process, the Simulink property is used, according to which, a moment of time equal to 0 is perceived as the commencement of the circuit operation (switching on the source) at simulation; therefore, switching keys are not required. -the Multimeter block allows measuring the values of currents and voltages of the SimPowerSystem library blocks for which the corresponding Measurements parameter is set in their dialog box. Select the measured variables in the Multimeter block parameters window that will be transmitted to its output, and also turn on the Plot selected measurements switch which allows displaying the curves of the measured signals in a separate graphic window following the end of simulation; -the Powergui block (the user interface necessary for electrical circuit simulation) in this case does not require additional settings.
Next, we will set the simulation parameters using the Simulation/Model Configuration Parameters command. To do this, calculate the time constant of the circuit , for example, at R=50 Ohm and L=5 mH it is equal to =L/R=0.005/50=0.1 ms. At that point choose the end time of the simulation (Stop time) equal to 5 . For =0.1 ms it equals 0.5 ms. Since the model has continuous states, for the Solver parameter one can select the general purpose simulation method ode45 with a variable (variable) step (Type: Variable-step). The other parameters can be left by default. One can also choose a normal (not accelerated) calculation mode (Normal).
Having started the simulation (by pressing the Run button), following its end we will immediately see the graphic window Simulation result for: Multimeter that opens with the simulation results. The simulation results for the circuit with E=20 V, R=50 ohms and L=5 mH are provided in Figure 3.  The corresponding X coordinate is 0.0001 which is equal to the calculated value of the circuit time constant =0.1 ms. Thus, the results of the calculation and simulation completely coincide. It can also be seen from the graph in Figure  4 (a) that on expiration of the time equal to 5 =0.5 ms, the transition process will end with an error of no more than 1%.
Next, determine the switching time on the relay tON. To do this, calculate the instantaneous value of the relay control winding current when it reaches 70% of the steady-state value IUST=E/R=0.4 A, as I=0.7·IUST=0.7*0.4=0.28 A. Set the cursor in the Simulation result for: Multimeter graphical window to the point with the Y coordinate value closest to the calculated value I=0.28 A (in Figure 4 (b) -Y: 0.2795). In Figure 4 (b), the corresponding X coordinate is 0.00012 which corresponds to the desired relay activation time in seconds. By changing the value of the inductance L and restarting the simulation, it is possible to draw conclusions on how the inductance of the winding L affects the relay switching time.

RC equivalent circuit
Conduct simulation and analysis of a linear electrical circuit in the case of connecting a capacitor through a limiting resistor to the DC voltage source E and disconnecting it from the source (Figure 1, b).
Omit the details of model building shown in Figure 5 as well as the rest of the simulation steps demonstrated in the research methodology. the Current Measurement blocks. The measurement results are displayed on the Scope block. The control signal to the Ideal Switch1 key for disconnecting the electrical circuit from the source is generated at the output of the Sum adder, to the input of which signals are generated from the output of the Step1 and Step2 blocks. For the ground connection of the electrical circuit, the Ideal Switch2 key is used сontrolled by a signal from the output of the Step2 block.
For the circuit with R=50 Ohm and C=10 uF, the time constant is R C=50 0.00001=0.0005 s. The time of the second switching should be at least 10 (in our case 0.005 s), so that the transition process is established with an error of no more than 1% after the first switching. In the simulation parameters window set the simulation end time (Stop time) equal to 0.01 which corresponds to the double time of the second switching.
View the simulation results by opening the Scope block window. The graphs for a circuit with E=20 V, R=50 Ohm and C=10 uF are shown in Figure 6.   Thus, the results of the calculation and simulation of the onset time coincide with an error of less than 2%.
To analyze the effect of the value of the additional resistance on the charge (discharge) of the capacitor, change the resistance value and repeat the simulation. Note the time of transition processes as well as the maximum value of the current flowing through the capacitance. Based on the results obtained, it can be concluded that with a decrease in the resistance value the transition time decreases, and the maximum value of the current flowing through the capacitance increases according to the resistance decrease. With resistance increase, obtain opposite results.

RLC equivalent circuit
Simulate and analyze a linear electrical circuit when a capacitive element is discharged to an active-inductive load (Figure 1, c) the model of which is shown in Figure 8. Study the nature of transition processes when a capacitor is discharged in a circuit with two reactive elements when the resistance value changes in the range from 0.25 RK to 1.25 RK with increments of 0.25 RK. To solve this problem, write and run a program in the Command Windows window of the MatLab package that forms a cycle in which five resistance values of the Resistance block are set while the simulation is started when accessing the model file. The graphs are based on the data t and i, which are transmitted to the workspace by two blocks To Workspace. To distinguish dependencies, some color is used (using the switch selection construct).
The results of the program operation at the resistance change for RK=50 Ohm are shown in Figure 9. From the graphs, the following conclusions can be drawn on the transition process nature: at R>RK, the transient process is oscillatory, and the greater the resistance, the longer the attenuation of oscillations is; at R=RK and R<RK there is a decrease in oscillations, and the transition process is almost aperiodic.

Branched electrical circuit
Simulate a branched electrical circuit of the first order, in which, after switching, its topology changes. Define the root of the characteristic equation for a given electrical circuit. To solve this problem, we write and run a program in the Command Windows window to find the root of the characteristic equation p for the circuit shown in Figure 1 (d) based on expression (5) for the operator resistance of the circuit after switching. Make a program for the following values of the circuit parameters: E=20 V; R1=R2=20 Ohm; R3=10 Ohm; L=5 mH: >> E=20; L=0.005; R1=20; R2=20; R3=10; syms p; D=R1*R2/(R1+R2)+R3+p*L; p=solve(D); >> p p = -4000 As a result of the program execution, the value of the root of the characteristic equation p=(-4000) s -1 will be returned. Define the circuit values of the time constant as =(-1)/p=250 ms.
Add the necessary blocks to the model window. We will provide for the output of the required simulation results in the Scope block window. Figure 10 shows a model for implementing the circuit shown in Figure 1     It can be seen from the graph that before switching the Ideal Switch unit, the transition process proceeds aperiodically while the current approaches its nominal value of 1 A. After switching, the topology of the circuit changes by reducing the total resistance, and the current starts to increase more intensively. The time constants of the circuit according to the simulation results both after connecting the source and after switching using the Ideal Switch block almost completely coincide with the calculated values with an error of less than 1%, which are respectively 0.00017 s and 0.00025 s.

Conclusion
In conclusion, it is worth noting that as a result of the work done, transitions in linear electrical circuits were simulated and analyzed using the MatLab software package. The transition processes occurring in the following linear electrical circuits were analyzed: RL equivalent circuit in case of connecting the relay control winding to a DC voltage source; RC equivalent circuit in case of connecting a capacitor through a limiting resistor to a DC voltage source and disconnecting it from the source; RLC equivalent circuit in case of capacitor discharge to an inductor; this capacitor shall be pre-charged from a DC voltage source; a branched electrical circuit of the first order where its topology changes after switching. Transient graphs were obtained and the following effects of electrical circuit parameters on the quality of the transient process were revealed: -for the RC circuit: when the resistance decreases, the transient time decreases, and the maximum value of the current flowing through the capacitance increases according to the resistance decrease. With the resistance increase we have the opposite results; -for an RLC circuit: at R>RK, the transition process is oscillatory, and the greater the resistance, the longer the attenuation of oscillations occurs; at R=RK and and R<R K there is a decrease in oscillations, and the transition process is almost aperiodic.
-for a branched circuit: the transition proceeds aperiodically, and the current approaches its nominal value. After switching, the topology of the circuit changes by reducing the total resistance, and the current starts to increase more intensively.
Thus, by simulating and analyzing transition processes in linear electrical circuits in the MatLab software package, it is possible to achieve stability and reduce the transition process duration in the course of circuit switching.