Skip to content

Commit

Permalink
Merge branch 'dev' into ms/#1186-add-congestion-detection
Browse files Browse the repository at this point in the history
# Conflicts:
#	CHANGELOG.md
#	src/main/scala/edu/ie3/simona/agent/grid/GridAgent.scala
#	src/main/scala/edu/ie3/simona/util/ConfigUtil.scala
  • Loading branch information
staudtMarius committed Feb 24, 2025
2 parents 41a1878 + 5f867a4 commit eabd68f
Show file tree
Hide file tree
Showing 91 changed files with 2,181 additions and 6,991 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Introducing new ParticipantAgent and ParticipantModel [#1134](https://github.com/ie3-institute/simona/issues/1134)
- Using new `ParticipantAgent.Request` messages everywhere [#1195](https://github.com/ie3-institute/simona/issues/1195)
- Implementing consideration of `NotifierConfig` into new participant [#1200](https://github.com/ie3-institute/simona/issues/1200)
- Replace `LoadModel` with its new implementation [#1150](https://github.com/ie3-institute/simona/issues/1150)
- Replace `FixedFeedInModel` with its new implementation [#1152](https://github.com/ie3-institute/simona/issues/1152)
- Added congestion detection [#1186](https://github.com/ie3-institute/simona/issues/1186)

### Changed
Expand Down Expand Up @@ -137,6 +139,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Refactor `RuntimeConfig` [#1172](https://github.com/ie3-institute/simona/issues/1172)
- Renamed some methods and variables within `ThermalGrid` and `ThermalHouse` [#1193](https://github.com/ie3-institute/simona/issues/1193)
- Replaced Java Durations with Scala Durations [#1068](https://github.com/ie3-institute/simona/issues/1068)
- Typo and format of `ThermalGrid` and `ThermalHouse` ScalaDocs [#1196](https://github.com/ie3-institute/simona/issues/1196)
- Refactor `EmRuntimeConfig` [#1181](https://github.com/ie3-institute/simona/issues/1181)
- Based `PvModel` calculations on irradiance (power per area) instead of irradiation (energy per area) [#1212](https://github.com/ie3-institute/simona/issues/1212)

### Fixed
- Fix rendering of references in documentation [#505](https://github.com/ie3-institute/simona/issues/505)
Expand Down Expand Up @@ -186,6 +191,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Move `ScheduleServiceActivation` out of `RegistrationResponseMessage` [#1143](https://github.com/ie3-institute/simona/issues/1143)
- Check for runningHp when handling infeed to thermalGrid [#1167](https://github.com/ie3-institute/simona/issues/1167)
- Send `FlexResult` to EM [#1202](https://github.com/ie3-institute/simona/issues/1202)
- Fix test timeouts for all tests [#1222](https://github.com/ie3-institute/simona/issues/1222)

### Removed
- Removed `SimonaListerner` and related code [#1205](https://github.com/ie3-institute/simona/issues/1205)

## [3.0.0] - 2023-08-07

Expand Down
5 changes: 3 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ ext {
confluentKafkaVersion = '7.4.0'
scapegoatVersion = '3.1.4'

junitVersion = '1.12.0'
testContainerVersion = '0.41.8'

scriptsLocation = 'gradle' + File.separator + 'scripts' + File.separator // location of script plugins
Expand Down Expand Up @@ -98,8 +99,8 @@ dependencies {
/* testing */
// scalatest & junit
testImplementation "org.scalatest:scalatest_${scalaVersion}:3.2.19"
testImplementation "org.junit.platform:junit-platform-launcher:1.11.4"
testRuntimeOnly "org.junit.platform:junit-platform-engine:1.11.4"
testImplementation "org.junit.platform:junit-platform-launcher:${junitVersion}"
testRuntimeOnly "org.junit.platform:junit-platform-engine:${junitVersion}"
testRuntimeOnly "org.scalatestplus:junit-5-11_${scalaVersion}:3.2.19.0"

// mocking framework
Expand Down
6 changes: 0 additions & 6 deletions docs/readthedocs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,12 +237,6 @@ The initial SOC defaults to 0%, while the target SOC is optional. When no target

Individual configuration can be assigned accordingly.

## Event configuration

Tba:

`simona.event.listener = []`

## Grid configuration

### Reference System
Expand Down
107 changes: 65 additions & 42 deletions docs/readthedocs/models/pv_model.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

This page documents the functionality of the PV model available in SIMONA.

The initial parts of the model are presented in the paper [Agent based approach to model photovoltaic feed-in in distribution network planning](https://ieeexplore.ieee.org/abstract/document/7038345). Since then several adaptions has been made that are documented as follows.
The initial parts of the model are presented in the paper _Agent based approach to model photovoltaic feed-in in distribution network planning_ by {cite:cts}`Seack.2014`.
Since then several adaptions has been made that are documented as follows.

The PV Model is part of the SIMONA Simulation framework and represented by an agent.

Expand All @@ -20,21 +21,29 @@ Please refer to {doc}`PowerSystemDataModel - PV Model <psdm:models/input/partici

![Sequence Diagram Behaviour PV Model](http://www.plantuml.com/plantuml/proxy?cache=no&src=https://raw.githubusercontent.com/ie3-institute/simona/dev/docs/uml/main/models/pv_model/BehaviourPvModel.puml)

## Output visualization

## Calculations

The energy produced by a photovoltaic (pv) unit in a specific time step is based on the diffuse and direct radiation provided by the used weather data. The following steps are done to calculate (= estimate) the power feed by the pv.
The energy produced by a photovoltaic (PV) unit in a specific time step is based on the diffuse and direct radiance provided by the used weather data.
The following steps are done to calculate (= estimate) the power feed in by the PV.

The model calculations are performed on the basis of _radiance_ (power per area, symbol $G$).
Some sources are primarily based on radiance {cite:p}`Myers.2017`.
Others are developing models using _radiation_ values (energy per area, symbols $I$ or $H$), which are often times referencing a fixed time frame, e.g. of one hour.
Conversions to radiance values can be easily made and can be used interchangeably ({cite:p}`Duffie.2013` p. 86, footnote).

To calculate the overall feed in of the pv unit, the sum of the direct radiation, diffuse radiation and reflected radiation is needed. In the following, the formulas to calculate each of these radiations are presented and explained. The sections end with the formula to calculate the corresponding power feed in.
_Irradiance_ and _irradiation_ describe power and energy arriving at a surface, while the terms _radiance_ and _radiation_ are used for general purposes ({cite:p}`Iqbal.1983` Ch. 2.6).

**Caution:** all angles are given in radian!
To calculate the overall feed in of the PV unit, the sum of the direct irradiance, diffuse irradiance and reflected irradiance is needed.
In the following, the formulas to calculate each of these radiances are presented and explained.
The sections end with the formula to calculate the corresponding power feed in.

The surface azimuth angle $\alpha_{E}$ starts at negative values in the East and moves over 0° (South) towards positive values in the West. [(Source)](https://www.photovoltaik.org/wissen/azimutwinkel)
The surface azimuth angle $\alpha_{e}$ starts at negative values in the East and moves over 0° (South) towards positive values in the West ([Source](https://www.photovoltaik.org/wissen/azimutwinkel)).

### Declination Angle

The declination angle $\delta$ (in radian!) is the day angle that represents the position of the earth in relation to the sun. To calculate this angle, we need to calculate the day angle $J$. The day angle in radian is represented by:
The declination angle $\delta$ (in radian!) is the day angle that represents the position of the earth in relation to the sun.
To calculate this angle, we need to calculate the day angle $J$.
The day angle in radian is represented by:

$$
J = 2 \pi(\frac{n-1}{365})
Expand All @@ -59,7 +68,9 @@ $$

### Hour Angle

The hour angle is a conceptual description of the rotation of the earth around its polar axis. It starts with a negative value in the morning, arrives at 0° at noon (solar time) and ends with a positive value in the evening. The hour angle (in radian!) is calculated as follows
The hour angle is a conceptual description of the rotation of the earth around its polar axis.
It starts with a negative value in the morning, arrives at 0° at noon (solar time) and ends with a positive value in the evening.
The hour angle (in radian!) is calculated as follows

$$
\omega = ((12 - ST) \cdot 15) \cdot (\frac{\pi}{180})
Expand Down Expand Up @@ -99,7 +110,8 @@ $$
*with*\
**J** = day angle (in radian!)

**Note:** The used formulas are based on *\"DIN 5034-2: Tageslicht in Innenräumen, Grundlagen.\"* and therefore valid especially for Germany and Europe. For international calculations a more general formulation that can be found in [Maleki, S.A., Hizam, H., & Gomes, C. (2017). Estimation of Hourly, Daily and Monthly Global Solar Radiation on Inclined Surfaces: Models Re-Visited.](https://res.mdpi.com/d_attachment/energies/energies-10-00134/article_deploy/energies-10-00134-v2.pdf) might be used.
**Note:** The used formulas are based on *\"DIN 5034-2: Tageslicht in Innenräumen, Grundlagen.\"* and therefore valid especially for Germany and Europe.
For international calculations a more general formulation that can be found in {cite:p}`Maleki.2017` might be used.

**References:**

Expand All @@ -110,7 +122,9 @@ $$

### Sunrise Angle

The hour angles at sunrise and sunset are very useful quantities to know. These two values have the same absolute value, however the sunset angle ($\omega_{SS}$) is positive and the sunrise angle ($\omega_{SR}$) is negative. Both can be calculated from:
The hour angles at sunrise and sunset are very useful quantities to know.
These two values have the same absolute value, however the sunset angle ($\omega_{SS}$) is positive and the sunrise angle ($\omega_{SR}$) is negative.
Both can be calculated from:

$$
\omega_{SS}=\cos^{-1}(-\tan (\phi) \cdot \tan (\delta))
Expand Down Expand Up @@ -151,7 +165,7 @@ $$

### Zenith Angle

Represents the angle between the vertical and the line to the sun, that is, the angle of incidence of beam radiation on a horizontal surface.
Represents the angle between the vertical and the line to the sun, that is, the angle of incidence of beam radiance on a horizontal surface.

$$
\theta_{z} = (\frac{\pi}{2}) - \alpha_{s}
Expand All @@ -165,7 +179,8 @@ See Solar Altitude Angle

### Incidence Angle

The angle of incidence is the angle between the Sun\'s rays and the PV panel. It can be calculated as follows:
The angle of incidence is the angle between the Sun\'s rays and the PV panel.
It can be calculated as follows:

$$
\begin{eqnarray*}
Expand Down Expand Up @@ -195,7 +210,7 @@ $$

### Air Mass

Calculating the air mass ratio by dividing the radius of the earth with approx. effective height of the atmosphere (each in kilometer)
Calculating the air mass ratio by dividing the radius of the earth with approx. effective height of the atmosphere (each in kilometer):

$$
\mathrm{airmassratio} = (\frac{6371 km}{9 km}) = 707.8\overline{8}
Expand All @@ -211,9 +226,9 @@ $$
* {cite:cts}`WikiAirMass`


### Extraterrestrial Radiation
### Extraterrestrial Radiance

The extraterrestrial radiation $I_0$ is calculated by multiplying the eccentricity correction factor
The extraterrestrial radiance $G_0$ is calculated by multiplying the eccentricity correction factor.

$$
\begin{eqnarray*}
Expand All @@ -238,9 +253,10 @@ $$
* {cite:cts}`Duffie.2013` (the fifth ed. seems to have a typo in formula (1.4.1b): factor $0.000719$ is missing a zero)


### Beam Radiation on Sloped Surface
### Beam Irradiance on Sloped Surface

For our use case, $\omega_{2}$ is normally set to the hour angle one hour after $\omega_{1}$. Within one hour distance to sunrise/sunset, we adjust $\omega_{1}$ and $\omega_{2}$ accordingly:
For our use case, $\omega_{2}$ is normally set to the hour angle one hour after $\omega_{1}$.
Within one hour distance to sunrise/sunset, we adjust $\omega_{1}$ and $\omega_{2}$ accordingly:

$$
\begin{eqnarray*}
Expand Down Expand Up @@ -276,41 +292,45 @@ b = (\cos(\phi) \cdot \cos(\delta)) \cdot (\sin(\omega_{2}) - \sin(\omega_{1}))
$$

$$
E_{\mathrm{beam},S} = E_{\mathrm{beam},H} \cdot \frac{a}{b}
G_{\mathrm{beam},S} = G_{\mathrm{beam},H} \cdot \frac{a}{b}
$$

**Please note:** $\frac{1}{180}\pi$ is omitted from these formulas, as we are already working with data in *radians*.

*with*\
**$\delta$** = the declination angle\
**$\phi$** = observer's latitude\
**$\gamma_{e}$** = slope angle of the surface\
**$\omega_1$** = hour angle $\omega$\
**$\omega_2$** = hour angle $\omega$ + 1 hour\
**$\alpha_e$** = surface azimuth angle\
**$E_{\mathrm{beam},H}$** = beam radiation (horizontal surface)
**$G_{\mathrm{beam},H}$** = beam irradiance (horizontal surface)

**Please note:**
1. $\frac{1}{180}\pi$ is omitted from these formulas, as we are already working with data in *radians*.
2. In contrast to the primary source {cite:p}`Duffie.2013`, radiance values instead of radiation values are used here, as described above.

**Reference:**

* {cite:cts}`Duffie.2013` p. 88


### Diffuse Radiation on Sloped Surface
### Diffuse Irradiance on Sloped Surface

The diffuse radiation is computed using the Perez model, which divides the radiation in three parts. First, there is an intensified radiation from the direct vicinity of the sun. Furthermore, there is Rayleigh scattering, backscatter (which lead to increased in intensity on the horizon) and isotropic radiation considered.
The diffuse irradiance is computed using the Perez model, which divides the irradiance into three parts.
First, there is an intensified irradiance from the direct vicinity of the sun.
Furthermore, there is Rayleigh scattering, backscatter (which lead to increased in intensity on the horizon) and isotropic irradiance considered.

A cloud index is defined by

$$
\epsilon = \frac{\frac{E_{\mathrm{dif},H} + E_{\mathrm{beam},N}}{E_{\mathrm{dif},H}} + 5.535 \cdot 10^{-6} \cdot \theta_{z}^3}{1 + 5.535 \cdot 10^{-6} \cdot \theta_{z}^3}
\epsilon = \frac{\frac{G_{\mathrm{dif},H} + G_{\mathrm{beam},N}}{G_{\mathrm{dif},H}} + 5.535 \cdot 10^{-6} \cdot \theta_{z}^3}{1 + 5.535 \cdot 10^{-6} \cdot \theta_{z}^3}
$$

with angle $\theta_z$ values in **degrees** ({cite:cts}`Duffie.2013` p. 94) and $E_{\mathrm{beam},N} = \frac{E_{\mathrm{beam},H}}{\cos (\theta_z)}$ ({cite:cts}`Duffie.2013` p. 95).
with angle $\theta_z$ values in **degrees** ({cite:p}`Duffie.2013` p. 94) and $G_{\mathrm{beam},N} = \frac{G_{\mathrm{beam},H}}{\cos (\theta_z)}$ ({cite:p}`Duffie.2013` p. 95).

Calculating a brightness index

$$
\Delta = m \cdot \frac{E_{\mathrm{dif},H}}{I_{0}}
\Delta = m \cdot \frac{G_{\mathrm{dif},H}}{G_{0}}
$$

**Perez Fij coefficients (Myers 2017):**
Expand Down Expand Up @@ -385,10 +405,10 @@ $$
b = max(0.087, \sin(\alpha_{s}))
$$

the diffuse radiation can be calculated:
the diffuse irradiance can be calculated:

$$
E_{\mathrm{dif},S} = E_{\mathrm{dif},H} \cdot (\frac{1}{2} \cdot (1 +
G_{\mathrm{dif},S} = G_{\mathrm{dif},H} \cdot (\frac{1}{2} \cdot (1 +
cos(\gamma_{e})) \cdot (1- F_{1}) + \frac{a}{b} \cdot F_{1} +
F_{2} \cdot \sin(\gamma_{e}))
$$
Expand All @@ -398,11 +418,13 @@ $$
**$\theta_{g}$** = angle of incidence\
**$\alpha_{s}$** = solar altitude angle\
**$\gamma_{e}$** = slope angle of the surface\
**$I_{0}$** = Extraterrestrial Radiation\
**$G_{0}$** = extraterrestrial radiance\
**$m$** = air mass\
**$E_{\mathrm{beam},H}$** = beam radiation (horizontal surface)\
**$E_{\mathrm{beam},N}$** = beam radiation (normal incidence, thus radiation on a plane normal to the direction of the beam)\
**$E_{\mathrm{dif},H}$** = diffuse radiation (horizontal surface)
**$G_{\mathrm{beam},H}$** = beam irradiance (horizontal surface)\
**$G_{\mathrm{beam},N}$** = beam irradiance (normal incidence, thus irradiance on a plane normal to the direction of the beam)\
**$G_{\mathrm{dif},H}$** = diffuse irradiance (horizontal surface)

**Please note:** In contrast to the primary source {cite:p}`Duffie.2013`, radiance values instead of radiation values are used here, as described above.

**References:**

Expand All @@ -412,15 +434,15 @@ $$
* {cite:cts}`Duffie.2013` p. 95f


### Reflected Radiation on Sloped Surface
### Reflected Irradiance on Sloped Surface

$$
E_{\mathrm{ref},S} = E_{\mathrm{Ges},H} \cdot \frac{\rho}{2} \cdot (1-
G_{\mathrm{ref},S} = G_{\mathrm{Ges},H} \cdot \frac{\rho}{2} \cdot (1-
\cos(\gamma_{e}))
$$

*with*\
**$E_{\mathrm{Ges},H}$** = total horizontal radiation ($E_{\mathrm{beam},H} + E_{\mathrm{dif},H})$\
**$G_{\mathrm{Ges},H}$** = total horizontal irradiance ($G_{\mathrm{beam},H} + G_{\mathrm{dif},H})$\
**$\gamma_e$** = slope angle of the surface\
**$\rho$** = albedo

Expand All @@ -431,17 +453,18 @@ $$

### Output

Received energy is calculated as the sum of all three types of irradiation.
Received energy is calculated as the sum of all three types of irradiance.

$$
E_{\mathrm{total}} = E_{\mathrm{beam},S} + E_{\mathrm{dif},S} + E_{\mathrm{ref},S}
G_{\mathrm{total}} = G_{\mathrm{beam},S} + G_{\mathrm{dif},S} + G_{\mathrm{ref},S}
$$

*with*\
**$E_{\mathrm{beam},S}$** = Beam radiation\
**$E_{\mathrm{dif},S}$** = Diffuse radiation\
**$E_{\mathrm{ref},S}$** = Reflected radiation
**$G_{\mathrm{beam},S}$** = Beam irradiance\
**$G_{\mathrm{dif},S}$** = Diffuse irradiance\
**$G_{\mathrm{ref},S}$** = Reflected irradiance

A generator correction factor (depending on month surface slope $\gamma_{e}$) and a temperature correction factor (depending on month) multiplied on top.

It is checked whether proposed output exceeds maximum ($p_{max}$), in which case a warning is logged. If output falls below activation threshold, it is set to 0.
It is checked whether proposed output exceeds maximum ($p_{max}$), in which case a warning is logged.
If output falls below activation threshold, it is set to 0.
2 changes: 1 addition & 1 deletion docs/readthedocs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Sphinx==8.1.3
Sphinx==8.2.1
sphinx-rtd-theme==3.0.2
sphinxcontrib-plantuml==0.30
myst-parser==4.0.1
Expand Down
7 changes: 1 addition & 6 deletions input/samples/vn_simona/vn_simona.conf
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ simona.runtime.participant.storage = {
# # # # #
# ATTENTION: calculateMissingReactivePowerWithModel and scaling is ignored here.
# # # # #
simona.runtime.participant.em = {
simona.runtime.em = {
defaultConfig = {
calculateMissingReactivePowerWithModel = false
uuids = ["default"]
Expand All @@ -188,11 +188,6 @@ simona.runtime.participant.em = {
individualConfigs = []
}

##################################################################
# Event Configuration
##################################################################
simona.event.listener = []

##################################################################
# Grid Configuration
##################################################################
Expand Down
1 change: 1 addition & 0 deletions src/main/scala/edu/ie3/simona/agent/grid/GridAgent.scala
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ object GridAgent extends DBFSAlgorithm with DCMAlgorithm {
constantData.simStartTime,
TimeUtil.withDefaults
.toZonedDateTime(cfg.time.endDateTime),
cfg.runtime.em,
cfg.runtime.participant,
cfg.output.participant,
constantData.resolution,
Expand Down
Loading

0 comments on commit eabd68f

Please sign in to comment.