D
D
DrWind2016-11-17 07:19:31
Python
DrWind, 2016-11-17 07:19:31

Ways to create a virtual simulator?

I'm new to programming. But there is a great desire to create a prototype over the winter and there may be a working version of a virtual process simulator. I am a technologist by profession. I am good at technology. Worked with differential equations. I'm going to create a project based on Python. The question is, can anyone have experience in creating such projects? Where did you start, literature.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
R
Rafael™, 2016-11-17
@maxminimus

if you are a beginner, then it’s better to choose js - the result will be no worse and the entry threshold is lower and there is a built-in graphical interface (css html) that is not in python

A
Anatoly Scherbakov, 2016-11-20
@Altaisoft

It is not entirely clear what process you intend to model: can it be considered discrete, or are there continuous components; what visualization is required; why do you mention differential equations; how high is the computational complexity.
I would say that there are the following methods for solving the problem.
Desktop application in Python. Python for any complex systems is a more convenient language than JavaScript, because you can easily decompose your simulation into classes, describe the relationship between them. There are many data structures: lists, queues, dictionaries, whatever - you don't need to make your own prioritized queue class, for example. There are all sorts of optimized tools like numpy, scipy.
There are application development frameworks: pygame and the newer kivy. I can't say anything about kivy. About pygame, I can say that its API might have looked good twenty years ago, but not today. Python is a flexible language, you can write much more human-readable libraries in it.
In addition, on pygame without additional libraries, you will have to draw graphs, diagrams, etc with your hands, from rectangles and circles, - that is, you will spend a lot of time on auxiliary things instead of developing your simulation. There may be libraries for these things, but I'm not familiar with Python desktop development so I can't say.
Finally, in order to distribute your application, you will need to make an installer, build it into an .exe with a special tool, update it somehow. All this is quite dreary and inspires melancholy.
The client application in JS, as the distinguished participants in the discussion above wrote, is devoid of many of these shortcomings. Users will have access to your program from anywhere, no need to install anything on the computer. Canvas, SVG and, if necessary, WebGL are at your service. And the sea, no, is an ocean of various JS libraries that allow you to quickly and conveniently create graphics, diagrams, animations, visualizations of any kind.
The disadvantages that I met when doing something like this:

  • Lack of convenient data structures. JavaScript has clumsy lists that are inconvenient to work with. But I think that now this shortcoming is leveled by the development of the language itself and the emergence of libraries like underscore.js.
  • The inconvenience and noodles of the resulting code as a result of the lack of normal inheritance. Well, here again: there are many libraries for the same inheritance; there are requirejs and modules; Well, actually, now I would do it all differently :)
  • Calculation slowness. A very relative thing, because the program can be greatly optimized if desired; for most of the simulations I've been talking about, performance hasn't been a problem.
Hybrid option. Web application, on the back-end there is a process that performs calculations; the client code runs on the front-end, which communicates with the user and visualizes the results. For large simulations - obviously the best option, but also the most difficult. Both the client and the server each have their own object model, and in a sense, the same thing, it turns out, needs to be implemented twice.
Therefore, as a result - I would suggest that you stop at option 2 (client code in JS), and over time, if the simulation turns out to be very difficult, you can move on to option 3, based on the accumulated experience. Partially transfer part of the calculations from the already written application to the server. As an example: you count a separate process according to the given parameters with visualization on the client, and if you need to count one hundred processes and find some average characteristics, this is transferred to the server. Simple and logical.
If you're interested, send me an email and we can chat. By no means am I a specialist, but while I was studying at a university, I was a little interested in the topic, read books / articles and wrote simple programs on discrete-event modeling of economic processes as a course project.

D
DrWind, 2016-11-19
@DrWood

Having searched a little on the Internet for information, I suggested that it is possible to create a simulator based on engines when creating games. Namely unity3d, UE, LibGDX. What do you think about this ?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question