Component-oriented acausal modeling of the dynamical systems in Python language on the example of the model of the sucker rod string
Typically, component-oriented acausal hybrid modeling of complex dynamic systems is implemented by specialized modeling languages. A well-known example is the Modelica language. The specialized nature, complexity of implementation and learning of such languages somewhat limits their development and...
Main Authors: | , , |
---|---|
Format: | Article |
Language: | English |
Published: |
PeerJ Inc.
2019-10-01
|
Series: | PeerJ Computer Science |
Subjects: | |
Online Access: | https://peerj.com/articles/cs-227.pdf |
id |
doaj-b367bf961ea7425dbe2d12b087073150 |
---|---|
record_format |
Article |
spelling |
doaj-b367bf961ea7425dbe2d12b0870731502020-11-24T21:45:42ZengPeerJ Inc.PeerJ Computer Science2376-59922019-10-015e22710.7717/peerj-cs.227Component-oriented acausal modeling of the dynamical systems in Python language on the example of the model of the sucker rod stringVolodymyr B. KopeiOleh R. OnyskoVitalii G. PanchukTypically, component-oriented acausal hybrid modeling of complex dynamic systems is implemented by specialized modeling languages. A well-known example is the Modelica language. The specialized nature, complexity of implementation and learning of such languages somewhat limits their development and wide use by developers who know only general-purpose languages. The paper suggests the principle of developing simple to understand and modify Modelica-like system based on the general-purpose programming language Python. The principle consists in: (1) Python classes are used to describe components and their systems, (2) declarative symbolic tools SymPy are used to describe components behavior by difference or differential equations, (3) the solution procedure uses a function initially created using the SymPy lambdify function and computes unknown values in the current step using known values from the previous step, (4) Python imperative constructs are used for simple events handling, (5) external solvers of differential-algebraic equations can optionally be applied via the Assimulo interface, (6) SymPy package allows to arbitrarily manipulate model equations, generate code and solve some equations symbolically. The basic set of mechanical components (1D translational “mass”, “spring-damper” and “force”) is developed. The models of a sucker rods string are developed and simulated using these components. The comparison of results of the sucker rod string simulations with practical dynamometer cards and Modelica results verify the adequacy of the models. The proposed approach simplifies the understanding of the system, its modification and improvement, adaptation for other purposes, makes it available to a much larger community, simplifies integration into third-party software.https://peerj.com/articles/cs-227.pdfComponent-oriented modelingAcausal modelingHybrid modelingDynamical systemVariable structure systemDifference equations |
collection |
DOAJ |
language |
English |
format |
Article |
sources |
DOAJ |
author |
Volodymyr B. Kopei Oleh R. Onysko Vitalii G. Panchuk |
spellingShingle |
Volodymyr B. Kopei Oleh R. Onysko Vitalii G. Panchuk Component-oriented acausal modeling of the dynamical systems in Python language on the example of the model of the sucker rod string PeerJ Computer Science Component-oriented modeling Acausal modeling Hybrid modeling Dynamical system Variable structure system Difference equations |
author_facet |
Volodymyr B. Kopei Oleh R. Onysko Vitalii G. Panchuk |
author_sort |
Volodymyr B. Kopei |
title |
Component-oriented acausal modeling of the dynamical systems in Python language on the example of the model of the sucker rod string |
title_short |
Component-oriented acausal modeling of the dynamical systems in Python language on the example of the model of the sucker rod string |
title_full |
Component-oriented acausal modeling of the dynamical systems in Python language on the example of the model of the sucker rod string |
title_fullStr |
Component-oriented acausal modeling of the dynamical systems in Python language on the example of the model of the sucker rod string |
title_full_unstemmed |
Component-oriented acausal modeling of the dynamical systems in Python language on the example of the model of the sucker rod string |
title_sort |
component-oriented acausal modeling of the dynamical systems in python language on the example of the model of the sucker rod string |
publisher |
PeerJ Inc. |
series |
PeerJ Computer Science |
issn |
2376-5992 |
publishDate |
2019-10-01 |
description |
Typically, component-oriented acausal hybrid modeling of complex dynamic systems is implemented by specialized modeling languages. A well-known example is the Modelica language. The specialized nature, complexity of implementation and learning of such languages somewhat limits their development and wide use by developers who know only general-purpose languages. The paper suggests the principle of developing simple to understand and modify Modelica-like system based on the general-purpose programming language Python. The principle consists in: (1) Python classes are used to describe components and their systems, (2) declarative symbolic tools SymPy are used to describe components behavior by difference or differential equations, (3) the solution procedure uses a function initially created using the SymPy lambdify function and computes unknown values in the current step using known values from the previous step, (4) Python imperative constructs are used for simple events handling, (5) external solvers of differential-algebraic equations can optionally be applied via the Assimulo interface, (6) SymPy package allows to arbitrarily manipulate model equations, generate code and solve some equations symbolically. The basic set of mechanical components (1D translational “mass”, “spring-damper” and “force”) is developed. The models of a sucker rods string are developed and simulated using these components. The comparison of results of the sucker rod string simulations with practical dynamometer cards and Modelica results verify the adequacy of the models. The proposed approach simplifies the understanding of the system, its modification and improvement, adaptation for other purposes, makes it available to a much larger community, simplifies integration into third-party software. |
topic |
Component-oriented modeling Acausal modeling Hybrid modeling Dynamical system Variable structure system Difference equations |
url |
https://peerj.com/articles/cs-227.pdf |
work_keys_str_mv |
AT volodymyrbkopei componentorientedacausalmodelingofthedynamicalsystemsinpythonlanguageontheexampleofthemodelofthesuckerrodstring AT olehronysko componentorientedacausalmodelingofthedynamicalsystemsinpythonlanguageontheexampleofthemodelofthesuckerrodstring AT vitaliigpanchuk componentorientedacausalmodelingofthedynamicalsystemsinpythonlanguageontheexampleofthemodelofthesuckerrodstring |
_version_ |
1725904881593614336 |