Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Update `Gradle Wrapper` to 9.1.0 [#624](https://github.com/ie3-institute/OSMoGrid/issues/624)
- Updated Ubuntu version to 24.04 and Python version to 3.13 in readthedocs.yml [#640](https://github.com/ie3-institute/OSMoGrid/issues/640)
- Updated gradle version 9.2.1 new version [#649](https://github.com/ie3-institute/OSMoGrid/issues/649)
- Updated `tscfg` to 1.2.5 [#659](https://github.com/ie3-institute/OSMoGrid/issues/659)

### Fixed
- Fixed bug in `LvGridGeneratorSupport` [#388](https://github.com/ie3-institute/OSMoGrid/issues/388)
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ ext {
scalaBinaryVersion = '3.7.4'
pekkoVersion = '1.3.0'

tscfgVersion = '0.9.995'
tscfgVersion = '1.2.5'
scapegoatVersion = '3.2.3'

scriptsLocation = 'gradle' + File.separator + 'scripts' + File.separator
Expand Down
71 changes: 29 additions & 42 deletions gradle/scripts/tscfg.gradle
Original file line number Diff line number Diff line change
@@ -1,56 +1,43 @@
////////////////////////////////////////////////////////////////////////////
// Generate config classes reflecting the osmogrid-config-tempalte.conf template file
////////////////////////////////////////////////////////////////////////////
task genConfigClass {
doLast {
def tscfgJarFile = layout.buildDirectory.file('tscfg-' + tscfgVersion + '.jar').get().asFile
if (!tscfgJarFile.exists() || !tscfgJarFile.isFile()) {
download.run {
src 'https://github.com/carueda/tscfg/releases/download/v' + tscfgVersion + '/tscfg-' + tscfgVersion + '.jar'
dest layout.buildDirectory.get()
}
}
javaexec {
main = "-jar"
args = [
"build/tscfg-${tscfgVersion}.jar",
"--spec",
"src/main/resources/config/config-template.conf",
"--scala",
"--durations",
"--pn",
"edu.ie3.osmogrid.cfg",
"--cn",
"OsmoGridConfig",
"--dd",
"src/main/scala/edu/ie3/osmogrid/cfg/"
]
tasks.register('genConfigClass', JavaExec) {
def tscfgJarFile = layout.buildDirectory.file("tscfg-${tscfgVersion}.jar").get().asFile
if (!tscfgJarFile.exists() || !tscfgJarFile.isFile()) {
download.run {
src "https://github.com/carueda/tscfg/releases/download/v${tscfgVersion}/tscfg-${tscfgVersion}.jar"
dest layout.buildDirectory.get()
}
}

mainClass.set("-jar")
args = [
"build/tscfg-${tscfgVersion}.jar",
"--spec", "src/main/resources/config/config-template.conf",
"--scala", "--durations",
"--pn", "edu.ie3.osmogrid.cfg",
"--cn", "OsmoGridConfig",
"--dd", "src/main/scala/edu/ie3/osmogrid/cfg/"
]
}

////////////////////////////////////////////////////////////////////////////
// Generate sample config file reflecting the application.conf template file
// This can be used to setup a new simulation configuration
////////////////////////////////////////////////////////////////////////////
task genConfigSample {
doLast {
def tscfgJarFile = layout.buildDirectory.file('tscfg-' + tscfgVersion + '.jar').get().asFile
if (!tscfgJarFile.exists() || !tscfgJarFile.isFile()) {
download.run {
src 'https://github.com/carueda/tscfg/releases/download/v' + tscfgVersion + '/tscfg-' + tscfgVersion + '.jar'
dest layout.buildDirectory.get()
}
}
javaexec {
main = "-jar"
args = [
"build/tscfg-${tscfgVersion}.jar",
"--spec",
"src/main/resources/config/config-template.conf",
"--tpl",
"configs/osmogrid/OSMoGrid_sample.conf"
]
tasks.register('genConfigSample', JavaExec) {
def tscfgJarFile = layout.buildDirectory.file("tscfg-${tscfgVersion}.jar").get().asFile
if (!tscfgJarFile.exists() || !tscfgJarFile.isFile()) {
download.run {
src "https://github.com/carueda/tscfg/releases/download/v${tscfgVersion}/tscfg-${tscfgVersion}.jar"
dest layout.buildDirectory.get()
}
}

mainClass.set("-jar")
args = [
"build/tscfg-${tscfgVersion}.jar",
"--spec", "src/main/resources/config/config-template.conf",
"--tpl", "configs/osmogrid/OSMoGrid_sample.conf"
]
}
40 changes: 30 additions & 10 deletions src/main/scala/edu/ie3/osmogrid/cfg/OsmoGridConfig.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* © 2024. TU Dortmund University,
* © 2025. TU Dortmund University,
* Institute of Energy Systems, Energy Efficiency and Energy Economics,
* Research group Distribution grid planning and operation
*/
Expand All @@ -19,6 +19,12 @@ object OsmoGridConfig {
mv: scala.Option[OsmoGridConfig.Generation.Mv],
)
object Generation {

/** @param averagePowerDensity
* as W/m^2
* @param considerHouseConnectionPoints
* If there shall be no distinct lines for house connection
*/
final case class Lv(
averagePowerDensity: scala.Double,
boundaryAdminLevel: OsmoGridConfig.Generation.Lv.BoundaryAdminLevel,
Expand Down Expand Up @@ -50,6 +56,10 @@ object OsmoGridConfig {
filter: scala.Option[OsmoGridConfig.Generation.Lv.Osm.Filter]
)
object Osm {

/** @param building
* filter to be applied for the LvOsmoGridModel
*/
final case class Filter(
building: scala.List[java.lang.String],
highway: scala.List[java.lang.String],
Expand Down Expand Up @@ -87,7 +97,7 @@ object OsmoGridConfig {
$tsCfgValidator,
)
)
else None
else scala.None
)
}
}
Expand Down Expand Up @@ -173,14 +183,14 @@ object OsmoGridConfig {
OsmoGridConfig.Generation
.Lv(c.getConfig("lv"), parentPath + "lv.", $tsCfgValidator)
)
else None,
else scala.None,
mv =
if (c.hasPathOrNull("mv"))
scala.Some(
OsmoGridConfig.Generation
.Mv(c.getConfig("mv"), parentPath + "mv.", $tsCfgValidator)
)
else None,
else scala.None,
)
}
}
Expand Down Expand Up @@ -284,7 +294,7 @@ object OsmoGridConfig {
$tsCfgValidator,
)
)
else None
else scala.None
)
}
}
Expand Down Expand Up @@ -336,7 +346,7 @@ object OsmoGridConfig {
OsmoGridConfig.Input.Osm
.Pbf(c.getConfig("pbf"), parentPath + "pbf.", $tsCfgValidator)
)
else None
else scala.None
)
}
}
Expand Down Expand Up @@ -421,7 +431,7 @@ object OsmoGridConfig {
OsmoGridConfig.Output
.Csv(c.getConfig("csv"), parentPath + "csv.", $tsCfgValidator)
)
else None,
else scala.None,
gridName = $_reqStr(parentPath, c, "gridName", $tsCfgValidator),
)
}
Expand Down Expand Up @@ -449,6 +459,10 @@ object OsmoGridConfig {
mv: OsmoGridConfig.Voltage.Mv,
)
object Voltage {

/** @param vNom
* values should be given in kV
*/
final case class Hv(
default: scala.Double,
id: java.lang.String,
Expand All @@ -469,11 +483,14 @@ object OsmoGridConfig {
scala.Some(
$_L$_dbl(c.getList("vNom"), parentPath, $tsCfgValidator)
)
else None,
else scala.None,
)
}
}

/** @param vNom
* values should be given in kV
*/
final case class Lv(
default: scala.Double,
id: java.lang.String,
Expand All @@ -494,11 +511,14 @@ object OsmoGridConfig {
scala.Some(
$_L$_dbl(c.getList("vNom"), parentPath, $tsCfgValidator)
)
else None,
else scala.None,
)
}
}

/** @param vNom
* values should be given in kV
*/
final case class Mv(
default: scala.Double,
id: java.lang.String,
Expand All @@ -519,7 +539,7 @@ object OsmoGridConfig {
scala.Some(
$_L$_dbl(c.getList("vNom"), parentPath, $tsCfgValidator)
)
else None,
else scala.None,
)
}
}
Expand Down