Component-oriented acausal modeling of the dynamical systems in Python language on the example of the model of the sucker rod string
- Published
- Accepted
- Subject Areas
- Algorithms and Analysis of Algorithms, Scientific Computing and Simulation, Programming Languages, Software Engineering
- Keywords
- component-oriented modeling, acausal modeling, hybrid modeling, dynamical system, variable structure system, difference equations, Python, SymPy, sucker rod string, multi-domain modeling
- Copyright
- © 2019 Kopei et al.
- Licence
- This is an open access article distributed under the terms of the Creative Commons Attribution License, which permits unrestricted use, distribution, reproduction and adaptation in any medium and for any purpose provided that it is properly attributed. For attribution, the original author(s), title, publication source (PeerJ Preprints) and either DOI or URL of the article must be cited.
- Cite this article
- 2019. Component-oriented acausal modeling of the dynamical systems in Python language on the example of the model of the sucker rod string. PeerJ Preprints 7:e27612v1 https://doi.org/10.7287/peerj.preprints.27612v1
Abstract
As a rule, the limitations of specialized modeling languages for acausal modeling of the complex dynamical systems are: limited applicability, poor interoperability with the third party software packages, the high cost of learning, the complexity of the implementation of hybrid modeling and modeling systems with the variable structure, the complexity of the modifications and improvements. In order to solve these problems, it is proposed to develop the easy-to-understand and to modify component-oriented acausal hybrid modeling system that is based on: (1) the general-purpose programming language Python, (2) the description of components by Python classes, (3) the description of components behavior by difference equations using declarative tools SymPy, (4) the event generation using Python imperative constructs, (5) composing and solving the system of algebraic equations in each discrete time point of the simulation. The classes that allow creating the models in Python without the need to study and apply specialized modeling languages are developed. These classes can also be used to automate the construction of the system of difference equations, describing the behavior of the model in a symbolic form. The basic set of mechanical components is developed — 1D translational components "mass", "spring-damper", "force". Using these components, the models of sucker rods string are developed and simulated. These simulation results are compared with the simulation results in Modelica language. The replacement of differential equations by difference equations allow simplifying the implementation of the hybrid modeling and the requirements for the modules for symbolic mathematics and for solving equations.
Author Comment
This is a submission to PeerJ Computer Science for review.