Re:Electr, a language for electronic formulas
by nyir on Thursday August 27, 2015 @05:56PM
(#10132404)
That has probably a lot of overlap with Frink https://futureboy.us/frinkdocs/, though after a quick try the output could be nicer, e.g. like described in this document.
Re:Electr, a language for electronic formulas
by lkdjiin on Friday August 28, 2015 @03:53AM
(#10134174)
Thanks for pointing this one. I don't think java is the right tool for what I have in mind (because of the JVM overhead) but I'll definitely try Frink.
Re:Electr, a language for electronic formulas
by compumike on Thursday August 27, 2015 @06:26PM
(#10132559)
Not command line (or open source), but we've built most of this capability and more into CircuitLab https://www.circuitlab.com/ (disclosure: I'm one of the developers) -- we have to manage units, metric prefixes, all sorts of arbitrary expressions https://www.circuitlab.com/docs/expressions/ , real and frequency domain, etc. We also have schematic-wide parameters, the ability to define functions of those parameters to set component values, and/or to set real-time arbitrary behavioral voltages and currents within the circuit graph, etc. On top of that, iteratively solved non-linear feedback systems, Laplace-domain filter notation.... It gets complicated fast!
One of the cool things about understanding circuits and simulation is that you can use the same concepts and tools to model non-electronics-domain problems: thermal systems, mechanical systems, etc. You can combine these, too: for a simple non-confidential example, we recently did modeling of the fusing of tin whiskers, which involves solving the electrical and thermodynamic properties at the same time.
Re:Electr, a language for electronic formulas
by ChuckMcM on Thursday August 27, 2015 @06:42PM
(#10132629)
I was going to mention you guys, its a pretty straight forward system.
There has been some other work on notational representation of electronics as part of the SPICE work that Berkley did. Also AT&T did some work there, the BLADES papers (http://ieeexplore.ieee.org/xpl/login.jsp?tp=&arnumber=31523&...) and others have that. Hardward description languages (HDL's) often include an internal way of expressing various things as well.
From a purely hobby based approach building something which was a calculator with a resistor, capacitor, and inductor key might be useful. All though if you add two resistors and an inductor what you really want is the frequency response of the RL circuit not the parasitic resistance of the coil added to the resistors.
Re:Electr, a language for electronic formulas
by selimthegrim on Thursday August 27, 2015 @10:16PM
(#10133402)
TI used to distribute an script written in Lua that did essentially this - the original software company has long since gone out of business and I am not sure if TI has persisted with it (this was 2012)
NB: This was a separate product from the Inspire software
Re:Electr, a language for electronic formulas
by csn on Thursday August 27, 2015 @07:37PM
(#10132826)
Why can't Electr detect unit K form "10K + 200"? It's the only unit present in the equation.
Why kilo-ohms are denoted with "K" while milliamperes are using the proper SI unit "mA"? Why not to use "Ω" and "kΩ"? We have that symbol in high ASCII.
Probably just my ignorance of programming language design speaking but I really have to ask.
Re:Electr, a language for electronic formulas
by mallin on Thursday August 27, 2015 @08:39PM
(#10133034)
In practical engineering (on circuit diagrams, bills of
materials, etc), you almost never see the "Ω" symbol. "K" is used for kΩ, "M" for MΩ, and "R" for Ω (as in 330R is a 330Ω resistor).
It's nothing to do with programming language design.
Re:Electr, a language for electronic formulas
by lkdjiin on Friday August 28, 2015 @04:06AM
(#10134222)
Like said before it has nothing to do with language design.
That said, I like the idea of having Ω, √, etc. But I'm afraid that our keyboards/editors/terminals are still not good to type that kind of characters quickly. But maybe I could use R or Ω, K or KΩ, why not…
And yes I think you're right, I could infer that 10K + 200 is 10.2K, like 3V times 2 is 6V, etc
Re:Electr, a language for electronic formulas
by leni536 on Thursday August 27, 2015 @07:56PM
(#10132913)
Nice idea. Unit handling can be hard though, there are several problems that you can bump into:
- It's not always evident what unit you want show after a calculation. (As/Vm or C/Vm, kV/m or V/mm)
- You should handle fractional power of units (like V/sqrt(Hz))
I recently discovered orpie and that one has unit handling. It has electrical (and all sort of physical) units and handles both of this problems fairly well. For the calculation result's unit it uses the one that comes evidently from the source terms (1kV* 0.5mA=0.5kV* mA), then the user can convert it to other equivalent units or to SI base units. It's an RPN calculator so one has to get the hang of it.
Edit:
Oh, electric engineers like to think of "rad" as a unit (like in rad/s and Hz). I think it's impossible to handle it well.
... and why in general programmers like to think about bare numbers and love to differentiate them into floats and ints of various length (like it's the 90-ies) but don't care if they are volts or meters.
https://en.wikipedia.org/wiki/GNU_Units
Calculations aren't quite as short as "1mA 3K", but pretty close to it.
It has long and short SI prefixes, scientific notation, implicit multiplication, and a history dating back to Unix itself.By the way, one of the example calculations (calculation of 205 Hz) is too high by a factor 10.
https://education.ti.com/en/us/products/computer_software/ti...
One of the cool things about understanding circuits and simulation is that you can use the same concepts and tools to model non-electronics-domain problems: thermal systems, mechanical systems, etc. You can combine these, too: for a simple non-confidential example, we recently did modeling of the fusing of tin whiskers, which involves solving the electrical and thermodynamic properties at the same time.
There has been some other work on notational representation of electronics as part of the SPICE work that Berkley did. Also AT&T did some work there, the BLADES papers (http://ieeexplore.ieee.org/xpl/login.jsp?tp=&arnumber=31523&...) and others have that. Hardward description languages (HDL's) often include an internal way of expressing various things as well.
From a purely hobby based approach building something which was a calculator with a resistor, capacitor, and inductor key might be useful. All though if you add two resistors and an inductor what you really want is the frequency response of the RL circuit not the parasitic resistance of the coil added to the resistors.
NB: This was a separate product from the Inspire software
Why kilo-ohms are denoted with "K" while milliamperes are using the proper SI unit "mA"? Why not to use "Ω" and "kΩ"? We have that symbol in high ASCII.
Probably just my ignorance of programming language design speaking but I really have to ask.
It's nothing to do with programming language design.
That said, I like the idea of having Ω, √, etc. But I'm afraid that our keyboards/editors/terminals are still not good to type that kind of characters quickly. But maybe I could use R or Ω, K or KΩ, why not…
And yes I think you're right, I could infer that 10K + 200 is 10.2K, like 3V times 2 is 6V, etc
- It's not always evident what unit you want show after a calculation. (As/Vm or C/Vm, kV/m or V/mm)
- You should handle fractional power of units (like V/sqrt(Hz))
I recently discovered orpie and that one has unit handling. It has electrical (and all sort of physical) units and handles both of this problems fairly well. For the calculation result's unit it uses the one that comes evidently from the source terms (1kV* 0.5mA=0.5kV* mA), then the user can convert it to other equivalent units or to SI base units. It's an RPN calculator so one has to get the hang of it.
Edit:
Oh, electric engineers like to think of "rad" as a unit (like in rad/s and Hz). I think it's impossible to handle it well.
http://fsharpforfunandprofit.com/posts/units-of-measure/
https://futureboy.us/frinkdocs/
... and why in general programmers like to think about bare numbers and love to differentiate them into floats and ints of various length (like it's the 90-ies) but don't care if they are volts or meters.