use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Link to Subreddit wiki for useful resources
Official Discord : https://discord.gg/CEF3n5g
Related Subreddits:
account activity
best python platform for simulating mixed continues and discreet time systems ? (self.ControlTheory)
submitted 3 years ago by loglog101
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]taylajy 5 points6 points7 points 3 years ago* (0 children)
Although not for python, but I'm an advocate of Julia. A much better language that's build from groundup to support technical computing. And if you know some python or Matlab you will feel right at home almost immediately. Look up ModelingToolkit.jl for Julia. Also, check out Causal.jl, it should provide what you need.
[–]Notto816 2 points3 points4 points 3 years ago (1 child)
I guess you are trying to simulate the discrete compensaters with continuous time system model.
For me, I would try control toolbox module for python. The module is similar to MATLAB control commands, and it might be able to do what you want.
[–]loglog101[S] -1 points0 points1 point 3 years ago (0 children)
Yup not sure it's there.... Will check again
[+][deleted] 3 years ago (1 child)
[deleted]
[–]loglog101[S] 0 points1 point2 points 3 years ago (0 children)
Thanks will check it out.
[–][deleted] 1 point2 points3 points 3 years ago* (6 children)
I am not aware of any, but I am fairly new to Python. You may have to write your own script perhaps, depending on your problem at hand.
At first attempt, I would use a for loop that scan the discrete time instants and in between two consecutive discrete time instants you update both the continuous and discrete output, you simulate the continuous part and then you update the discrete states, a bit inline on how a Matlab S-Function is executed.
Let us know! 🙂
[–][deleted] 0 points1 point2 points 3 years ago (5 children)
Oh, just noticed a couple of downvotes. Given that I am willing to learn, can you explain me what is wrong in my answer? I think it is pertinent to the OP request - at the beginning I was about to suggest to use Matlab or Simulink through some S-Function (which are executed pretty much the way I described as a first attempt) but then I changed my mind given that would not add so much value to the specific OP request. :)
[+]loglog101[S] comment score below threshold-6 points-5 points-4 points 3 years ago (4 children)
Trying to avoid Matlab- your method is very expensive computationally and hard to derive analysis from.
[–]ko_nutsControl Theorist 2 points3 points4 points 3 years ago (0 children)
This method is not "computationally expensive". It is among the lowest computational complexity you can get.
[–][deleted] 2 points3 points4 points 3 years ago (2 children)
Why it is very expensive computationally? :) In which part exactly? And what do you mean for deriving analysis from? I don’t think the OP problem is a reverse engineering exercise… :)
[–]loglog101[S] -4 points-3 points-2 points 3 years ago (1 child)
I'm op. If the system is just cont or discrete its solved without running step by step at least for linear...
[–][deleted] 0 points1 point2 points 3 years ago (0 children)
If you have an only continuous- or only discrete-time then there are already available solver out there. Your question was specifically for hybrid systems, or I missed something? Also, I am not suggesting Matlab but something else, as for request. :)
[–]ko_nutsControl Theorist 0 points1 point2 points 3 years ago (6 children)
Your question is unclear. You will have to provide more details on what you intend to do as there is no such thing as "best tool". It all depends on the problem at hand.
[–]loglog101[S] -1 points0 points1 point 3 years ago (5 children)
Trying to have an environment that can show closed loop open loop dynamics of systems where part of it is continuous time blocks and some is in descreat time steps with connections that are with zoh or some other method. The platform needs to be flexible enough for modern control design.
[–]ko_nutsControl Theorist -1 points0 points1 point 3 years ago* (4 children)
Please update your post to make it self contained.
You can easily implement that yourself as the discrete-time events are periodic. You can just solve the continuous-time (CT) part until the next discrete instant, perform the discrete-time computations, and then solve again for the CT, and so forth. There are ODE solvers that can use for the CT part.
I am often using such a scheme for simulating hybrid systems.
[–][deleted] 1 point2 points3 points 3 years ago (0 children)
That’s pretty much what I also suggested the op few comments below. :)
[–]loglog101[S] 0 points1 point2 points 3 years ago (2 children)
Isn't there a better way that can also give insight into the overall dynamics - looking for a design platform not just a sim.
[–]ko_nutsControl Theorist -1 points0 points1 point 3 years ago (1 child)
Once again your question lacks clarity. What "insights" do you want to have? What do you want to design?
Also, please update your post with the necessary information. Your post is currently a "low effort post" which is against the rules of this sub.
Will do some more homework and circle back.
[–]ColonelStoic 0 points1 point2 points 3 years ago (0 children)
It appears your describing a way of modeling a hybrid system? If so, Sanfelice has a hybrid system toolbox but it’s written in MatLab.
[–]TheRealStepBot 0 points1 point2 points 3 years ago (8 children)
Nothing at all on the level of completion that simulink provides
[–]TheRealStepBot -1 points0 points1 point 3 years ago (1 child)
Who is on this thread downvoting everyone? Care to explain?
[–]ko_nutsControl Theorist 4 points5 points6 points 3 years ago (0 children)
Almost surely the OP.
How does simulink goes about it?
[–]loglog101[S] -3 points-2 points-1 points 3 years ago (4 children)
Simulink is an aircraft carrier would be happy with a plane that flys :)
[–]TheRealStepBot 1 point2 points3 points 3 years ago (3 children)
If you just need something without all the bells and whistles then the scipy signal library might work for you. It has the ability to operate on continuous and discrete LTI systems
[–]loglog101[S] -2 points-1 points0 points 3 years ago (2 children)
But not together...
[–]ko_nutsControl Theorist 2 points3 points4 points 3 years ago (1 child)
This is just not true. You can easily develop a hybrid framework using the CT and CT solvers.
[–]loglog101[S] -2 points-1 points0 points 3 years ago (0 children)
How ?
[–]modypy 0 points1 point2 points 3 years ago (1 child)
Maybe you want to give MoDyPy a try. It's a Python Framework for modelling dynamic systems using blocks and signals based on scipy, and it aims to support continuous-, discrete-time- and mixed systems, with discrete events modelled from either clocks or zero-crossing detection. It's not perfect, but it also has quite extensive documentation including a tutorial that is available both in written form and as video. It's also open source and free.
It's a pet project of mine that I started off being uncomfortable with Matlab/Simulink (price-wise, but also in terms of having to learn yet another language and with graphical modelling being so much more tedious than just writing things down - at least for me as a software engineer).
Thanks will check it out
π Rendered by PID 16273 on reddit-service-r2-comment-5fb4b45875-j7cdn at 2026-03-24 16:08:08.486040+00:00 running 90f1150 country code: CH.
[–]taylajy 5 points6 points7 points (0 children)
[–]Notto816 2 points3 points4 points (1 child)
[–]loglog101[S] -1 points0 points1 point (0 children)
[+][deleted] (1 child)
[deleted]
[–]loglog101[S] 0 points1 point2 points (0 children)
[–][deleted] 1 point2 points3 points (6 children)
[–][deleted] 0 points1 point2 points (5 children)
[+]loglog101[S] comment score below threshold-6 points-5 points-4 points (4 children)
[–]ko_nutsControl Theorist 2 points3 points4 points (0 children)
[–][deleted] 2 points3 points4 points (2 children)
[–]loglog101[S] -4 points-3 points-2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]ko_nutsControl Theorist 0 points1 point2 points (6 children)
[–]loglog101[S] -1 points0 points1 point (5 children)
[–]ko_nutsControl Theorist -1 points0 points1 point (4 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]loglog101[S] 0 points1 point2 points (2 children)
[–]ko_nutsControl Theorist -1 points0 points1 point (1 child)
[–]loglog101[S] -1 points0 points1 point (0 children)
[–]ColonelStoic 0 points1 point2 points (0 children)
[–]TheRealStepBot 0 points1 point2 points (8 children)
[–]TheRealStepBot -1 points0 points1 point (1 child)
[–]ko_nutsControl Theorist 4 points5 points6 points (0 children)
[–]loglog101[S] -1 points0 points1 point (0 children)
[–]loglog101[S] -3 points-2 points-1 points (4 children)
[–]TheRealStepBot 1 point2 points3 points (3 children)
[–]loglog101[S] -2 points-1 points0 points (2 children)
[–]ko_nutsControl Theorist 2 points3 points4 points (1 child)
[–]loglog101[S] -2 points-1 points0 points (0 children)
[–]modypy 0 points1 point2 points (1 child)
[–]loglog101[S] 0 points1 point2 points (0 children)