By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,275 Members | 920 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,275 IT Pros & Developers. It's quick & easy.

Continuous system simulation in Python

P: n/a
Hello,

I'm looking for any work/paper/ressource about continuous system
simulation using Python or any similar object oriented languages (or
even UML theory !).

I'm aware of SimPy for discrete event simulation, but I haven't found
any work about continuous system.
I would like to develop a generic continous system simulator, and so
would be eager to join any open source effort on the subject.

For instance, it would be useful for modelling an airplane with all the
dynamics (flight simulator).

Python is my language of choice because of the keyword 'generic'. Being
an object oriented dynamic language, it's perfect for such a task.
Unfortunately I'm a novice when it comes to object oriented
design and development, so I would prefer to start from something
already existent instead of starting from scratch.

If you had any idea on the subject, I would be really glad to discuss it
with you.

Thanks in advance,

P.S. : for email, replace nowhere by yahoo
Oct 6 '05 #1
Share this Question
Share on Google+
19 Replies


P: n/a
A good starting point is the book "Python Scripting for Computational
Science" by Hans Petter Langtangen. The book covers topics that go
from simulating second order mechanical systems to solving partial
differentail equations.

Howard

Nicolas Pernetty wrote:
Hello,

I'm looking for any work/paper/ressource about continuous system
simulation using Python or any similar object oriented languages (or
even UML theory !).

I'm aware of SimPy for discrete event simulation, but I haven't found
any work about continuous system.
I would like to develop a generic continous system simulator, and so
would be eager to join any open source effort on the subject.

For instance, it would be useful for modelling an airplane with all the
dynamics (flight simulator).

Python is my language of choice because of the keyword 'generic'. Being
an object oriented dynamic language, it's perfect for such a task.
Unfortunately I'm a novice when it comes to object oriented
design and development, so I would prefer to start from something
already existent instead of starting from scratch.

If you had any idea on the subject, I would be really glad to discuss it
with you.

Thanks in advance,

P.S. : for email, replace nowhere by yahoo


Oct 7 '05 #2

P: n/a
On Fri, 7 Oct 2005 01:12:22 +0200, Nicolas Pernetty
<ni**********@nowhere.fr> declaimed the following in comp.lang.python:

I'm aware of SimPy for discrete event simulation, but I haven't found
any work about continuous system.
I would like to develop a generic continous system simulator, and so
would be eager to join any open source effort on the subject.

For instance, it would be useful for modelling an airplane with all the
dynamics (flight simulator).
Unless that flight simulator is running on some big ugly ANALOG
computer (the ones that used rheostats, transformers, and amplifiers),
they all are really using discrete time intervals and computing values
at those time points. Such computation may require integration of
continuous functions from previous time step to current time step.
-- ================================================== ============ <
wl*****@ix.netcom.com | Wulfraed Dennis Lee Bieber KD6MOG <
wu******@dm.net | Bestiaria Support Staff <
================================================== ============ <
Home Page: <http://www.dm.net/~wulfraed/> <
Overflow Page: <http://wlfraed.home.netcom.com/> <

Oct 7 '05 #3

P: n/a
Dennis Lee Bieber wrote:
On Fri, 7 Oct 2005 01:12:22 +0200, Nicolas Pernetty
<ni**********@nowhere.fr> declaimed the following in comp.lang.python:
I'm aware of SimPy for discrete event simulation, but I haven't found
any work about continuous system.
I would like to develop a generic continous system simulator, and so
would be eager to join any open source effort on the subject.

For instance, it would be useful for modelling an airplane with all the
dynamics (flight simulator).


Unless that flight simulator is running on some big ugly ANALOG
computer (the ones that used rheostats, transformers, and amplifiers),
they all are really using discrete time intervals and computing values
at those time points. Such computation may require integration of
continuous functions from previous time step to current time step.


I think Nicolas means "(discrete event) simulation" as opposed to
"discrete (event simulation)" and "(continuous system) simulation" as
opposed to "continuous (system simulation)". The methods used in SimPy
to model (discrete events) don't apply terribly well to simulating many
(continuous systems) like airplane dynamics. For example, an ODE
integrator would probably want to adaptively select its timesteps as
opposed to laying out a uniform discretization upfront.

--
Robert Kern
rk***@ucsd.edu

"In the fields of hell where the grass grows high
Are the graves of dreams allowed to die."
-- Richard Harter

Oct 7 '05 #4

P: n/a
[Robert Kern]
[...] an ODE integrator would probably want to adaptively select its
timesteps as opposed to laying out a uniform discretization upfront.


Eons ago, I gave myself such a little beast (but really found in an
Appendix of a book on simulation), which I use since then whenever I
need it, not so often in these days. If you are curious, see:

http://fp-etc.progiciels-bpi.ca/rke.html

yet I'm sure there is just plenty of such things, all around.

The above is in C, not in Python. I vaguely remember having once
rewritten the thing in Python, then discarded the result as not fast
enough for the need I then had. If I really needed to use it nowadays,
I'll probably try to quickly link it through Pyrex. Or just look around
a bit for some already made, and maybe better solution. :-)

It is easy and convenient, when writing a mixed discrete and continuous
simulation system, to tie the advancement control of the various active
ODE solvers within the main loop of the discrete event scheduler.

--
François Pinard http://pinard.progiciels-bpi.ca
Oct 7 '05 #5

P: n/a
François Pinard wrote:
[Robert Kern]
[...] an ODE integrator would probably want to adaptively select its
timesteps as opposed to laying out a uniform discretization upfront.


Eons ago, I gave myself such a little beast (but really found in an
Appendix of a book on simulation), which I use since then whenever I
need it, not so often in these days. If you are curious, see:

http://fp-etc.progiciels-bpi.ca/rke.html

yet I'm sure there is just plenty of such things, all around.

The above is in C, not in Python. I vaguely remember having once
rewritten the thing in Python, then discarded the result as not fast
enough for the need I then had. If I really needed to use it nowadays,
I'll probably try to quickly link it through Pyrex. Or just look around
a bit for some already made, and maybe better solution. :-)


scipy has wrapped LSODA and VODE from ODEPACK. There are a few more
integrators in ODEPACK which could easily be wrapped with f2py should
someone feel the urge. We'd probably wrap yours, too, if it weren't
GPLed. ;-)

--
Robert Kern
rk***@ucsd.edu

"In the fields of hell where the grass grows high
Are the graves of dreams allowed to die."
-- Richard Harter

Oct 7 '05 #6

P: n/a
Nicholas,

Have you looked at Octave? It is not Python, but I believe it can talk
to Python.
Octave is comparable to Matlab for many things, including having ODE
solvers. I have successfully used it to model and simulate simple
systems. Complex system would be easy to model as well, provided that
you model your dynamic elements with (systems of) differential
equations.

Oct 7 '05 #7

P: n/a
Hello Phil,

Yes I have considered Octave. In fact I'm already using Matlab and
decided to 'reject' it for Python + Numeric/numarray + SciPy because I
think you could do more in Python and in more simple ways.

Problem is that neither Octave, Matlab and Python offer today a
framework to build continuous system simulator (in fact Matlab with
Simulink and SimMechanics, do propose, but I was not convinced at all).

Regards,

*********** REPLY SEPARATOR ***********

On 7 Oct 2005 11:00:54 -0700, ph*****************@yahoo.com wrote :
Nicholas,

Have you looked at Octave? It is not Python, but I believe it can talk
to Python.
Octave is comparable to Matlab for many things, including having ODE
solvers. I have successfully used it to model and simulate simple
systems. Complex system would be easy to model as well, provided that
you model your dynamic elements with (systems of) differential
equations.

Oct 7 '05 #8

P: n/a
On Thu, 06 Oct 2005 22:30:00 -0700, Robert Kern <ro*********@gmail.com>
wrote :
Dennis Lee Bieber wrote:
On Fri, 7 Oct 2005 01:12:22 +0200, Nicolas Pernetty
<ni**********@nowhere.fr> declaimed the following in
comp.lang.python:
I'm aware of SimPy for discrete event simulation, but I haven't
found any work about continuous system.
I would like to develop a generic continous system simulator, and
so would be eager to join any open source effort on the subject.

For instance, it would be useful for modelling an airplane with all
the dynamics (flight simulator).


Unless that flight simulator is running on some big ugly ANALOG
computer (the ones that used rheostats, transformers, and
amplifiers), they all are really using discrete time intervals and
computing values at those time points. Such computation may require
integration of continuous functions from previous time step to
current time step.


I think Nicolas means "(discrete event) simulation" as opposed to
"discrete (event simulation)" and "(continuous system) simulation" as
opposed to "continuous (system simulation)". The methods used in SimPy
to model (discrete events) don't apply terribly well to simulating
many (continuous systems) like airplane dynamics. For example, an ODE
integrator would probably want to adaptively select its timesteps as
opposed to laying out a uniform discretization upfront.


Yes you are absolutely right. That's what I wanted to mean.
Thanks
Oct 7 '05 #9

P: n/a
Thanks, but what is really difficult is not to understand how to design
the program which solve a specific problem but to design a generic
framework for solving all these kinds of problem. And in a simple enough
way for basic programmers (but good scientists !) to handle it.

*********** REPLY SEPARATOR ***********

On 6 Oct 2005 17:04:01 -0700, "hrh1818" <ho******@westerncom.net> wrote
:
A good starting point is the book "Python Scripting for Computational
Science" by Hans Petter Langtangen. The book covers topics that go
from simulating second order mechanical systems to solving partial
differentail equations.

Howard

Nicolas Pernetty wrote:
Hello,

I'm looking for any work/paper/ressource about continuous system
simulation using Python or any similar object oriented languages (or
even UML theory !).

I'm aware of SimPy for discrete event simulation, but I haven't
found any work about continuous system.
I would like to develop a generic continous system simulator, and so
would be eager to join any open source effort on the subject.

For instance, it would be useful for modelling an airplane with all
the dynamics (flight simulator).

Python is my language of choice because of the keyword 'generic'.
Being an object oriented dynamic language, it's perfect for such a
task. Unfortunately I'm a novice when it comes to object oriented
design and development, so I would prefer to start from something
already existent instead of starting from scratch.

If you had any idea on the subject, I would be really glad to
discuss it with you.

Thanks in advance,

P.S. : for email, replace nowhere by yahoo

Oct 7 '05 #10

P: n/a
I don't know much about numerical aerodynamics, but assume that you are
interested in a finite element solver. I googled a bit and found the
following projects. The first is a 2d finite element solver for python.
The second is a 2d finite element solver without python.

http://ellipt2d.sourceforge.net/
http://www-rocq1.inria.fr/gamma/cdro...reefem/eng.htm

You can probably find more libraries by looking at http://netlib.org.

Oct 8 '05 #11

P: n/a
Nicolas Pernetty wrote:
I'm looking for any work/paper/ressource about continuous system
simulation using Python or any similar object oriented languages (or
even UML theory !).

I'm aware of SimPy for discrete event simulation, but I haven't found
any work about continuous system.
I would like to develop a generic continous system simulator, and so
would be eager to join any open source effort on the subject.


There was going to be a talk on continuous system simulation (*) at
EuroPython this year, but for some reason it didn't appear to happen (It
was one of the talks I was hoping to see). I've no real idea of the content
of the talk or the work involved though for obvious reasons. Maybe that can
provide a lead?
(*) http://www.python-in-business.org/ep...html?track=646
"Implementing Continuous Time Simulation Systems in Python, Paul J
Nolan"

Another lead //might// actually be to ask on the pygame list (MAYBE). It's
not directly the same thing, but essentially lots of games are in many
respects a form of continuous systems simulation, and someone on that
list might be able to point you in a good direction.

One book I bought a while back (looked interesting) which might be relevant
for you is O'Reilly's "physics for game developers", and and another is "AI
for games programmer"(*) since they both touch on these areas. If you have
a Safari account already that could be an easy way of checking to see
whether the book covers the sorts of answers you're after. (They don't use
python as their example language, but that's a minor problem really IMO)

(*) This is less obviously relevant, but deals with things deciding to move
themselves around continuous spaces and visualised at indeterminate
frame or display rates.

Best Regards,
Michael.
Oct 8 '05 #12

P: n/a

Simulink is a framework widely used by the control engineers ...
It is not *perfect* but the ODEs piece is probably the best
part of the simulator. Why were you not convinced ?

You may also have a look at Scicos and Ptolemy II. These
simulators are open-source ... but not based on Python.

Cheers,

SB

Nicolas Pernetty a écrit :
Hello Phil,

Yes I have considered Octave. In fact I'm already using Matlab and
decided to 'reject' it for Python + Numeric/numarray + SciPy because I
think you could do more in Python and in more simple ways.

Problem is that neither Octave, Matlab and Python offer today a
framework to build continuous system simulator (in fact Matlab with
Simulink and SimMechanics, do propose, but I was not convinced at all).

Regards,

*********** REPLY SEPARATOR ***********

On 7 Oct 2005 11:00:54 -0700, ph*****************@yahoo.com wrote :
Nicholas,

Have you looked at Octave? It is not Python, but I believe it can talk
to Python.
Octave is comparable to Matlab for many things, including having ODE
solvers. I have successfully used it to model and simulate simple
systems. Complex system would be easy to model as well, provided that
you model your dynamic elements with (systems of) differential
equations.


Oct 8 '05 #13

P: n/a
Simulink is well fitted for small simulators, but when you run into big
projects, I find many shortcomings appears which made the whole thing
next to unusable for our kind of projects.

That's why I'm interested in Python by the way, it is not a simple clone
like Scilab/Scicos. It is a real language which bring its own
advantages, and its own shortcomings, which I find well suited for our
activity.

If you want, I can send you a paper I wrote last year, detailing all
Simulink shortcomings. I doubt that this mailing list is interested in
such things...(and it's in French...).

Concerning Scilab/Scicos, I'm not really interested in a technology
primarily developed (INRIA and ENSPC) and used by France. Python and all
its libraries and communities are so much more dynamic !
And also I've heard that Scilab was developed in Fortran in a way which
make it rigid and that the sources are poorly documented, not a good
sign for an open source software (and Scilab isn't 'Free' for the FSF).

Regards,
*********** REPLY SEPARATOR ***********

On 8 Oct 2005 11:06:25 -0700, "Sébastien Boisgérault"
<Se*******************@gmail.com> wrote :

Simulink is a framework widely used by the control engineers ...
It is not *perfect* but the ODEs piece is probably the best
part of the simulator. Why were you not convinced ?

You may also have a look at Scicos and Ptolemy II. These
simulators are open-source ... but not based on Python.

Cheers,

SB

Nicolas Pernetty a écrit :
Hello Phil,

Yes I have considered Octave. In fact I'm already using Matlab and
decided to 'reject' it for Python + Numeric/numarray + SciPy because
I think you could do more in Python and in more simple ways.

Problem is that neither Octave, Matlab and Python offer today a
framework to build continuous system simulator (in fact Matlab with
Simulink and SimMechanics, do propose, but I was not convinced at
all).

Regards,

*********** REPLY SEPARATOR ***********

On 7 Oct 2005 11:00:54 -0700, ph*****************@yahoo.com wrote :
Nicholas,

Have you looked at Octave? It is not Python, but I believe it can
talk to Python.
Octave is comparable to Matlab for many things, including having
ODE solvers. I have successfully used it to model and simulate
simple systems. Complex system would be easy to model as well,
provided that you model your dynamic elements with (systems of)
differential equations.

Oct 8 '05 #14

P: n/a
Nicholas,

I have a particular interest in this subject as well. I've also used
the Python/Scipy combination, and it is a tantalizing combination, but
I found it to be a bit more clumsy than I'd like. Plus, my need for
continuous-time simulation is not as great as it has been in the past.

That said, I've been down this path before (see
http://custom.lab.unb.br/pub/asme/DYNAMICS/BUFORD1.zip), and I would be
interested in helping to develop something. I agree that Python would
be a great foundation to build upon.

Oct 9 '05 #15

P: n/a
Hello Phil,

I'm currently looking to see if I can build upon SimPy, thus making it
an hybrid system simulator. That would be a great step for the
community.

Main difficulty would be to build a framework which isn't clumsy, like
you said.
I have close to no experience in Python and object oriented development,
but I'm fairly advanced in C and procedural development, and of course
in continuous sytem simulator. I'll keep you informed of my
investigations...

I've downloaded your zip files, but unfortunately I have no access to
Windows. Are you able to send me only the sources ?

Thanks in advance,

*********** REPLY SEPARATOR ***********

On 8 Oct 2005 21:36:05 -0700, ph*****************@yahoo.com wrote :
Nicholas,

I have a particular interest in this subject as well. I've also used
the Python/Scipy combination, and it is a tantalizing combination, but
I found it to be a bit more clumsy than I'd like. Plus, my need for
continuous-time simulation is not as great as it has been in the past.

That said, I've been down this path before (see
http://custom.lab.unb.br/pub/asme/DYNAMICS/BUFORD1.zip), and I would
be interested in helping to develop something. I agree that Python
would be a great foundation to build upon.

Oct 9 '05 #16

P: n/a
Nicolas,

I am aware of some shortcomings and design flaws of Simulink,
especially in the code generation area. I am interested by
your paper nonetheless, please send me copy.

However, Simulink is used by many people on a day-to-day basis
in the context of big, industrial projects. The claim that it
is "next to unusable" is, in my book, an overstatement ...

Scicos is not perfect either but you can hardly say that is
is a simple clone of Simulink. No time and space to go into
the details ...

Obviously, the python community is very dynamic, but how much
support will you get in the very specific topic of continuous
time systems simulation ?

IMHO, an hybrid approach, such as the development of bridge
to include Python components into Simulink/Scicos/Ptolemy/
Modelica/pick_your_favorite_simulator may grant you more
interest from the simulation community.

Cheers,

SB

Nicolas Pernetty wrote:
Simulink is well fitted for small simulators, but when you run into big
projects, I find many shortcomings appears which made the whole thing
next to unusable for our kind of projects.
That's why I'm interested in Python by the way, it is not a simple clone
like Scilab/Scicos. It is a real language which bring its own
advantages, and its own shortcomings, which I find well suited for our
activity.

If you want, I can send you a paper I wrote last year, detailing all
Simulink shortcomings. I doubt that this mailing list is interested in
such things...(and it's in French...).
Concerning Scilab/Scicos, I'm not really interested in a technology
primarily developed (INRIA and ENSPC) and used by France. Python and all
its libraries and communities are so much more dynamic !
And also I've heard that Scilab was developed in Fortran in a way which
make it rigid and that the sources are poorly documented, not a good
sign for an open source software (and Scilab isn't 'Free' for the FSF).

Regards,
*********** REPLY SEPARATOR ***********

On 8 Oct 2005 11:06:25 -0700, "Sébastien Boisgérault"
<Se*******************@gmail.com> wrote :

Simulink is a framework widely used by the control engineers ...
It is not *perfect* but the ODEs piece is probably the best
part of the simulator. Why were you not convinced ?

You may also have a look at Scicos and Ptolemy II. These
simulators are open-source ... but not based on Python.

Cheers,

SB

Nicolas Pernetty a écrit :
Hello Phil,

Yes I have considered Octave. In fact I'm already using Matlab and
decided to 'reject' it for Python + Numeric/numarray + SciPy because
I think you could do more in Python and in more simple ways.

Problem is that neither Octave, Matlab and Python offer today a
framework to build continuous system simulator (in fact Matlab with
Simulink and SimMechanics, do propose, but I was not convinced at
all).

Regards,

*********** REPLY SEPARATOR ***********

On 7 Oct 2005 11:00:54 -0700, ph*****************@yahoo.com wrote :

> Nicholas,
>
> Have you looked at Octave? It is not Python, but I believe it can
> talk to Python.
> Octave is comparable to Matlab for many things, including having
> ODE solvers. I have successfully used it to model and simulate
> simple systems. Complex system would be easy to model as well,
> provided that you model your dynamic elements with (systems of)
> differential equations.
>


Oct 10 '05 #17

P: n/a
> I am aware of some shortcomings and design flaws of Simulink,
especially in the code generation area. I am interested by
your paper nonetheless, please send me copy.
Ok no problem. Let me just a few days to strip any irrelevant data on
it...
However, Simulink is used by many people on a day-to-day basis
in the context of big, industrial projects. The claim that it
is "next to unusable" is, in my book, an overstatement ...
Well the exact sentence is "next to unusable for our kind of projects".
You'll see the details on the paper, but I'm not joking.
For instance, under Simulink, our model is so big (well not so, but too
big for Simulink obviously), that you may have a loss of up to 40x in
performance compared to the model in C (how to optimize the Simulink
model is a whole other subject in itself). So to make it usable, we have
to use automatic code generation wich bring a whole new set of
problems... BUT our work is *very* specific, and I'm not talking about
Simulink in general. It may be perfect suited for others, it's just that
for us it's far from perfect...
Scicos is not perfect either but you can hardly say that is
is a simple clone of Simulink. No time and space to go into
the details ...
I wasn't in charge of evaluating Scilab/Scicos, so I can only talk about
the conclusion : main motives to switch to Scilab/Scicos would be
because it's free, that's all. Report said that next to almost
everything Scilab/Scicos does, Matlab/Simulink can do, and more often
than not, do it much better.
So if you have a different report, I would be happy to read and transmit
it...
Obviously, the python community is very dynamic, but how much
support will you get in the very specific topic of continuous
time systems simulation ?
Well some people already offered me their help. But I believe
that someone _has_ to begin alone some day...
Otherwise people who work on continuous system simulation would never be
interested in Python.

That's the beauty of open source : do what you can, but do it ! and hope
that someone else will come one day and use your work to build upon it.
Step by step you will have something usable (in theory).
IMHO, an hybrid approach, such as the development of bridge
to include Python components into Simulink/Scicos/Ptolemy/
Modelica/pick_your_favorite_simulator may grant you more
interest from the simulation community.
I already know some bridges like pymat or mlabwrap and I agree that a
way to include Python to Matlab/Simulink would be a great step.
But :

1) I think that it's Mathworks job to do it, and if they don't want to
do it, we'll never have a very good integration.

2) For our kind of projects and our kind of developers (mainly
non-IT engineers), I'm very reluctant to introduce too many different
technologies in a project. If we decided to go for Python, fine, let's
do the entire thing in Python/C. If we decided to go for Simulink, fine,
let's do the whole thing in Simulink/Matlab/C. Matlab, for algorithms,
can do almost the same things than Python and sometimes much better, so
if you have already Simulink (and so have the license) why go for Python
and struggle to have a good integration ?

Regards,

Cheers,

SB

Nicolas Pernetty wrote:
Simulink is well fitted for small simulators, but when you run into
big projects, I find many shortcomings appears which made the whole
thing next to unusable for our kind of projects.
That's why I'm interested in Python by the way, it is not a simple
clone like Scilab/Scicos. It is a real language which bring its own
advantages, and its own shortcomings, which I find well suited for
our activity.

If you want, I can send you a paper I wrote last year, detailing all
Simulink shortcomings. I doubt that this mailing list is interested
in such things...(and it's in French...).
Concerning Scilab/Scicos, I'm not really interested in a technology
primarily developed (INRIA and ENSPC) and used by France. Python and
all its libraries and communities are so much more dynamic !
And also I've heard that Scilab was developed in Fortran in a way
which make it rigid and that the sources are poorly documented, not
a good sign for an open source software (and Scilab isn't 'Free' for
the FSF).

Regards,
*********** REPLY SEPARATOR ***********

On 8 Oct 2005 11:06:25 -0700, "Sébastien Boisgérault"
<Se*******************@gmail.com> wrote :

Simulink is a framework widely used by the control engineers ...
It is not *perfect* but the ODEs piece is probably the best
part of the simulator. Why were you not convinced ?

You may also have a look at Scicos and Ptolemy II. These
simulators are open-source ... but not based on Python.

Cheers,

SB

Nicolas Pernetty a écrit :

> Hello Phil,
>
> Yes I have considered Octave. In fact I'm already using Matlab
> and decided to 'reject' it for Python + Numeric/numarray + SciPy
> because I think you could do more in Python and in more simple
> ways.
>
> Problem is that neither Octave, Matlab and Python offer today a
> framework to build continuous system simulator (in fact Matlab
> with Simulink and SimMechanics, do propose, but I was not
> convinced at all).
>
> Regards,
>
> *********** REPLY SEPARATOR ***********
>
> On 7 Oct 2005 11:00:54 -0700, ph*****************@yahoo.com
> wrote :
>
> > Nicholas,
> >
> > Have you looked at Octave? It is not Python, but I believe it
> > can talk to Python.
> > Octave is comparable to Matlab for many things, including
> > having ODE solvers. I have successfully used it to model and
> > simulate simple systems. Complex system would be easy to model
> > as well, provided that you model your dynamic elements with
> > (systems of) differential equations.
> >

Oct 10 '05 #18

P: n/a
In your simulator how much do you want Python to do? I ask this
because your subject title implies you want to write your simulation
code in Python but a simulator written entirely in Python would be
very slow. Python is an interpreted language and pure Python code is
not suitable for simulating big continuous systems. Hence to me it
appears you have two distinct proplems. One is developing a front end,
a user interface, that is easy to use. The other is either finding or
writing a good code compiler that wlll produce fast simulation code or
writing an interface to existing optimize simulation code. Although
most likely not suitable for your applicaion but a good example of this
type of program is Mathematica. It is written in two parts a user
interface and a kernel that does all of the high power math.

Howard
Nicolas Pernetty wrote:
I am aware of some shortcomings and design flaws of Simulink,
especially in the code generation area. I am interested by
your paper nonetheless, please send me copy.


Ok no problem. Let me just a few days to strip any irrelevant data on
it...
However, Simulink is used by many people on a day-to-day basis
in the context of big, industrial projects. The claim that it
is "next to unusable" is, in my book, an overstatement ...


Well the exact sentence is "next to unusable for our kind of projects".
You'll see the details on the paper, but I'm not joking.
For instance, under Simulink, our model is so big (well not so, but too
big for Simulink obviously), that you may have a loss of up to 40x in
performance compared to the model in C (how to optimize the Simulink
model is a whole other subject in itself). So to make it usable, we have
to use automatic code generation wich bring a whole new set of
problems... BUT our work is *very* specific, and I'm not talking about
Simulink in general. It may be perfect suited for others, it's just that
for us it's far from perfect...
Scicos is not perfect either but you can hardly say that is
is a simple clone of Simulink. No time and space to go into
the details ...


I wasn't in charge of evaluating Scilab/Scicos, so I can only talk about
the conclusion : main motives to switch to Scilab/Scicos would be
because it's free, that's all. Report said that next to almost
everything Scilab/Scicos does, Matlab/Simulink can do, and more often
than not, do it much better.
So if you have a different report, I would be happy to read and transmit
it...
Obviously, the python community is very dynamic, but how much
support will you get in the very specific topic of continuous
time systems simulation ?


Well some people already offered me their help. But I believe
that someone _has_ to begin alone some day...
Otherwise people who work on continuous system simulation would never be
interested in Python.

That's the beauty of open source : do what you can, but do it ! and hope
that someone else will come one day and use your work to build upon it.
Step by step you will have something usable (in theory).
IMHO, an hybrid approach, such as the development of bridge
to include Python components into Simulink/Scicos/Ptolemy/
Modelica/pick_your_favorite_simulator may grant you more
interest from the simulation community.


I already know some bridges like pymat or mlabwrap and I agree that a
way to include Python to Matlab/Simulink would be a great step.
But :

1) I think that it's Mathworks job to do it, and if they don't want to
do it, we'll never have a very good integration.

2) For our kind of projects and our kind of developers (mainly
non-IT engineers), I'm very reluctant to introduce too many different
technologies in a project. If we decided to go for Python, fine, let's
do the entire thing in Python/C. If we decided to go for Simulink, fine,
let's do the whole thing in Simulink/Matlab/C. Matlab, for algorithms,
can do almost the same things than Python and sometimes much better, so
if you have already Simulink (and so have the license) why go for Python
and struggle to have a good integration ?

Regards,

Cheers,

SB

Nicolas Pernetty wrote:
Simulink is well fitted for small simulators, but when you run into
big projects, I find many shortcomings appears which made the whole
thing next to unusable for our kind of projects.
That's why I'm interested in Python by the way, it is not a simple
clone like Scilab/Scicos. It is a real language which bring its own
advantages, and its own shortcomings, which I find well suited for
our activity.

If you want, I can send you a paper I wrote last year, detailing all
Simulink shortcomings. I doubt that this mailing list is interested
in such things...(and it's in French...).
Concerning Scilab/Scicos, I'm not really interested in a technology
primarily developed (INRIA and ENSPC) and used by France. Python and
all its libraries and communities are so much more dynamic !
And also I've heard that Scilab was developed in Fortran in a way
which make it rigid and that the sources are poorly documented, not
a good sign for an open source software (and Scilab isn't 'Free' for
the FSF).

Regards,
*********** REPLY SEPARATOR ***********

On 8 Oct 2005 11:06:25 -0700, "Sébastien Boisgérault"
<Se*******************@gmail.com> wrote :

>
> Simulink is a framework widely used by the control engineers ...
> It is not *perfect* but the ODEs piece is probably the best
> part of the simulator. Why were you not convinced ?
>
> You may also have a look at Scicos and Ptolemy II. These
> simulators are open-source ... but not based on Python.
>
> Cheers,
>
> SB
>
>
>
>
>
> Nicolas Pernetty a écrit :
>
> > Hello Phil,
> >
> > Yes I have considered Octave. In fact I'm already using Matlab
> > and decided to 'reject' it for Python + Numeric/numarray + SciPy
> > because I think you could do more in Python and in more simple
> > ways.
> >
> > Problem is that neither Octave, Matlab and Python offer today a
> > framework to build continuous system simulator (in fact Matlab
> > with Simulink and SimMechanics, do propose, but I was not
> > convinced at all).
> >
> > Regards,
> >
> > *********** REPLY SEPARATOR ***********
> >
> > On 7 Oct 2005 11:00:54 -0700, ph*****************@yahoo.com
> > wrote :
> >
> > > Nicholas,
> > >
> > > Have you looked at Octave? It is not Python, but I believe it
> > > can talk to Python.
> > > Octave is comparable to Matlab for many things, including
> > > having ODE solvers. I have successfully used it to model and
> > > simulate simple systems. Complex system would be easy to model
> > > as well, provided that you model your dynamic elements with
> > > (systems of) differential equations.
> > >
>


Oct 11 '05 #19

P: n/a
I was implicitly referring to Python/C model for this.
I'm aware that Python can be very slow on heavy computations (it's a
_documented_ shortcoming), sometimes much slower than Simulink.

I believe that no current technology can meet the needs of both rapid
prototyping (for projects in their infancy) and performance (for
projects in their industrial cycle).

That's why, as it is _documented_ and _recommended_ on the Python
website, I intend to first prototype with Python then slowly migrate
some critical parts to C/C++ as we refine and stabilize the specs.
Ideally, at the end of the project, we'll have the best of both worlds.

Note that it's the first time that I try this, I may be a perfectly
wrong approach for continuous system simulation...

*********** REPLY SEPARATOR ***********

On 10 Oct 2005 17:48:39 -0700, "hrh1818" <ho******@westerncom.net> wrote
:
In your simulator how much do you want Python to do? I ask this
because your subject title implies you want to write your simulation
code in Python but a simulator written entirely in Python would be
very slow. Python is an interpreted language and pure Python code is
not suitable for simulating big continuous systems. Hence to me it
appears you have two distinct proplems. One is developing a front end,
a user interface, that is easy to use. The other is either finding or
writing a good code compiler that wlll produce fast simulation code or
writing an interface to existing optimize simulation code. Although
most likely not suitable for your applicaion but a good example of
this type of program is Mathematica. It is written in two parts a user
interface and a kernel that does all of the high power math.

Howard
Nicolas Pernetty wrote:
I am aware of some shortcomings and design flaws of Simulink,
especially in the code generation area. I am interested by
your paper nonetheless, please send me copy.


Ok no problem. Let me just a few days to strip any irrelevant data
on it...
However, Simulink is used by many people on a day-to-day basis
in the context of big, industrial projects. The claim that it
is "next to unusable" is, in my book, an overstatement ...


Well the exact sentence is "next to unusable for our kind of
projects". You'll see the details on the paper, but I'm not joking.
For instance, under Simulink, our model is so big (well not so, but
too big for Simulink obviously), that you may have a loss of up to
40x in performance compared to the model in C (how to optimize the
Simulink model is a whole other subject in itself). So to make it
usable, we have to use automatic code generation wich bring a whole
new set of problems... BUT our work is *very* specific, and I'm not
talking about Simulink in general. It may be perfect suited for
others, it's just that for us it's far from perfect...
Scicos is not perfect either but you can hardly say that is
is a simple clone of Simulink. No time and space to go into
the details ...


I wasn't in charge of evaluating Scilab/Scicos, so I can only talk
about the conclusion : main motives to switch to Scilab/Scicos would
be because it's free, that's all. Report said that next to almost
everything Scilab/Scicos does, Matlab/Simulink can do, and more
often than not, do it much better.
So if you have a different report, I would be happy to read and
transmit it...
Obviously, the python community is very dynamic, but how much
support will you get in the very specific topic of continuous
time systems simulation ?


Well some people already offered me their help. But I believe
that someone _has_ to begin alone some day...
Otherwise people who work on continuous system simulation would
never be interested in Python.

That's the beauty of open source : do what you can, but do it ! and
hope that someone else will come one day and use your work to build
upon it. Step by step you will have something usable (in theory).
IMHO, an hybrid approach, such as the development of bridge
to include Python components into Simulink/Scicos/Ptolemy/
Modelica/pick_your_favorite_simulator may grant you more
interest from the simulation community.


I already know some bridges like pymat or mlabwrap and I agree that
a way to include Python to Matlab/Simulink would be a great step.
But :

1) I think that it's Mathworks job to do it, and if they don't want
to do it, we'll never have a very good integration.

2) For our kind of projects and our kind of developers (mainly
non-IT engineers), I'm very reluctant to introduce too many
different technologies in a project. If we decided to go for Python,
fine, let's do the entire thing in Python/C. If we decided to go for
Simulink, fine, let's do the whole thing in Simulink/Matlab/C.
Matlab, for algorithms, can do almost the same things than Python
and sometimes much better, so if you have already Simulink (and so
have the license) why go for Python and struggle to have a good
integration ?

Regards,

Cheers,

SB

Nicolas Pernetty wrote:
> Simulink is well fitted for small simulators, but when you run
> into big projects, I find many shortcomings appears which made
> the whole thing next to unusable for our kind of projects.
> That's why I'm interested in Python by the way, it is not a
> simple clone like Scilab/Scicos. It is a real language which
> bring its own advantages, and its own shortcomings, which I find
> well suited for our activity.
>
> If you want, I can send you a paper I wrote last year, detailing
> all Simulink shortcomings. I doubt that this mailing list is
> interested in such things...(and it's in French...).
> Concerning Scilab/Scicos, I'm not really interested in a
> technology primarily developed (INRIA and ENSPC) and used by
> France. Python and all its libraries and communities are so much
> more dynamic ! And also I've heard that Scilab was developed in
> Fortran in a way which make it rigid and that the sources are
> poorly documented, not a good sign for an open source software
> (and Scilab isn't 'Free' for the FSF).
>
> Regards,
>
>
> *********** REPLY SEPARATOR ***********
>
> On 8 Oct 2005 11:06:25 -0700, "Sébastien Boisgérault"
> <Se*******************@gmail.com> wrote :
>
> >
> > Simulink is a framework widely used by the control engineers
> > ... It is not *perfect* but the ODEs piece is probably the
> > best part of the simulator. Why were you not convinced ?
> >
> > You may also have a look at Scicos and Ptolemy II. These
> > simulators are open-source ... but not based on Python.
> >
> > Cheers,
> >
> > SB
> >
> >
> >
> >
> >
> > Nicolas Pernetty a écrit :
> >
> > > Hello Phil,
> > >
> > > Yes I have considered Octave. In fact I'm already using
> > > Matlab and decided to 'reject' it for Python +
> > > Numeric/numarray + SciPy because I think you could do more
> > > in Python and in more simple ways.
> > >
> > > Problem is that neither Octave, Matlab and Python offer
> > > today a framework to build continuous system simulator (in
> > > fact Matlab with Simulink and SimMechanics, do propose, but
> > > I was not convinced at all).
> > >
> > > Regards,
> > >
> > > *********** REPLY SEPARATOR ***********
> > >
> > > On 7 Oct 2005 11:00:54 -0700, ph*****************@yahoo.com
> > > wrote :
> > >
> > > > Nicholas,
> > > >
> > > > Have you looked at Octave? It is not Python, but I believe
> > > > it can talk to Python.
> > > > Octave is comparable to Matlab for many things, including
> > > > having ODE solvers. I have successfully used it to model
> > > > and simulate simple systems. Complex system would be easy
> > > > to model as well, provided that you model your dynamic
> > > > elements with (systems of) differential equations.
> > > >
> >

Oct 12 '05 #20

This discussion thread is closed

Replies have been disabled for this discussion.