age-series / ElectricalAge

Electrical Age (ELN) is a Minecraft Mod offering the ability to perform large-scale in-game electrical simulations.
Other
66 stars 31 forks source link

Introduce -V terminal to Motors/Generators #32

Open Grissess opened 6 years ago

Grissess commented 6 years ago

This allows the generators and motors, like batteries, to base their voltage generation, or current dissipation, off of a reference other than ground.

Probably just as simple as setting bPin correctly in both.

Three big issues:

Credit to Omega_Haxors for the idea.

OmegaHaxors commented 5 years ago

I might actually end up doing this update myself then doing a pull request, but right now i'm focused on gameplay improvements since I realized that Survival gameplay was horrendously unfun.

jrddunbr commented 5 years ago

As it turns out, it's relatively common for HVDC power lines to have a (value aprox) +500kV and -500kV line, as compared against ground. This could potentially mean that we have a positive and negative power lead that we run over the poles, and this would work with that. Just a thought, not sure if it's the best thing to do in light of MNA runtime cost, using grounds definitely reduces complexity of the circuits.

So here's a thought - should regular crafting of the generator include a ground pin? Or should we make it an inventory item that you can remove to allow the negative pin to go negative?

jrddunbr commented 5 years ago

Here's my thoughts on this.

Keep the existing motor/generator blocks, they will be positive only. A crafting ingredient including a bridge rectifier (4 diodes) will be added to keep the voltage input/output always positive, even if the shaft goes the other way.

We introduce 2 new blocks, and those support the pos/neg voltages.

The other question is - what happens with the gas turbine and the steam turbine. Those are the only other direction sensitive thing we have to care about

OmegaHaxors commented 5 years ago

Shouldn't be too difficult to drop a Negate in the math so that energy is only ever created at the generators. If the shafts are spinning backwards, then the generators will increase the negative shaft speed. In cases when you're at or near 0, start it in a random direction, or bias it to positive spinning.

This way legacy shafts will all remain functional, while allowing room to expand into the new system.

Grissess commented 5 years ago

Perhaps for a transitional period, the two blocks are fine--but the overlap in function is irksome; I think a breaking change, should we get this working, might have to be in the future (much like the breaking change to "slowing down shaft networks by placing an additional block"). Note that it will probably affect people (myself included) who have taken for granted that the transverse sides of generators are connected to the same circuit ("the generator is a wire") to make compact power-generation builds.

(Electrical) Power is proportional to both the current and the voltage; in standard ohmic materials, Ohm's Law dictates that--for positive resistances, which are physically realistic--I and V must have the same sign (the same solutions bring the square into the direct solution for power in terms of I or V, and squaring a value has the effect of always making it positive). In other words, in the Real World:tm:, one can extract (Joule) power from a circuit regardless of its exact polarity. The biggest effects of polarity reversals are in nonlinear components (see, for example, Zener diodes) and magnetic fields--though simple devices depending on ferromagnetism, like our trusty relays, won't operate in notably different ways, modulo the residual induced magnetism (which should be quite small for a small armature).

(After some research, the exact details of our "generator" are woefully underconstrained, and a number of different physical implementations--especially with self-excited field coils--can even self-rectify based on how their exciters are set up, not to mention that nearly all modern electrical power generation is AC, so an "inversion" is merely a phase shift. Let's just conveniently ignore those issues :P)

One final note--this begs the question of what other devices we might consider polarizing. Exposing an (ohmic!) device to a "localized negative voltage" is very easy by swapping the terminals. (I think it would personally be hilarious to have a "reverse polarity magnet/advanced magnet" item that results if you reverse-bias the Magnetizer, for example, or for someone to find out their Macerator isn't macerating because it's running backwards :P .) ELN's emphasis on having one (positive) terminal and implicit ground for everything is what makes this a breaking change.

jrddunbr commented 5 years ago

Believe it or not, the machines will run just fine on negative voltage - it's just currently a pain to create.

I consider this a feature, for the moment.

I'm for breaking changes, I think that we're going to be making a lot of those in 1.16.x and 1.17.x branches. ... I thought I'd just about finished bug-fixing 1.16.x and could work on poles but I am very wrong on that front - Isolated mode of everything is borked, and I think I need to comb the MNA for any scenarios that we're only using floats.

jrddunbr commented 4 years ago

This issue is being closed now since there will be no more feature updates in Electrical Age for Minecraft 1.7.10. If the issue is relevant to 1.12, it will be re-opened there at a later date.