Component-oriented acausal modeling of the dynamical systems in Python language on the example of the model of the sucker rod string

Department of Computerized Mechanical Engineering, Ivano-Frankivsk National Technical University of Oil and Gas, Ivano-Frankivsk, Ukraine
DOI
10.7287/peerj.preprints.27612v1
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
Kopei VB, Onysko OR, Panchuk VG. 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

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.

Supplemental Information

pycodyn module with base classes (in Python)

DOI: 10.7287/peerj.preprints.27612v1/supp-2

Simulation of free vibrations of the sucker rod string (in Python)

DOI: 10.7287/peerj.preprints.27612v1/supp-3

pycodyn module with base classes (trapezoidal rule, in Python)

DOI: 10.7287/peerj.preprints.27612v1/supp-4

Simulation of free vibrations of the sucker rod string (trapezoidal rule, in Python)

DOI: 10.7287/peerj.preprints.27612v1/supp-5

Simulation of the pumping process by the two-section string (in Python)

DOI: 10.7287/peerj.preprints.27612v1/supp-6

The simulation of the variable structure system (in Python)

DOI: 10.7287/peerj.preprints.27612v1/supp-7