-
Notifications
You must be signed in to change notification settings - Fork 7
Added SystemParticipantWithHeatResult class and modified ChpResult accordingly #269
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
515611e
#236 Added SystemParticipantWithHeatResult class and modified ChpResu…
avgprog b039c9c
#269 Modified test cases due to the addition of thermal power variabl…
avgprog 819cc41
#269 Fixed codacy static code analysis issues
avgprog 8ba0441
#269 Fixed codacy static code analysis issues
avgprog 8fc8448
#269 Fixed codacy static code analysis issues
avgprog 86daf49
#269 Fixed codacy static code analysis issues
avgprog 25031dd
#269 Fixed codacy static code analysis issues
avgprog 589a394
#270 Modified test cases to check the builder implementations
avgprog 976853f
#269 Added and modified functions as a part of code refinement
avgprog c05ed90
#269 Added other test cases for testing functionalities of ChpResult …
avgprog e840c82
#269 Added other test cases for testing functionalities of ChpResult …
avgprog 492ae15
#269 Modified functionalities and test cases for ChpResult and System…
avgprog 77aef5d
#269 Made changes as per the review
avgprog 4abbd2c
#269 Removed unused imports
avgprog c101d77
#269 Modified documentation due to changes in ChpResult and HpResult …
avgprog a206b24
Merge branch 'dev' into sb/#236-modifyingChpResult
ckittl d5ffc93
Merge branch 'dev' into sb/#236-modifyingChpResult
ckittl c9a2390
#269 Modified uml documentation to add SystemParticipantWithHeatResul…
avgprog 3b16fb8
Adapt Jenkinsfile to meet correct path to Java 11
ckittl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
97 changes: 97 additions & 0 deletions
97
src/main/java/edu/ie3/datamodel/models/result/system/SystemParticipantWithHeatResult.java
This file contains hidden or 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,97 @@ | ||
/* | ||
* © 2021. TU Dortmund University, | ||
* Institute of Energy Systems, Energy Efficiency and Energy Economics, | ||
* Research group Distribution grid planning and operation | ||
*/ | ||
package edu.ie3.datamodel.models.result.system; | ||
|
||
import java.time.ZonedDateTime; | ||
import java.util.Objects; | ||
import java.util.UUID; | ||
import javax.measure.quantity.Power; | ||
import tech.units.indriya.ComparableQuantity; | ||
|
||
/** Abstract class that holds values common to result entities having heat result */ | ||
public abstract class SystemParticipantWithHeatResult extends SystemParticipantResult { | ||
/** The thermal power output normally provided in MW */ | ||
private final ComparableQuantity<Power> qDot; | ||
|
||
/** | ||
* @param time date and time when the result is produced | ||
* @param inputModel uuid of the input model that produces the result | ||
* @param p active power output normally provided in MW | ||
* @param q reactive power output normally provided in MVAr | ||
* @param qDot thermal power output normally provided in MW | ||
*/ | ||
public SystemParticipantWithHeatResult( | ||
ZonedDateTime time, | ||
UUID inputModel, | ||
ComparableQuantity<Power> p, | ||
ComparableQuantity<Power> q, | ||
ComparableQuantity<Power> qDot) { | ||
super(time, inputModel, p, q); | ||
this.qDot = qDot; | ||
} | ||
|
||
/** | ||
* @param uuid uuid of this result entity, for automatic uuid generation use primary constructor | ||
* above | ||
* @param time date and time when the result is produced | ||
* @param inputModel uuid of the input model that produces the result | ||
* @param p active power output normally provided in MW | ||
* @param q reactive power output normally provided in MVAr | ||
* @param qDot thermal power output normally provided in MW | ||
*/ | ||
public SystemParticipantWithHeatResult( | ||
UUID uuid, | ||
ZonedDateTime time, | ||
UUID inputModel, | ||
ComparableQuantity<Power> p, | ||
ComparableQuantity<Power> q, | ||
ComparableQuantity<Power> qDot) { | ||
super(uuid, time, inputModel, p, q); | ||
this.qDot = qDot; | ||
} | ||
|
||
/** | ||
* Thermal power output of the decentralised energy resource asset. Convention: Generated powers | ||
* are given in negative values. | ||
* | ||
* @return Thermal power output in MW. | ||
*/ | ||
public ComparableQuantity<Power> getqDot() { | ||
return qDot; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
if (!super.equals(o)) return false; | ||
SystemParticipantWithHeatResult that = (SystemParticipantWithHeatResult) o; | ||
return qDot.equals(that.qDot); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(super.hashCode(), qDot); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "SystemParticipantWithHeatResult{" | ||
+ "uuid=" | ||
+ getUuid() | ||
+ ", time=" | ||
+ getTime() | ||
+ ", inputModel=" | ||
+ getInputModel() | ||
+ ", p=" | ||
+ getP() | ||
+ ", q=" | ||
+ getQ() | ||
+ ", qDot=" | ||
+ getqDot() | ||
+ '}'; | ||
} | ||
} | ||
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As also SonarQube suggests: Override
equals
andhasCode
methods. The auto-generated ones from IntelliJ should mostly be fine.Also please make sure, that you really check, what the static code analysis tools (SonarQube etc.) give you as hints.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I will add
equals
andhashCode
methods. Actually, I added them in one of the commits but there was a problem. The functions were not being tested and the code coverage was reduced. ThehashCode
function seemed to generate a new hash code for the sameqDot
as input so it was difficult to add a test case to test it. So, I added the test case for testing theequals
method and made another commit but then there was an issue. It seemed like Codacy wanted theequals
function replaced by==
operator or some change to the groovy settings. That is why I removed the two functions in a later commit.