Support offset voltages
Opened this issue · 0 comments
ducky64 commented
Currently, the system assumes all grounds are at 0v, which is reasonable for many systems. However, two applications break this assumption: offset grounds (eg, in a series battery pack, circuits might be referenced to different cells - primarily relevant for BMSes) and isolation.
No applications currently use offset grounds (this will change soon...), and isolation is handled with separate nets (though there's no isolation enforcement).
Ideas for supporting offset grounds:
- Status quo: we assume each ground is at zero, so nothing needs to change. Effectively, a positive source only defines the local voltage. Users must be diligent about signals that cross different grounds, because the model will false-negative since it's unaware of the ground offsets.
- Precise ground offset. The main problem with encoding grounds as a range (and supporting tolerances) is anything referenced from that then inherits that tolerance - for example, a signal stacked on top of a 5v +/- 5% ground inherits the ground's tolerance, and because operations always expand tolerance, subtracting the ground does not recover the original signal. So grounds must be at exactly one voltage (presumably the nominal voltage?), even if not zero. But this won't do proper tolerance stackup analysis across ground domains.
- Not all nodes have a clean fixed reference voltage even if tolerance is ignored - for example, a switching node in a power converter oscillates between voltages. It could be set at the average (or either extreme), but the full tolerance stackup would be incorrect.
- This requires refactoring all the examples and libraries so signals have a defined reference. Which really is probably a good API anyways.
- Maybe there could be some kind of implicit ground for syntactic sugar - TBD what the semantics would look like.
- Isolation can be defined in terms of the maximum offset voltage.
- Symbolic analysis. Maybe not a full blown symbolic solver (yet?), but grounds provide a reference variable that other values can be defined in terms of .
- For example, a ground defines
g
. A signal voltage can then be defined in terms of that, for example v = g + 5v +/- 5%. A check might be v within g and g + 10v, and the solver would cancel out the gs without introducing additional tolerance, even if g was defined as 10v +/- 5% referenced to something else. - This could be API compatible with the above - it could be practical to start with the above, then the solver / internal representation could be swapped without library and example changes.
- Isolation can be defined as the range of offset voltages.
- Needs a lot of thought on how this should be exposed to the user (both at the edg_core level and electronics model level) and defined in the IR.
- What is the return value and type of an expression where not all variables cancel out?
- For example, a ground defines