-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathEquation.php
executable file
·30 lines (26 loc) · 2.91 KB
/
Equation.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
namespace KateMorley\Grid\UI;
use KateMorley\Grid\State\Datum;
use KateMorley\Grid\State\Demand;
/** Outputs the demand equation. */
class Equation {
/**
* Outputs the demand equation.
*
* @param Datum $datum The datum
* @param bool $help Whether to show the help
*/
public static function output(Datum $datum, bool $help = false): void {
$transfers = $datum->demand->get(Demand::TRANSFERS);
?>
<dl data-operator="<?= ($transfers < 0 ? '−' : '+') ?>">
<dt>Demand<?php if ($help) { ?> <span data-help="<p>The demand is the net amount of power being drawn from the National Grid. As the grid is balanced, demand is equal to the power being generated plus the net amount of power being transferred to the grid.</p>"></span><?php } ?></dt>
<dd><?= Value::formatTotalPower($datum->demand->get(Demand::DEMAND)) ?><abbr>GW</abbr></dd>
<dt>Generation<?php if ($help) { ?> <span data-help="<p>Most electrical power used in Great Britain is generated by power stations located around the country. These power stations use three types of fuel:<p><p>Fossil fuels are the remains of ancient plants and animals. Burning these to produce power causes carbon dioxide and other pollutants to be emitted, worsening the climate crisis and damaging human health.<p><p>Renewables are resources that are rapidly replenished naturally. Replacing fossil fuels with renewables dramatically reduces carbon dioxide emissions.</p><p>Other sources are those that may be preferable to fossil fuels but have unwanted effects of their own, such as the creation of radioactive waste or the destruction of old-growth forests.</p>"></span><?php } ?></dt>
<dd><?= Value::formatTotalPower($datum->demand->getGeneration()) ?><abbr>GW</abbr></dd>
<dt>Transfers<?php if ($help) { ?> <span data-help="<p>Generation does not need to match demand exactly, as energy can be transferred to and from other countries and into and out of energy storage systems.</p><p>Cables known as interconnectors link the National Grid to the electric power transmission networks of neighbouring countries, transferring energy from countries with lower electricity prices to those with higher electricity prices.</p><p>Energy storage systems store energy when electricity prices are lower and release it when prices are higher. Historically, pumped storage systems have been the main form of energy storage, but battery storage systems have become increasingly common as costs have fallen.</p><p>The operators of interconnectors and energy storage systems earn a profit from the difference in electricity prices between countries or over time, while increasing the resilience of energy supply and helping to stabilise prices as demand and generation fluctuate.</p>"></span><?php } ?></dt>
<dd><?= Value::formatTotalPower(abs($transfers)) ?><abbr>GW</abbr></dd>
</dl>
<?php
}
}