5 ms·
Question since you appear familiar with math simulation, could you do what you're describing with Matlab with Octave instead?
by thx-2718 3y ago
Question since you appear familiar with math simulation, could you do what you're describing with Matlab with Octave instead?
- ted_dunning 3y agoYes. Easier with Julia, though, because the ODE and PDE support is better and you have better / simpler notation. Performance will be better as well, but for simple problems you can't tell.
- ChrisRackauckas 3y agoFor circuits a lot of them are represented by differential-algebraic equations (DAEs) and require modeling tools in order to handle the high differential index of the systems. This is the reason why they are typically handled via acausal modeling systems which can do index reduction. For Julia, this is the ModelingToolkit portion of the SciML ecosystem (https://docs.sciml.ai/ModelingToolkit/stable/ https://docs.sciml.ai/ModelingToolkit/stable/), and some modeling tools like https://github.com/ModiaSim/Modia.jl https://github.com/ModiaSim/Modia.jl and OpenModelica front-ends https://github.com/OpenModelica/OMJulia.jl https://github.com/OpenModelica/OMJulia.jl.
- fsckboy 3y agoI'm not familiar with matlab or octave :) but I do know the discrete and continuous underlying mathematics involved here, and from the https://octave.org/ https://octave.org/ homepage, "the Octave syntax is largely compatible with Matlab", the answer is yes. just to ELI5 for folks, the cool thing about analog computers (or digital approximations or simulations) is that since they are actually integrating (storing charge in a capacitor as the voltage varies) or actually differentiating (current through a capacitor varies with the voltage differential/rate of change) they can calculate what would be very complex to do on paper. Or more plainly, if the rate that the water flows out of the drain of the bathtub depends on the water pressure above which depends on the depth of the water in the tub, you can study all the math involved (what you did in calculus) or you can just put water in the tub and set your stopwatch (analog computer); and electrons through or in a capacitor is just like water in a tub this is basically all that's involved inside a music synthesizer. The complexity comes from stacking together a variety of different concepts once you understand that the concepts are stackable (like when they taught you about arithmetic being commutative, associative, distributive, reflexive, etc)
- etrautmann 3y agoYes, but simulink's graphical interface makes simple circuit simulation a bit easier for rapid iteration, testing, etc.
- pkaye 3y agoI'm wondering if Modelica might be useful for this. Its an open source modeling language though I've never used it. Its basically writing models with differential equations for each of the components and then connect them together to form a system. https://en.wikipedia.org/wiki/Modelica https://en.wikipedia.org/wiki/Modelica
- GeorgeTirebiter 3y agoI have used https://openmodelica.org/ https://openmodelica.org/. It's another one of those "invest substantial time understanding what they are doing, and you will likely be rewarded." Simple things are simple, but I found it took longer than I would have like to bang out e.g. a PID algo with a particular motor and load. If you want to try this, buy the book, and follow it to the end. Then keep learning, as you build more and more sophisticated simulators.
- ChrisRackauckas 3y agoI'd argue that acausal modeling is much easier for circuit design. And there's quite a bit of research, including surveys of experts, that backs it up as well. I recently put out a video exactly on this topic that summarizes some of the research and shows some examples to this end (https://www.youtube.com/watch?v=ZYkojUozeC4 https://www.youtube.com/watch?v=ZYkojUozeC4). Acausal modeling definitely isn't something that is taught in most (American) engineering schools, but once you get the brain flip it pretty clearly can improve productivity, no matter which acausal modeling language is used.
- mk_stjames 3y agoResponding at the bottom of the thread here, and also just to say Hi to Chris above. So in my top level I mentioned Simulink as a nice path for students to learn modeling circuits, and in a way then could use this path to simulate what an Analog computer such as that in the original link is running. My early forays into numerical simulation and linear systems modeling were thru Simulink, and I've built models of some very big systems in Simulink and used them in the design process of various things- typically vehicles, automotive systems; modeling powertrains, electro-hydraulic controls, EV drive cycle range simulation, etc. That was all many years ago. I then went down the path of learning a bit of OpenModelica and as I was intrigued by the acausal approach and the open source aspect. Like anything the learning curve was steep (steeper than simulink) and I never got past a lot of clunkiness. Then I discovered Julia a few years ago and even though I've moved on to other work, I've followed how people using Julia are modeling and solving closely, and what Chris says about how building acausal systems can be easier, and the benefits seen in ModelingToolkit.jl combined with the full Julia ecosystem all rings so true. I'm really excited to eventually see a full on acausal, block-based, yet easily extendable Simulink competitor sprout from Julia devs because as it does it will be the killer app for the language for a lot of engineers, IMO. Funny enough, now Mathworks implements an acausal modeling approach in the Simulink GUI domain with their 'SimScape' add-on, but I have not gotten a chance to use it. Anyway, yeah I need to get a project going to utilize some of the latest happenings in Julia modeling, and maybe find a way to contribute. Cheers to you and the other devs, Chris!
- wrp 3y agoMatlab has Simulink, but I don't think there is anything equivalent for Octave. However, Scilab has Xcos. In general, if you don't need total compatibility with Matlab, you should take a look at Scilab, because it is much more polished than Octave.