GTS Tech-talk

I think it’s fair to say that everything on the GTS* project can be classified as software, hardware, procedures or documentation; so, without further ado, let’s begin with the software.

First acronym: GTS for “Greening the Spark” (see also acronym list at the bottom of this page)

Software

Basic concepts

There are two levels of control: simulator level where a supervisor determines what configuration will be run and when, and operator level where a grid operator interacts directly with the running simulator via a physical control panel. The diagram below shows the main simulation loop which controls the operation of the models.

The prime function of the main simulation loop is to provide the timing needed for loop iteration and synchronisation of the models. Every model has code for initialisation and looping. Other functions include storing simulation information for further analysis and compiling a simulation report.

The simulation runs in simulation time but the actual software runs in real time. The relationships between quantities measured in these two time frames are illustrated in the diagram above. The rate at which simulation time runs faster than real time is called the time factor, like fast forward on a video player. A time factor of 60 allows a 24 hour simulation to complete in 24 minutes.

Due to hardware limitations* the fastest loop iteration speed is 6 Hz (real time) which is plenty for this project, where pinpoint precision isn’t required. Integrations of power to energy are linear but, as the changes are small and generally cyclical over the periods concerned, errors are small and not cumulative.

*The time taken to process analogue inputs is ~130ms so, together with updating the control panel displays, they are scheduled into three separate iterations: update displays, input 1, input 2. This happens twice a second making a total of 6 iterations per second, or 6 Hz. Slack time is calculated for each iteration and a warning issued if less than the minimum allowed (usually 5%). The first loop in any simulation always exceeds its allowed time and is ignored.

Control System and Models

Grid controller operation is based on a spacecraft monitoring and control system (MCS) which reads telemetry (TM) from the various subsystems, takes input from the grid controller, interprets the control laws and then sends telecommands (TCs) back to those subsystems. This process repeats in a continuous loop until the simulation is finished. The MCS also contains a Storage Management System (SMS) which determines how energy is to be stored and retrieved in order to maintain a balanced grid.

There is also a placeholder for a non-renewables management system (NMS) for autonomous control of fossil fuels and nuclear, but this has not yet been implemented.

Static models run scenarios based on predefined weather and consumer demand patterns. Weather models include wind speed, solar intensity and temperature (although temperature isn’t used yet). A scenario is defined as uniform sets of samples over a timeline. The value at any given moment is interpolated between its enclosing samples. The samples in a scenario file represent a baseline scenario from which actual and forecast scenarios are calculated. These derived scenarios are calculated from the baseline scenario by addition of random Fourier components at DC, full wave, half wave and sample frequencies whose coefficients are a function of the difficulty level*. Scenario forecasts can be either literal or differential, indicating what change is expected over the next sample interval.

*Difficulty level is a game type parameter affecting volatility and predictability of scenarios as well as the scale of storage elements, the end result being to make controlling the grid less or more challenging.

Dynamic models include generation by fossil fuels and nuclear facilities which are controlled by the grid operator via the MCS control panel, and storage devices which respond to telecommands from the SMS. Dynamic models all return telemetry to the MCS.

Storage models are defined by two parameters: maximum power and capacity. Power is the rate at which a storage device can charge or discharge and capacity is the total energy a device can store. The amount of energy stored as a fraction of the capacity is called the level, so a half-full battery has a level of 0.5, or50% (the same as a half-empty one).

What are not modelled are the efficiency of a charge / discharge cycle, reduction in capacity over time, differences in maximum charge and discharge rates, and delays or limits to changing the charge and discharge rates.

There is always a discrepancy between generation and demand. The Storage Management System (SMS) manages the storage devices with a view to meeting demand (no shortfall) and avoiding waste (no surplus).

Storage devices are ranked by level. When excess power is generated, the device with the lowest level is charged first at up to its maximum charge rate unless full. If more power needs to be sinked then the next device up in the level hierarchy is charged in the same way. This continues with the remaining devices as necessary. If the storage devices cannot sink all the excess power, then the MCS registers a grid status of surplus and the grid surplus LED is illuminated. Discharging works the other way round, where the device with the highest level is discharged first etc. If the storage devices cannot make up all the deficit and more power is still required by the grid, then the MCS registers a grid status of shortfall and the grid shortfall LED is illuminated. In all other cases the grid status is nominal.

Reporting

When a simulation is complete a report is generated on-screen for immediate viewing and a csv file created for further processing / archiving. Reports contain the following information:

Summary data, comprising date and time information, total energy generated, used and stored, total and average of costs incurred and CO2 produced. Comments and scores are attached to quantities which indicate how well a grid operator has performed. They are generally calculated by comparing to a best or worst case and assigning points accordingly*. Ranges are defined to enable comments to be attached to a given score.

Sparks are awarded on overall performance* in three “E” categories: Efficiency, Eco-friendliness and Economy where :

  • Red spark is the worst
  • Green spark is the best
  • Blue spark is in between

*Shortfall and surplus points are are calculated as a function of that quantity divided by total demand. If the total demand is zero, then the shortfall can only be zero. However, surplus can still be positive resulting in division by zero which computers don’t like (or exceedingly large numbers when demand is very small). The function used is a scaled arctan (tan-1 for mathematicians), which happily deals with numbers from nought to infinity, with a trap for division by zero which computers do not.

Sparks are calculated as a weighted average of relevant points and converted to a colour, together with an appropriate comment.

Hardware

Power

The power comes from a 12V 20A switched mode PSU with a custom “glitch-buster” ultra-capacitor (4*10F@3V in series) storage device which can supply power for up to a minute in the event of power failure.

Raspberry Pi

The Raspberry Pi’s are model 4Bs with 8GB ram and 32GB flash cards. The GTS one is fitted with a Red Robotics Redboard+.

Embedded headless Raspberry Pi with Redboard hat

This is the Raspberry Pi development area with an Adafruit T-Cobbler Plus connected to a breadboard.

Raspberry Pi development area

Control Panel

The control panel comprises:

  • The main panel with artwork created in Lucid Chart and printed on aluminium. This was machined to fit all the components and mounted on a wooden frame.
  • A numeric header was added later, using a wooden panel with artwork printed on glossy photo paper and glued to the panel for four displays indicating either time, mains frequency, CO2 and cost or power generated by each source
  • A switch to control which set of numbers is displayed on the numeric header
  • Two renewables generator panels (wind & solar), with gauges displaying actual power being generated and relevant weather forecast (wind & sun)
  • Two non-renewables panels (fossil fuels & nuclear), with gauges displaying power generated and knobs for controlling the power
  • A consumer demand panel with gauge displaying actual power being used and a demand forecast
  • A status panel with bar LEDs showing storage status (batteries and pumped hydro) and LEDs overall grid status (shortfall, nominal, surplus)

All hardware is interfaced to the RPi via the Redboard+ hat. The various hardware types and connections are as follows:

  • The four numeric displays are Adafruit 4 digit 7 segment LEDs, connected via an I2C bus.
  • Numeric header switch is connected to a spare input on the batteries expander board (see below)
  • Eight gauges are stepper motors connected to the stepper motor ports..
  • Two potentiometers (the control knobs) are connected to the ADC ports.
  • Three grid status LEDs are connected via a discrete NOR logic board requiring only two GPIO pins.
  • Two storage status 10 bar LED arrays are connected to an Adafruit GPIO expander on the I2C bus.
Front of control panel
Rear view of control panel showing rats’ nest

Representations

There are representations of a wind farm with three model wind turbines and a sun lamp in front of a mural depicting actual wind and solar farms. These are controlled via the Redboard+ PWM motor ports, the turbines directly and the sun lamp via a custom Darlington pair driver circuit (just visible in the bottom right of the rear view picture) for extra ‘oomph, getting its power directly from the PSU.

The sunlamp has four high power 12V LED arrays powered by GTS and it also has a mains bulb so it can function as a normal room light when GTS is off.

Sun lamp

Calibration

The servos which drive the gauges need calibrating in both position and scale. There is a calibration program in which uses the two power input control knobs (fossil fuel = coarse and nuclear = fine) to generate a voltage to control servo positions. Each servo is calibrated in turn for zero and full scale deflection, with the position values entered into the calibration file. Two modes of operation are possible, set by a simulation parameter at run time : full scale or proportional (standardised). Full scale uses the gauge FSD as the maximum power for that generator and standardised uses the FSD for the maximum power of the demand. Each gauge can show up to 110% FSD, limited by software to protect the servos from damage.

Power control knobs are calibrated in both position and scale. Each knob is calibrated in turn for zero and full scale deflection, with the measured voltages entered into the calibration file.

Representations. The solar lamp needs no calibration measurement: zero is off and 100% PWM is fully on. Scaling is provided in the calibration file to match sun intensity to lamp brightness, but this is a given. However, the wind turbines are a bit more complicated.

With wind turbine models it is necessary to match up the stall and maximum safe speeds of the physical models with realistic stall and maximum safe wind speeds of a real turbine. Hysteresis complicates matters as the actual stall speed is different depending on whether it is slowing down or speeding up. Using the control knobs as before, calibration software allows the stall speed in both directions to be measured as the PWM% sent to the model. The natural stall speed of the model is then overridden in software so that anything below the stall wind speed is interpreted as zero power and the turbine behaves more or less as expected.* The maximum speed of the model turbines is set so as look realistic and not wear out too quickly.

Ideally, if a turbine is moving then wind power is registered on the grid and conversely, if none is moving, then no power is registered. However, a bit of artistic license can be applied here: if power is registered when no turbine is moving, then we can say it must be from ones on the other side of the hill. Conversely, if no power is registered when turbines are moving, then they may be rotating but not generating, perhaps undergoing maintenance.

Hardware Central

This is where the chips are fried and other components and boards tested to destruction. Happy days.

Electronics development area

List of acronyms

  • FSD Full Scale Deflection
  • GTS Greening the Spark
  • MCS Monitoring and Control System
  • NMS Non-renewables Management System
  • PWM Pulse Width Modulation
  • SMS Storage Management System
  • TC Telecommand
  • TM Telemetry

Back to GTS main menu.

This image has an empty alt attribute; its file name is RoadWorks.jpg

This page is an exciting new development and will be under construction for the next few weeks. Cornucopia wishes to apologise for any inconvenience or disappointment this may cause.



Hard hat