-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [conluz-68] Moved classes to get package * [conluz-68] Renamed measurement to replace - by _ * [conluz-68] Created method to get an auth method to perform request through the Huawei REST API * [conluz-68] Created repository to get real time production from Huawei REST API * [conluz-68] Created DB migration to create Huawei config table * [conluz-68] Created test to verify repository retrieving real time production data * [conluz-68] Completed a call to get real-time production * [conluz-68] Prepared job to run every five minutes and sync real time production for a Huawei inverter * [conluz-68] Fixed tests * [conluz-68] Implemented job to retrieve hourly production from a Huawei inverter throught the REST API every hour * [conluz-68] Implemented endpoint to to create a plant * [conluz-68] Implemented endpoint to get all plants * [conluz-68] Implemented endpoint to update a plant * [conluz-68] Implemented endponit to delete a plant
- Loading branch information
1 parent
bed84a4
commit 2094b71
Showing
109 changed files
with
4,661 additions
and
315 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
src/main/java/org/lucoenergia/conluz/domain/production/InverterProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package org.lucoenergia.conluz.domain.production; | ||
|
||
public enum InverterProvider { | ||
|
||
HUAWEI | ||
} |
13 changes: 13 additions & 0 deletions
13
src/main/java/org/lucoenergia/conluz/domain/production/get/GetEnergyStationRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package org.lucoenergia.conluz.domain.production.get; | ||
|
||
import org.lucoenergia.conluz.domain.production.plant.Plant; | ||
import org.lucoenergia.conluz.domain.production.InverterProvider; | ||
|
||
import java.util.List; | ||
|
||
public interface GetEnergyStationRepository { | ||
|
||
List<Plant> findAll(); | ||
|
||
List<Plant> findAllByInverterProvider(InverterProvider provider); | ||
} |
5 changes: 4 additions & 1 deletion
5
...n/production/GetProductionRepository.java → ...oduction/get/GetProductionRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
...main/production/GetProductionService.java → .../production/get/GetProductionService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
116 changes: 116 additions & 0 deletions
116
src/main/java/org/lucoenergia/conluz/domain/production/huawei/HourlyProduction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
package org.lucoenergia.conluz.domain.production.huawei; | ||
|
||
import java.time.OffsetDateTime; | ||
|
||
public class HourlyProduction { | ||
|
||
private OffsetDateTime time; | ||
private String stationCode; | ||
/** | ||
* Global irradiation in kWh/m² | ||
*/ | ||
private Double radiationIntensity; | ||
/** | ||
* Theoretical yield in kWh | ||
*/ | ||
private Double theoryPower; | ||
/** | ||
* Inverter yield in kWh | ||
*/ | ||
private Double inverterPower; | ||
/** | ||
* Feed-in energy in kWh | ||
*/ | ||
private Double ongridPower; | ||
/** | ||
* Revenue. | ||
* The currency specified in the management system | ||
*/ | ||
private Double powerProfit; | ||
|
||
public OffsetDateTime getTime() { | ||
return time; | ||
} | ||
|
||
public String getStationCode() { | ||
return stationCode; | ||
} | ||
|
||
public Double getRadiationIntensity() { | ||
return radiationIntensity; | ||
} | ||
|
||
public Double getTheoryPower() { | ||
return theoryPower; | ||
} | ||
|
||
public Double getInverterPower() { | ||
return inverterPower; | ||
} | ||
|
||
public Double getOngridPower() { | ||
return ongridPower; | ||
} | ||
|
||
public Double getPowerProfit() { | ||
return powerProfit; | ||
} | ||
|
||
|
||
public static class Builder { | ||
private OffsetDateTime time; | ||
private Double radiationIntensity; | ||
private Double theoryPower; | ||
private Double inverterPower; | ||
private Double ongridPower; | ||
private Double powerProfit; | ||
private String stationCode; | ||
|
||
public Builder withTime(OffsetDateTime time) { | ||
this.time = time; | ||
return this; | ||
} | ||
|
||
public Builder withRadiationIntensity(Double radiationIntensity) { | ||
this.radiationIntensity = radiationIntensity; | ||
return this; | ||
} | ||
|
||
public Builder withTheoryPower(Double theoryPower) { | ||
this.theoryPower = theoryPower; | ||
return this; | ||
} | ||
|
||
public Builder withInverterPower(Double inverterPower) { | ||
this.inverterPower = inverterPower; | ||
return this; | ||
} | ||
|
||
public Builder withOngridPower(Double ongridPower) { | ||
this.ongridPower = ongridPower; | ||
return this; | ||
} | ||
|
||
public Builder withPowerProfit(Double powerProfit) { | ||
this.powerProfit = powerProfit; | ||
return this; | ||
} | ||
|
||
public Builder withStationCode(String stationCode) { | ||
this.stationCode = stationCode; | ||
return this; | ||
} | ||
|
||
public HourlyProduction build() { | ||
HourlyProduction hourlyProduction = new HourlyProduction(); | ||
hourlyProduction.time = this.time; | ||
hourlyProduction.radiationIntensity = this.radiationIntensity; | ||
hourlyProduction.theoryPower = this.theoryPower; | ||
hourlyProduction.inverterPower = this.inverterPower; | ||
hourlyProduction.ongridPower = this.ongridPower; | ||
hourlyProduction.powerProfit = this.powerProfit; | ||
hourlyProduction.stationCode = this.stationCode; | ||
return hourlyProduction; | ||
} | ||
} | ||
} |
56 changes: 56 additions & 0 deletions
56
src/main/java/org/lucoenergia/conluz/domain/production/huawei/HuaweiConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package org.lucoenergia.conluz.domain.production.huawei; | ||
|
||
import java.util.UUID; | ||
|
||
public class HuaweiConfig { | ||
|
||
public static final String HUAWEI_REAL_TIME_PRODUCTION_MEASUREMENT = "huawei_production_realtime"; | ||
public static final String HUAWEI_HOURLY_PRODUCTION_MEASUREMENT = "huawei_production_hourly"; | ||
|
||
public static final String BASE_URL = "https://eu5.fusionsolar.huawei.com/thirdData"; | ||
|
||
private UUID id; | ||
private String username; | ||
private String password; | ||
|
||
public UUID getId() { | ||
return id; | ||
} | ||
|
||
public String getUsername() { | ||
return username; | ||
} | ||
|
||
public String getPassword() { | ||
return password; | ||
} | ||
|
||
public static class Builder { | ||
private UUID id; | ||
private String username; | ||
private String password; | ||
|
||
public Builder setId(UUID id) { | ||
this.id = id; | ||
return this; | ||
} | ||
|
||
public Builder setUsername(String username) { | ||
this.username = username; | ||
return this; | ||
} | ||
|
||
public Builder setPassword(String password) { | ||
this.password = password; | ||
return this; | ||
} | ||
|
||
public HuaweiConfig build() { | ||
HuaweiConfig huaweiConfig = new HuaweiConfig(); | ||
huaweiConfig.id = this.id; | ||
huaweiConfig.username = this.username; | ||
huaweiConfig.password = this.password; | ||
return huaweiConfig; | ||
} | ||
} | ||
} |
Oops, something went wrong.