Game Design, Programming and running a one-man games business…

Solar Farm Update: ENERGIZATION!

So yesterday was the big day and we finally switched on our solar farm! The site is not 100% finished, with a lot of tidying up to do, but for the first time ever, the 3,024 solar panels on the site are finally generating power and feeding it into the national grid. Overall, it will provide power for 300 homes, which is pretty good. That might sound a lot if you are reading this in the US, but UK per-household electricity consumption is actually quite low. Yesterday was a big big milestone, but not the total end of the project. We do not have the monitoring logins set up yet (but the power is being logged by the meter), and we do not have the final construction bill, soi I cannot tell you if/how profitable it might be yet. But here are the switch-on day details:

Annoyingly, I live hundreds of miles away from the site, so we have a four hour drive to get there (including a short breakfast/coffee stop where I recharge the EV). Because switch-on was booked in for 9.30AM, that meant a very early start, and then a long drive in darkness and eventual sunrise. That did mean that the project manager was onsite at sunrise and got some really nice pictures:

Because you have to arrange someone from the distribution network operator (DNO) to come and ‘witness’ the site energization, you have a hard deadline, because they are busy and not flexible. My wife had to come back from holiday a day early to make the date. It also meant that this was a HARD deadline, and everything had to be ready. I had assumed we would comfortably meet that, but when we arrived on site there were about 9 vans and a bunch of people still running cables and connecting stuff. This was pretty scary because the DNO will not wait all day, and there is every chance some initial test fails, or something is wrong. There was a lot of pacing up and down. Also the site manager was beyond stressed. Obviously a good time to just take photos :D.

Because everything was being tested, it was a good time to poke around and look at how everything works. The DNO substation was open and being worked on, which is a rare chance to see inside it. We will probably never see inside this box again, as it is owned by the DNO, and is their responsibility, and only they have the key! The insides are basically some big fuses and switching stuff and a transformer. This is where the power gets converted from about 400v to 11,000 volts to go out into the grid. This box is also where the (now underground) cable that connects the farm comes into the site. You can see that a lot of cabling goes down through the floor and then runs underground out to where it eventually goes back up above ground onto power poles away from the site. There is other, much thicker cabling on the LHS that goes to our big green switchgear box.

Here is the big green box I’m talking about with both doors open:

The left hand door goes into the main room that has all the switchgear and is where all of the phat cables from the inverters enter (from under the floor into that concrete trench, yet to be filled in with earth. Thats the bit that has the fire suppression system in it, and the big cooper bars which are live when energized (see previous blog post). The room on the right hand side is basically the meter and CCTV room. Its got the incoming supply meter (to measure how much power we have imported to site overnight to power minor stuff like CCTV etc) and the outgoing meter, which is the one I care about, and is remotely read to work out how much power we are generating. It also has the wifi router for the CCTV and other CCTV related equipment. Here is the meter stuff:

As I recall LHS is the power supply (import) meter, middle bit is CCTV related and RHS is the important export-tracking meter. I guess what most people are interested in, including me, is where is the big button with ACTIVATE SOLAR FARM written on it, with klaxons and so on. The answer to this seemed pretty vague, and thats in part because we connect each of our inverters through to the DNO substation, rather than there being a single cable or a single switch. The closest we get to it seems to be this button, and ironically this isn’t even my finger, its the project manager pointing at it :D

Also you would imagine there is some big ceremonial ‘moment’ when its activated, but I think such things are only really staged for TV. Basically each inverter got switched on, and then the DNO people check that nothing trips or goes wrong, and then they switch everything on, then switch the power TO the site off, just to check that when that happens, the site correctly switches itself off in reaction (just like home inverters do).

In practice this means there is a lot of nervous pacing while DNO people and ‘my’ people switch things on and off and then give the thumbs up to each other, and then eventually they come over and get you to sign a piece of paper, and declare that its all approved and energized. Any disappointment at the lack of champagne and fireworks is just matched by relief that it happened.

What I do NOT have yet is live (or indeed delayed) monitoring of the site. That should be set up at the start of next week, at which point I will exhaustively investigate all the options and data and write long blog posts about it :D. I definitely felt extremely relieved at the point at which everything was declared live, although frankly the site manager seemed even more relieved than me. I thought he might feint/explode. It was also cool that the landowners were taking a break from looking after their 1,200 sheep (OMG) to come witness the final energization of the site.

It feels almost surreal that its connected. There is other stuff to do, but no matter what, I now own (entirely! no financing!) my own solar farm. It has a peak output of 1,243 kwh (output capped at 900kw), will supply 300 houses, and has over three thousand solar panels. It is the ultimate geek toy. My stupid-ass DJI drone failed me (software awfulness for which I blame google 100%) on the day, so no decent drone pics, but it was untidy and a bit cloudy anyway. As a result I may well frame one of the sunrise pictures to sit above my monitor in my office :D.

I hope you enjoyed following this epic saga of many years. Its not 100% over yet, but this is a huge milestone. I celebrated after the 4 hour drive home with a glass of bubbly, and luckily my celebration-purchase (a chunky watch) arrived as I was typing this blog post. I feel much less stressed, but the true smugness of owning a solar farm has not kicked in yet :D.

Solar Farm Update! Line moved, Power agreement signed. Energizing date near.

I visited the solar farm yesterday. Its a long trip, but worth it. I had not been there for a while, so it was good to see progress. The reason I went on that day, was it was the day that the DNO (Distribution Network Operator) finally came and removed (recovered!) the 11kv line that ran right over the middle of our site, and redirected it around the farm, with a spur coming off to join into their substation. This was critical (and HUGELY DELAYED by insane bureaucracy) because without that line being gone, we could not install the final mounting tables and panels, or the last few inverters. There is now about a months work to go.

Its so hard to know with these things what is REALLY involved, so I half expected there to be two guys and a ladder on site, but in fact that was probably about 12 people, and multiple vans and cars and 2 tractor things and some people on those extendy platform things they use to go do stuff up telegraph poles, and a LOT of big phat cable. Here is some cable, with me for scale.

The big phat cables are the ones that connect the inverters to our switchgear and also the ones that go from that switchgear to the substation with the transformer in, so they are all roughly 400V cables. They are insanely, insanely heavy. Even heavier than they look, and they do not look light.

One of the big things that had changed since my last visit was the installation of our switchgear in a big metal shipping container. This is a big green thing, that was mostly assembled offsite, but then things need wiring into it. This is basically a switchboard where all the inverter cables get joined together ready to connect (still at 410V which is considered low voltage) to the DNO owned substation and transformer to take it from 410v to 11,000v. Annoyingly, due to earthing concerns, these two structures have to be a certain distance apart, BUT there is also a maximum distance apart they can be, for some technical reason, so its a bit tight, and nuts. Surely it makes sense to be one building? anyway… I had a good look inside the green box. Its big, you can walk around in there:

Maybe the most interesting bit in here will be the actual meter, but that is not installed yet (soon!) but also of interest are the copper busbars that all the cables coming in get attached to, so they can flow together as a single power source. Although amusingly there are two separate places for this, so its not actually single :D. In any case, these super chunky copper bars are LIVE when everything is energized:

There are a lot of cool things in the box, but the most unusual, to me, and wacky are the big fire-suppression systems in the ceiling. I hope we never need them, but I guess you have to have them. All this stuff ends up being madly pricey. Anyway, here is a picture of an industrial automatic fire extinguisher :D

The other momentous thing is probably the sight (finally omg) of the DNO doing the work to move the old line and actually connect my site to the grid. It will now be connected, but not energised. We need the final panels, and then some paperwork and a ceremony called ‘witnessing’ to ‘commission’ the site. I am surprised we do not need to sacrifice a goat at this point, but it will probably just be throwing a switch and then some paperwork. Hopefully in a months time. Anyway, here are DNO people doing things:

And this picture gives you an idea of where the DNO substation (tan color) and our switchgear (green box) are:

Hilariously while I was driving to the site and back, we were also arranging to sell the power. I got quotes from 4 companies, and agreed a price and signed the documents on my mobile phone at a cafe near the site. I won’t say who I sell it too until its officially on their website (we might get an entry on their map of generators). As for the price? Its not bad. Certainly way higher than when I started this project, but my costs have shot up too, so hopefully its ok. I estimate break even in 13 years, which is kind of insane, but when you look at valuation of stocks, in a way thats a price/earnings ratio of 13, which is actually sort of reasonable? However, I suspect we will see short term rises in energy prices and long term falls, so it really depends on how things work out in terms of govt policy favoring renewables/heat pumps/ EVs and the ability to build out large scale energy supply. Anything could happen. In terms of how competitive the market is, there was a range of prices. The company I chose offered the most, but not by much, and it does look like there is real and genuine competition. I had to sign by 3PM that day to get the quoted offer, as it changes daily, but I chose to lock in that price for a year. In future I might choose longer term locks.

Amusingly, we get paid for the power monthly, which is more frequent than I get for console video games I own the IP to. Even the staid old dinosaur energy industry can pay monthly, within 10 days. Take note, video game publishers!

The next big step will be energizing the site, a day on which I am determined to get drunk afterwards, and then we will have the first few stats to obsess over, and eventually the first actual income for this company of mine. Oh My God. There is a lot of ancillary stuff to do on site, like plant some trees, tidy things up, and some plants have grown too high for the sheep to cope with, so it all needs actually proper mowing once, after which the sheep should take care of keeping the grass down.

Anyway, enjoy this final picture. It is me pointing at one of the two (now inactive) overhead 11,000 volt lines that delayed this project by a year, cost me probably more than my first house, and drove me to actual real tears. Its finally gone, and not a problem. Its about the same thickness as the power cable plugged into this laptop.

Solar Farm: Everything you always wanted to know about power purchase agreements (PPA)

I just had another meeting about the solar farm. We are now talking in very confident and believable terms about the date to actually switch on the farm, which is absolutely amazing after the last fifty billion years oft development. Amazingly, humans continue to exist on Earth and the solar system has not been swallowed up by an expanding star and yet my solar farm may get energized. (Obviously an expanding sun would be, in the short term, great news for PV generation…

This week is an exciting week because the overhead line that initially was supposed to save money and make life easy, but actually ended up causing chaos and delays… is actually being buried this week. This is a 5 day process, because what is involved includes the burying of some new line, recovery of the old line, and the actual proper live connection of the high voltage part of the site (this is the DNO’s territory and problem). This should all be completed by this Friday, which is also the day I am next visiting the site to see how things are. I don’t think THAT much visible will have changed since my last visit, but that was a while ago so its good to have a final walk-around before the next visit which should be switch-on.

Now in theory, as maybe 80% of the site is built out, and the site gets actually connected to high voltage national grid connections on Friday, you might think that we could switch on 80% of the site while we finish the rest, but thats a logistical headache. The removal of the line lets us drill the piles for the last few mounting tables and final inverters, and then connect the last few hundred panels, but all those new panels need connecting to the earthing, and the final inverters need connecting to our switchgear (all at relatively low voltage, about 400V), and doing all of that while the rest of the site is live sounds like hell…

On a huge site, like a 50MWP site, it would be absolutely worth the hassle, because of the opportunity cost of not being connected, but on our site, its just not worth introducing complexity just for literally one month of generation for 80% of a farm in a wet cloudy September…

Anyway, there is still a bunch of stuff to do that you don’t think about, like the tree planting (a condition of our planning application), and a lot of incredibly tedious paperwork to claim REGOs (Renewable generation certificates you get for producing green energy that er traded like a commodity). Honestly if someone like Elon Musk saw the bureaucracy and inefficiency behind the REGO system he would explode, but it has to be done as they are worth about £12/MWH.

The REALLY exciting part though is the arrangement of the power purchase agreement which I expect to sign tomorrow. I will go for either a 1, 2 or 3 year fixed price for each megawatt hour of energy the site produces. The actual calculation is a real paid, because there is the raw traded price per megawatt hour (about £70/MWH) and then the ’embedded benefits’ (about £20/MWH for my site) which are payments for being good enough to generate power where it is needed, and not put a strain on the main transmission network…and then the REGOs (about £12/MWH).

The embedded benefits stuff is interesting. If you think of electricity like traffic, then you have local roads, A roads and then Motorways (highways). As anybody who has built a road will tell you (We did!) the cost per mile goes up a LOT as your road gets bigger. So if generation requires an upgrade to a major transmission line (motorway) its stupidly expensive. If you can generate power that never leaves the local roads, and in fact therefore puts less pressure on even the A roads, then there is value in that, and you get compensated. To put it another way, building a small local solar farm helps supply a rural(ish) community, and puts less pressure on the connections to and from that community. In practice, my energy will certainly never leave Shropshire, and will probably never even leave the local town within Shropshire. I’ve made the job of managing the transmission network easier!

Anyway, for reasons that escape me, it seems that you lock in power purchase agreements for 1-3 years, but the price fluctuates on a DAILY basis, so you have to sign the deal the same day (before 4PM) that you get the quote. So at some point tomorrow I may well make a financial decision that affects my business for a few years. Still, I’m playing the long game here. I might lose money for 15 years then suddenly reap the rewards of madly high prices. Who knows. Doing this stuff is not for the meek. I’ll probably have pics to share on Friday!

Solar Farm update. Even a video!

Is it depressing that I am actually pleasantly surprised that wordpress handles direct uploading and embedding of video clips? It should be a pretty trivial endeavor in 2024, but I’m apparently shocked to find it working :D. Anyway, here is a video taken by some contractors on the site as they worked on the cabling and site substation.

In terms of progress… well not a lot, despite it being HUGELY SUNNY right now, my farm remains unconnected, earning nothing, due to the insane delays and bureaucracy. There is some good news, in that finally the insane list of delays and excuses got exhausted and I was given an actual firm date for when the overhead line (so small you will barely see it on the video) gets taken down and buried. This is the hugely expensive work that has to happen before we can fill in those pesky gaps in the rows of panels, and then actually do the final bits and pieces before the big ‘energisation’ of the farm when it goes live.

That date is <DRUMROLL>

SEPTEMBER 9th.

There is actually a few days of work associated with all this. The schedule looks like this:

  • 9th September – Deliver materials to site
  • 10th September – Install 2 x HV poles ready for shutdown
  • 11th September – make off 2 x 11kv pole terms
  • 12th September – make off any stay and make sure everything is in place ready for shut down
  • 13th September – Shutdown to loop in new substation

So from the 13th September onwards we will be in a hopefully minutely planned and seamless period of work to install the last frames and panels, and wire those up, plus connect the final bits and pieces, final fencing, and so on before we can switch on the site, just in time for mid-October’s total lack of sunshine. Oh the irony. However, that means a switch-on this year is almost guaranteed!

I will definitely be going to the site to see what is going on during that week, probably on the 13th, and obviously I’ll be returning to see it switched on. I might go back in-between those dates as well.

Some actual progress has taken place in the meantime, but its been slow because frankly there has not been any hurry given that the line-move was delayed so much and then there was insistence on a pointless 8 week delay on top of that. We are currently finishing our substation (mostly a switchboard) and the inverter to substation cabling (underground), and then there is something called ‘tails’ that needs doing, and we need to install the meter to read the generation, and also any power we import to run equipment overnight. The only interesting picture I have of all this is these big phat rolls of high capacity power cable:

    So its sort of good news, in that there is progress and then end is in sight. I have not yet signed a deal to sell the energy from the farm (a power-purchase agreement), as its a bit early to do that. Also prices tend to rise as we head towards winter so a late signing probably benefits me. I’ll be considering that around late August/September.

    Something interesting is that lithium-ion battery storage costs continue to fall. I had decided not to add a battery but may be able to revisit the economics of that once everything is running. I’ll definitely want a full years data from generation before I even consider it though.

    Re-thinking painters algorithm rendering optimisation

    Before I even start this post, I should point out that currently the project I am coding is for fun. I actually really ENJOY complex programming design challenges, unlike many people, so the comment ‘this is done for you in X’ or ‘there is middleware that solves this without you doing anything in Y’ is irrelevant to me, and actually depressing. Whatever happened to the joy of working on hard problems?

    Take an imaginary game that has a lot of entities in it. Say 500. Each entity is a sprite. That sprite has an effect drawn on top of it (say its a glowy light) and a different effect below it (say its another glowy light). The objects have to be rendered in a sensible way, so that if one object passes over another (for example) the glowy lights ‘stack’ properly, and you don’t see aberrations where the lights from something are seen through something else. Here is a visualisation:

    In this case red is the ‘underglow’ grey is the sprite, yellow is the overglow. The bottom right duo shows the issue where things have to be rendered correctly. In a 3D game with complex meshes and no antialiasing, you just use a zbuffer to draw all this stuff, and forget about it, but if you are using sprites with nice fuzzy edges (not horrible jaggy pixels, you really need to use the classic ‘painters algorithm’ of drawing from back to front for each object. There are clear performance problems:

    A naïve way to code this would be my current system which handles each object in 3 draw calls. So we set up the blend mode for the underglow, and draw that, then set a normal blend mode, draw the sprite, then a glowy blend mode to draw the top glow, then repeat for every other entity. The trouble is, with 500 entities, thats 1,500 draw calls simply to draw the most simple part of the game…

    Unfortunately this only scratches the surface because there may also be other layers of things that need drawing on top of each entity, and between drawing each sprite. However there is a major optimisation to be had…. <drumroll>. Actually my game really works like this:

    Where there is a grid, and <generally speaking> the entities stay in one grid box at a time. WITHIN that grid box, all sorts of stuff may happen, but items in the top left grid box will not suddenly appear in the bottom right grid box. In other words I can make some clever assumptions, if only I can find a way to generalize them into an algorithm.

    For example I could draw the underglow in one object in each grid box all together in a single draw call like this:

    So this is suddenly one draw call instead of 8. I then do the same for the sprites, then the overglow, and then do the other object in each grid square as a second pass (basically a second Z layer. Assuming 8 grid squares, 2 per square, 3 passes, thats 48 draw calls for naïve method and 6 for the new method. Pretty awesome! However, thats oversimplifying things. Firstly in some cases there are 16 entities in each grid, in others just 1. Secondly, in some cases items ‘spill’ over into the next grid square, so I need to ensure I do not get an anomaly where 2 objects would overlap just slightly and thus z-fight when drawn…

    Like everything in game coding, the simple code design always accelerates towards spaghetti, but I would like to do my best to avoid that if possible…

    In order to decide what is drawn at what time, I basically need 2 pieces of metadata about each object. Item 1 is what grid square it is in, and item 2 is the Z value of that object, where I can cope with say 16 different Z ‘bands’ for the whole world, meaning a group of 16 entities in a square will definitely be drawn with 16 different draw calls, and thus be painter-algorithm-ed ok.

    I also want to do this without having to do insane amounts of sorting and processing every frame, for obvious efficiency reasons…

    So my first thoughts on this are to handle everything via Z sorting, and make the list of entities the de-facto Z sort. In other words, when I build up the initial list of entities at the start of the game, I have pre-sorted them into z order. So instead of a single list of randomly jumbled Z orders. I get this situation, where the black -number is the Z position, and the blue references the grid square:

    So my now pre-sorted object list goes like this:

    A1 B1 C1 D1 E1 F1 G1 H1 A2 C2 F2 etc..

    I can then do batches of draw class so my actual code looks like this

    • DrawUnderGlowFor1()
    • DrawSpritesFor1()
    • DrawOverglowFor1()

    The nature of the game means that generally speaking, Z order can be fixed from the start and never change, which simplifies things hugely. The bit where it becomes a real pain is the overlap of objects to adjacent grid squares. I would also like a super-generic system that can handle not just these fixed entities, but anything else in the game. What I really need is a two layered graphics engine:

    Layer 1 just send out a ton of draw calls, probably with some sort of metadata. This is like a draw call, plus relevant texture, plus blend state for the object. This is done in a naïve way with no thought to anything else.

    Layer 2 processes layer 1, does some analysis and works out how to collapse draw calls. It can calculate bounding boxes for everything that is drawn, see what overlaps with what, and what can be batched, and then decides on a final ‘optimised’ series of calls to directx. This is done before any textures get set or draw calls are made. It then hands all this off to ideally a new thread, which just streams those draw calls to directx, while the other threads get on with composing the next frame.

    I have attempted such a system once before in the past, but I was a less experienced coder then, and full-time working, and on a (self-imposed) deadline to ship the game, rather than obsess over noodling with rendering engine design. So hopefully this time, I will crack it, and then have something super cool that can handle whatever I throw at it :D. Also the beauty of this design is it would be easy to bypass stage 2 and just render everything as it comes in, so I could even hook up a hotkey to watch the frame rate difference and check I’m not wasting all ny time :D.