nets Posted May 27, 2019 Share Posted May 27, 2019 It would be helpful to see if a building's rolling 600 second "running performance" is close to 10 seconds a cycle or 600 seconds a cycle. The animations is not a very good indicator and it's very hard to make any indicator using automation (as counting would require a very complex setup). If i could see that my electrolyzer is running 500 seconds out of the last 600 or 83% this would help me make better decisions (almost no matter how it's presented, as long as it's somewhat accurate). I don't need history, only a rolling indicator. Since I'm typically terrible at explaining myself (Aspergers+ADHD) and i have to follow the thought process to understand what I'm trying to convey: Building.indicator as integer. Building.indicator = ( 600 * ticks-per-second ) -- (at start of map load) For each tick do If ( building.running==true && building.indicator < ( ticks-per-second * 600 ) ) then Building.indicator++; If ( building.running==false && building.indicator > 0 ) then Building.indicator--; done Theoretically the building.indicator should give some indication, depending on how you want to display/use it. GRANTED this is atleast four extra branches, two extra reads (building.running and building.indicator) cache assumed, and an extra inc/dec per tick, again assuming cache the write is cached unless synchronized, it isn't exactly free in terms of performance. Even if called as update functions or part of a larger loop it would still cost something. So it could be prudent to have a flag for whether measurement is desired and by default disabled. I mean, it could all be designed as a sensor object but that would require buildings to have an output automation that pulses on building use. Alternatively a sensor that could measure the electrical surge passing through it measuring a certain load and rolling the sensor.indicator. Sort of like a pipe element indicator or an pass-through transformer acting as a sensor. Alternatively a sensor that counts automation ticks but in combination with an electrical sensor (pass-through transformer?) so the electrical sensor can react to above/below X watt and pulse the automation for the indicator sensor to increase or decrease. You know your creation best, not trying to imply you don't know all these things already. You've probably already considered many of them and found a very good reason for not. I dunno, i'm just passionate about the things that brings joy and definitely keeps my stress level low! Can't wait for next release! Link to comment https://forums.kleientertainment.com/forums/topic/106775-show-building-running-efficiency-as-indicator/ Share on other sites More sharing options...
Nightinggale Posted May 27, 2019 Share Posted May 27, 2019 I like this idea and I would like to propose an implementation. It should be possible to do fairly simple. void Sim1000ms(float dt) { this.operationalHits++; if (this.operating) { this.operationalHitsOn++; } } void OnNewCycle() { if (this.operationalHits > 0) { this.operationalPercentage = (100*this.operationalHitsOn)/this.operationalHits; } else { this.operationalPercentage = 0; } this.operationalHits = 0; this.operationalHitsOn = 0; } The idea is: top one is called once every 1000 ms (once a second). It counts how many times it is called and how many of those the building is operational. When there is a new cycle, calculate the percentage of how often the building was on. The display can then display just this.operationalPercentage. The reason why it should count how many times Sim1000ms is called rather than just assume 600 per cycle is if the CPU isn't fast enough and it ends up calling say 599 times, then it will still calculate correctly and be able to say 100%. We can also use Sim200ms, which demands more CPU power, but is more accurate. Depending on the existing code, Sim200ms might be called already in which case modifying the existing code to count would likely be faster than adding new calls specific for counting. Link to comment https://forums.kleientertainment.com/forums/topic/106775-show-building-running-efficiency-as-indicator/#findComment-1201389 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.
Please be aware that the content of this thread may be outdated and no longer applicable.