![]() My journey started in May 2020, during the first covid lockdown. The essence of the problem is create a function that takes the state vector and computes its derivative by passing values from block outputs to block inputs in the correct sequence - a block can’t be executed until its predecessors have been. This is essentially a dataflow scheduling problem. Given such a function we pass it to a numerical integrator, say RK45 from SciPy to get the time response of the block diagram. Problem solved! This would be a Pythonic solution to the problem. Putting aside, for now, the business of graphical model building, the dynamic simulation could revisit some ideas from the distant past where models were described by a textual system modelling language, ala Simnon. Who needs to draw blocks and wires anyway! (Spoiler alert, later I will recant) But rather than create a new language like Simnon, we could use Python and represent the dynamic components (the "blocks") using standard Python classes. When I first contemplated writing a Python version of the book (in press, hopefully available before the end of this year) the biggest problem, after porting all the old MATLAB toolboxes, was what to do about all those Simulink models, some quite complicated, that were in the current edition of the book? There is no Simulink equivalent in Python and the prospect of omitting all the block diagrams was not very palatable. ![]() My Robotics, Vision & Control book includes 25 block diagram models created and simulated using Simulink. Over the years, Simulink has grown in sophistication and complexity, partly due to its other purpose of building/controlling/monitoring embedded control systems. However my mental model of Simulink is based on my early encounters, as a powerful graphical tool where I could describe a dynamic system and simulate it. It had a better graphical editor and was tightly integrated with MATLAB which was already entrenched. That project I worked on transitioned to Simulink, and I’ve used it a lot ever since. Block diagrams are commonly used in engineering and I personally find them to be a useful and intuitive abstraction and a good way to think about complex systems. Simulink was then the new kid on the block, from the newly founded MathWorks. (ISI) had, at that time, a simple but powerful keyboard/graphics interface (System Builder) that allowed blocks to be placed and wired, and then the resulting model could be simulated. ISI was later acquired by WindRiver Systems and then by National Instruments, and is now in EOL phase. Real y(start = 1) "y coordinate" // y starts at 1ĭer(x) = y // This is the 1st diff equation //ĭer(y) = -x + lambda*(1-x*x)*y /* This is the 2nd diff equation */ Real x(start = 1) "Descriptive string for x" // x starts at 1 class VanDerPol "Van der Pol oscillator model" While powerful with respect to dynamic systems, it was quite limited in all the other things we expect of a programming language. Other text-based tools of the era, like Modelica, were more powerful programming languages as well. ![]() (from the Simnon Tutorial by Karl Åström 1985 ) ![]() Lund and dating back to 1974, was essentially a custom programming language for describing dynamic systems - a system modeling language At that time there was a huge explosion of ideas and tools in the space of what was then called Computer Aided Control System Design (CACSD). By comparison, the options today are greatly reduced and one of these packages, Simulink, has gone on to become dominant. My second ever job, during the early 1980s, involved dynamic systems modelling using tools like Simnon, MATRIXx® and Simulink®. I've had a lot of geeky fun with this, and I hope it's something that might be interesting to a wider group of people. It's become a passion project and a big sink of discretionary time (the one thing I really don't have enough of). This is a long account of about the development of a software tool (bdsim) I've been working on for the last two years. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |