Configurable quality dynamic modeling method and system based on Modelica language
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-19
- Publication Date
- 2026-03-13
Smart Images

Figure CN121659537A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer simulation technology, and in particular to a configurable quality dynamic modeling method and system based on the Modelica language. Background Technology
[0002] Modelica is an equation-based, multi-domain physical system modeling language widely used for modeling and simulating mechanical, electrical, thermal, and fluid systems. The existing Modelica mechanical translation library provides mass elements with fixed mass, whose dynamic equation is F=m·a, where mass m is a constant. This model can describe most constant-mass systems, but it cannot accurately reflect the dynamic behavior of mass changing over time. In practical engineering, there are many variable-mass systems, such as mass reduction due to rocket fuel combustion, mass increase due to material loading on transport vehicles, and mass reduction due to liquid loss from storage tanks. However, the existing Modelica library lacks a modeling mechanism that can dynamically update mass parameters, making it difficult for users to model and solve variable-mass systems within the same simulation framework, resulting in insufficient simulation accuracy and limited applicability. Therefore, there is an urgent need for a modeling method that can realize dynamic changes in mass parameters over time within the Modelica environment, addressing the lack of a dynamic mass parameter update mechanism in the existing Modelica library. Summary of the Invention
[0003] This application provides a configurable dynamic quality modeling method and system based on the Modelica language, which solves the technical problem that the existing Modelica library lacks a modeling mechanism that can dynamically update quality parameters.
[0004] To achieve the above objectives, this application adopts the following technical solution: Firstly, a configurable mass dynamic modeling method based on the Modelica language is provided, including: S1: obtaining the current simulation time, simulation stop time, and step size, and constructing a two-dimensional data table of simulation time and mass; S2: performing interpolation on the two-dimensional data table according to the simulation time to obtain the mass value at the current moment; S3: differentiating the mass value to obtain the rate of change of mass with time; S4: establishing kinematic relationships based on the potential and flow variables constraints of the Modelica mechanical translational connector; S5: constructing a variable mass dynamic equation based on the kinematic relationship, the mass value at the current moment, and the rate of change of mass with time; S6: solving the dynamic equation and the connector conservation equation together to obtain the velocity, displacement, and force results at the current moment; S7: advancing the simulation time to the next moment and repeating S1 to S6 until the preset simulation stop time is reached to stop the simulation and obtain the simulation results.
[0005] In conjunction with the first aspect above, in one possible implementation, interpolation is performed on the two-dimensional data table based on the simulation time to obtain the quality value at the current moment. This includes: determining the interval between the current simulation time and adjacent first and second time points in the two-dimensional data table; calculating the quality value at the current moment using linear interpolation based on the first quality value corresponding to the first time point and the second quality value corresponding to the second time point; the quality value at the current moment satisfies the following formula:
[0006] in, The first mass value, This is the second mass value. As the first point in time, This is the second time point, where t is the current time. When the simulation time exceeds the time range of the two-dimensional data table, the boundary value extrapolation method is used to output the quality values at adjacent boundaries.
[0007] In conjunction with the first aspect mentioned above, in one possible implementation, kinematic relationships are established based on the potential and flow variables of the Modelica mechanical translation connector. This includes: defining the potential variable of the mechanical translation connector as velocity and the flow variable as force, and ensuring that the first and second interfaces of the connector satisfy preset constraints; and establishing kinematic relationships between displacement, velocity, and acceleration based on the potential variable, flow variable, and preset constraints.
[0008] In conjunction with the first aspect mentioned above, in one possible implementation, preset constraints include: the sum of the flow variables in the first interface and the second interface is 0; the potential variables in the first interface and the potential variables in the second interface are equal.
[0009] In conjunction with the first aspect mentioned above, one possible implementation involves constructing a variable mass dynamic equation based on kinematic relations, the current mass value, and the rate of change of mass over time. This includes: introducing the current mass and its rate of change based on the kinematic relations, and constructing the dynamic equation of the variable mass system based on the principle of conservation of momentum.
[0010] In conjunction with the first aspect mentioned above, in one possible implementation, the dynamic equations satisfy the following formula:
[0011] Where F is the total force transmitted through the mechanical translation connector. For the quality of the current simulation moment, For acceleration, For speed, This represents the rate of change of mass over time.
[0012] In conjunction with the first aspect mentioned above, one possible implementation involves solving the dynamic equations and the connector conservation equations together to obtain the velocity, displacement, and force results at the current moment. This includes: combining the dynamic equations and the connector conservation equations to form a combined equation; inputting mass, rate of change of mass, velocity, and acceleration as solution variables into the combined equation; and calling the Modelica solver to perform numerical calculations on the equation set to obtain the displacement, velocity v, acceleration a, and force results at the current moment.
[0013] Secondly, a configurable mass dynamic modeling system based on the Modelica language is provided, including: a time generation module, a mass data processing module, a kinematics calculation module, a dynamics solution module, and a simulation control module; The system comprises the following modules: a time generation module for acquiring the current simulation time, simulation stop time, and step size; a mass data processing module for constructing a two-dimensional data table relating simulation time and mass based on the current simulation time, simulation stop time, and step size, and determining the rate of change of mass over time; a kinematics calculation module for establishing kinematic relationships between displacement, velocity, and acceleration based on the potential and flow constraints of the mechanical translational connector; a dynamics solution module for constructing the variable mass dynamics equations based on the kinematic relationships, the current mass value, and the rate of change of mass over time, and solving them together with the force conservation equations of the connector to obtain the velocity, displacement, and force results of the system at the current moment; and a simulation control module for advancing the simulation time to the next moment and repeating the calculation process from the time generation module to the dynamics solution module until the preset simulation end time is reached, outputting the dynamics simulation results of the variable mass system.
[0014] In conjunction with the second aspect above, in one possible implementation, the quality data processing module includes: a quality value calculation unit and a quality change rate calculation unit; wherein, the quality value calculation unit is used to construct a two-dimensional data table containing the correspondence between simulation time and quality, and to perform interpolation operations on the two-dimensional data table according to the current simulation time to obtain the quality value at the current moment; the quality change rate calculation unit is used to differentiate the quality value to obtain the rate of change of quality over time.
[0015] In conjunction with the second aspect above, in one possible implementation, the kinematic calculation module is also used to: define the potential variable of the mechanical translation connector as velocity and the flow variable as force, and ensure that the first and second interfaces of the connector satisfy preset constraints; and establish the kinematic relationship between displacement, velocity and acceleration based on the potential variable, flow variable and preset constraints.
[0016] This application provides a configurable mass dynamic modeling method and system based on the Modelica language. By introducing a time-driven dynamic mass update mechanism into the Modelica environment, configurable modeling of mass parameters changing over time is achieved. Through interpolation of the mass and time two-dimensional tables and differentiation of the mass change rate, the system can update the mass value in real time at each time step and solve for the system's forces, velocities, and displacements based on extended dynamic equations. Compared to existing Modelica mass elements that only support constant mass, this application can accurately describe the dynamic behavior of objects with mass changing over time, is compatible with Modelica's original mechanical translation connector interface, achieves seamless switching between constant and variable mass modeling, improves the modeling accuracy and applicability of Modelica in practical variable mass systems, and solves the technical problem of existing Modelica libraries lacking a modeling mechanism capable of dynamically updating mass parameters.
[0017] It should be understood that the descriptions of technical features, technical solutions, beneficial effects, or similar language in this application do not imply that all features and advantages can be achieved in any single embodiment. Rather, it is understood that the description of a feature or beneficial effect means that a specific technical feature, technical solution, or beneficial effect is included in at least one embodiment. Therefore, the descriptions of technical features, technical solutions, or beneficial effects in this specification do not necessarily refer to the same embodiment. Furthermore, the technical features, technical solutions, and beneficial effects described in this embodiment can be combined in any suitable manner. Those skilled in the art will understand that embodiments can be implemented without one or more specific technical features, technical solutions, or beneficial effects of a particular embodiment. In other embodiments, additional technical features and beneficial effects may be identified in specific embodiments that do not embody all embodiments. Attached Figure Description
[0018] Figure 1 A system architecture diagram of a configurable quality dynamic modeling system based on the Modelica language is provided for embodiments of this application; Figure 2 A flowchart illustrating a configurable quality dynamic modeling method based on the Modelica language, provided for an embodiment of this application; Figure 3 A flowchart illustrating another configurable dynamic quality modeling method based on the Modelica language provided in this application embodiment; Figure 4 A flowchart illustrating another configurable dynamic quality modeling method based on the Modelica language provided in this application embodiment; Figure 5A flowchart illustrating another configurable dynamic quality modeling method based on the Modelica language provided in this application embodiment; Figure 6 Simulation results of a configurable quality dynamic modeling method based on the Modelica language provided in this application embodiment; Figure 7 The simulation result diagram shows a configurable quality dynamic modeling method based on the Modelica language provided in the embodiments of this application. Detailed Implementation
[0019] In the description of this application, unless otherwise stated, " / " means "or," for example, A / B can mean A or B. The "and / or" in this document is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, and B alone. Furthermore, "at least one" means one or more, and "multiple" means two or more. The terms "first," "second," etc., do not limit the quantity or order of execution, and "first," "second," etc., do not necessarily imply differences.
[0020] It should be noted that, in this application, the terms "exemplary" or "for example" are used to indicate that something is being described as an example, illustration, or illustration. Any embodiment or design described as "exemplary" or "for example" in this application should not be construed as being more preferred or advantageous than other embodiments or design solutions. Specifically, the use of terms such as "exemplary" or "for example" is intended to present the relevant concepts in a concrete manner.
[0021] The configurable quality dynamic modeling method based on the Modelica language provided in this application embodiment can be applied to, for example... Figure 1 In the configurable quality dynamic modeling system based on the Modelica language shown, such as Figure 1 As shown, the system includes: a time generation module 101, a mass data processing module 102, a kinematics calculation module 103, a dynamics solution module 104, and a simulation control module 105.
[0022] The time generation module 101 is used to obtain the current simulation time, simulation stop time, and step size. The quality data processing module 102 is used to construct a two-dimensional data table of the correspondence between simulation time and quality based on the current simulation time, simulation stop time and step size, and to determine the rate of change of quality over time. Kinematics calculation module 103 is used to establish kinematic relationships between displacement, velocity and acceleration based on the potential and flow variables constraints of the mechanical translation connector. In one possible implementation, the kinematic calculation module 103 is further used to: define the potential variable of the mechanical translation connector as velocity and the flow variable as force, and make the first interface and the second interface of the connector satisfy preset constraints; and establish the kinematic relationship between displacement, velocity and acceleration based on the potential variable, flow variable and preset constraints.
[0023] The dynamics solution module 104 is used to construct the variable mass dynamic equation based on the kinematic relationship, the mass value at the current moment, and the rate of change of mass over time, and solve it together with the force conservation equation of the connector to obtain the velocity, displacement and force results of the system at the current moment. The simulation control module 105 is used to advance the simulation time to the next moment and repeat the calculation process from the time generation module to the dynamic solution module until the preset simulation end time is reached, and output the dynamic simulation results of the variable mass system.
[0024] In one possible implementation, the quality data processing module 102 includes: a quality value calculation unit and a quality change rate calculation unit; wherein, the quality value calculation unit is used to construct a two-dimensional data table containing the correspondence between simulation time and quality, and to perform interpolation operation on the two-dimensional data table according to the current simulation time to obtain the quality value at the current moment; the quality change rate calculation unit is used to differentiate the quality value to obtain the rate of change of quality over time.
[0025] To address the technical problem of the lack of a modeling mechanism capable of dynamically updating mass parameters in the existing Modelica library, this application provides a configurable dynamic mass modeling method based on the Modelica language. The method includes: S1: Obtaining the current simulation time, simulation stop time, and step size, and constructing a two-dimensional data table of simulation time and mass; S2: Performing interpolation on the two-dimensional data table based on the simulation time to obtain the mass value at the current moment; S3: Differentiating the mass value to obtain the rate of change of mass over time; S4: Establishing kinematic relationships based on the potential and flow variables constraints of the Modelica mechanical translational connector; S5: Constructing a variable mass dynamic equation based on the kinematic relationship, the current mass value, and the rate of change of mass over time; S6: Solving the dynamic equation and the connector conservation equation together to obtain the velocity, displacement, and force results at the current moment; S7: Advancing the simulation time to the next moment and repeating S1 to S6 until the simulation stops at a preset time point, obtaining the simulation results.
[0026] Figure 2 A flowchart illustrating the configurable quality dynamic modeling method based on the Modelica language provided in this application embodiment is shown below. Figure 2 As shown, the method includes: S1. Obtain the current simulation time, simulation stop time, and step size, and construct a two-dimensional data table of simulation time and quality.
[0027] Wherein, simulation time represents the time from the start of the simulation to the current calculation point, simulation stop time represents the termination time of the entire simulation process, and step size represents the magnitude of the time increment of the simulation calculation.
[0028] In one possible implementation, the Clock component of the time generator can generate a time series according to the user-defined initial time, end time, and step size, and construct an N×2 two-dimensional table with predefined quality data, where the first column is time and the second column is the corresponding quality value.
[0029] It should be noted that this two-dimensional data table can be used to represent both constant mass and mass that changes over time, and the number of rows and columns in the data table can be dynamically adjusted according to actual simulation requirements.
[0030] As an example, time can be generated from 0s to 10s in steps of 0.01s, and a two-dimensional table can be constructed by combining the initial mass value and the change pattern. For example, the first row with time 0 corresponds to a mass of 1000kg, and the last row with time 10s corresponds to a mass of 500kg.
[0031] S2. Perform interpolation on the two-dimensional data table based on the simulation time to obtain the quality value at the current moment.
[0032] Interpolation refers to finding adjacent time points in a two-dimensional data table based on the current simulation time and calculating the quality value at the current moment according to the selected method.
[0033] In one possible implementation, the current simulation time is determined to be within the interval between adjacent first and second time points in the two-dimensional data table. Based on the first mass value corresponding to the first time point and the second mass value corresponding to the second time point, linear interpolation is used to calculate the mass value at the current moment. When the simulation time exceeds the time range of the two-dimensional data table, boundary value extrapolation is used to output the mass values at adjacent boundaries.
[0034] It should be noted that when the current simulation time exceeds the range of the data table, you can choose to maintain the last value through constant extrapolation, perform periodic extrapolation, or issue an error message to ensure the continuity and stability of the simulation process.
[0035] As an example, if the time series is 0, 2, 4s, corresponding to masses of 1000, 900, 800 kg, then at the current simulation time t=1s, the interpolation result is 950 kg.
[0036] S3. Differentiate the mass value to obtain the rate of change of mass over time.
[0037] Among them, the rate of change of mass represents the speed at which the mass changes per unit time at the current moment, denoted as dm / dt, and is one of the key parameters for the calculation of variable mass dynamics.
[0038] In one possible implementation, the mass value in the two-dimensional table can be differentiated using numerical differentiation methods, such as by using forward difference or central difference formulas to obtain dm / dt, and then output to the calculation module in real time.
[0039] It should be noted that for the case of constant mass, dm / dt is zero, but this value still needs to be calculated to ensure the generality of the model and the consistency of the code.
[0040] S4. Based on the potential and flow constraints of the Modelica mechanical translation connector, establish the kinematic relationship.
[0041] In one possible implementation, the potential variable of the mechanical translational connector is defined as velocity, and the flow variable as force, with the first and second interfaces of the connector satisfying preset constraints. Based on the potential variable, flow variable, and preset constraints, the kinematic relationship between displacement, velocity, and acceleration is established.
[0042] It should be noted that this kinematic relationship is applicable to single-degree-of-freedom translations and can also be extended to multi-degree-of-freedom systems. At the same time, it can handle additional inertial force terms caused by mass changes over time, ensuring the accuracy and continuity of the mechanical solution.
[0043] S5. Construct a variable mass dynamic equation based on the kinematic relationship, the current mass value, and the rate of change of mass over time.
[0044] In one possible implementation, based on the kinematic relations, the current mass and its rate of change are introduced, and the dynamic equations of the variable mass system are constructed based on the principle of conservation of momentum.
[0045] As an example, in an embodiment of this application, the dynamic equation satisfies the following formula:
[0046] Where F is the total force transmitted through the mechanical translation connector. For the quality of the current simulation moment, For acceleration, For speed, This represents the rate of change of mass over time.
[0047] S6. Solve the dynamic equation and the connector conservation equation together to obtain the velocity, displacement and force results at the current moment.
[0048] The conservation equations include constraints on the connector flow variables and potential variables, which are used to ensure force balance and velocity consistency, and serve as constraints for solving the dynamics problem.
[0049] In one possible implementation, the dynamic equations and conservation equations are combined to form a system of equations, which is then solved using Modelica's built-in solver or a custom iterative algorithm, outputting the current velocity, displacement, and force in real time. This solution process is executed once for each simulation step, ensuring the continuity and stability of the simulation process, while numerical accuracy can be improved through error monitoring and adaptive step size adjustment.
[0050] S7. Advance the simulation time to the next moment and repeat S1 to S6 until the preset time point is reached, at which point the simulation stops and the simulation results are obtained.
[0051] The simulation time advancement means increasing the current time by a step size Δt and repeating the aforementioned steps until the termination time is reached or the event triggering condition is met, thus forming a complete dynamic simulation process.
[0052] In one possible implementation, the Clock component is used to automatically update the current simulation time. Based on the updated simulation time, the mass is interpolated and calculated. Then, through a complete process of differentiation, establishing dynamic equations, and joint solution, the simulation results are obtained through iterative iteration.
[0053] As an example, in this embodiment of the application, the water bottle ball falling simulation starts from t=0s, and is calculated cyclically with a step length Δt=0.001s. Finally, the water bottle ball hits the ground at t=0.786s. At the same time, the mass, velocity, displacement and force of each time step are recorded to achieve high-precision dynamic simulation.
[0054] This application achieves standardization and configurability of variable mass input by establishing a two-dimensional data table of time and mass; ensures the continuity and smoothness of mass change through interpolation algorithms; captures the rate of mass change by real-time differentiation, enabling the dynamic model to reflect the inertial effect of mass flow; combines the potential and flow variables constraints of Modelica mechanical connectors to accurately construct dynamic equations suitable for variable mass systems; the joint solution mechanism of the equations ensures the consistency and numerical stability of velocity, displacement, and force results; finally, by progressively advancing the simulation time, it achieves time-series solution and state tracking of the entire dynamic process, making the model both compatible with the Modelica standard library and expanding its application boundaries in the field of variable mass dynamics. It can be widely used in modeling and simulation scenarios of various systems with mass change characteristics, such as aerospace propulsion, mechanical transportation, and liquid transport, solving the technical problem that the existing Modelica library lacks a modeling mechanism that can dynamically update mass parameters.
[0055] In one possible implementation of the embodiments of this application, combined with Figure 2 ,like Figure 3 As shown, the above S2 performs interpolation calculations on the two-dimensional data table based on the simulation time to obtain the current mass value. This can be specifically achieved through the following S301, S302, and S303, which are explained in detail below: S301. Determine the current simulation time within the interval between the first and second adjacent time points in the two-dimensional data table.
[0056] In one possible implementation, the simulation control module first reads the current simulation time, and then performs a binary search or index scan to locate the interval in the table that satisfies the conditions at the first and second time points.
[0057] As an example, if a two-dimensional table contains time points {0.0, 0.5, 1.0, 1.5}, and the current simulation time t = 0.72s, the lookup algorithm will locate the interval between t2 = 0.5s and t3 = 1.0s, obtaining index i = 2 for subsequent interpolation.
[0058] S302. Based on the first mass value corresponding to the first time point and the second mass value corresponding to the second time point, the mass value at the current time is calculated by linear interpolation.
[0059] Linear interpolation refers to obtaining the quality value corresponding to the current simulation time by performing proportional calculations within a time interval, given two adjacent time points and their corresponding qualities, thus making the quality changes of the discrete time series appear continuous.
[0060] In one possible implementation, based on the two time points determined in the previous step, the corresponding quality data is read, and the quality value at the current moment is calculated according to the proportional relationship of the time intervals. To prevent numerical instability, an average quality value can be used as an approximation when the time interval is extremely small, thereby ensuring the numerical stability of the interpolation result.
[0061] It should be noted that while linear interpolation is computationally simple and fast, it may introduce errors in scenarios with high rates of quality change or nonlinearity. Therefore, higher-order interpolation methods can be flexibly selected based on the operating conditions, or accuracy can be improved by reducing the simulation step size. Furthermore, under high-speed iterative conditions, frequent updates to the interpolated data should be avoided to reduce the computational burden.
[0062] As an example, in an embodiment of this application, the mass value at the current moment satisfies the following formula:
[0063] in, The first mass value, This is the second mass value. As the first point in time, This is the second time point, where t is the current time. S303. When the simulation time exceeds the time range of the two-dimensional data table, the mass value at the adjacent boundary is output using the boundary value extrapolation method.
[0064] In this context, "out of range" refers to situations where the current simulation time is earlier than the minimum time point or later than the maximum time point. Boundary value extrapolation is a commonly used numerical processing strategy, where, when the range is exceeded, the system directly uses the mass value at the boundary as the mass output at the current moment.
[0065] In one possible implementation, the simulation time is first determined to be outside the timetable. If the time is earlier than the minimum value, the initial quality value is used; if it is later than the maximum value, the final quality value remains unchanged. Simultaneously, an extrapolation event record is generated so that the user can confirm whether the simulation time exceeds the valid range in subsequent analysis.
[0066] It should be noted that this boundary value extrapolation strategy is applicable to most engineering applications and can effectively avoid non-physical fluctuations during simulation. However, for some systems that require continuous or periodic changes, the boundary extrapolation can be replaced with linear extrapolation, periodic extrapolation, or a trigger event-based stopping mechanism, depending on the requirements, to maintain physical consistency.
[0067] As an example, when the maximum value of the timetable is 10 seconds and the current simulation time is 12 seconds, the system will automatically output the quality value at 10 seconds and record a boundary extrapolation event in the background to prompt the user that the time has exceeded the defined range.
[0068] This application's embodiments achieve efficient time index positioning by accurately determining the time interval of the current simulation time, enabling the system to respond quickly in large-scale or non-uniform time step data environments and improving overall simulation efficiency. By smoothing discrete mass data through a linear interpolation algorithm, the continuity and physical rationality of mass changes over time are ensured, providing high-quality input for subsequent differentiation calculations and the establishment of dynamic equations. The introduction of a boundary value extrapolation strategy maintains the stability and physical consistency of the model output when the simulation time exceeds the data table's defined range, effectively avoiding abnormal oscillations or computational interruptions, and enabling the variable mass modeling process to maintain stable numerical performance across different time scales.
[0069] In one possible implementation of the embodiments of this application, combined with Figure 2 ,like Figure 4 As shown, the kinematic relationship established by S4 above based on the potential and flow variables constraints of the Modelica mechanical translation connector can be specifically implemented through the following S401 and S402, which are explained in detail below: S401. Define the potential variable of the mechanical translation connector as velocity and the flow variable as force, and ensure that the first and second interfaces of the connector meet the preset constraints.
[0070] Among them, potential variable refers to the displacement derivative quantified signal at the connector, usually expressed in the form of velocity; flow variable refers to the action transmitted at the connector, usually expressed in the form of force; the first interface and the second interface correspond to the two ends of the component, respectively, and are used to establish a dynamic connection with external mechanical components.
[0071] In one possible implementation, the two ports are declared as mechanical translational connectors in the component's interface definition section, and the potential variable field is defined as a velocity variable and the flow variable field as a force variable in the connector properties. Subsequently, the naming and data types of the two ports are bound in the component interface layer to ensure automatic matching of the corresponding signals from external components during model connection. Pre-defined constraints include: the sum of the flow variables in the first and second interfaces is 0; the potential variables in the first and second interfaces are equal.
[0072] It should be noted that, in order to ensure compatibility and interoperability with the Modelica standard library, the speed and force signals of the connector must comply with the same data type and unit conventions. At the same time, the semantics of the constraints should be clearly defined at the interface level to avoid inconsistencies or hidden errors when connecting complex systems.
[0073] As an example, the external interfaces of the component are named flage_a and flage_b, and the documentation states that the two interfaces expose velocity signals and force signals respectively. It is required that when the component is connected to the mechanical link, the velocities of the two interfaces are the same and the forces they are subjected to meet the preset equilibrium conditions, so as to facilitate the construction and solution of the subsequent system of equations.
[0074] S402. Based on potential variables, flow variables, and preset constraints, establish the kinematic relationship between displacement, velocity, and acceleration.
[0075] In one possible implementation, the velocity signals of the two endpoints are read through the interface and the velocity state variables are maintained internally. Then, time difference or integration operations are performed on the velocity states to obtain the corresponding displacement and acceleration estimates. At the same time, the consistency conditions between the endpoints are updated in real time according to the connector constraints, and these kinematic relationships are passed to the solver as constraint submodules.
[0076] As an example, in a horizontal translation scenario, if the velocities of the two interfaces are agreed to be equal, the system uses that velocity in each simulation step to calculate the current displacement increment and velocity change, thereby obtaining an acceleration estimate and providing the necessary initial values or boundary conditions for the dynamic equations, so that the dynamic solution is based on physically consistent kinematic information.
[0077] This embodiment of the application achieves full structural compatibility with the Modelica standard library by defining the potential variable of the mechanical translational connector as velocity and the flow variable as force, and by setting interface constraints. This provides a unified interface specification for interconnection and data exchange between different modules. Furthermore, by establishing kinematic relationships between displacement, velocity, and acceleration through potential and flow variables, the model can realistically reflect the dynamic response characteristics of mechanical components. This two-step approach achieves the connection from physical interface to mathematical constraints, ensuring the kinematic consistency and physical interpretability of the model under different working conditions, and laying a solid foundation for the accurate construction and numerical solution of the subsequent variable mass dynamic equations.
[0078] In one possible implementation of the embodiments of this application, combined with Figure 2 ,like Figure 5 As shown, S6 above solves the dynamic equation and the connector conservation equation together to obtain the velocity, displacement, and force results at the current moment. Specifically, this can be achieved through S501 and S502, which are explained in detail below: S501. Combine the dynamic equations with the connector conservation equations to form a combined equation.
[0079] Among them, the dynamic equations describe the interrelationships between mass, velocity, acceleration, and force in the system; the connector conservation equations ensure the consistency and conservation of force and velocity transmission at the interconnected mechanical interfaces. The combined equations achieve collaborative calculation of the overall dynamic behavior of the system by coupling and unifying the two types of equations.
[0080] In one possible implementation, element-level dynamic equations are generated based on the kinematic relationships established in the previous step, while conservation equations for force and velocity are extracted from the mechanical translation connector interface. The two types of equations are then automatically combined and indexed using symbolic compilation to generate a global equation set containing various interface variables, internal state variables, and external constraint variables.
[0081] As an example, in an embodiment of this application, the system of equations satisfies the following formula:
[0082] Where F is the total force transmitted through the mechanical translation connector. For the quality of the current simulation moment, For acceleration, For speed, The rate of change of mass over time. The potential energy of the first interface. It is the potential energy of the second interface.
[0083] S502. Input mass, rate of change of mass, velocity and acceleration as solution variables into the combined equations, call the Modelica solver to perform numerical calculations on the equations, and obtain the displacement, velocity, acceleration and force results at the current moment.
[0084] The solution variables refer to the physical quantities that are iteratively calculated during the equation solving process, including instantaneous mass, rate of change of mass, velocity, and acceleration. The Modelica solver is a computational engine used for analyzing, compiling, and numerically integrating systems of equations, and can automatically complete the equation solving process under given initial conditions.
[0085] In one possible implementation, the combined equations formed in the previous step are input into the Modelica solver, and initial values and boundary conditions for the solution variables are set during the initialization phase. The solver performs numerical integration on the combined equations within the simulation step, and calculates the displacement, velocity, acceleration, and force results at the current moment through iterative convergence. Adaptive step size and error control strategies can be used during the solution process to improve stability and computational accuracy.
[0086] As an example, when the mass of the simulated system changes dynamically over time, the solver updates the system's inertial parameters in real time based on the input rate of mass change, and synchronously calculates the corresponding velocity, displacement, and force at each time step, thereby accurately reflecting the dynamic response process of the variable mass system.
[0087] As an example, in this embodiment of the application, to further clarify the complete process of S1-S502 described above, this application provides a complete process implementation example. In Modelica, the newly defined variable-mass point element is directly dragged and dropped into the modeling panel, assuming a simulation process of a time-varying mass element impacting the ground under constant gravitational acceleration. When building a model containing the variable-mass element, the various types of connectors are directly connected according to Modelica's syntax and semantics. Then, the gravitational acceleration is defined according to actual needs, and finally, the time, mass curve, and object height are defined to complete the modeling. The initial mass is 1kg, the gravitational acceleration is 9.8m / s², and the height is 3000mm. A two-dimensional table is defined to represent the water loss of the water bottle ball per second as 100g. Figure 6 , Figure 7 This represents the experimental results of the simulation experiment. For example... Figure 6 As shown, the water bottle ball hits the ground after 0.786 seconds. Figure 7 As shown, the mass of the water bottle ball at this point is 0.9214 kg. Without this variable mass simulation method, this working condition cannot be calculated in Modelica.
[0088] This application combines the dynamic equations with the connector conservation equations to form a global coupled equation system, ensuring energy conservation and momentum consistency in the force and velocity transmission process, fundamentally avoiding coupling errors and physical inconsistencies that occur in traditional independent solution methods. On this basis, mass, rate of change of mass, velocity, and acceleration are input into the equation system as solution variables, and the Modelica solver is used to perform numerical integration calculations with adaptive step sizes, realizing real-time iterative updates and high-precision output of system state variables.
[0089] In implementation, each step of the method provided in this embodiment can be completed by integrated logic circuits in the processor or by instructions in software form. The steps of the method disclosed in the embodiments of this application can be directly manifested as being executed by a hardware processor, or being executed by a combination of hardware and software modules in the processor.
[0090] This application also provides a computer-readable storage medium including instructions that, when run on a computer, cause the computer to perform any of the methods described above.
[0091] This application also provides a computer program product containing instructions that, when run on a computer, cause the computer to perform any of the methods described above.
[0092] This application also provides a chip including a processor and an interface circuit. The interface circuit is coupled to the processor. The processor is used to run computer programs or instructions to implement the above-described method. The interface circuit is used to communicate with other modules outside the chip.
[0093] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented using software programs, implementation can be, in whole or in part, in the form of a computer program product. This computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium accessible to a computer or a data storage device containing one or more servers, data centers, etc., that can be integrated with the medium. The available media can be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., DVDs), or semiconductor media (e.g., solid-state disks (SSDs)).
[0094] Although this application has been described herein in conjunction with various embodiments, those skilled in the art, by reviewing the accompanying drawings, disclosure, and appended claims, will understand and implement other variations of the disclosed embodiments in carrying out the claimed application. In the claims, the word "comprising" does not exclude other components or steps, and "a" or "an" does not exclude multiple instances. A single processor or other unit can implement several functions listed in the claims. While different dependent claims may recite certain measures, this does not mean that these measures cannot be combined to produce good results.
[0095] Although this application has been described in conjunction with specific features and embodiments, it is obvious that various modifications and combinations can be made thereto without departing from the spirit and scope of this application. Accordingly, this specification and drawings are merely exemplary illustrations of this application as defined by the appended claims, and are considered to cover any and all modifications, variations, combinations, or equivalents within the scope of this application. Clearly, those skilled in the art can make various alterations and modifications to this application without departing from the spirit and scope of this application. Thus, if such modifications and modifications of this application fall within the scope of the claims of this application and their equivalents, this application is also intended to include such modifications and modifications.
Claims
1. A configurable quality dynamic modeling method based on the Modelica language, characterized in that, include: S1: Obtain the current simulation time, preset simulation stop time, and step size, and construct a two-dimensional data table of simulation time and quality; S2: Perform interpolation on the two-dimensional data table based on the simulation time to obtain the quality value at the current moment; S3: Differentiate the mass value to obtain the rate of change of mass over time; S4: Based on the potential and flow constraints of the Modelica mechanical translation connector, establish the kinematic relationship; S5: Construct a variable mass dynamic equation based on the kinematic relationship, the mass value at the current moment, and the rate of change of mass over time; S6: Solve the dynamic equations together with the connector conservation equations to obtain the velocity, displacement and force results at the current moment; S7: Advance the simulation time to the next moment and repeat S1 to S6 until the preset simulation stop time is reached to stop the simulation and obtain the simulation results.
2. The configurable quality dynamic modeling method based on Modelica language according to claim 1, characterized in that, The step of interpolating the two-dimensional data table based on the simulation time to obtain the quality value at the current moment includes: Determine the current simulation time within the interval between the first and second adjacent time points in the two-dimensional data table; Based on the first mass value corresponding to the first time point and the second mass value corresponding to the second time point, linear interpolation is used to calculate the mass value at the current time; the mass value at the current time satisfies the following formula: in, The first mass value, This is the second mass value. As the first point in time, This is the second time point, where t is the current time. When the simulation time exceeds the time range of the two-dimensional data table, the quality value at the adjacent boundary is output using the boundary value extrapolation method.
3. The configurable quality dynamic modeling method based on Modelica language according to claim 1, characterized in that, The kinematic relationships are established based on the potential and flow constraints of the Modelica mechanical translation connector, including: Define the potential variable of the mechanical translation connector as velocity and the flow variable as force, and ensure that the first and second interfaces of the connector meet preset constraints. Based on the potential variable, the flow variable, and the preset constraints, the kinematic relationship between displacement, velocity, and acceleration is established.
4. The configurable quality dynamic modeling method based on Modelica language according to claim 3, characterized in that, The preset constraints include: The sum of the stream variables in the first interface and the second interface is 0; The potential variables in the first interface are equal to those in the second interface.
5. The configurable quality dynamic modeling method based on Modelica language according to claim 1, characterized in that, The construction of the variable mass dynamic equation based on the kinematic relationship, the mass value at the current moment, and the rate of change of mass over time includes: introducing the mass at the current moment and its rate of change based on the kinematic relationship, and constructing the dynamic equation of the variable mass system based on the principle of conservation of momentum.
6. The configurable quality dynamic modeling method based on Modelica language according to claim 5, characterized in that, The dynamic equations satisfy the following formula: Where F is the total force transmitted through the mechanical translation connector. For the quality of the current simulation moment, For acceleration, For speed, This represents the rate of change of mass over time.
7. The configurable quality dynamic modeling method based on Modelica language according to claim 1, characterized in that, The process of solving the dynamic equations and the connector conservation equations together yields the velocity, displacement, and force results at the current moment, including: The dynamic equations are combined with the connector conservation equations to form a combined equation; Mass, rate of change of mass, velocity, and acceleration are input into the combined equations as solution variables. The Modelica solver is then called to perform numerical calculations on the equations to obtain the displacement, velocity, acceleration, and force results at the current moment.
8. A configurable quality dynamic modeling system based on the Modelica language, used to implement the configurable quality dynamic modeling method based on the Modelica language as described in any one of claims 1-7, characterized in that, include: The system includes a time generation module, a mass data processing module, a kinematics calculation module, a dynamics solution module, and a simulation control module. The time generation module is used to obtain the current simulation time, the preset simulation stop time, and the step size. The quality data processing module is used to construct a two-dimensional data table of the correspondence between simulation time and quality based on the current simulation time, simulation stop time and step size, and to determine the rate of change of quality over time. The kinematics calculation module is used to establish kinematic relationships between displacement, velocity, and acceleration based on the potential and flow variables constraints of the mechanical translation connector. The dynamics solution module is used to construct the variable mass dynamic equation based on the kinematic relationship, the mass value at the current moment, and the rate of change of the mass over time, and solve it together with the force conservation equation of the connector to obtain the velocity, displacement, and force results of the system at the current moment. The simulation control module is used to advance the simulation time to the next moment and repeat the calculation process from the time generation module to the dynamic solution module until the preset simulation stop time is reached, and output the dynamic simulation results of the variable mass system.
9. The configurable quality dynamic modeling system based on Modelica language according to claim 8, characterized in that, The quality data processing module includes: a quality value calculation unit and a quality change rate calculation unit; The quality value calculation unit is used to construct a two-dimensional data table containing the correspondence between simulation time and quality, and to perform interpolation calculation on the two-dimensional data table according to the current simulation time to obtain the quality value at the current moment. The mass change rate calculation unit is used to differentiate the mass value to obtain the mass change rate over time.
10. The configurable quality dynamic modeling system based on Modelica language according to claim 8, characterized in that, The kinematics calculation module is also used for: Define the potential variable of the mechanical translation connector as velocity and the flow variable as force, and ensure that the first and second interfaces of the connector meet preset constraints. Based on the potential variable, the flow variable, and the preset constraints, the kinematic relationship between displacement, velocity, and acceleration is established.