Skip to content

Commit

Permalink
Inclusion of GitHub CI and minor updates in docs (#4)
Browse files Browse the repository at this point in the history
* Inclusion of GitHub CI and minor updates in docs
* Fix test error
* Enforce restrictions in types
  • Loading branch information
JulStraus authored Jan 30, 2024
1 parent c38f895 commit 90efe8a
Show file tree
Hide file tree
Showing 13 changed files with 200 additions and 91 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: CI
on:
push:
branches:
- main
- release-*
pull_request:
types: [opened, synchronize, reopened]
jobs:
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# Since EnergyModelsRenewableProducers doesn't have binary dependencies,
# only test on a subset of possible platforms.
include:
- version: '1' # The latest point-release (Linux)
os: ubuntu-latest
arch: x64
- version: '1' # The latest point-release (Windows)
os: windows-latest
arch: x64
- version: '1.9' # 1.9
os: ubuntu-latest
arch: x64
- version: '1.9' # 1.9
os: ubuntu-latest
arch: x86
- version: 'nightly'
os: ubuntu-latest
arch: x64
steps:
- uses: actions/checkout@v3
- uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: actions/cache@v3
env:
cache-name: cache-artifacts
with:
path: ~/.julia/artifacts
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
restore-keys: |
${{ runner.os }}-test-${{ env.cache-name }}-
${{ runner.os }}-test-
${{ runner.os }}-
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
with:
depwarn: error
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v3
with:
file: lcov.info
1 change: 0 additions & 1 deletion .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ jobs:
shell: julia --color=yes --project=docs/ {0}
run: |
using Pkg
Pkg.add(url="https://github.com/EnergyModelsX/EnergyModelsBase.jl")
Pkg.develop(PackageSpec(path=pwd()))
Pkg.instantiate()
- name: Build and deploy
Expand Down
27 changes: 11 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,33 @@
# EnergyModelsRenewableProducers

[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://energymodelsx.github.io/EnergyModelsRenewableProducers.jl//stable)
[![Build Status](https://github.com/EnergyModelsX/EnergyModelsRenewableProducers.jl/workflows/CI/badge.svg)](https://github.com/EnergyModelsX/EnergyModelsRenewableProducers.jl/actions?query=workflow%3ACI)
[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://energymodelsx.github.io/EnergyModelsRenewableProducers.jl/stable/)
[![In Development](https://img.shields.io/badge/docs-dev-blue.svg)](https://energymodelsx.github.io/EnergyModelsRenewableProducers.jl/dev/)

`EnergyModelsRenewableProducers` is a package to model renewable power generation
technologies.
It extends the [`EnergyModelsBase`](https://github.com/EnergyModelsX/EnergyModelsBase.jl) package with non-dispatchable power generation from sources such as wind turbines as well as modelling of hydro power..

> **Note**
>
> We migrated recently from an internal Git solution to GitHub, including the package [`EnergyModelsBase`](https://github.com/EnergyModelsX/EnergyModelsBase.jl).
> As `EnergyModelsBase` is not yet registered, it is not possible to run the tests without significant changes in the CI.
> Hence, we plan to wait with creating a release to be certain the tests are running.
> As a result, the stable docs are not yet available.
> This may impact as well some links.
`EnergyModelsRenewableProducers` is a package to model renewable power generation technologies.
It extends the [`EnergyModelsBase`](https://github.com/EnergyModelsX/EnergyModelsBase.jl) package with non-dispatchable power generation from sources such as wind turbines as well as modelling of hydro power.
It can also be used to see how a new node type can be developed.

## Usage

See examples of usage of the package and a simple guide for running them in the folder [`examples`](examples).
The usage of the package is best illustrated through the commented [`examples`](examples).
The examples are minimum working examples highlighting the individual new nodes and how they may impact the results.

## Cite

If you find `EnergyModelsRenewableProducers` useful in your work, we kindly request that you cite the following publication:

```@article{boedal_2024,
title = {Hydrogen for harvesting the potential of offshore wind: A North Sea case study},
```bibtex
@article{boedal_2024,
title = {Hydrogen for harvesting the potential of offshore wind: A {N}orth {S}ea case study},
journal = {Applied Energy},
volume = {357},
pages = {122484},
year = {2024},
issn = {0306-2619},
doi = {https://doi.org/10.1016/j.apenergy.2023.122484},
url = {https://www.sciencedirect.com/science/article/pii/S0306261923018482},
author = {Espen Flo Bødal and Sigmund Eggen Holm and Avinash Subramanian and Goran Durakovic and Dimitri Pinel and Lars Hellemo and Miguel Muñoz Ortiz and Brage Rugstad Knudsen and Julian Straus}
author = {Espen Flo B{\o}dal and Sigmund Eggen Holm and Avinash Subramanian and Goran Durakovic and Dimitri Pinel and Lars Hellemo and Miguel Mu{\~n}oz Ortiz and Brage Rugstad Knudsen and Julian Straus}
}
```

Expand Down
1 change: 1 addition & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[deps]
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
EnergyModelsBase = "5d7e687e-f956-46f3-9045-6f5a5fd49f50"
EnergyModelsRenewableProducers = "b007c34f-ba52-4995-ba37-fffe79fbde35"
JuMP = "4076af6c-e467-56ae-b986-b466b2749572"
TimeStruct = "f9ed5ce0-9f41-4eaa-96da-f38ab8df101c"
5 changes: 2 additions & 3 deletions docs/src/manual/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@
> ```
!!! note
If you receive the error that one of the packages is not yet registered, you have to add the packages using the GitHub repositories through
If you receive the error that `EnergyModelsRenewableProducers` is not yet registered, you have to add the package using the GitHub repository through
```
] add https://github.com/EnergyModelsX/EnergyModelsBase.jl
] add https://github.com/EnergyModelsX/EnergyModelsRenewableProducers.jl
```
Once the packages are registered, this is not required.
Once the package is registered, this is not required.
14 changes: 0 additions & 14 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,3 @@ include(joinpath(exdir, "simple_nondisres.jl"))
# Include the code into the Julia REPL to run the first example of the Hydropower node
include(joinpath(exdir, "simple_hydro_power.jl"))
```

> **Note**
>
> The example is not running yet, as the instantiation would require that the package [`EnergyModelsBase`](https://github.com/EnergyModelsX/EnergyModelsBase.jl) is registered.
> It is however possible to run the code directly from a local project in which the packages `TimeStruct`, `EnergyModelsBase`, `EnergyModelsRenewableProducers`, `HiGHS`, `JuMP`, and `PrettyTables` are loaded.
> In this case, you have to comment lines 2-7 out:
> ```julia
> # Activate the test-environment, where HiGHS is added as dependency.
> Pkg.activate(joinpath(@__DIR__, "../test"))
> # Install the dependencies.
> Pkg.instantiate()
> # Add the package EnergyModelsRenewableProducers to the environment.
> Pkg.develop(path=joinpath(@__DIR__, ".."))
> ```
9 changes: 4 additions & 5 deletions examples/simple_hydro_power.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ function generate_data()
Power = ResourceCarrier("Power", 1.0)
products = [CO2, Power]


# Variables for the individual entries of the time structure
op_duration = 2 # Each operational period has a duration of 2
op_number = 4 # There are in total 4 operational periods
operational_periods = SimpleTimes(op_number, op_duration)

# The number of operational periods times the duration of the operational periods, which
# can also be extracted using the function `duration` which corresponds to the total
# duration of the operational periods in a `SimpleTimes` structure
# can also be extracted using the function `duration` of a `SimpleTimes` structure.
# This implies, that a strategic period is 8 times longer than an operational period,
# resulting in the values below as "/8h".
op_per_strat = duration(operational_periods)

# Create the time structure and global data
Expand All @@ -53,7 +53,6 @@ function generate_data()
FixedProfile(5), # Variable OPEX in EUR/MW
FixedProfile(10), # Fixed OPEX in EUR/8h
Dict(Power => 1), # Output from the Node, in this gase, Power
[], # Potential additional data
)

# Create a regulated hydro power plant without storage capacity
Expand All @@ -69,7 +68,7 @@ function generate_data()
Power, # Stored resource
Dict(Power => 0.9), # Input to the power plant, irrelevant in this case
Dict(Power => 1), # Output from the Node, in this gase, Power
[], # Potential additional data
Data[], # Potential additional data
)

# Create a power demand node
Expand Down
11 changes: 5 additions & 6 deletions examples/simple_nondisres.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ function demo_data()
operational_periods = SimpleTimes(op_number, op_duration)

# The number of operational periods times the duration of the operational periods, which
# can also be extracted using the function `duration` which corresponds to the total
# duration of the operational periods in a `SimpleTimes` structure
# can also be extracted using the function `duration` of a `SimpleTimes` structure.
# This implies, that a strategic period is 8 times longer than an operational period,
# resulting in the values below as "/8h".
op_per_strat = duration(operational_periods)

# Creation of the time structure and global data
Expand All @@ -49,7 +50,6 @@ function demo_data()
FixedProfile(30), # Variable OPEX in EUR/MW
FixedProfile(10), # Fixed OPEX in EUR/8h
Dict(Power => 1), # Output from the Node, in this gase, Power
[], # Potential additional data
)
sink = RefSink(
"sink", # Node ID
Expand All @@ -72,11 +72,10 @@ function demo_data()
wind = NonDisRES(
"wind", # Node ID
FixedProfile(4), # Capacity in MW
OperationalProfile([0.9, 0.4, 0.1, 0.8]), # Profile
OperationalProfile([0.9, 0.4, 0.1, 0.8]), # Profile of the NonDisRES node
FixedProfile(10), # Variable OPEX in EUR/MW
FixedProfile(10), # Fixed OPEX in EUR/8h
Dict(Power => 1), # Output from the Node, in this gase, Power
[], # Potential additional data
)

# Update the case data with the non-dispatchable power source and link
Expand All @@ -89,7 +88,7 @@ end

# Create the case and model data and run the model
case, model = demo_data()
optimizer = optimizer_with_attributes(HiGHS.Optimizer)#, MOI.Silent() => true)
optimizer = optimizer_with_attributes(HiGHS.Optimizer, MOI.Silent() => true)
m = EMB.run_model(case, model, optimizer)

# Display some results
Expand Down
6 changes: 3 additions & 3 deletions src/EnergyModelsRenewableProducers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
Main module for `EnergyModelsRenewableProducers.jl`.
This module implements the following types (Nodes) with constraints:
- `NonDisRes` is a subtype of `Source` and represents a
- `NonDisRes` is a subtype of `Source` and represents a \
non-dispatchable renewable producer, as wind, solar etc.
- `PumpedHydroStor` is a subtype of `Storage` and represents a regulated pumped
- `PumpedHydroStor` is a subtype of `Storage` and represents a regulated pumped \
hydro storage.
- `HydroStor` is a subtype of `Storage` and represents a regulated hydro storage,
- `HydroStor` is a subtype of `Storage` and represents a regulated hydro storage, \
that is a standard hydro powerplant without pumps.
"""
module EnergyModelsRenewableProducers
Expand Down
Loading

0 comments on commit 90efe8a

Please sign in to comment.