Research Article

A Blockchain-Enabled Trading Framework for Distributed Photovoltaic Power Using Federated Learning

Algorithm 2

The matching procedure.
  Input:
  Output: ,
1 begin
2   the total amount of electricity traded
3   a sequence sorted by descending order of ;
4   a sequence sorted by descending order of ;
5   maximum tradable quantity
6   while do
7    sort and in descending order;
8    if then
9       create edge in ;
10      
11      
12      if =0 then
13        remove from ;
14      end
15      remove from ;
16      
17    else
18      if there is a satisfying then
19        for to do
20          create edge in ;
21          if then
22            ;
23            remove from ;
24          else
25            ;
26            ;
27          end
28          ;
29        end
30        if =0 then
31          remove from ;
32        end
33        remove from ;
34      else
35        for to do
36          ;
37          remove from ;
38          ;
39          ;
40        end
41      end
42    end
43   end
44   return
45 end