Meter Point Administration Number
A Meter Point Administration Number, also known as MPAN, Supply Number or S-Number, is a 21-digit reference used in Great Britain to uniquely identify electricity supply points such as individual domestic residences. The system was introduced in 1998 to aid creation of a competitive environment for the electricity companies, and allows consumers to switch their supplier easily as well as simplifying administration. Although the name suggests that an MPAN refers to a particular meter, an MPAN can have several meters associated with it,[1] or indeed none where it is an unmetered supply. A supply receiving power from the network operator (DNO) has an import MPAN, while generation and microgeneration projects feeding back into the DNO network are given export MPANs.[1]
The equivalent for gas supplies is the Meter Point Reference Number and the water/wastewater equivalent for non-household customers is the Supply Point ID.
Structure
[edit]An MPAN is commonly separated into two sections: the core and the top line data. The core is the final 13 digits and is the unique identifier. The top line data gives information about the characteristics of the supply and is the responsibility of the supplier.
The full MPAN is required to be depicted on electricity bills (the boxes on the top and bottom line are generally unaligned).[2]
The core data is on the second line, the supplementary data on the first. Only the last digit on the bottom row is the check digit.
Profile Class (PC)
[edit]The first two digits of a full MPAN reflect its profile class.[3]
00 | Half-hourly supply (import and export) |
---|---|
01 | Domestic unrestricted |
02 | Domestic Economy meter of two or more rates |
03 | Non-domestic unrestricted |
04 | Non-domestic Economy 7 |
05 | Non-domestic, with maximum demand (MD) recording capability and with load factor (LF) less than or equal to 20% |
06 | Non-domestic, with MD recording capability and with LF less than or equal to 30% and greater than 20% |
07 | Non-domestic, with MD recording capability and with LF less than or equal to 40% and greater than 30% |
08 | Non-domestic, with MD recording capability and with LF greater than 40% (also all non-half-hourly export MSIDs) |
Profile class 00 supplies are half-hourly (HH) metered, i.e. they record electricity consumption for every half hour of every day, and supplies of the other profile classes are non-half-hourly (NHH) metered. A NHH supply must be upgraded to HH where:[4]
Any Metering System where the average of the maximum monthly electrical demands in the three months of highest demand, either in:
- a. the previous twelve months; or
- b. the period since the most recent Significant Change of Demand (whichever is the shorter)
exceeds 100kW.
HH data is recorded by the meter and collected by an onsite download, or by remote communication methods such as GSM, SMS, GPRS or telephone line.[2]
Domestic NHH import MPANs always have a profile class of 01 or 02. Domestic NHH export MPANs are allocated a profile class of 08.[3]
Meter Time Switch Code (MTC)
[edit]The MTC is a 3 digit code that reflects the various registers a meter may have, such as a single rate, day/night split, or a seasonal time of day.[5][6]
001–399 | DNO specific |
400–499 | Reserved |
500–509 | Codes for related Metering Systems – common across the Industry |
510–799 | Codes for related Metering Systems – DNO specific |
800–999 | Codes common across the Industry |
Line Loss Factor Class (LLFC)
[edit]The Line Loss Factor Class or LLFC[7] is an alphanumeric code used to identify the related Distribution Use of System (DUoS) charges for the MPAN. The figure reflects both the amount of distribution infrastructure used to supply the exit point and the amount of energy lost through heating of cables, transformers, etc.[2]
Core
[edit]The MPAN core is the final 13 digits of the MPAN, and uniquely identifies an exit point. It consists of a two-digit Distributor ID, followed by an eight-digit unique identifier, then by two digits and a single check digit.
Distributor ID
[edit]Great Britain is divided into fourteen distribution areas. For each area a single company, the distribution network operator, has a licence to distribute electricity.[8] They effectively carry electricity from the National Grid to the exit points (each having a unique MPAN and a possibility of several meters) where the customers are. The owner of the distribution network charges electricity suppliers for carrying the electricity in their network. Their DNO licensed regions are the same geographic areas as the former nationalised electricity boards.[8]
ID[8] | Name | Operator | Phone Number | Market Participant ID[9] | GSP Group ID[10] |
---|---|---|---|---|---|
10 | Eastern England | UK Power Networks | 0800 029 4285 | EELC | _A |
11 | East Midlands | National Grid (formerly Western Power Distribution) | 0800 096 3080 | EMEB | _B |
12 | London | UK Power Networks | 0800 029 4285 | LOND | _C |
13 | Merseyside and Northern Wales | SP Energy Networks | 0330 10 10 444 | MANW | _D |
14 | West Midlands | National Grid (formerly Western Power Distribution) | 0800 096 3080 | MIDE | _E |
15 | North Eastern England | Northern Powergrid | 0800 011 3332 | NEEB | _F |
16 | North Western England | Electricity North West | 0800 048 1820 | NORW | _G |
17 | Northern Scotland | Scottish & Southern Electricity Networks | 0800 048 3516 | HYDE | _P |
18 | Southern Scotland | SP Energy Networks | 0330 10 10 444 | SPOW | _N |
19 | South Eastern England | UK Power Networks | 0800 029 4285 | SEEB | _J |
20 | Southern England | Scottish & Southern Electricity Networks | 0800 048 3516 | SOUT | _H |
21 | Southern Wales | National Grid (formerly Western Power Distribution) | 0800 096 3080 | SWAE | _K |
22 | South Western England | National Grid (formerly Western Power Distribution) | 0800 096 3080 | SWEB | _L |
23 | Yorkshire | Northern Powergrid | 0800 011 3332 | YELG | _M |
In addition to the distribution network operators noted above who are licensed for a specific geographic area, there are also independent distribution network operators (IDNOs). These own and operate electricity distribution networks which are mostly network extensions connected to the existing distribution network, e.g. to serve new housing developments.
Scottish Hydro Electric Power Distribution also provide distribution services in South Scotland as an IDNO and Southern Electric Power Distribution provide IDNO services in all other England and Wales areas. Other IDNOs have no "base" area.[11]
ID[citation needed] | Name | Licensee[12] | Market Participant Id[9] |
---|---|---|---|
24 | GTC | Independent Power Networks Limited | IPNL |
25 | ESP Energy | ESP Energy | LENG |
26 | Energetics / Last Mile | Last Mile Electricity Limited | GUCL |
27 | GTC | The Electricity Network Company Ltd | ETCL |
28 | EDF IDNO | UK Power Networks (IDNO) Ltd | EDFI (no longer live) |
29 | Harlaxton Energy Networks Ltd | HARL | |
30 | Leep Electricity Networks Ltd | PENL | |
31 | UK Power Distributions Ltd | UKPD | |
32 | Energy Assets Networks | Energy Assets Networks Ltd | UDNL |
33 | EPN | Eclipse Power Networks Ltd | GGEN |
34 | Murphy Power Distribution Limited | MPDL | |
35 | Fulcrum Electricity Assets | Fulcrum Electricity Assets Ltd | FEAL |
36 | Vattenfall Networks | Vattenfall Network Limited | VATT |
37 | Forbury Assets Limited | Forbury Assets Limited | FORB |
38 | Indigo Power Limited | Indigo Power Limited | INDI |
39 | Squire Energy Metering Ltd | Squire Energy Metering Ltd | STRK |
40 | Utility Assets Limited | Utility Assets Limited | UTAL |
42 | Advanced Electricity Networks | Advanced Electricity Networks | AENL |
43 | IDCS Ltd | IDCS Ltd | IDCS |
45 | Aurora Utilities Limited | Aurora Utilities Limited | AURO |
46 | Aidien Limited | Aidien Limited | AIDI |
MPAN state
[edit]The supply identified by the MPAN can be in one of four states: disconnected, de-energised, live, and new.
- Disconnected: The service cable has been removed and the MPAN will not be reused.
- De-energised: The service cable is in place, but the fuse has been removed. The meter remains connected to the distribution network, but no electricity can be used.
- Live: Both the service cable and the fuse are in place. The supply is fully operational.
- New: A new MPAN has been generated, however, the top line (supplementary data consisting of the Profile Class and Meter Time-Switch Code) is not yet complete. The service cable may or may not be installed.
These terms are by no means standardised. For example, a disconnected supply might be referred to as a 'dead' supply.
Export MPANs
[edit]The vast majority of MPANs are import MPANs, where energy is being consumed. However, if a supply exports to the distribution network, then an export MPAN is issued. If a supply both imports and exports, then both an import MPAN and export MPAN are issued.
Microgeneration
[edit]Formerly, export MPANs required a half-hourly compliant meter to be installed. Since 2003, it has been possible for microgeneration projects, with a capacity of 30 kW or below, to have a non-half-hourly meter to measure export back into the distribution network. Uptake was slow, with the first microgeneration export MPAN being issued in June 2005. Some suppliers may not bother to register the export MPAN in MPAS as the revenue is so small.[citation needed]
Following the closure of the feed-in tariffs, in January 2020 Ofgem introduced the Smart Export Guarantee (SEG) arrangements, where an export MPAN is allocated to allow a supplier to pay a customer for export of low-carbon energy.[13][14]
Export capacity over 30 kW is required to be half-hourly metered. As part of the Marketwide Half Hourly Arrangements (MHHS), all export consumption will be required to be registered and settled on a half-hourly basis.[citation needed]
Metered Supply Point
[edit]The Metered Supply Point (MSP) is the point at which the meter measuring a customer's consumption is located. It is thus also the point at which either the distribution network operator's supply, or the building network operator's lateral cable, terminates and the customer's equipment begins. In order to firmly establish a supply's MSP, the MPAN needs to be associated with a meter serial number.
Although it is common for an MPAN to be associated with one meter serial number, in some cases there is a many-to-many relationship. For example, one meter could be associated with both an import and an export MPAN, or one MPAN could be measured by three separate meters.
Metering Code of Practice
[edit]Code | Range | Configuration |
---|---|---|
COP10 | less than 72 kW | One HH whole current meter installed. Introduced for February 2009.[16] |
COP5 | less than 1MW | One HH meter installed. |
COP3 | 1MW to 10MW | Two meters installed, main and check, both recording the same load. The main meter being used for billing. |
COP2 | 10MW to 100MW | Two meters installed as in COP3, but higher-accuracy class meters. |
COP1 | > 100MW | Very few sites in the UK at this level, generally power stations and connections with the National Grid. |
Unmetered supplies
[edit]It is possible for small predictable supplies to be unmetered.[17] Examples are street lights, traffic signals, signs, bollards, telephone kiosks, CCTV and advertising displays.
For an item of equipment to be connected to the distribution network via an unmetered connection, its consumption should typically not exceed 500 watts and it should operate in a predictable manner, with no provision for it to be manually turned on/off at the end user's request. Generally the equipment would either be in operation and taking a supply of electricity 24 hours a day, or be controlled by a photocell, as is often the case for street lights.
It is the customer's responsibility to maintain an accurate and up-to-date inventory of unmetered supplies, and to inform the UMSO (UnMetered Supplies Operator) of all changes to the connected equipment within one month of the change.
Larger local authorities generally have unmetered supplies with a demand over 100kW and are required to trade their unmetered energy on a half-hourly basis. To do so, they employ a meter administrator[18][19] who will use daily data from a photo-electric control unit (PECU) array which is then used to calculate the energy consumption. A PECU array is a device that holds a representative number of the photocells that authority uses on their street lights or traffic signals.[20] By trading energy as unmetered half-hourly the authority will accurately pay for the energy consumed by their declared unmetered equipment, and because the data is downloaded daily the authority will see their energy invoices change throughout the year to represent the changes in the seasonal daily lighting levels.
If, however, the unmetered supplies are being traded as non half-hourly the UMSO undertakes the responsibility to calculate an EAC (Estimated Annual Consumption). This is done using a simple formula which takes into account the circuit watts of the equipment and the annual hours of operation. For example, a piece of equipment that is in use 24 hours per day will have annual hours of 8766. For, say, a CCTV camera rated at 24 circuit watts the EAC would be 210.384kWh, calculated as circuit watts × annual hours divided by 1000. As a result of Ofgem's decision to progress with Marketwide Half Hourly Settlement (MHHS) all new unmetered supplies from April 2024 will be half hourly and existing non half-hourly unmetered supplies will move to half hourly trading during 2024.
If the equipment is street lighting the same process is used for non half-hourly; however, the annual hours will change as each photocell is assigned a set number of annual hours which indicate how and when the lights turn on and off. These annual hours have been set by Elexon and are not locally agreed with the UMSO by the customer.
Once an EAC calculation has taken place, an EAC Certificate is provided to the customer's appointed electricity supplier for billing, with an electronic copy of the EAC being sent to the appointed data collector. The DNO make a Distribution Use of System charge on the electricity supplier for the delivery of the electricity to the customer's unmetered equipment.
Standard Settlement Configuration (SSC)
[edit]Each non-half-hourly supply has a four digit code called the Standard Settlement Configuration (SSC), which specifies the number of registers a meter has, and the times that each register is recording electricity usage. The times that a register is recording is specified with a five digit code Time Pattern Regime (TPR). So for example a supply with SSC 0943 has two registers with TPRs 00404 and 00405. The 00404 TPR register records from 01:00 to 02:30 and 08:00 to 23:30, and the 00405 register records for the rest of the time.[21]
Meter Point Administration System
[edit]Each DNO operates a Meter Point Administration System (MPAS) which holds the following information for each MPAN:
- Supplier
- Data Collector (DC)
- Data Aggregator (DA)
- Meter Operator (MOP) or Meter Administrator for HH unmetered
- Customer
- Address of the exit point
- Associated MPANs
- MPAN state
- Profile Class (PC)
- Line Loss Factor Class (LLFC)
- Meter Time Switch Class (MTC)
- GSP Group
MPRS is the name of the software package that implements the MPAS system for all DNOs.[22] Since MPRS is used by most DNOs it is often used interchangeably with the term MPAS.
ECOES
[edit]ECOES (formally the Electricity Central Online Enquiry Service) is now the Electricity Enquiry Service (EES) is a website that allows users and authorised industry parties to search for supply details (past and present) using such things as the 13-digit MPAN bottom line number, the meter serial number or the postcode. The user can determine a wide range of data relating to the supply including the full address, meter details, the current energisation status and also the appointed parties (i.e. the supplier, distributor, MOP, DC and DA). The site is populated from information sent from the supplier regarding the metering system.[23]
Only non-domestic users (with two valid MPANs that are not Profile Class 1 or 2) can register to access this service.[24]
Check digit modulus
[edit]Check digit
[edit]The final digit in the MPAN is the check digit, and validates the previous 12 (the core) using a modulus 11 test. The check digit is calculated thus:
- Multiply the first digit by 3
- Multiply the second digit by the next prime number (5)
- Repeat this for each digit (missing 11 out on the list of prime numbers for the purposes of this algorithm)
- Add up all these products
- The check digit is the sum modulo 11 modulo 10.[25]
MPAN verification examples |
---|
The algorithm in Java is:
int checkDigit(String toCheck) {
int[] primes = {3, 5, 7, 13, 17, 19, 23, 29, 31, 37, 41, 43};
int sum = 0;
for (int i = 0; i < primes.length; i++) {
sum += Character.getNumericValue(toCheck.charAt(i)) * primes[i];
}
return sum % 11 % 10;
}
In Matlab: function check = checkdigits(MPANCore)
% MPANCore is a cell array of 13 digit strings.
% Check is a boolean vector the same size as MPANCore.
% (100,000 MPANs in 0.05 seconds.)
core = double(char(MPANCore)')-48; c = core(1:12,:);
p = [3 5 7 13 17 19 23 29 31 37 41 43]' * ones(1, size(c, 2));
m = mod(mod(sum(p.*c), 11), 10); k = core(13,:); check = m == k;
In Pascal / Delphi: function CheckDigit(MPANCore : array of Byte): Integer;
const
Primes : array [0..11] of Byte = (3, 5, 7, 13, 17, 19, 23, 29, 31, 37, 41, 43);
var
i : integer;
begin
Result := 0;
for i := 0 to 11 do
Result := Result + (MPANCore[i] * Primes[i]);
Result := Result mod 11 mod 10;
end;
In Ruby: # where mpan is a string
def check_digit(mpan)
primes = [3, 5, 7, 13, 17, 19, 23, 29, 31, 37, 41, 43]
(0..11).inject(0) { |sum, n| sum + (mpan[n, 1].to_i * primes[n]) } % 11 % 10
end
In Visual Basic: Public Function mpancheck(mpan As String) As Boolean
' Michael Diarmid (EDF)
' Updated 04/08/2010 MD
' Returns True / False if MPAN is valid
On Error GoTo inval
Dim c As Variant, sum As Integer, i as Byte
c = Array(0, 3, 5, 7, 13, 17, 19, 23, 29, 31, 37, 41, 43)
For i = 1 To 12
sum = sum + (Mid(mpan, i, 1) * c(i))
Next i
If Right(mpan, 1) = ((sum Mod 11) Mod 10) Then
mpancheck = True
Else
inval:
mpancheck = False
End If
End Function
In VisualBasic.Net 2010: Public Function mpancheck(mpan As String) As Boolean
' Michael Diarmid (EDF)
' Updated 04/08/2010 MD
' Returns True / False if MPAN is valid
' Revised by Tym Huckin (16/03/2012) for VB 2010
On Error GoTo inval
Dim c As Object, sum As Integer
c = New List(Of Integer) From {0, 3, 5, 7, 13, 17, 19, 23, 29, 31, 37, 41, 43}
For i = 1 To 12
sum = sum + (Mid(mpan, i, 1) * c(i))
Next i
If sRight(mpan, 1) = ((sum Mod 11) Mod 10) Then
Return True
Else
inval:
Return False
End If
End Function
Public Function sRight(sSTRING As String, iLEN As Integer) As String
Dim sRET As String = ""
Try
If iLEN >= Len(sSTRING) Then
sRET = sSTRING
End If
sRET = Mid(sSTRING, Len(sSTRING) - (iLEN - 1), iLEN)
Catch ex As Exception
sRET = ""
End Try
Return sRET
End Function
Or VB.Net 2010, avoiding the use of VB6 Compatibility Library : ''' <summary>
''' Validates an MPAN number
''' </summary>
''' <param name="mpan">At least the last 13 digits from the MPAN number, including the check digit,
''' expressed as a string</param>
''' <returns>True for valid, otherwise false</returns>
''' <remarks>Written by Martin Milan, May 2012, avoiding use of VB6 compatibility library, for .Net 4.0 Client Profile</remarks>
Public Function MPANIsValid(mpan As String) As Boolean
' Set initial conditions.
Dim validationResult As Boolean = False
If mpan.Length > 12 Then
'Read the check digit into an Integer variable.
Dim intCheckDigit As Integer
If Integer.TryParse(mpan.Substring(mpan.Length - 1), intCheckDigit) Then
Dim strTest As String = mpan.Substring(mpan.Length-13,12)
Dim intPrimes() As Integer = { 3, 5, 7, 13, 17, 19, 23, 29, 31, 37, 41, 43}
Dim productTotal As Integer = 0
Dim blnError As Boolean = False
For i As Integer = 0 To 11 Step 1
Dim intTestDigit As Integer
If Integer.TryParse(mpan.Substring(i,1), intTestDigit) Then
productTotal += (intTestDigit * intPrimes(i))
Else
blnError = True
Exit For
End If
Next
If Not blnError Then
validationResult = ((productTotal Mod 11 Mod 10) = intCheckDigit)
Else
validationResult = False ' Due to a parsing error.
End If
End If
End If
Return validationResult
End Function
In C#: /// <summary>
/// Validates an MPAN number.
/// </summary>
/// <param name="mpan">At least the last 13 digits from the MPAN number, including the check digit,
/// expressed as a string.</param>
/// <returns>True for valid, otherwise false.</returns>
public static bool MpanIsValid(string mpan)
{
// Set initial conditions.
bool validationResult = false;
if (mpan.Length > 12)
{
// Read the check digit into an Integer variable.
int intCheckDigit = 0;
if (int.TryParse(mpan.Substring(mpan.Length - 1), out intCheckDigit))
{
string strTest = mpan.Substring(mpan.Length - 13, 12);
int[] intPrimes = {3, 5, 7, 13, 17, 19, 23, 29, 31, 37, 41, 43};
int productTotal = 0;
bool blnError = false;
for (int i = 0; i <= 11; i++)
{
int intTestDigit = 0;
if (int.TryParse(strTest.Substring(i, 1), out intTestDigit))
{
productTotal += (intTestDigit * intPrimes[i]);
}
else
{
blnError = true;
break;
}
}
if (!blnError)
{
validationResult = ((productTotal % 11 % 10) == intCheckDigit);
}
else
{
validationResult = false; // Due to a parsing error.
}
}
}
return validationResult;
}
As a formula in Excel 365: 'MPAN in Cell A1
=IF(RIGHT(MOD(SUM(MID(A1,SEQUENCE(12),1)*{3;5;7;13;17;19;23;29;31;37;41;43}),11))=RIGHT(A1),"Correct","Invalid MPAN")
In Python: def check_digit(mpan):
"""Check MPAN digit.
Args:
mpan -- The first 12 digits of the MPAN number, excluding the check digit.
"""
return sum(prime * int(digit) for prime, digit in \
zip([3, 5, 7, 13, 17, 19, 23, 29, 31, 37, 41, 43], mpan)) % 11 % 10
In PL/SQL: create or replace function mpan_check(mpan in varchar2) return boolean is
--CDP ATKINSON
res integer := 0;
TYPE prime_tab IS VARRAY(12) OF integer;
primes prime_tab := prime_tab (3, 5, 7, 13, 17, 19, 23, 29, 31, 37, 41, 43);
begin
for i in 1..12 loop
res := res + to_number( substr( mpan, i, 1) ) * primes (i);
end loop;
return to_char(mod(mod(res , 11) , 10)) = substr(mpan,13,1);
end mpan_check;
In JavaScript: function checkMPAN(mpan) {
var primes = [3, 5, 7, 13, 17, 19, 23, 29, 31, 37, 41, 43];
var sum = 0;
var m = mpan.toString();
if (m.length - 1 === primes.length) {
for (var i = 0; i < primes.length; i++) {
sum += parseInt(m.charAt(i)) * primes[i];
}
return sum % 11 % 10 === parseInt(m.charAt(12));
}
return false;
}
In PHP: function checkMPAN($mpan)
{
$primes = array(3, 5, 7, 13, 17, 19, 23, 29, 31, 37, 41, 43);
$sum = 0;
$mpan = str_split($mpan);
if ((count($mpan) - 1) == count($primes)) {
for ($i = 0; $i < count($primes); $i++) {
$sum += $mpan[$i] * $primes[$i];
}
return (($sum % 11 % 10) == end($mpan)) ? true : false;
} else {
return false;
}
}
In SQL Server: CREATE FUNCTION is_valid_mpan
( @mpan VARCHAR(50) )
RETURNS INT
AS
BEGIN
--Tim Foster (2013-01-04)
DECLARE @is_mpan INT
,@x INT = 1
,@sum INT = 0
DECLARE @arr TABLE (id INT IDENTITY(1, 1), val INT)
INSERT INTO @arr(val) VALUES(3),(5),(7),(13),(17),(19),(23),(29),(31),(37),(41),(43)
WHILE @x <= 12
BEGIN
SELECT @sum = @sum + (SUBSTRING(@mpan, @x, 1) * val)
FROM @arr
WHERE id = @x
SELECT @x = @x + 1
END
IF RIGHT(@mpan, 1) = ((@sum % 11) % 10)
BEGIN
SELECT @is_mpan = 1
END
ELSE
BEGIN
SELECT @is_mpan = 0
END
RETURN @is_mpan
END
In MySQL: CREATE DEFINER=`root`@`%` FUNCTION `is_valid_mpan`(mpan varchar(13)) RETURNS int(11)
begin
DECLARE is_mpan INT;
DECLARE x INT;
DECLARE sum INT;
declare ret int;
set x = 1;
set sum = 0;
CREATE TEMPORARY TABLE IF NOT EXISTS arr
SELECT 1 `id`, 3 `val` union all
SELECT 2 `id`, 5 `val` union all
SELECT 3 `id`, 7 `val` union all
SELECT 4 `id`, 13 `val` union all
SELECT 5 `id`, 17 `val` union all
SELECT 6 `id`, 19 `val` union all
SELECT 7 `id`, 23 `val` union all
SELECT 8 `id`, 29 `val` union all
SELECT 9 `id`, 31 `val` union all
SELECT 10 `id`, 37 `val` union all
SELECT 11 `id`, 41 `val` union all
SELECT 12 `id`, 43 `val`;
WHILE x <= 12 DO
SELECT (SUBSTRING(mpan, x, 1) * val)
into ret
FROM arr
WHERE id = x;
set sum = sum + ret;
set x = x + 1;
END while;
IF RIGHT(mpan, 1) = ((sum % 11) % 10) then
set is_mpan = 1;
ELSE
set is_mpan = 0;
end if;
drop TEMPORARY table arr;
RETURN is_mpan;
end;
In Swift 3 is: func isValid(mpan: String) -> Bool {
let primes = [3, 5, 7, 13, 17, 19, 23, 29, 31, 37, 41, 43]
let chars = Array(mpan.characters).map({Int(String($0))}).flatMap({$0})
return zip(primes, chars).reduce(0) { $0 + $1.0 * $1.1} % 11 % 10 == chars.last!
}
In Apex (Salesforce): /**
* @description Validates an MPAN. Written by Adam Dry June 2018. Apex version 43
* @param mpan the 13 digit MPAN including the check digit on the end
*/
public Boolean mpanIsValid(String mpan) {
List<Integer> primes = new List<Integer>{3, 5, 7, 13, 17, 19, 23, 29, 31, 37, 41, 43};
// Read the check digit into an Integer variable
Integer checkDigit = Integer.valueOf(mpan.right(1));
String strTest = mpan.substring(0, 12);
Integer productTotal = 0;
for (Integer i = 0; i <= 11; i++) {
Integer testDigit = Integer.valueOf(strTest.Substring(i, i + 1));
productTotal += (testDigit * primes[i]);
}
Integer computedCheck = Math.mod(Math.mod(productTotal, 11), 10);
Boolean validationResult = (computedCheck == checkDigit);
return validationResult;
}
|
See also
[edit]- Energy accounting software
- Meter operator
- Mains electricity
- Distribution network operator
- Electrical power industry
- Electricity billing in the UK
External links
[edit]- Specific definitions of meter timeswitch codes can be found on the MRASCo documentation page.
- ECOES (Electricity Central Online Enquiry Service)
- Implementations of the MPAN check digit algorithm
References
[edit]- ^ a b Elexon. "Settlement of Microgeneration Export" (PDF). Archived from the original (PDF) on 9 October 2007.
- ^ a b c Energy Linx (2007). "MPAN (Meter Point Administration Number)". Retrieved 22 February 2007.
- ^ a b Elexon. "BSCP516 – Balancing and Settlement Code" (PDF). Archived from the original (PDF) on 19 March 2012. Retrieved 25 July 2011.
- ^ Elexon (25 June 2015). "Change of Measurement Class and Change of Profile Class" (PDF). Archived from the original (PDF) on 17 August 2016. Retrieved 5 July 2016.
- ^ MRASCo. "The Rough Guide To MTCs" (PDF). Archived from the original (PDF) on 13 January 2016. Retrieved 5 February 2011.
- ^ Elexon. "Meter Timeswitch Class table". Archived from the original on 26 April 2011. Retrieved 23 August 2011.
- ^ "Line Loss Factor Class(es)". Elexon Glossary. Retrieved 27 January 2013.
- ^ a b c "MPAN (Meter Point Administration Number)". Energylinx. Retrieved 23 October 2023.
- ^ a b Elexon. "Market Participant Role". Retrieved 20 December 2009. [dead link ]
- ^ Elexon. "GSP Group". Retrieved 22 June 2010. [dead link ]
- ^ Ofgem. "Notice under section 11 of the Electricity Act 1989" (PDF). Archived from the original (PDF) on 30 December 2005. Retrieved 22 February 2007.
- ^ Ofgem. "List of all electricity licensees including suppliers". Retrieved 21 September 2021.
- ^ "Smart Export Guarantee (SEG)". Ofgem. Retrieved 4 March 2022.
- ^ "Smart Export Guarantee (SEG) Terms and Conditions" (PDF). OVO Energy. 23 December 2019. Retrieved 4 March 2022.
- ^ See "ELEXON - Codes of Practice". Archived from the original on 13 August 2007. Retrieved 16 November 2008.
- ^ "Change Implementation".[dead link ]
- ^ "Unmetered Supplies". ELEXON. Retrieved 3 January 2019.
- ^ Power Data Associates Ltd. "Meter Administrator".
- ^ ICTIS (UK) Ltd. "Meter Administrator".
- ^ "Photo Electric Control Unit Arrays". Power Data Associates. Retrieved 4 March 2022.
- ^ Elexon (12 December 2011). "What are Standard Settlement Configurations?". Retrieved 5 July 2016.
- ^ St. Clements Services Ltd. "Metering Point Registration System". Retrieved 29 May 2008.
- ^ MRASCO. "Access to ECOES Data". Retrieved 11 July 2009.
- ^ "Briefing_Note_on_Customer_Access_NDC_2" (PDF). ECOES. MRASCO. Retrieved 25 June 2015.
- ^ Energy Retail Association. "Data Item Definition v1 final" (PDF). p. 23. Archived from the original (PDF) on 25 September 2007. Retrieved 25 February 2014.