diff --git a/src/PowerSystemsUnits.jl b/src/PowerSystemsUnits.jl index 41b2772..c5b9b45 100644 --- a/src/PowerSystemsUnits.jl +++ b/src/PowerSystemsUnits.jl @@ -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 diff --git a/test/runtests.jl b/test/runtests.jl index 8b3fe81..fe9be85 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -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 @@ -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