A PINN intelligent simulation method for non-continuous ODE systems
Patent Information
- Application Number
- CN202610847698.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-12
- Publication Date
- 2026-10-09
- Estimated Expiration
- 2046-06-12
AI Technical Summary
上述不连续行为会导致系统方程在时间域上存在跳变点或导数不连续点,使得基于光滑函数逼近与自动微分构建约束的PINN方法难以直接适用
本发明引入事件表达式与锁止控制机制,具体地,将系统中的时变条件转换为“过零表达式”形式的事件表达式,为每个事件表达式配置锁止信号与锁止值:当锁止信号为正值时,事件表达式强制返回预设的锁止值,屏蔽实际条件判断;当锁止信号为负值时,事件表达式返回真实的过零值与条件值;解决了现有PINN训练过程中,因神经网络预测状态精度不足,导致的误触发条件分支切换、破坏全局连续可微假设、引发梯度异常与训练不稳定的问题,避免训练前期的低精度预测值干扰不连续点检测。本发明在单段网络的整个训练周期内锁定条件分支,强制系统维持固定运算路径,严格保障局部区间内系统方程的连续可微特性,从源头抑制不连续点错检,保障训练过程的稳定性,避免梯度震荡、残差不收敛等问题。
Smart Images

Figure CN122365969B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of intelligent modeling and simulation, intelligent control and digital twin technology, and more specifically, to a PINN intelligent simulation method for discontinuous ODE systems. Background Technology
[0002] In the field of system modeling and simulation, the dynamic behavior of complex engineering systems (such as power electronic systems, electromechanical coupling systems, and multi-domain systems containing control logic) is usually described by initial value problems of Ordinary Differential Equations (ODEs). In recent years, Physics-Informed Neural Networks (PINNs), as a method integrating data-driven and mechanistic modeling, have been gradually introduced into ODE solving and system simulation. This method approximates the system state as a continuous function of time by constructing a neural network, and uses automatic differentiation techniques to calculate the state derivatives. These derivatives are then used to construct residual constraints with the system dynamic equations, thereby enabling the calculation of ODE solutions during the training process.
[0003] Compared to traditional numerical integration methods, PINN does not rely on explicit time stepping processes. Instead, it obtains an approximate expression of the solution through global optimization in the continuous time domain, thus possessing potential advantages in scenarios requiring continuous solution representation or coupling with optimization and control algorithms. However, existing PINN methods typically imply several preconditions when solving ODE initial value problems: the system dynamics must be expressible as a continuous-time first-order differential equation, and the right-hand side of the equation and the corresponding state trajectory should exhibit good continuity and differentiability within the solution interval. In practical engineering applications, many system models contain discontinuous characteristics, such as state abrupt changes caused by switching actions, logical judgments, threshold triggers, or external events. These systems often exhibit piecewise continuous or even locally non-differentiable dynamics. These discontinuous behaviors lead to jump points or derivative discontinuities in the system equations in the time domain, making it difficult to directly apply PINN methods based on smooth function approximation and automatic differentiation to construct constraints. In such problems, PINN models are prone to residual convergence difficulties, decreased solution approximation accuracy, and inability to accurately characterize discontinuities during training.
[0004] Therefore, the existing PINN method has significant shortcomings in dealing with ODE systems with discontinuous dynamic characteristics. Its dependence on the mathematical properties of the system limits its application in the modeling and simulation of complex systems containing discrete events or piecewise logic. There is an urgent need to propose new methods to improve the applicability of PINN in such problems. Summary of the Invention
[0005] The purpose of this invention is to provide a PINN intelligent simulation method for discontinuous ODE systems, which can effectively adapt to the solution scenario of ODE systems at unknown discontinuous moments and suppress the problem of false detection of discontinuous points caused by premature and erroneous switching.
[0006] This invention provides a PINN intelligent simulation method for discontinuous ODE systems, comprising the following steps: S1: Model and preprocess the given ODE system to obtain the state derivative calculation function, zero-crossing calculation function, initial zero-crossing value and initial locking value; S2: Construct the initial PINN model based on the state derivative calculation function, zero-crossing calculation function, initial zero-crossing value, initial latching value, and user-given simulation parameters; S3: Based on the initial PINN model, use the state derivative calculation function and the zero-crossing calculation function to perform serial training to obtain the piecewise PINN fitting model for the entire simulation interval; S4: Simulation is performed using the segmented PINN fitting model of the full simulation interval.
[0007] Furthermore, step S1 specifically includes: S11: Construct a state derivative calculation function based on a given ODE system; S12: Construct an event expression based on the triggering conditions of the discontinuous behavior of the given ODE system; S13: Based on the event expression, use the locking mechanism to obtain an event expression with locking control logic; S14: Encapsulate the zero-crossing calculation logic of all event expressions with lock-up control logic into a standardized zero-crossing calculation function; S15: Based on the initial state, initial time, and initial state derivative, use the zero-crossing calculation function to obtain the initial zero-crossing value and condition value of each event expression, and store the condition value as the initial locking value of each event expression.
[0008] Furthermore, step S3 specifically includes: S31: Perform initial state calculation and lock value update based on the initial PINN model to obtain the updated zero-crossing left-hand value array, lock value array, and lock signal; S32: Based on the updated locking value array and locking signal, use the initial PINN model and state derivative calculation function to perform loss calculation and PINN parameter update, and obtain the activated state neural network and iteration counter after updating parameters; S33: Based on the updated activated neural network parameters, the current training time, the segmented interval termination time corresponding to the activated neural network, the total simulation termination time, and the maximum neural network number, perform segmented interval switching judgment to obtain the updated activated neural network, the next round training time, the time interval, and the updated current training time; S34: Based on the updated activated neural network, time interval, and updated current training time, perform forward computation and zero-crossing right-hand side value calculation to obtain the state variable prediction value, the true state derivative value, and the zero-crossing right-hand side value array; S35: Based on the zero-crossing left-end value array and the zero-crossing right-end value array, perform a preliminary zero-crossing trigger judgment to obtain the zero-crossing trigger judgment result; S36: Based on the zero-crossing trigger judgment result, the actual state derivative value, and the zero-crossing calculation function, the precision of the zero-crossing right-hand side value is corrected to obtain the corrected zero-crossing right-hand side value array; S37: Based on the modified zero-crossing right-end value array and zero-crossing left-end value array, perform zero-crossing trigger confirmation and discontinuity point location to obtain the discontinuity point time and zero-crossing trigger judgment result; S38: Based on the discontinuous point time, the estimated value of the state variable, the actual state derivative value, the zero-crossing left-hand value array, the locking value array, and the locking signal, perform segmented interval division and neural network cloning and fusion to obtain the updated neural network set, locking signal, and zero-crossing left-hand value array. S39: Based on the zero-crossing right-hand side value array and the maximum number of training iterations, update the zero-crossing left-hand side value and determine the training termination, to obtain the updated zero-crossing left-hand side value array, the updated current training time, the training termination / continuation signal, and the piecewise PINN fitting model for the full simulation interval.
[0009] Furthermore, step S31 specifically includes: Based on the initial PINN model, the latching signal, the user-given initial state and initial time, the initial state derivative value is calculated using the state derivative calculation function; Based on the initial state derivative value, the initial state, and the initial time, the zero-crossing value of each event expression is calculated using the zero-crossing calculation function to obtain an array of zero-crossing left-hand values; The locking values of each event expression are updated based on the current zero-crossing value, and the global locking signal is set to a positive value to lock the current branch, avoiding accidental switching during training. This results in the updated array of zero-crossing left-hand values, the array of locking values, and the locking signal.
[0010] Furthermore, step S32 specifically includes: Based on the updated locking value array and locking signal, the predicted state of the initial PINN model and the derivative of the predicted state obtained by automatic differentiation of the initial PINN model are obtained using the initial PINN model. The physical residual loss is calculated using the loss function based on the predicted state of the initial PINN model, the predicted state derivative obtained by automatic differentiation of the initial PINN model, and the true state derivative calculated using the state derivative calculation function. The network parameters of the initial PINN model are updated using the backpropagation algorithm based on the physical residual loss, resulting in an activated neural network with updated parameters. The iteration counter is then incremented by 1.
[0011] Furthermore, step S33 specifically includes: If the current training time is less than the termination time of the segment interval corresponding to the activated neural network, it means that the current training time is still within the current segment interval. Calculate the time interval and generate the next round of training time. If the current training time is not less than the termination time of the segment interval corresponding to the activated neural network, it means that the current segment interval has been trained. Determine whether the current activated neural network number is the maximum number: if yes, set the initial PINN model with number 1 to the activated state and set the initial time of the current activated neural network to the total simulation initial time; if no, set the neural network with the current number to the activated state and set the initial time of the current activated neural network to the start time of the segment interval corresponding to the neural network, and obtain the updated activated neural network, the next round training time, the time interval, and the updated current training time.
[0012] Furthermore, step S36 specifically includes: Based on the zero-crossing trigger judgment result, the true state derivative value, and the zero-crossing calculation function, the numerical integration method is used to integrate the true state derivative value at the current training moment to obtain a more accurate state variable correction value for the next moment; the zero-crossing calculation function is used to calculate a new zero-crossing value based on the state variable correction value and the true state derivative value, and the right-hand side value array of the zero-crossing is updated.
[0013] Furthermore, step S37 specifically includes: The corrected zero-crossing right-hand value array and zero-crossing left-hand value array are used to determine the zero-crossing trigger result as follows: If the product of all elements is >0, it means that the previous sign change was a misjudgment caused by prediction error, and there was actually no zero-crossing trigger. The zero-crossing left-hand value is updated and training is terminated. If there exists any element product ≤0, the zero-crossing trigger is confirmed. The earliest occurrence time among all zero-crossing events is calculated using linear interpolation to obtain the discontinuity point time. Segmented interval division and neural network cloning and fusion are then performed.
[0014] Furthermore, step S38 specifically includes: Set the global lock signal to a negative value to allow branch switching. Based on the current training time, the estimated value of the state variables, and the derivative value of the true state, use the zero-crossing calculation function to obtain the true zero-crossing value and conditional value at the current moment, and handle them in two cases: Case 1: Interval fusion: If the current activated neural network number is not the maximum number, and the current condition value is consistent with the locking value of the next numbered neural network, it means that the branching rules of adjacent segmented intervals are the same, and no new network is needed: Set the initial time of the next numbered neural network to the discontinuous point time, update its initial zero-crossing left end value and locking value with the current zero-crossing value, and merge the two segmented intervals; Case 2: Cloning a new neural network: If the current number is the maximum number, or the condition value is inconsistent with the lock value of the next number, it means that the branch has been switched and a new segment needs to be added: Set the termination time of the neural network with the current number, clone the current activated neural network to generate a new independent neural network with the new number i+1, synchronously update the numbers of all neural networks, set the initial time of the new neural network to the termination time of the neural network with the current number, and record its initial zero-crossing left end value and lock value; The global locking signal is reset to a positive value, the branching rules of the new segment interval are locked, and the updated neural network set, locking signal and zero-crossing left-hand value array are obtained.
[0015] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the PINN intelligent simulation method for discontinuous ODE systems described above.
[0016] Implementing the PINN intelligent simulation method for discontinuous ODE systems provided by this invention has the following beneficial effects: This invention introduces an event expression and locking control mechanism. Specifically, it converts time-varying conditions in the system into event expressions in the form of "zero-crossing expressions," and configures a locking signal and locking value for each event expression: when the locking signal is positive, the event expression is forced to return the preset locking value, masking the actual condition judgment; when the locking signal is negative, the event expression returns the true zero-crossing value and condition value. This solves the problems in existing PINN training processes caused by insufficient accuracy of neural network prediction states, leading to false triggering of conditional branch switching, violation of the global continuous differentiability assumption, gradient anomalies, and training instability. It also avoids interference from low-precision prediction values in the early stages of training with discontinuity point detection. This invention locks the conditional branch throughout the entire training cycle of a single network segment, forcing the system to maintain a fixed computation path, strictly ensuring the continuous differentiability of the system equations within local intervals, suppressing false detections of discontinuities from the source, ensuring the stability of the training process, and avoiding problems such as gradient oscillation and residual non-convergence.
[0017] This invention designs an automatic detection and location method for discontinuities based on the sign change of zero-crossing values. Specifically, this invention records the left-hand and right-hand zero-crossing values at each sampling moment, and determines whether a zero-crossing trigger has occurred by the sign of their product. If a zero-crossing is confirmed, the right-hand zero-crossing value is corrected based on numerical integration, and the earliest discontinuity point time is calculated by an interpolation algorithm. This solves the limitations of traditional segmented PINN, which requires pre-calibration of discontinuity times and cannot adapt to scenarios where discontinuity times are unknown. It also solves the problems of false zero-crossings and discontinuity point location deviations caused by insufficient prediction accuracy in the early stages of training. It can identify the discontinuity point time and jump position of the system in real time during simulation and training, without the need for pre-dividing segmented intervals. It effectively adapts to the solution scenario of ODE systems where discontinuity times are unknown, and the accuracy of discontinuity point location gradually converges with training iterations.
[0018] This invention employs a segmented adaptation mechanism combining dynamic cloning of neural networks and fusion of adjacent segmented intervals. Specifically, using the located discontinuities as segmentation nodes, the currently activated neural network is dynamically cloned to generate a new independent neural network, adapting to the new segmented intervals. Simultaneously, an adjacent interval fusion logic is designed: if the conditional branches of adjacent segmented intervals are consistent, the intervals are merged and the existing neural network is reused, avoiding redundant cloning. This solves the problem that existing PINN single-network global fitting cannot adapt to segmented continuous systems, and also addresses the low training efficiency caused by interval fragmentation and neural network redundancy during the discontinuity point localization iteration process. This invention overcomes the limitation of traditional segmentation methods requiring pre-dividing of intervals; each segmented interval can be fitted independently, accurately adapting to the dynamic characteristics of segmented continuity. Furthermore, interval fusion reduces redundant networks, lowers training costs, and improves the fitting accuracy of the final solution.
[0019] In summary, this invention proposes an automatic detection and precise location method for discontinuous points, which can identify the moment of abrupt change and the location of jumps in the system in real time during simulation and training. Based on this, a new neural network is dynamically cloned and generated according to the detected discontinuous boundaries, and each segmented continuous subsystem is independently modeled and fitted with high precision. This overcomes the limitation of traditional segmentation methods that require pre-dividing intervals, effectively adapting to the solution scenario of ODE systems with unknown discontinuous moments. This invention introduces a branch locking control mechanism. Within a single network training cycle, the conditional logic branch is locked, forcing the model to maintain a fixed computational path, preventing disordered branch switching during training, strictly ensuring the continuous differentiability of the system equations within local intervals, effectively avoiding the destruction of PINN training assumptions by dynamic branch switching, suppressing the problem of false detection of discontinuous points caused by premature and erroneous switching from the source, and fundamentally avoiding the defects of network training instability and convergence difficulties caused by discontinuous abrupt changes. It is applicable to fields such as intelligent modeling and simulation, intelligent control, and digital twins, especially in intelligent solution and analysis applications of complex systems with discontinuous dynamic characteristics. Attached Figure Description
[0020] The present invention will be further described below with reference to the accompanying drawings and embodiments. In the accompanying drawings: Figure 1 This is a flowchart of the PINN intelligent simulation method for discontinuous ODE systems provided by the present invention; Figure 2 This is a schematic diagram of the power electronic system composition principle provided by the present invention; Figure 3 This is a schematic diagram illustrating the abrupt change in the derivative variable of the ODE system provided by the present invention. Detailed Implementation
[0021] To provide a clearer understanding of the technical features, objectives, and effects of the present invention, specific embodiments of the present invention will now be described in detail with reference to the accompanying drawings.
[0022] Figure 1 A schematic diagram of the PINN intelligent simulation method for discontinuous ODE systems according to this embodiment is shown. In this embodiment, the PINN intelligent simulation method for discontinuous ODE systems includes the following steps: S1: Model and preprocess the given ODE system to obtain the state derivative calculation function, zero-crossing calculation function, initial zero-crossing value and initial locking value; It should be noted that step S1 is the first processing stage: mathematical modeling and preprocessing of the discontinuous ODE system. This stage is a pre-training step, and its core is to convert the discontinuous ODE system in the actual project into a standardized model that can be processed by this invention, and output two core calculation functions for subsequent training calls.
[0023] In one exemplary embodiment, step S1 specifically includes: S11: Construct a state derivative calculation function based on a given ODE system; It should be noted that this function serves as the core carrier of physical constraints and is used in subsequent training to calculate the derivative of the true state, which is then used to construct residual constraints with the derivative of the predicted state obtained by PINN automatic differentiation.
[0024] S12: Construct an event expression based on the triggering conditions of the discontinuous behavior of the given ODE system; It should be noted that step S12 converts the abstract discontinuous triggering conditions into quantifiable zero-crossing values, providing a basis for subsequent automatic detection of discontinuous points.
[0025] S13: Based on the event expression, use the locking mechanism to obtain an event expression with locking control logic; It should be noted that step S13 avoids accidentally triggering branch switching and destroying the training hypothesis when the PINN prediction accuracy is insufficient in the early stage of training, thus ensuring the continuous differentiability of the system equations during a single training segment.
[0026] S14: Encapsulate the zero-crossing calculation logic of all event expressions with lock-up control logic into a standardized zero-crossing calculation function; It should be noted that this function serves as the core carrier for discontinuity point detection and is used in subsequent training to calculate the zero-crossing value at each sampling time and determine whether a zero-crossing trigger has occurred.
[0027] S15: Based on the initial state, initial time, and initial state derivative, use the zero-crossing calculation function to obtain the initial zero-crossing value and condition value of each event expression, and store the condition value as the initial locking value of each event expression. It should be noted that step S15 determines the conditional branch corresponding to the initial simulation interval, providing initial rules for subsequent training locking.
[0028] S2: Construct the initial PINN model based on the state derivative calculation function, zero-crossing calculation function, initial zero-crossing value, initial latching value, and user-given simulation parameters; As an exemplary embodiment, step S2 is for pre-training initialization preparation, outputting all initial parameters and the initial PINN model required for training, based on the simulation parameters (initial state) given by the user. Initial time The simulation process includes: total simulation termination time T, maximum number of training iterations, state derivative calculation function, zero-crossing calculation function, initial locking value, and initial zero-crossing value. The execution steps are as follows: Construct an initial neural network model, numbered 1, and set as the current active neural network (i.e., the PINN currently responsible for training); initialize the global locking signal to a negative value; initialize the zero-crossing left-hand side value array as the initial zero-crossing value array; initialize the training iteration counter to 0; initialize the maximum neural network number to 1; Output: active neural network (number 1), locking signal = negative value, zero-crossing left-hand side value array, locking value array, iteration counter = 0, maximum neural network number.
[0029] S3: Based on the initial PINN model, use the state derivative calculation function and the zero-crossing calculation function to perform serial training to obtain the piecewise PINN fitting model for the entire simulation interval; In one exemplary embodiment, step S3 specifically includes: S31: Perform initial state calculation and lock value update based on the initial PINN model to obtain the updated zero-crossing left-hand value array, lock value array, and lock signal; In one exemplary embodiment, step S31 specifically includes: Based on the initial PINN model, the latching signal, the user-given initial state and initial time, the initial state derivative value is calculated using the state derivative calculation function; Based on the initial state derivative value, the initial state, and the initial time, the zero-crossing value of each event expression is calculated using the zero-crossing calculation function to obtain an array of zero-crossing left-hand values; The locking values of each event expression are updated based on the current zero-crossing value, and the global locking signal is set to a positive value to lock the current branch, avoiding accidental switching during training. The updated array of zero-crossing left-hand values, the array of locking values, and the locking signal are obtained. As an exemplary embodiment, the updated latching signal is a positive value; S32: Based on the updated locking value array and locking signal, use the initial PINN model and state derivative calculation function to perform loss calculation and PINN parameter update, and obtain the activated state neural network and iteration counter after updating parameters; In one exemplary embodiment, step S32 specifically includes: Based on the updated locking value array and locking signal, the predicted state of the initial PINN model and the derivative of the predicted state obtained by automatic differentiation of the initial PINN model are obtained using the initial PINN model. The physical residual loss is calculated using the loss function based on the predicted state of the initial PINN model, the predicted state derivative obtained by automatic differentiation of the initial PINN model, and the true state derivative calculated using the state derivative calculation function. Based on the physical residual loss, the network parameters of the initial PINN model are updated using the backpropagation algorithm to obtain the activated neural network with updated parameters, and the iteration counter is incremented by 1. S33: Based on the updated activated neural network parameters, the current training time, the segmented interval termination time corresponding to the activated neural network, the total simulation termination time, and the maximum neural network number, perform segmented interval switching judgment to obtain the updated activated neural network, the next round training time, the time interval, and the updated current training time; In one exemplary embodiment, step S33 specifically includes: If the current training time is less than the termination time of the segment interval corresponding to the activated neural network, it means that the current training time is still within the current segment interval. Calculate the time interval and generate the next round of training time. If the current training time is not less than the termination time of the segment interval corresponding to the activated neural network, it means that the current segment interval has been trained. Determine whether the current activated neural network number is the maximum number: if yes, set the initial PINN model of number 1 to the activated state and set the initial time of the current activated neural network to the total simulation initial time; if no, set the neural network of the current number to the activated state and set the initial time of the current activated neural network to the start time of the segment interval corresponding to the neural network, and obtain the updated activated neural network, the next round training time, the time interval, and the updated current training time. As an exemplary embodiment, the time interval is user-specified or uniformly sampled; S34: Based on the updated activated neural network, time interval, and updated current training time, perform forward computation and zero-crossing right-hand side value calculation to obtain the state variable prediction value, the true state derivative value, and the zero-crossing right-hand side value array; In one exemplary embodiment, step S34 specifically includes: Perform forward computation of the activated neural network to obtain the estimated values of the state variables; By utilizing the automatic differentiation function of neural networks, the state variable prediction value is differentiated with respect to the training time to obtain the state derivative prediction value; Based on the predicted values of state variables and the training time, the true state derivative value is calculated using the state derivative calculation function. Based on the estimated values of state variables, the actual derivative values of the states, and the training time, the zero-crossing values of each event expression are calculated using the zero-crossing calculation function and recorded as an array of zero-crossing right-hand side values. S35: Based on the zero-crossing left-end value array and the zero-crossing right-end value array, perform a preliminary zero-crossing trigger judgment to obtain the zero-crossing trigger judgment result; In one exemplary embodiment, step S35 specifically includes: Based on the zero-crossing left-hand value array and the zero-crossing right-hand value array, a preliminary judgment of zero-crossing trigger is made: if there is any element product ≤ 0, it means that the sign of the zero-crossing value of the corresponding event expression has changed, and it is determined that there is a zero-crossing trigger, and the precision of the zero-crossing right-hand value is corrected; if the product of all elements > 0, it means that there is no zero-crossing trigger in the interval, and the zero-crossing left-hand value is updated and the training is terminated. S36: Based on the zero-crossing trigger judgment result, the actual state derivative value, and the zero-crossing calculation function, the precision of the zero-crossing right-hand side value is corrected to obtain the corrected zero-crossing right-hand side value array; In one exemplary embodiment, step S36 specifically includes: Based on the zero-crossing trigger judgment result, the true state derivative value, and the zero-crossing calculation function, integration is performed using numerical integration methods based on the true state derivative value at the current training moment. Get the nextA more accurate state variable correction value at any given time; using the zero-crossing calculation function, calculate the new zero-crossing value based on the state variable correction value and the true state derivative value, and update the zero-crossing right-hand side value array; As an exemplary embodiment, the numerical integration method is the Euler integral; S37: Based on the modified zero-crossing right-end value array and zero-crossing left-end value array, perform zero-crossing trigger confirmation and discontinuity point location to obtain the discontinuity point time and zero-crossing trigger judgment result; In one exemplary embodiment, step S37 specifically includes: The corrected zero-crossing right-hand and left-hand zero-crossing value arrays are used to determine the zero-crossing trigger result as follows: If the product of all elements is >0, it indicates that the previous sign change was a misjudgment caused by prediction error, and there was actually no zero-crossing trigger. The left-hand zero-crossing value is updated and training is terminated. If there exists any element product ≤0, the zero-crossing trigger is confirmed. The earliest occurrence time among all zero-crossing events is calculated using linear interpolation to obtain the discontinuity point time. Segmented intervals are then divided and the neural network is cloned and fused. S38: Based on the discontinuous point time, the estimated value of the state variable, the actual state derivative value, the zero-crossing left-hand value array, the locking value array, and the locking signal, perform segmented interval division and neural network cloning and fusion to obtain the updated neural network set, locking signal, and zero-crossing left-hand value array. In one exemplary embodiment, step S38 specifically includes: Set the global lock signal to a negative value to allow branch switching. Based on the current training time, the estimated value of the state variables, and the derivative value of the true state, use the zero-crossing calculation function to obtain the true zero-crossing value and conditional value at the current moment, and handle them in two cases: Case 1: Interval fusion: If the current activated neural network number is not the maximum number, and the current condition value is consistent with the locking value of the next numbered neural network, it means that the branching rules of adjacent segmented intervals are the same, and no new network is needed: Set the initial time of the next numbered neural network to the discontinuous point time, update its initial zero-crossing left end value and locking value with the current zero-crossing value, and merge the two segmented intervals; Case 2: Cloning a new neural network: If the current number is the maximum number, or the condition value is inconsistent with the lock value of the next number, it means that the branch has been switched and a new segment needs to be added: Set the termination time of the neural network with the current number, clone the current activated neural network to generate a new independent neural network with the new number i+1, synchronously update the numbers of all neural networks, set the initial time of the new neural network to the termination time of the neural network with the current number, and record its initial zero-crossing left end value and lock value; The global locking signal is reset to a positive value to lock the branch rules of the new segmented interval, resulting in the updated neural network set, locking signal, and zero-crossing left-hand value array. S39: Based on the zero-crossing right-hand value array and the maximum number of training iterations, update the zero-crossing left-hand value and determine the training termination, to obtain the updated zero-crossing left-hand value array, the updated current training time, the training termination / continuation signal, and the piecewise PINN fitting model for the full simulation interval. In one exemplary embodiment, step S39 specifically includes: Update the array of zero-crossing left-crossing values using the zero-crossing right-hand side values, and use it as the zero-crossing left-hand side reference for the next iteration; Update the current training time and determine if the iteration counter has reached the maximum number of training iterations: if yes, exit training and output the final piecewise PINN fitting model for the full simulation interval; otherwise, recalculate the loss and update the PINN parameters, and enter the next training cycle.
[0030] S4: Simulation is performed using the segmented PINN fitting model of the full simulation interval.
[0031] It should be noted that the event expression is the zero-crossing expression or the time-varying conditional expression; the locking signal is the locking control signal; the locking value is the conditional branch locking value; the state derivative calculation function is the system dynamics function or the right-hand side function of the ODE; the zero-crossing calculation function is the event detection function; the activated state neural network is the current segmented neural network to be trained or the neural network corresponding to number i; the left-hand zero-crossing value is the historical zero-crossing value or the zero-crossing value at the beginning of the segmented interval; the right-hand zero-crossing value is the zero-crossing value at the current time or the zero-crossing value at the new sampling time; the discontinuity point is the zero-crossing trigger time, the jump point, or the abrupt change time; and the segmented interval is the sub-fitting interval or the segmented continuous interval.
[0032] In some embodiments, the PINN intelligent simulation method for discontinuous ODE systems described above can also be implemented in the following ways.
[0033] First, an event expression with locking control capability is introduced into the mathematical modeling process of the ODE system. Second, during the model training phase, zero-crossing trigger events are determined based on the calculation results of the event expression, and a numerical integration algorithm is integrated to achieve high-precision positioning of discontinuous points. Finally, multiple independent neural networks are adaptively built using discontinuous moments as segmentation nodes to complete the differentiated fitting of the system's segmented continuous intervals, fundamentally avoiding the defects of network training instability and convergence difficulties caused by discontinuous abrupt changes.
[0034] In this embodiment, the PINN intelligent simulation method for discontinuous ODE systems includes the following steps: First, for discontinuous system models, event expressions are used to describe the discontinuous behavior.
[0035] Furthermore, discontinuous behavior refers to a system of equations constrained by time-varying conditions; the values of the conditions differ at different times, thereby driving the model equations to switch.
[0036] Furthermore, time-varying conditions are represented by relational operations on time variables, including greater than >, greater than or equal to >=, less than <, and less than or equal to <=. The result of these operations is the condition value, indicating whether the condition is true or false.
[0037] Furthermore, the above time-varying conditions can be expressed as zero-crossing expressions. Specifically, the two operands of the relational operation are moved to the same side of the operator, and the original form is converted into a comparison between the operation result and the value 0. The difference between the two operands is called the zero-crossing value.
[0038] Furthermore, all event expressions in the model are uniformly numbered in an incrementing manner, and the zero-crossing values of each event expression are stored in array form according to the numbering order.
[0039] Furthermore, a locking mechanism is added to the relational operation results of the event expressions in the model. Specifically, when the locking signal is positive, the operation result of the event expression is always the locked value, and when the locking signal is negative, the operation result of the event expression takes the actual calculated condition value.
[0040] Then, the state equations of the system model are encapsulated into state derivative calculation functions, whose inputs are state variables and time, and whose outputs are the derivative values of the state variables. All event expressions are encapsulated into zero-crossing calculation functions, whose inputs are state variables, their derivatives, and time, and whose outputs are the zero-crossing values of the event expressions.
[0041] Finally, the physical information neural network is trained based on the state derivative calculation function and zero-crossing calculation function of the above system model. The training method is as follows: Step 1: Construct an initial neural network model, assign it the number 1, and set it to the activated state; initialize... The initial lock signal is set to a negative value; Step 2, based on the given initial state and initial time The initial state derivative is obtained by calling the state derivative calculation function. The zero-crossing value is obtained by calling the zero-crossing calculation function and recorded as the left-hand side value of the zero-crossing; further, the locking value of each event expression is determined based on the current zero-crossing value, and finally the locking signal is set to a positive value. Step 3: Calculate the loss value using the loss function, and update the neural network parameters based on the loss value; Step four, if Less than the termination time of the neural network in the current activated state Then calculate the time interval. With the next round of neural network input parameters Otherwise, determine if the activation state neural network number i is the largest number. If it is, set the neural network with number 1 to the active state; otherwise, set the neural network with number i+1 to the active state. Further... Set to the initial time of the activated neural network; Step 5: Perform forward computation of the activated neural network to obtain the predicted values of the state variables. Furthermore, the estimated value of the state derivative is obtained through automatic differentiation calculation using a neural network. Based on the current time and state variable predictions Call the state derivative calculation function to calculate the state derivative value. The zero-crossing value is obtained by further calling the zero-crossing calculation function, which is called the right-hand side value of the zero-crossing; Step 6: Multiply the left and right values of the recorded zero-crossing event. If the result is less than or equal to 0, it indicates that a zero-crossing event has occurred, and we need to proceed to Step 7 to perform event location. If the result is greater than 0, it indicates that no zero-crossing event has occurred, and we need to proceed to Step 10. Step 7, based on The state derivative value at time t. Points earned State variable value at time 1 Then, the zero-crossing calculation function is called to obtain the zero-crossing value, and the value on the right is updated; Step 8: Multiply the left-hand and right-hand values of the record. If the result is less than or equal to 0, then calculate the earliest event time through interpolation. Then proceed to step nine to update the event; if the result is greater than 0, it means that there is no zero-crossing trigger, then proceed to step ten; Step nine, set the latch signal to a negative value, based on the current time. State variable prediction values and state derivative value The zero-crossing calculation function is called to obtain the zero-crossing value and the condition value. If the current neural network number i is not the maximum number, the condition value is checked to see if it matches the locking value of the neural network numbered i+1. If so, it is fused with the neural network numbered i+1. Specifically, the initial time of the neural network numbered i+1 is set to... The initial left-hand side value and locking value are updated using the zero-crossing value; if the current neural network number i is the maximum number or cannot be fused with the neural network number i+1, the segment termination time of number i is set. It automatically clones the current neural network to form a new neural network, sets the new number to i+1, and synchronously updates the numbers of other neural networks, initially setting it to i. Record its initial zero-crossing left-hand value and latching value; finally, set the latching signal to a positive value. Step 10: Update the left value using the zero-crossing right-hand side value. If the training has reached the maximum number of repetitions, exit the training; otherwise, return to step three. In some embodiments, the PINN intelligent simulation method for discontinuous ODE systems described above can also be implemented in the following ways.
[0042] It should be noted that the dynamic characteristics of a given ODE system are expressed in the form of state equations. ,Will This is called the state derivative calculation function. ODE systems with discontinuous behavior typically use conditional branches to express different computational relationships, and the conditional expressions may be time-varying and unknown. It is necessary to monitor whether the conditions change during simulation and switch branches accordingly to ensure the correctness of the simulation results. The following example represents a common mathematical model of a discontinuous ODE system:
[0043]
[0044]
[0045]
[0046] In the example above, the state derivative The value in the condition The state variable changes over time; prior to this, the state derivative was always 0, meaning the rate of change of the state variable was always 0. Therefore, the state variable... The value remains at the initial value of 0. During simulation time... After that, state variables The rate of change is 1, therefore when the simulation time... At that time, state variables The value increases to 5, at which point the condition... Not satisfied, state variable The computational branch switching is performed. Based on the above analysis, it can be seen that the discontinuous ODE system is discontinuous at times 1s and 6s within the simulation interval.
[0047] When solving ODE systems based on PINN, it generally relies on the premise that the model is globally continuous and differentiable. If the system has discontinuous characteristics such as abrupt changes or jumps, it will destroy the effectiveness of gradient backpropagation, which can easily lead to problems such as slow network training convergence, abnormal gradient oscillations, deterioration of fitting accuracy, or even the model failing to converge at all.
[0048] To address the challenges of solving discontinuous ODE systems, piecewise fitting is a feasible approach. This involves decomposing the globally discontinuous model into multiple locally continuous sub-ODE systems, using the discontinuity moments as boundaries. Independent PINNs are then constructed and trained for each segment, and the piecewise fitting of these segments leverages the continuity of the system's segments, thus mitigating the solution defects caused by discontinuities. However, this approach has a key limitation: in real-world complex dynamic systems, the trigger moments and abrupt change locations are unknowns in the simulation and cannot be predicted or pre-calibrated. Therefore, it is difficult to pre-decompose system segments in the early stages of model training, making traditional fixed-segment PINN solutions unsuitable for direct application.
[0049] like Figure 2 The figure shows an embodiment of a power electronic system, whose state equations for the ODE system are as follows: sineVoltage.i = sin(2 PI time); continuousClock.y = time; switch.off = if (continuousClock.y>1) then true else false; mwAux.2 = if (switch.off) then switch.Goff else 1; mwAux.3 = if (switch.off) then 1 else switch.Ron; A = (-1) mwAux.3-mwAux.2; b = (-1) capacitor.v; switch.s = b / A; switch.i = mwAux.2 switch.s; switch.v = mwAux.3 switch.s; resistor.v = capacitor.v-switch.v; capacitor.i = (-1) sineVoltage.i-switch.i; der(capacitor.v) = capacitor.i / capacitor.C; In this embodiment, the state variable is the voltage variable `capacitor.y` of the capacitor, and the derivative variable in the above calculation formula is `der(capacitor.v)`. Furthermore, all formulas used to calculate `der(capacitor.v)` are components of the derivative calculation function. In this embodiment, the ideal switching device is controlled by a clock variable; when the clock variable `time` > 1 second, the switch opens, as shown below. Figure 3 As shown, this causes the branches containing resistors in the system topology to be eliminated, resulting in a sudden change in the current of the branch containing the capacitor, which in turn causes a sudden change in the derivative variable der(capacitor.v)=capacitor.i / capacitor.C.
[0050] To address this, this embodiment proposes a PINN intelligent simulation method for discontinuous ODE systems, which can identify system mutation moments and jump locations in real time during simulation and training. Based on this, a novel neural network is dynamically cloned and generated according to the detected discontinuity boundaries, enabling independent modeling and high-precision fitting of each segmented continuous subsystem. This overcomes the limitation of traditional segmentation methods requiring pre-division of intervals and effectively adapts to the solution scenarios of ODE systems with unknown discontinuous moments.
[0051] During PINN training, it can only be assumed that the target ODE system is continuous. The core of its training lies in first predicting the state variables through the neural network. Then, substitute the estimated value of the state variable into the ODE system state derivative calculation function to calculate the state derivative that satisfies the physical constraints. Finally, the state derivative is obtained by automatic differentiation using a neural network. The error value is compared and used to correct the neural network parameters. For ODE systems with conditional switching characteristics, the calculation rules for state derivatives dynamically switch with the logical conditions. If branch jumps are triggered directly based on instantaneous calculation results during training, the system model will not meet the pre-assumed requirements of continuity and differentiability. At the same time, the network prediction results have not yet converged in the early stage of training, and the prediction accuracy of state variables is low. Relying on unstable intermediate prediction values for conditional branch switching can easily cause problems such as misjudgment of discontinuities and positioning errors at abrupt changes, seriously affecting training stability and solution accuracy. To address the above defects, this invention introduces a branch locking control mechanism. The conditional logic branch is locked within a single network training cycle, forcing the model to maintain a fixed computation path, preventing disordered branch switching during training, strictly ensuring the continuous differentiability of the system equations within local intervals, effectively avoiding the destruction of PINN training assumptions by dynamic branch switching, and suppressing the problem of misdetection of discontinuities caused by premature and erroneous switching from the source.
[0052] In this embodiment, the PINN intelligent simulation method for discontinuous ODE systems includes: First, for discontinuous system models, event expressions are used to describe the discontinuous behavior.
[0053] Furthermore, discontinuous behavior refers to a system of equations constrained by time-varying conditions; the values of the conditions differ at different times, thereby driving the model equations to switch.
[0054] As in the previous embodiments, the derivative of the state variable Time-varying conditions Decide The calculation formulas are respectively and .
[0055] Furthermore, time-varying conditions are represented by relational operations on time variables, including greater than >, greater than or equal to >=, less than <, and less than or equal to <=. The result of these operations is the condition value, indicating whether the condition is true or false.
[0056] The result of time-varying conditions is a Boolean value, either true or false, which is called the condition value. The condition branch that takes effect is determined by the condition value.
[0057] Furthermore, the above time-varying conditions can be expressed as zero-crossing expressions. Specifically, the two operands of the relational operation are moved to the same side of the operator, and the original form is converted into a comparison between the operation result and the value 0. The difference between the two operands is called the zero-crossing value.
[0058] A zero-crossing expression moves the operands on both sides of a relational operator to the same side and compares their difference with the value 0. For example, ... The zero-crossing expression is And the difference between the two This is called a zero-crossing value. If in The zero-crossing value at time and If the zero-crossing values at time points have opposite signs, it indicates that the interval is... A zero-crossing occurred within the expression, for example, in the above zero-crossing expression. Zero was triggered within the interval.
[0059] Furthermore, all event expressions in the model are uniformly numbered in an incrementing manner, and the zero-crossing values of each event expression are stored in array form according to the numbering order.
[0060] To achieve zero-crossing event detection and localization, it is necessary to record the zero-crossing values during the training process. Therefore, each event expression is uniformly numbered for easy differentiation and storage.
[0061] Furthermore, a locking mechanism is added to the relational operation results of the event expressions in the model. Specifically, when the locking signal is positive, the operation result of the event expression is always the locked value, and when the locking signal is negative, the operation result of the event expression takes the actual calculated condition value.
[0062] As described above, an event expression has two results: a zero-crossing value and a condition value, where the condition value determines the computational branch. Based on the above analysis, it is known that the condition value cannot be directly used during training; therefore, a locking signal and a locking value are introduced for the event expression. A positive locking signal indicates that the current training mode is continuous, and the conditional branch cannot be switched; all event expressions can only use the previously determined locking value. When the training phase completes event localization and determines the point of discontinuity, the locking signal is switched to a negative value, allowing the calculation of the new branch to be updated and a new locking value to be determined. As an example, the event expression can be represented by a function: bool GreaterEvent(left, right) { zeroCross = left – right; / / Calculate zero-crossing values if (lock_flag>0) then / / Check the lock signal return locked_value; / / Use the locked value if the locking signal is positive. else return zeroCross>0; / / Use condition value when the latch signal is negative } Then, the state equations of the system model are encapsulated into state derivative calculation functions, whose inputs are state variables and time, and whose outputs are the derivative values of the state variables. All event expressions are encapsulated into zero-crossing calculation functions, whose inputs are state variables, their derivatives, and time, and whose outputs are the zero-crossing values of the event expressions.
[0063] Finally, the physical information neural network is trained based on the state derivative calculation function and zero-crossing calculation function of the above system model.
[0064] It should be noted that the design concept of this invention is: assuming the simulation interval is... Initialize a neural network numbered 1. During the training of this neural network, dynamically detect whether there are zero-crossing events. If they exist, determine the discontinuous moments. The simulation interval is then divided into segmented intervals based on this time point. and The current neural network is cloned to obtain a new neural network for fitting the ODE system of the new interval. Each subsequent segment interval can be trained independently in parallel or sequentially. If a new zero-crossing event is detected in a segment interval, the simulation interval is further segmented and the new neural network is cloned. Specifically, in the early stages of training, the accuracy of the prediction results may lead to significant deviations in the discontinuous moments of localization. It is assumed that the results are based on inaccurate moments. Divide into segmented intervals and The left half of the interval represents the condition value true, and the right half represents the condition value false. (In the training segment interval...) When the same event expression is detected crossing zero again, and the time intervals are not consecutive, the event expression is zero-crossing. At this time interval The condition value is true, and the interval is... The condition value is false. In this case, the two right half-intervals need to be merged, that is, the start time of the right half-interval is updated to... This approach not only improves positioning accuracy at discontinuous moments but also avoids cloning too many neural networks.
[0065] It should be noted that the serial training method proposed in this invention is as follows: Step 1: Construct an initial neural network model, assign it the number 1, and set it to the activated state; initialize... The initial lock signal is set to a negative value; This invention only describes the serial training method, therefore the current training input time The neural network is set to the active state based on the segment interval it is located in, and all subsequent operations are performed on that neural network. Initially, the latch signal needs to be set to a negative value so that each event expression switches calculation branches according to the actual condition value to obtain the state derivative and zero-crossing value.
[0066] Step 2, based on the given initial state and initial time The initial state derivative is obtained by calling the state derivative calculation function. The zero-crossing value is obtained by calling the zero-crossing calculation function and recorded as the left-hand side value of the zero-crossing; further, the locking value of each event expression is determined based on the current zero-crossing value, and finally the locking signal is set to a positive value. initial state and initial time Provided by the user. After calculation, the zero-crossing value at this time needs to be recorded as the left-hand side value. The right-hand side value calculated at the next time step is compared to determine whether a zero-crossing event has been triggered. At the same time, as the starting point of training, the locking value of each conditional expression in the current interval needs to be determined, and the conditional branch corresponding to the current locking value is maintained during subsequent training.
[0067] Step 3: Calculate the loss value using the loss function, and update the neural network parameters based on the loss value; Step four, if Less than the termination time of the neural network in the current activated state Then calculate the time interval. With the next round of neural network input parameters Otherwise, determine if the activation state neural network number i is the largest number. If it is, set the neural network with number 1 to the active state; otherwise, set the neural network with number i+1 to the active state. Further... Set to the initial time of the activated neural network; The first step in neural network training is to determine the input time variable. If the time of the previous round of training The right boundary time of the activated neural network has not yet been reached. If this is the case, then this round of training is still targeting the neural network numbered i. At this point, the value is determined based on dt. dt can be specified by the user or determined using a uniformly distributed sampling method. If When the right boundary time of the currently numbered neural network i is reached, the time interval for the next round will change. It is necessary to determine the neural network to be activated based on the number value and set the initial time of the sub-interval corresponding to the newly activated neural network to [value missing]. .
[0068] Step 5: Perform forward computation of the activated neural network to obtain the predicted values of the state variables. Furthermore, the estimated value of the state derivative is obtained through automatic differentiation calculation using a neural network. Based on the current time and state variable predictions Call the state derivative calculation function to calculate the state derivative value. The zero-crossing value is obtained by further calling the zero-crossing calculation function, which is called the right-hand side value of the zero-crossing; After identifying the activated neural network and its inputs, the computation phase begins to obtain the estimated value of the state variables at that moment. State derivative prediction value and state derivative value Simultaneously, the zero-crossing value corresponding to that moment is obtained, called the right-hand value, for subsequent interval determination. Has zero occurred within it?
[0069] Step 6: Multiply the left and right values of the recorded zero-crossing event. If the result is less than or equal to 0, it indicates that a zero-crossing event has occurred, and we need to proceed to Step 7 to perform event location. If the result is greater than 0, it indicates that no zero-crossing event has occurred, and we need to proceed to Step 10. Step 7, based on The state derivative value at time t. Points earned State variable value at time 1 Then, the zero-crossing calculation function is called to obtain the zero-crossing value, and the value on the right is updated; The zero-crossing right-hand side value in step five is based on the estimated value of the state variable. The calculated value, due to its low accuracy in the early stages of training, may lead to incorrect zero-crossing judgments from its right-hand side. Therefore, the state variable x is obtained by integrating the derivative value from the previous or historical time step, such as using Euler integrals. The new zero-crossing right-hand side value is calculated based on the state variable obtained from the integration.
[0070] Step 8: Multiply the left-hand and right-hand values of the record. If the result is less than or equal to 0, then calculate the earliest event time through interpolation. Then proceed to step nine to update the event; if the result is greater than 0, it means that there is no zero-crossing trigger, then proceed to step ten; If a zero-crossing event is confirmed based on the updated right-hand side value, then the earliest zero-crossing event time is calculated by interpolation. A formula for linear interpolation is: The current interval may have multiple event expressions that cross zero, so it is necessary to determine the earliest zero-crossing event.
[0071] Step nine, set the latch signal to a negative value, based on the current time. State variable prediction values and state derivative value The zero-crossing calculation function is called to obtain the zero-crossing value and the condition value. If the current neural network number i is not the maximum number, the condition value is checked to see if it matches the locking value of the neural network numbered i+1. If so, it is fused with the neural network numbered i+1. Specifically, the initial time of the neural network numbered i+1 is set to... The initial left-hand side value and locking value are updated using the zero-crossing value; if the current neural network number i is the maximum number or cannot be fused with the neural network number i+1, the segment termination time of number i is set. It automatically clones the current neural network to form a new neural network, sets the new number to i+1, and synchronously updates the numbers of other neural networks, initially setting it to i. Record its initial zero-crossing left-hand value and latching value; finally, set the latching signal to a positive value. This step completes the interval partitioning and neural network cloning operations. Once the discontinuity points are determined, the latching signal is set to a negative value and adjusted based on the current time. State variable prediction values and state derivative value Based on Instead The purpose of updating the zero-crossing value is to ensure that the zero-crossing actually occurs. Because... It is calculated by interpolation. Considering training error and numerical accuracy issues, it may not be possible to guarantee that it actually crosses zero at this moment, so it uses... Eliminate possible errors. Even at this time... It may not be precise, but with training iterations and interval fusion, these event points will gradually converge to the correct result.
[0072] If the current neural network number i is the maximum number, then it is necessary to [ Divide the data into new fitting intervals. If the current number i is not the maximum number, consider whether to merge it with the sub-interval of number i+i. The specific method is to compare... and Check if the corresponding condition values are consistent. If they are consistent, it means that the branches at the two time points are the same, and the initial time of the neural network with the number i+1 needs to be updated. If the two sub-intervals cannot be merged, or if a new fitting interval is defined, then the neural network with the current number i needs to be cloned. Using the cloning method can avoid completely retraining the network parameters, thus improving training efficiency to some extent.
[0073] Step 10: Update the left value using the zero-crossing right-hand side value. If the training has reached the maximum number of repetitions, exit the training; otherwise, return to step three.
[0074] This embodiment provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the PINN intelligent simulation method for discontinuous ODE systems described above.
[0075] The embodiments of the present invention have been described above with reference to the accompanying drawings. However, the present invention is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of the present invention without departing from the spirit and scope of the claims. All of these forms are within the protection scope of the present invention.
Claims
1. A PINN intelligent simulation method for discontinuous ODE systems, used for power electronic system simulation, characterized in that, The power electronic system includes switches, resistors, and capacitors, wherein the switches are ideal switching devices controlled by a clock variable, and the method includes the following steps: S1: Based on the ODE system of the given power electronic system, modeling and preprocessing are performed to obtain the state derivative calculation function, zero-crossing calculation function, initial zero-crossing value, and initial latch-up value, specifically including: S11: Construct a state derivative calculation function based on the ODE system of a given power electronic system. The state derivative calculation function is used to calculate the derivative of the capacitor voltage with respect to time. S12: Construct an event expression based on the triggering conditions of the discontinuous behavior of the ODE system of a given power electronic system; S13: Based on the event expression, use the locking mechanism to obtain an event expression with locking control logic; S14: Encapsulate the zero-crossing calculation logic of all event expressions with lock-up control logic into a standardized zero-crossing calculation function; S15: Based on the initial state, initial time, and initial state derivative, use the zero-crossing calculation function to obtain the initial zero-crossing value and condition value of each event expression, and store the condition value as the initial locking value of each event expression. S2: Construct the initial PINN model based on the state derivative calculation function, zero-crossing calculation function, initial zero-crossing value, initial latching value, and user-given simulation parameters; S3: Based on the initial PINN model, use the state derivative calculation function and the zero-crossing calculation function to perform serial training to obtain the piecewise PINN fitting model for the entire simulation interval; S4: Simulation is performed using the segmented PINN fitting model of the full simulation interval.
2. The PINN intelligent simulation method for discontinuous ODE systems according to claim 1, characterized in that, Step S3 specifically includes: S31: Perform initial state calculation and lock value update based on the initial PINN model to obtain the updated zero-crossing left-hand value array, lock value array, and lock signal; S32: Based on the updated locking value array and locking signal, use the initial PINN model and state derivative calculation function to perform loss calculation and PINN parameter update, and obtain the activated state neural network and iteration counter after updating parameters; S33: Based on the updated activated neural network parameters, the current training time, the segmented interval termination time corresponding to the activated neural network, the total simulation termination time, and the maximum neural network number, perform segmented interval switching judgment to obtain the updated activated neural network, the next round training time, the time interval, and the updated current training time; S34: Based on the updated activated neural network, time interval, and updated current training time, perform forward computation and zero-crossing right-hand side value calculation to obtain the state variable prediction value, the true state derivative value, and the zero-crossing right-hand side value array; S35: Based on the zero-crossing left-end value array and the zero-crossing right-end value array, perform a preliminary zero-crossing trigger judgment to obtain the zero-crossing trigger judgment result; S36: Based on the zero-crossing trigger judgment result, the actual state derivative value, and the zero-crossing calculation function, the precision of the zero-crossing right-hand side value is corrected to obtain the corrected zero-crossing right-hand side value array; S37: Based on the modified zero-crossing right-end value array and zero-crossing left-end value array, perform zero-crossing trigger confirmation and discontinuity point location to obtain the discontinuity point time and zero-crossing trigger judgment result; S38: Based on the discontinuous point time, the estimated value of the state variable, the actual state derivative value, the zero-crossing left-hand value array, the locking value array, and the locking signal, perform segmented interval division and neural network cloning and fusion to obtain the updated neural network set, locking signal, and zero-crossing left-hand value array. S39: Based on the zero-crossing right-hand side value array and the maximum number of training iterations, update the zero-crossing left-hand side value and determine the training termination, to obtain the updated zero-crossing left-hand side value array, the updated current training time, the training termination / continuation signal, and the piecewise PINN fitting model for the full simulation interval.
3. The PINN intelligent simulation method for discontinuous ODE systems according to claim 2, characterized in that, Step S31 specifically includes: Based on the initial PINN model, the latching signal, the user-given initial state and initial time, the initial state derivative value is calculated using the state derivative calculation function; Based on the initial state derivative value, the initial state, and the initial time, the zero-crossing value of each event expression is calculated using the zero-crossing calculation function to obtain an array of zero-crossing left-hand values; The locking values of each event expression are updated based on the current zero-crossing value, and the global locking signal is set to a positive value to lock the current branch, avoiding accidental switching during training. This results in the updated array of zero-crossing left-hand values, the array of locking values, and the locking signal.
4. The PINN intelligent simulation method for discontinuous ODE systems according to claim 2, characterized in that, Step S32 specifically includes: Based on the updated locking value array and locking signal, the predicted state of the initial PINN model and the derivative of the predicted state obtained by automatic differentiation of the initial PINN model are obtained using the initial PINN model. The physical residual loss is calculated using the loss function based on the predicted state of the initial PINN model, the predicted state derivative obtained by automatic differentiation of the initial PINN model, and the true state derivative calculated using the state derivative calculation function. The network parameters of the initial PINN model are updated using the backpropagation algorithm based on the physical residual loss, resulting in an activated neural network with updated parameters. The iteration counter is then incremented by 1.
5. The PINN intelligent simulation method for discontinuous ODE systems according to claim 2, characterized in that, Step S33 specifically includes: If the current training time is less than the termination time of the segment interval corresponding to the activated neural network, it means that the current training time is still within the current segment interval. Calculate the time interval and generate the next round of training time. If the current training time is not less than the termination time of the segment interval corresponding to the activated neural network, it means that the current segment interval has been trained. Determine whether the current activated neural network number is the maximum number: if yes, set the initial PINN model with number 1 to the activated state and set the initial time of the current activated neural network to the total simulation initial time; if no, set the neural network with the current number to the activated state and set the initial time of the current activated neural network to the start time of the segment interval corresponding to the neural network, and obtain the updated activated neural network, the next round training time, the time interval, and the updated current training time.
6. The PINN intelligent simulation method for discontinuous ODE systems according to claim 2, characterized in that, Step S36 specifically includes: Based on the zero-crossing trigger judgment result, the true state derivative value, and the zero-crossing calculation function, the numerical integration method is used to integrate the true state derivative value at the current training moment to obtain a more accurate state variable correction value for the next moment; the zero-crossing calculation function is used to calculate a new zero-crossing value based on the state variable correction value and the true state derivative value, and the right-hand side value array of the zero-crossing is updated.
7. The PINN intelligent simulation method for discontinuous ODE systems according to claim 2, characterized in that, Step S37 specifically includes: The corrected zero-crossing right-hand value array and zero-crossing left-hand value array are used to determine the zero-crossing trigger result as follows: If the product of all elements is >0, it means that the previous sign change was a misjudgment caused by prediction error, and there was actually no zero-crossing trigger. The zero-crossing left-hand value is updated and training is terminated. If there exists any element product ≤0, the zero-crossing trigger is confirmed. The earliest occurrence time among all zero-crossing events is calculated using linear interpolation to obtain the discontinuity point time. Segmented interval division and neural network cloning and fusion are then performed.
8. The PINN intelligent simulation method for discontinuous ODE systems according to claim 2, characterized in that, Step S38 specifically includes: Set the global lock signal to a negative value to allow branch switching. Based on the current training time, the estimated value of the state variables, and the derivative value of the true state, use the zero-crossing calculation function to obtain the true zero-crossing value and conditional value at the current moment, and handle them in two cases: Case 1: Interval fusion: If the current activated neural network number is not the maximum number, and the current condition value is consistent with the locking value of the next numbered neural network, it means that the branching rules of adjacent segmented intervals are the same, and no new network is needed: Set the initial time of the next numbered neural network to the discontinuous point time, update its initial zero-crossing left end value and locking value with the current zero-crossing value, and merge the two segmented intervals; Case 2: Cloning a new neural network: If the current number is the maximum number, or the condition value is inconsistent with the lock value of the next number, it means that the branch has been switched and a new segment needs to be added: Set the termination time of the neural network with the current number, clone the current activated neural network to generate a new independent neural network with the new number i+1, synchronously update the numbers of all neural networks, set the initial time of the new neural network to the termination time of the neural network with the current number, and record its initial zero-crossing left end value and lock value; The global locking signal is reset to a positive value, the branching rules of the new segment interval are locked, and the updated neural network set, locking signal and zero-crossing left-hand value array are obtained.
9. A computer program product, comprising a computer program, characterized in that, When executed by a processor, the computer program implements the steps of the PINN intelligent simulation method for discontinuous ODE systems as described in any one of claims 1-8.