Discuss: Power Switch should not "Blink"

Post your ideas and suggestions how to improve the game.
User avatar
ssilk
Global Moderator
Global Moderator
Posts: 10764
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Discuss: Power Switch should not "Blink"

Post by ssilk »

After some discussion I changed the topic of this discussion to make it more obvious, that this is in a complete open discussion stage. For me it's also clear, that the maintenance part of this suggestion should be cancelled; for the underlaying problem (that it just is a problem, when switching so fast, that the sign on devices are flashing) we can use also better aproaches. See end of first page -- ßilk

Well, you can use the new switch to switch something on and off again. Many 100 times. Per minute... :)

So this is my point: That makes no sense. Power switches are not meant to switch on and off in microseconds, 30 times per second for Factorio.
No, they are meant to be switched for - let's say - in AVERAGE every 60 seconds. 30 seconds on, then 30 seconds of. Again: In average!

So let's say we do it like so: We switch on/off every 60 seconds during a whole game. Let's say 20 hours. That's 1200 switch-events. Let's say that is the 50% durability of a switch. Till here the switch is very reliable, when using more it has a more and more bigger chance to break.

Again: below here is canceld

The switch needs then some maintenance to refill the maintenance points. That might be part of another suggestion. For now it should be enoght that it will work by hand and automated and you just need to put repair packs into it.

Missing maintenance works a bit different than loosing health:
- You don't see it missing for the first 10-20%
- Even then it will not be auto-repaired immediately, max. every 600 seconds.

You see: Normally used this is quite uncritical and there is no deeper game-play behind it. BUT for the case, that you switch much faster, like 30 times a second, the time that is needed to break the switch (the 1200 switch events) is then only 40 seconds!

That's faster, than the automated switch maintenance might be repeated. So the switch will fail at some time.


The interesting thing is then: Nobody can know, will it fail when switched on or off (the breaking depends on a probability). That will lead to really interesting situations. :)

That will also lead to interesting effects in the factory. The formerly (more or less) unwatched switch is suddenly much more important. Or you cannot use the switch as a switching power supply (the power supply in/for your computer switches on/off some hundred times per second to regulate the exact amount of power). At the same time the switch has not been loosing it's usability.

And it spares us one fix: How to display a number of devices that are continuously switched on/off. See viewtopic.php?f=6&t=27436
Even if the icon is fixed and will not longer blink, it will be quite disturbing, when the player creates some kind of circuit, that switches on/off very fast.

So - if you ask what this should be used for: For the case, that a player uses a power switch as regulator (need to switch on/off several times per second), Factorio does normally not forbid strange usages of entities/items, but in this case it is a bit of graphical glitch. And it really doesn't forbid it, but you need take care about it (place an inserter, which fills in repair packs into the switch?!).

As always: The exact numbers are balancing... :)
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...

fandingo
Inserter
Inserter
Posts: 35
Joined: Fri Apr 22, 2016 4:32 pm
Contact:

Re: Power Switch have a Durability and need Maintenance

Post by fandingo »

This gets back to the age-old problem with Factorio: If X requires maintenance, why don't belts and everything else with moving parts also need maintenance? Following that, what gameplay mechanic can the player reasonably use to service that many entities?

There's also a more practical concern. I run a steam and solar/accumulator power grid. Before 0.13, there was no practical way to get accumulators to actually be used if there was sufficient steam capacity. They'd stay charged all the time, and then you'd have tons of useless solar charge.* The power switch changed all this. I can make a power switch that checks an accumulator percentage and only switch on when its <15%. This feature is amazing, and that plus the broader circuit network functionality are the best parts of 0.13. The thing is that the power switch doesn't operate smoothly, especially during sunrise as solar ramps up and steam down. The power switch is active, and the accumulators start to charge for an instant. Some fraction of a percent tips the boolean <15% circuit condition. The power switch will flip for what seems like 1 tick. The accumulator will dip below 15% in 1 tick. The process repeats at a blistering pace. Fortunately, the factory seems to operate fine, which is a credit to how electricity works in the game. The only negative consequence is the power graphs freak out switching so quickly.

A power switch requiring maintenance would be impossible. By my reckoning, 3600 switch-events per minute seems like what's happening in my game. It'd break constantly and be so unstable to be used in a power grid.

* More details on my power network:

The save was uploaded as part of anotherbug report if you want to see the spasmatic switch. It's over by the "oil power" train station. My power network consists 2 parts. Steam generation and "Madzuri's" solar/accumulator blue print, which has balanced solar and accumulator capacities. This provides only partial capacity if the factory is fully loaded. These Madzuri arrays are on the primary power grid.

I also have some steam generation. I believe ~100MW in the attached save. I only want steam to kick on when the accumulators get low. So I did this:

Image

That accumulator outputs Z and is attached to the primary grid. When the accumulator charge gets below 10%, it closes the switch, and the steam kicks on. (The other switch controls another set of steam generators that kick on at 15% to help alleviate the spasmatic switch that occurs.)

One issue at play is simple control theory. I'm trying to control a power network, and all I can use is an instantaneous value from that power network. Merely having two boolean outputs based solely on the singular setpoint *always* leads to unstable behavior. (That's why the switch goes crazy flipping on and off! ;) ) This is perfectly fine! As I said, the way that entities buffer small amounts of electricity make everything work, except the graphs and the power switches toggling very, very quickly. I guess what I'm trying to say is that without PID controller based circuit conditions/combinators (which I think is totally infeasible in a video game -- tuning alone is far too complicated) controlling a power network with the 0.13 power switch will have periods of very rapid toggling. A maintenance cost would make it impossible to use in such applications.

mattj256
Fast Inserter
Fast Inserter
Posts: 203
Joined: Sun Mar 27, 2016 7:25 am
Contact:

Re: Power Switch have a Durability and need Maintenance

Post by mattj256 »

ssilk wrote:Power switches are not meant to switch on and off in microseconds, 30 times per second for Factorio.
I agree with ssilk that having the power switch change so frequently doesn't seem right. And I agree with fandingo that adding maintenance to the power switch doesn't add anything to gameplay.

I hate seeing those cycles back and forth 30 times a second, so I use the circuit network to set up an S-R latch:

Image

Here's the description of how to set up an S-R latch:
viewtopic.php?t=14556

The nice thing about my solution is that you can make the switch go ON for one condition and turn OFF for a different condition.
The bad thing is that this is way too complicated for most people.

Suggestion #1: put two different circuit or logistic conditions into the power switch: one to turn ON and one to turn OFF.
Suggestion #2: after the power switch has switched it has a "cool down" period of five seconds, meaning it doesn't check its inputs for five seconds. Or ten seconds or a minute or whatever.

User avatar
aRatNamedSammy
Fast Inserter
Fast Inserter
Posts: 216
Joined: Tue Jul 08, 2014 4:26 pm
Contact:

Re: Power Switch have a Durability and need Maintenance

Post by aRatNamedSammy »

hmmm, playing the janitor non-stop to replace broken things... we already have bitters for breaking things, no need of anything more.. my opinion, this is only a game breaking feature... with thousands of belts/switch/poles , yikes :shock:
Teeth for Two (so sorry my bad english)

fregate84
Fast Inserter
Fast Inserter
Posts: 233
Joined: Sun Jun 22, 2014 10:56 am
Contact:

Re: Power Switch have a Durability and need Maintenance

Post by fregate84 »

You can add a waiting time between to swith with circuit network.

I do that, So I check all 10s only.

User avatar
ssilk
Global Moderator
Global Moderator
Posts: 10764
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Power Switch have a Durability and need Maintenance

Post by ssilk »

fandingo wrote:This gets back to the age-old problem with Factorio: If X requires maintenance, why don't belts and everything else with moving parts also need maintenance? Following that, what gameplay mechanic can the player reasonably use to service that many entities?
Simple answer: Cause that is not interesting. If a belt fails it will just stop. Nothing serious.
If a switch fails the power of your factory will eventually drained to the max and you get power fails.
Or something else. I mean in most cases "interesting" stuff, sometimes a complete fuck-up. :)

It is for example the old principle of a tiny vicious circle: Need repair packs to maintain switch, switch turns maintenance-production on/off (with others).
There's also a more practical concern. I run a steam and solar/accumulator power grid. Before 0.13, there was no practical way to get accumulators to actually be used if there was sufficient steam capacity.
Sorry, that is wrong. :) We had since 0.6 dozens of working solutions to do exactly that (and they are still working).
The thing is that the power switch doesn't operate smoothly, especially during sunrise as solar ramps up and steam down.
Exactly. I like that. This is like in reality. With my suggestion you need a more complex solution to avoid that or you keep living with it (and need much repair packs).
A power switch requiring maintenance would be impossible. By my reckoning, 3600 switch-events per minute seems like what's happening in my game. It'd break constantly and be so unstable to be used in a power grid.
Well, I'm 100% sure there are many solutions for that kind of problem, because in reality they have the same problem with switching big power. In high-power electrotechnics to avoid such "contact burn out" is a very, very important thing. They use for example timer-circuits for such stuff (see previous post for example). Or they switch very clever only parts of a facility...

And - eventually - I think we need also a power-regulator. I read some comments from other players here, that go into that direction.

But a power-regulator is a different thing. Another suggestion.
For 0.14 I don't see the need for that. We (the players) need to learn some time how to use the current switch and then we can say clearly, what else is needed. (or the devs will see it themselves)
This suggestion goes around the problem, with the "look and feel" of he game, when we do constantly switch on/off (big) parts of a factory. It feels just wrong!



EDIT: I had another idea now, that will solve that problem also (but is a much deeper change to now): What if the switch himself cannot switch faster than each 10 seconds? Think of it, that he needs some kind of reload before he can be used again.

For example: In reality they blow out the high-voltage flash, that remains after switching of some very high-voltage (it doesn't go out itself, cause once air is in ionized state it can conduct electric power very well, which makes it self-sustaining) with pressured air. The pressured air needs first to be created before switching. Sorry for my English. :)
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...

User avatar
ssilk
Global Moderator
Global Moderator
Posts: 10764
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Power Switch have a Durability and need Maintenance

Post by ssilk »

Sorry for double post.
mattj256 wrote:The nice thing about my solution is that you can make the switch go ON for one condition and turn OFF for a different condition.
The bad thing is that this is way too complicated for most people.
I need to admit more or less. :/
It would be easy, if we would have some kind of "timer combinator", which does exactly that.
Suggestion #1: put two different circuit or logistic conditions into the power switch: one to turn ON and one to turn OFF.
Suggestion #2: after the power switch has switched it has a "cool down" period of five seconds, meaning it doesn't check its inputs for five seconds. Or ten seconds or a minute or whatever.
Your #1 seems to be a very useful solution. I really like that, cause that seems to be very simple to implement and understand and would have great use-cases.
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...

PacifyerGrey
Smart Inserter
Smart Inserter
Posts: 1045
Joined: Wed Jun 29, 2016 10:02 am
Contact:

Re: Power Switch have a Durability and need Maintenance

Post by PacifyerGrey »

mattj256 wrote: Suggestion #1: put two different circuit or logistic conditions into the power switch: one to turn ON and one to turn OFF.
This ^^ is a best solution to prevent switch from jiggling around exact condition.

Neotix
Filter Inserter
Filter Inserter
Posts: 597
Joined: Sat Nov 23, 2013 9:56 pm
Contact:

Re: Power Switch have a Durability and need Maintenance

Post by Neotix »

We had solar panels maintenance and that feature was abandon because it gives nothing to gameplay. It'a end up just placing roboport with construction bots and repair packs. The same thing will be with power switch. Just annoying feature witch no benefit for gameplay.

If you want to reduce power switch usage then add cooldown or make it slower.

User avatar
ssilk
Global Moderator
Global Moderator
Posts: 10764
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Power Switch have a Durability and need Maintenance

Post by ssilk »

Neotix wrote:We had solar panels maintenance and that feature was abandon because it gives nothing to gameplay. It'a end up just placing roboport with construction bots and repair packs. The same thing will be with power switch. Just annoying feature witch no benefit for gameplay.
No. This is a bit different.
See my comment here (today 10:08) viewtopic.php?f=6&t=28899#p183679

With new words:
If a solar panel fails it will just stop. Nothing serious. If a switch fails the power of your factory will eventually drained to the max and you get power fails, cause you don't know, if it is turned on or off before it fails. The switch functionality fails, not the power conduction.
If you want to reduce power switch usage then add cooldown or make it slower.
Meanwhile I think the both ideas from mattj256 are much better than mine. :)
I think a mix of two conditions and a cooldown that is configurable (defaults to 5 secs but can be also 1/60 secs) would be quite useful.

Forget about the mainenance stuff! ;) It is eventually interesting, but could also be implemented as mod first...
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...

bobucles
Smart Inserter
Smart Inserter
Posts: 1613
Joined: Wed Jun 10, 2015 10:37 pm
Contact:

Re: Power Switch have a Durability and need Maintenance

Post by bobucles »

Make power switches use copper wire ammo. Every time it breaks it consumes a wire to reconnect. Half a unit of copper is pretty damn cheap for typical use. EZ.
The same thing will be with power switch. Just annoying feature witch no benefit for gameplay.
Power switching events consume CPU resources as the connected appliances turn on and off. If you're doing this an insane amount of times or for an unusually complex network, it could very well affect gameplay. The ammo system deters against strange use, which in turn protects against the associated UPS loss.

User avatar
ssilk
Global Moderator
Global Moderator
Posts: 10764
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Power Switch have a Durability and need Maintenance

Post by ssilk »

bobucles wrote:Power switching events consume CPU resources as the connected appliances turn on and off. If you're doing this an insane amount of times or for an unusually complex network, it could very well affect gameplay. The ammo system deters against strange use, which in turn protects against the associated UPS loss.
That is a good point. :)
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...

Neotix
Filter Inserter
Filter Inserter
Posts: 597
Joined: Sat Nov 23, 2013 9:56 pm
Contact:

Re: Power Switch have a Durability and need Maintenance

Post by Neotix »

bobucles wrote:If you're doing this an insane amount of times or for an unusually complex network, it could very well affect gameplay.
If you will build insane amount of assemblers, if you move insane amount of items on belts, if you use insane amount of bots, if you ... it all affect gameplay. So this is not an argument.

Ammo system for switch is the worst idea I read so far and it change nothing with fast on/off switch. It will be only resource sink.

User avatar
ssilk
Global Moderator
Global Moderator
Posts: 10764
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Power Switch have a Durability and need Maintenance

Post by ssilk »

Neotix wrote:all affect gameplay. So this is not an argument.
Oh, I think yes. Every time you turn off the power in a network the devices in that network are turned off. So that they don't use any CPU time at all. When you turn the power on you need to go through all the devices and reactivate them. This can be quite CPU heavy, if you do that every tick and with many devices.
But I think the main point is still, that it is a graphical issue, what to do with constantly flashing stuff.
Ammo system for switch is the worst idea I read so far and it change nothing with fast on/off switch. It will be only resource sink.
Well, it depends on what you do with it. But I think that maintenance part of this suggestion that needs "ammo" can be really closed. I wrote a comment in the first post.
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...

mattj256
Fast Inserter
Fast Inserter
Posts: 203
Joined: Sun Mar 27, 2016 7:25 am
Contact:

Re: Power Switch have a Durability and need Maintenance

Post by mattj256 »

ssilk wrote:Meanwhile I think the both ideas from mattj256 are much better than mine. :)
I think a mix of two conditions and a cooldown that is configurable (defaults to 5 secs but can be also 1/60 secs) would be quite useful.
Thanks ssilk.
I think the "two different conditions" could find a nice home in vanilla Factorio. Most players would use it, it's easy to understand, and (hopefully) easy to implement.

My other suggestion of a cooldown period was my "plan B" if you didn't like the first idea.
I don't think it's as useful. Delays can already be implemented with combinators. Accumulators take many seconds to fully charge and discharge, so as long as the circuit condition is based on accumulator charge there is already an automatic delay.

Mainly I just want to make it easier for players to avoid that annoying up-down-up-down pattern in the graph. It doesn't feel right at all.

User avatar
MeduSalem
Smart Inserter
Smart Inserter
Posts: 1349
Joined: Sun Jun 08, 2014 8:13 pm
Contact:

Re: Power Switch have a Durability and need Maintenance

Post by MeduSalem »

I agree that turning the Power Switch on/off once every tick is absolutely ridiculous and unrealistic with electric currents this strong. It would wear out the hardware quite fast. It's by no means a transistor working in a circuit network and it shouldn't work like one. Power switches designed for several hundred thousand volts are always mechanical and they always have a huge delay for closing/opening.



That brings me to the point that as long as there is not an explicit timer combinator in the game for convenience sake I think that adding a delay to the power switch is probably the best/easiest way to go about it. (I say explicit timer combinator because creating a timer with a combinator is not really straight forward for casual players. I realize that experienced circuit designers may have their fun with that but most people don't.)

So the animation takes something like 5 seconds to close the switch after which it becomes connected, and when shutting off the networks disconnect immediately but the animation takes another 5 seconds to finally reach the open state, from which it can be closed again.

No more On/Off flickering.



That said 2 seperate conditions for when to turn off or on may be interesting as well, but I feel like it may be too complicated for day-to-day use as it isn't really necessary to have 2 conditions for both turning on and off. The problem is that when both signals for on and off are true... which one should be taken? With an RS latch the problem is solved easily, but inside the power switch it wouldn't be all that obvious why it is chosing one signal over the other. But in the end that's worth its own topic anyways because this one is basically about duabillity and/or maintenance.



And about the maintenance part... if something like that gets considered then there are other canditates that are much more in need for a maintenance part, like accumulators/solar panels/belts etc.

bobucles
Smart Inserter
Smart Inserter
Posts: 1613
Joined: Wed Jun 10, 2015 10:37 pm
Contact:

Re: Power Switch have a Durability and need Maintenance

Post by bobucles »

If you will build insane amount of assemblers, if you move insane amount of items on belts, if you use insane amount of bots, if you ... it all affect gameplay. So this is not an argument.
A single assembler has a CPU effect on one assembler. A single power switch can have a CPU effect on a hundred assemblers. A thousand power switches playing TSO music with power networks is not inconsequential.

One of the older friday news things talked about building the back end code for power switching networks. It's definitely more work than it may seem at first glance.

User avatar
MeduSalem
Smart Inserter
Smart Inserter
Posts: 1349
Joined: Sun Jun 08, 2014 8:13 pm
Contact:

Re: Power Switch have a Durability and need Maintenance

Post by MeduSalem »

bobucles wrote:One of the older friday news things talked about building the back end code for power switching networks. It's definitely more work than it may seem at first glance.
I'm not sure if it is implemented that way in Factorio but wouldn't it be best if internally the entire power grid is sectionized (with Power Switches acting as a dividers/gates defining sections, much like rail signals are the borders of blocks)... and have a list of suppliers/consumers for each section which is only updated once a player places/removes buildings to that section?

Then for each tick Sum up the Suppliers (according to their current possible max output) and then sum up the active consumers (max possible usage) .

And then ∑Supply / ∑Consumer gives a ratio.

If it is greater 1 then capacity is met and all consumers are able to run at 100% speed and the Suppliers can be reduced in output according to the ratio.
If it is smaller 1 then each supplier runs at 100% output and for each consumer reduce the consumption/speed according to the ratio. (Like Assembler Consumption * ratio).

And that's done for each section individually as long as the power switches are off (and there are suppliers/consumers of course).

Once a power switch becomes activated then Section x + Section y lists of Suppliers/Consumers get temporarely combined with an AND function (leaving the original sections intact, so you don't have to reestablish each individual section from scratch) before doing the supply/consumer ratio stuff.

Funny thing is that one could even precalulate the lists for every possible combination of the Sections and have the lists ready in the background and then activate them on demand for detailed calculation. But for a very complex graph the approach of precalculation may turn into an optimization problem, so combining sections on the fly may be better then performance-wise.


I'm not a programming ace but the approach seems pretty straight forward to me.

bobucles
Smart Inserter
Smart Inserter
Posts: 1613
Joined: Wed Jun 10, 2015 10:37 pm
Contact:

Re: Power Switch have a Durability and need Maintenance

Post by bobucles »

I'm not a programming ace but the approach seems pretty straight forward to me.
The programming aspect is certainly its own thing that players don't need to concern themselves with. Consuming resources is a balancing method to say "here's this cool thing, don't use it too much". It also helps identify problems in the circuit logic because if it's going bonkers it'll simply run out of material to continue messing up.

Players aren't doing too much with power switches. Yet. But as others have said your typical use isn't going to need more than switching it every now and then to save factory energy.

User avatar
MeduSalem
Smart Inserter
Smart Inserter
Posts: 1349
Joined: Sun Jun 08, 2014 8:13 pm
Contact:

Re: Power Switch have a Durability and need Maintenance

Post by MeduSalem »

bobucles wrote:Players aren't doing too much with power switches. Yet. But as others have said your typical use isn't going to need more than switching it every now and then to save factory energy.
Well...

I currently use it to Switch my Beacon/Assembler Arrays off once the buffer hits a limit.

I'm also a Steam Guy, so basically I want to ensure that the Oil Industry always gets energy. Meaning I have 3 seperate Power grids (1 for Power generation powering the Oil Industry, 1 for Defense, 1 for the rest of the factory).
But on the other hand I'm also using PM3s/Beacons there to maximize the output of the Oil Industry. So I'm also using the Power Switch to individually shut off Refinieries, Solid Fuel Chem Plants and Rocket Fuel Assemblers if something piles up.
That means that if everything is turned on there's a huge demand spike for the Steam Engines powering the Oil Industry, while the other time they are idling around when the Beacons etc are shut down.
So what I did there is reconnect the Steam Engines based on demand as well. So basically if the Oil Industry doesn't require as much energy to power itself currently then individual rows of Steam Engines get disconnected from the Oil Industry and connected to the Factory Power Grid to push Output there and then again disconnected from the Factory Power Grid and reconnected to the Oil Industry if the Oil Industry spikes up.
The only downside of the approach is it pretty much messes up the energy statistics calculation :/

But apart from that I'm still experimenting around on what else I could use the Power Switches for.

Post Reply

Return to “Ideas and Suggestions”

Who is online

Users browsing this forum: No registered users