Watts, Kilowatts, Megawatts - it's all a bit untidy [0.54]

Report bugs here! Please use the template when posting. For help running the game, please use the tech support forum.
Post Reply
Posts: 72
Joined: Wed Jun 24, 2015 10:40 am

Watts, Kilowatts, Megawatts - it's all a bit untidy [0.54]

Post by Woetoo » Sun Apr 03, 2016 8:27 pm

Alpha build number: 0.54
Operating System: Windows 7

Bug severity: Watts, Kilowatts, Megawatts - it's all a bit untidy

This is more a quality of life report than a bug. Although I could probably make a case for values displayed as "6.7e+003KW" being a bug.
Surely it wouldn't be too difficult to create a formatting function for Watts, Kilowatts, Megawatts, Gigawatt, Terawatt, Petawatt, with an optional number of decimal places?

Right now, there's all sorts of formatting for electrical values.
  • Solar panels display as 654.123W (Watts to 3 decimal places).
  • Wind Turbines display as 6543.12W (Watts to 2 decimal places).
  • Geothermal show as a fixed 2000W (Watts to 0 decimal places).
  • Flywheel Storage displays as 6543.321KW (Kilowatts to 3 decimal places).
  • Fission and Fusion Reactors display as 7654321W (Watts to 0 decimal places).
My Flywheels are currently showing wildly varying numbers like 6.7e+003KW, because I have both a fusion and fission reactor online.
I've got to assume that if it's showing as an exponential number, it's a bug - or at least an omission.

I don't know C, C##, C++ or the like enough to do much more than embarrass myself. And you really don't want an example in COBOL. So I'll throw in some something that's sort of pseudo BASIC...

Code: Select all

function FormatWatts (inWatt, inDecPlaces)

outWatt$ = "#err# W"
if  inWatt < 800 then
    outWatt$ = string (round(inWatt,inDecPlaces)) + "W"
    if  inWatt < 800000 then
        outWatt$ = string (round(inwatt/1000,inDecPlaces)) + "KW"
        if  inWatt < 800000000 then
            outWatt$ = string (round(inwatt/1000000,inDecPlaces)) + "MW"
        end if
    end if
end if

return (outWatt$)
Please excuse the bad code, it's about 30 years since I programmed in BASIC.
I picked 800 and it's multiples basically because I think numbers like 950W looks better as 0.95 KW or even 0.9 KW. Just a personal preference.
I'd even be tempted to hard code the inDecPlaces as 1. Sorry, but the constant jumping around of the display when hovering over things like Flywheels makes my brain ache, especially to 3 decimal places.
ofc, that doesn't address the localisation issues of European countries that reverse the comma and the fullstop or India where 100,000 is displayed as 1,00,000 - because after one thousand, they represent numbers as multiples of one hundred not one thousand.

Anyway, if it's not already on your things to do... 6.7e+003KW exponential numbers... ugly.

User avatar
Site Admin
Posts: 1106
Joined: Sat Jul 14, 2012 11:28 am

Re: Watts, Kilowatts, Megawatts - it's all a bit untidy [0.5

Post by SimoRoth » Mon Apr 04, 2016 3:32 pm

Yep indeed. I will be standardising the output of many of the infotips for sanity and clarity. This will likely be fixed by 0.60.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest