Research Article

Smart Grid Nontechnical Loss Detection Based on Power Gateway Consortium Blockchain

Algorithm 1

Contract for audit.
Input: HANpurchaseInfo = {UserID, SMID, Purchase amount, TimeStamp}
Output: Audit Result
(1)functionNTL(HANpurchaseInfo)
(2)get the state of the Smart Meter
(3)if State = offline then
(4)return Send warning to Auditors
(5)else
(6)Send request to the corresponding Smart Meter
(7)get HANsm = {SMID, UserID, SOC} sent from Smart Meter
(8)get HANgw = {SMID, UserID, Current Time, Tlast,Elast} from HAN
(9)if (Elast-SOC)-E_Output > threshold then
(10)return Send warning to Auditors
(11)else
(12)Purchasing Time = TimeStamp
(13)SOC = SOC + Purchase amount
(14)send HANgw1 = {SMID, UserID, Current Time, Purchasing Time, ATE} to BlockChain
(15)send update to user’s smart meter
(16)return Normal
(17)end if
(18)end if
(19)end function