Skip to content

Commit

Permalink
Merge pull request #8 from invenia/mj/AddingNewDimension
Browse files Browse the repository at this point in the history
adding dimension and unit for dollar per MWh.
  • Loading branch information
mjamei19 authored Jan 15, 2019
2 parents bdcb729 + 5f8a713 commit 1b234d3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/PowerSystemsUnits.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ export asqtype, fustrip, UnitfulMissing
@dimension Money "Money" Currency
@refunit USD "USD" Currency Money false

# Monetary and Power Units
@derived_dimension MoneyPerPowerHour Money*𝐋^-2*𝐌^-1*𝐓^2
@unit USDPerMWh "USDPerMWh" DollarPerMegaWattHour USD/(1000000*Wh) false

include("utils.jl")

# Pre compilation currently causes issues with seg faults in modules that use this one
Expand Down
8 changes: 8 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ using Compat.Test
using PowerSystemsUnits

using Unitful: @u_str
using Unitful
import Unitful: J, W, hr

Unitful.register(PowerSystemsUnits)

@testset "PowerSystemsUnits.jl" begin
@testset "Units" begin
Expand All @@ -15,5 +18,10 @@ using Unitful: @u_str
y = (offsets)u"minute"
@test x == y
end
@testset "Power Related Unit" begin
@test 1u"Wh" == 1u"W*hr"
@test 1u"VARh" == 3600u"J"
@test 1u"USDPerMWh" == 1u"USD/(MW*hr)"
end
end
end

0 comments on commit 1b234d3

Please sign in to comment.