Skip to content

Commit

Permalink
Merge branch 'dev' into df/#878-thermalGridIT
Browse files Browse the repository at this point in the history
# Conflicts:
#	CHANGELOG.md
  • Loading branch information
danielfeismann committed Nov 19, 2024
2 parents 98d7511 + f73c55b commit 0d40632
Show file tree
Hide file tree
Showing 23 changed files with 162 additions and 94 deletions.
77 changes: 77 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# © 2024. TU Dortmund University,
# Institute of Energy Systems, Energy Efficiency and Energy Economics,
# Research group Distribution grid planning and operation
#

name: CI

on:
push:
paths-ignore:
- 'docs/**'
branches:
- main
- dev
- 'hotfix/*'
- 'rel/*'
- 'dependabot/*'
pull_request:
branches:
- main
- dev

jobs:
buildAndTest:
runs-on: ubuntu-latest

steps:
- name: Checkout Source
uses: actions/checkout@v4
with:
fetch-depth: 1
ref: ${{ github.event.pull_request.head.ref || github.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}

- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4

- name: Build Project
run: ./gradlew --refresh-dependencies clean assemble spotlessCheck

- name: Run Tests
run: ./gradlew test reportScoverage checkScoverage

- name: Build Scala-Docs
run: ./gradlew scaladoc

- name: SonarQube
run: |
./gradlew sonar \
-Dsonar.projectKey=${{ vars.SONAR_PROJECT_KEY }} \
-Dsonar.host.url=${{ vars.SONAR_HOST_URL }} \
-Dsonar.login=${{ secrets.SONAR_TOKEN }}
SONAR_STATUS_URL="${{ vars.SONAR_HOST_URL }}/api/qualitygates/project_status?projectKey=${{ vars.SONAR_PROJECT_KEY }}"
QUALITY_GATE_STATUS=$(curl -s -u "${{ secrets.SONAR_TOKEN }}:" "$SONAR_STATUS_URL" | jq -r '.projectStatus.status')
echo "Quality Gate Status: $QUALITY_GATE_STATUS"
if [ "$QUALITY_GATE_STATUS" != "OK" ]; then
echo "Quality Gate failed!"
exit 1
fi
- name: Deploy
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev'
run: |
./gradlew publish\
-Puser=${{ secrets.MAVENCENTRAL_USER }} \
-Ppassword=${{ secrets.MAVENCENTRAL_PASS }} \
-Psigning.keyId=${{ secrets.MAVENCENTRAL_SIGNINGKEYID }} \
-Psigning.password=${{ secrets.MAVENCENTRAL_SIGNINGPASS }} \
-Psigning.secretKeyRingFile=${{ secrets.MAVENCENTRAL_SIGNINGKEY }}
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fix filter for thermal result checking for lastTick not for currentTick [#1008](https://github.com/ie3-institute/simona/issues/1008)
- Fixed `CHANGELOG` entry for issue ([#103](https://github.com/ie3-institute/simona/issues/103)) [#941](https://github.com/ie3-institute/simona/issues/941)
- Fix grammar and spelling in docs and comments [#1022](https://github.com/ie3-institute/simona/issues/1022)
- Fix some minor issues and findings from inspections [#1019](https://github.com/ie3-institute/simona/issues/1019)
- Refactoring of `ThermalGrid.handleInfeed` to fix thermal storage recharge correctly when empty [#930](https://github.com/ie3-institute/simona/issues/930)

## [3.0.0] - 2023-08-07
Expand Down
5 changes: 1 addition & 4 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ node {

sh 'java -version'

gradle('--refresh-dependencies spotlessCheck pmdMain pmdTest', projectName)
gradle('--refresh-dependencies spotlessCheck test', projectName)

sh(script: """set +x && cd $projectName""" + ''' set +x; ./gradlew javadoc''', returnStdout: true)
}
Expand Down Expand Up @@ -421,9 +421,6 @@ def publishReports(String relativeProjectDir) {
// publish test reports
publishHTML([allowMissing: true, alwaysLinkToLastBuild: true, escapeUnderscores: false, keepAll: true, reportDir: relativeProjectDir + '/build/reports/tests/allTests', reportFiles: 'index.html', reportName: "${relativeProjectDir}_java_tests_report", reportTitles: ''])

// publish pmd report for main project only
publishHTML([allowMissing: true, alwaysLinkToLastBuild: true, escapeUnderscores: false, keepAll: true, reportDir: relativeProjectDir + '/build/reports/pmd', reportFiles: 'main.html', reportName: "${relativeProjectDir}_pmd_report", reportTitles: ''])

// publish scalatest reports for main project only (currently the only one with scala sources!)
publishHTML([allowMissing: false, alwaysLinkToLastBuild: true, escapeUnderscores: false, keepAll: true, reportDir: relativeProjectDir + '/build/reports/tests/scalatest', reportFiles: 'index.html', reportName: "${relativeProjectDir}_scala_tests_report", reportTitles: ''])

Expand Down
2 changes: 0 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ plugins {
id 'scala' // scala support
id 'signing'
id 'maven-publish' // publish to a maven repo (local or mvn central, has to be defined)
id 'pmd' // code check, working on source code
id 'com.diffplug.spotless' version '6.25.0'// code format
id "com.github.ben-manes.versions" version '0.51.0'
id "de.undercouch.download" version "5.6.0" // downloads plugin
Expand Down Expand Up @@ -45,7 +44,6 @@ java {
targetCompatibility = javaVersion
}

apply from: scriptsLocation + 'pmd.gradle'
apply from: scriptsLocation + 'spotless.gradle'
apply from: scriptsLocation + 'checkJavaVersion.gradle'
apply from: scriptsLocation + 'tscfg.gradle' // config tasks
Expand Down
2 changes: 1 addition & 1 deletion docs/readthedocs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ sphinx-rtd-theme==3.0.2
sphinxcontrib-plantuml==0.30
myst-parser==4.0.0
markdown-it-py==3.0.0
sphinx-hoverxref==1.4.1
sphinx-hoverxref==1.4.2
sphinxcontrib-bibtex==2.6.3
7 changes: 0 additions & 7 deletions gradle/scripts/pmd.gradle

This file was deleted.

2 changes: 0 additions & 2 deletions gradle/scripts/sonarqube.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ sonarqube {
}

// sonarqube task dependencies
project.tasks["sonarqube"].dependsOn "pmdMain"
project.tasks["sonarqube"].dependsOn "pmdTest"
project.tasks["sonarqube"].dependsOn "test"
project.tasks["sonarqube"].dependsOn "reportScoverage"
project.tasks["sonarqube"].dependsOn "checkScoverage"
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,9 @@ private[grid] trait GridResultsSupport {
* @return
* a set of [[PartialTransformer3wResult]] s
*/
def buildTransformer3wResults(transformers3w: Set[Transformer3wModel])(
implicit
private def buildTransformer3wResults(
transformers3w: Set[Transformer3wModel]
)(implicit
sweepValueStoreData: Map[UUID, SweepValueStoreData],
iNominal: ElectricCurrent,
timestamp: ZonedDateTime,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1082,7 +1082,7 @@ protected trait ParticipantAgentFundamentals[
goto(Idle) using updatedBaseStateData
}

def pollNextActivationTrigger(
private def pollNextActivationTrigger(
baseStateData: BaseStateData[PD]
): Option[Long] = {
/* Determine what comes next: An additional activation or new data - or both at once */
Expand Down Expand Up @@ -1279,7 +1279,7 @@ protected trait ParticipantAgentFundamentals[
* @return
* Option on a possible fast state change
*/
final def determineFastReply(
private final def determineFastReply(
baseStateData: BaseStateData[PD],
mostRecentRequest: Option[(Long, PD)],
requestTick: Long,
Expand Down Expand Up @@ -1656,7 +1656,7 @@ protected trait ParticipantAgentFundamentals[
* @return
* Averaged result
*/
def determineAverageResult(
private def determineAverageResult(
baseStateData: BaseStateData[PD],
tickToResult: Map[Long, PD],
windowStartTick: Long,
Expand Down Expand Up @@ -1758,7 +1758,7 @@ protected trait ParticipantAgentFundamentals[
* @param outputConfig
* Configuration of the output behaviour
*/
protected def announceSimulationResult(
private def announceSimulationResult(
baseStateData: BaseStateData[PD],
tick: Long,
result: AccompaniedSimulationResult[PD],
Expand Down Expand Up @@ -1889,7 +1889,7 @@ protected trait ParticipantAgentFundamentals[
* @return
* The equivalent event
*/
def buildResultEvent(
private def buildResultEvent(
baseStateData: BaseStateData[PD],
tick: Long,
result: PD,
Expand All @@ -1910,7 +1910,7 @@ protected trait ParticipantAgentFundamentals[
* @return
* Optionally wrapped event
*/
def buildResultEvent[R <: ResultEntity](
private def buildResultEvent[R <: ResultEntity](
result: R
): Option[ResultEvent] = result match {
case thermalUnitResult: ThermalUnitResult =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ protected trait LoadAgentFundamentals[LD <: LoadRelevantData, LM <: LoadModel[
*
* @param baseStateData
* The base state data with collected secondary data
* @param maybeLastModelState
* @param lastModelState
* Optional last model state
* @param currentTick
* Tick, the trigger belongs to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ object ParticipantStateData {
/** Data for the state, in which the agent is not initialized, yet.
* <p>IMPORTANT: Needs to be an empty case class due to typing</p>
*/
final class ParticipantUninitializedStateData[+PD <: PrimaryData]()
final class ParticipantUninitializedStateData[+PD <: PrimaryData]
extends UninitializedStateData[PD]

object ParticipantUninitializedStateData {
Expand Down
4 changes: 2 additions & 2 deletions src/main/scala/edu/ie3/simona/config/ArgsParser.scala
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,11 @@ object ArgsParser extends LazyLogging {
// sealed trait for cluster type
sealed trait ClusterType

case object MasterNode extends ClusterType {
private case object MasterNode extends ClusterType {
override def toString = "master"
}

case object SeedNode extends ClusterType {
private case object SeedNode extends ClusterType {
override def toString = "worker"
}

Expand Down
12 changes: 6 additions & 6 deletions src/main/scala/edu/ie3/simona/config/ConfigFailFast.scala
Original file line number Diff line number Diff line change
Expand Up @@ -785,29 +785,29 @@ case object ConfigFailFast extends LazyLogging {

/** Check the suitability of storage config parameters.
*
* @param StorageRuntimeConfig
* @param storageRuntimeConfig
* RuntimeConfig of Storages
*/
private def checkStoragesConfig(
storageConfig: SimonaConfig.Simona.Runtime.Participant.Storage
storageRuntimeConfig: SimonaConfig.Simona.Runtime.Participant.Storage
): Unit = {
if (
storageConfig.defaultConfig.initialSoc < 0.0 || storageConfig.defaultConfig.initialSoc > 1.0
storageRuntimeConfig.defaultConfig.initialSoc < 0.0 || storageRuntimeConfig.defaultConfig.initialSoc > 1.0
)
throw new RuntimeException(
s"StorageRuntimeConfig: Default initial SOC needs to be between 0.0 and 1.0."
)

if (
storageConfig.defaultConfig.targetSoc.exists(
storageRuntimeConfig.defaultConfig.targetSoc.exists(
_ < 0.0
) || storageConfig.defaultConfig.targetSoc.exists(_ > 1.0)
) || storageRuntimeConfig.defaultConfig.targetSoc.exists(_ > 1.0)
)
throw new RuntimeException(
s"StorageRuntimeConfig: Default target SOC needs to be between 0.0 and 1.0."
)

storageConfig.individualConfigs.foreach { config =>
storageRuntimeConfig.individualConfigs.foreach { config =>
if (config.initialSoc < 0.0 || config.initialSoc > 1.0)
throw new RuntimeException(
s"StorageRuntimeConfig: ${config.uuids} initial SOC needs to be between 0.0 and 1.0."
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/edu/ie3/simona/model/grid/LineModel.scala
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ final case class LineModel(
* branch conductance g_ij between node A and B of the element in p.u.
*/
override def gij(): squants.Dimensionless =
super.gij() * (amount)
super.gij() * amount

/** see [[PiEquivalentCircuit.g0()]]
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,15 @@ trait TransformerTapping {
/** Increase transformer tap position by the provided delta value
*
* @param deltaTap
* number of tap positions to increase
*/
def incrTapPos(deltaTap: Int = 1): Unit =
tapRatio = transformerTappingModel.incrTapPos(deltaTap)

/** Decrease transformer tap position by the provided delta value
*
* @param deltaTap
* number of tap positions to decrease
*/
def decrTapPos(deltaTap: Int = 1): Unit =
tapRatio = transformerTappingModel.decrTapPos(deltaTap)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -928,7 +928,7 @@ final case class EvcsModel(
* @param chargingPoints
* max number of charging points available at this CS
*/
def validateArrivals(
private def validateArrivals(
lastEvs: Seq[EvModelWrapper],
arrivals: Seq[EvModelWrapper],
chargingPoints: Int,
Expand Down
Loading

0 comments on commit 0d40632

Please sign in to comment.