43
Producer
Events:
The
system
emits
producerRegistered
and
producerDeregistered
events whenever a producer joins or leaves the marketplace.
PPA Events: When a PPA is created, accepted, or completed, events like
createdPPA
,
acceptedCorpPPA
, and
purchasedPPA
are emitted. This allows all stakeholders to
monitor the lifecycle of PPAs in real-time.
5.2.7 Energy Trading and Auctions
Energy trading in the system is facilitated by two key functions: buyPPAKwhs and
energyTradingPPA. These functions allow buyers to purchase energy directly from producers based
on available energy (kWh) and contract terms:
buyPPAKwhs: This function allows buyers to purchase available energy from a specific
PPA. Buyers provide the ID of the PPA, and the contract checks if energy is available for
purchase. If energy is available, it is transferred to the buyer, and the PPA is updated to reflect
the transaction.
energyTradingPPA: In cases where buyers wish to purchase a specific amount of energy
(kWh), this function enables buyers to select the amount they want to purchase from available
energy sources. This is particularly useful for buyers with specific energy requirements.
Algorithm for managing available energy based on closed PPAs and energy supply:
Step 1: Algorithm ManageEnergyAvailabilityAndPurchase
Step 2: If producer wants to declare available energy then:
Step 3: Call availableKwhs(buyer, energy, idOfMatchPPA)
Step 4: Validate energy amount is >= 1 kWh
Step 5: Add available energy to listOfkwhs
Step 6: Emit availableEnergyNotification event
Step 7: End_if
Step 8: If buyer wants to purchase energy then:
Step 9: If buyer wants to purchase based on PPA:
Step 10: Call buyPPAKwhs(idOfPPA)
Step 11: Search for matching energy in approved PPAs
Step 12: If matching energy found then:
Step 13: Transfer energy to buyer
Step 14: Update energy records
Step 15: Call iRegistry.issue() to issue EAC for the
buyer (to certify green energy)
Step 16: Emit purchasedPPA event
Step 17: End_if
Step 18: End_if
Step 19: If buyer wants to purchase a specific energy amount:
Step 20: Call energyTradingPPA(idOfContract, buyEnergy)
Step 21: Validate energy availability and contract terms
Step 22: Transfer specified amount of energy to buyer
Step 23: Call iRegistry.issue() to issue EAC for the buyer
(to certify green energy)
Step 24: Emit purchasedPPA event
Step 25: End_if
Step 26: End_if
Step 27: End_ManageEnergyAvailabilityAndPurchase