Skip to content

Commit 49a5df6

Browse files
committed
use DataInterpolations in gas network
1 parent 6ffaf5a commit 49a5df6

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

docs/Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name = "ND.jl docs"
33
[deps]
44
Bonito = "824d6782-a2ef-11e9-3a09-e5662e0c26f8"
55
CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
6+
DataInterpolations = "82cc6244-b520-54b8-b5a6-8a565e85f1d0"
67
DiffEqCallbacks = "459566f4-90b8-5000-8ac3-15dfb0a30def"
78
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
89
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
@@ -12,7 +13,6 @@ Electron = "a1bb12fb-d4d1-54b4-b10a-ee7951ef7ad3"
1213
GraphMakie = "1ecd5474-83a3-4783-bb4f-06765db800d2"
1314
Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6"
1415
LaTeXStrings = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f"
15-
LinearInterpolations = "b20c7882-2490-4592-a606-fbbfe9e745e8"
1616
Literate = "98b081ad-f1c9-55d3-8b20-4c87d4299306"
1717
ModelingToolkit = "961ee093-0014-501f-94e3-6117800e7a78"
1818
NetworkDynamics = "22e9dc34-2a0d-11e9-0de0-8588d035468b"
@@ -39,6 +39,7 @@ NetworkDynamicsInspector = {path = "../NetworkDynamicsInspector"}
3939
[compat]
4040
Bonito = "≥0.0.1"
4141
CairoMakie = "0.13.1"
42+
DataInterpolations = "7"
4243
DiffEqCallbacks = "4.2.2"
4344
Distributions = "0.25.117"
4445
Documenter = "1.8.0"
@@ -48,7 +49,6 @@ Electron = "≥0.0.1"
4849
GraphMakie = "0.5.13"
4950
Graphs = "≥0.0.1"
5051
LaTeXStrings = "1.4.0"
51-
LinearInterpolations = "0.1.4"
5252
Literate = "2.20.1"
5353
ModelingToolkit = "≥0.0.1"
5454
NetworkDynamics = "≥0.0.1"

docs/examples/gas_network.jl

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ using DynamicQuantities
1919
using ModelingToolkit: D as Dt, t as t
2020
using Test
2121
using StaticArrays
22-
using LinearInterpolations
22+
using DataInterpolations
2323
using OrdinaryDiffEqTsit5
2424
using CairoMakie
2525
CairoMakie.activate!(type="svg") #hide
@@ -220,10 +220,8 @@ Julia code from the symbolic reepresentation all units will be stripped.
220220
However since we know the times exactly, we can handle this by simply giving a list of explicit
221221
tstops to the solve command, to make sure those are hit exactly.
222222
=#
223-
load2(t) = -Interpolate(SA[0, 4, 12, 20, 24]*3600, SA[20, 30, 10, 30, 20], extrapolate=LinearInterpolations.Constant(20))(t)
224-
load3(t) = -Interpolate(SA[0, 4, 12, 20, 24]*3600, SA[40, 50, 30, 50, 40], extrapolate=LinearInterpolations.Constant(40))(t)
225-
@register_symbolic load2(t)
226-
@register_symbolic load3(t)
223+
load2 = (t) -> LinearInterpolation(-1*Float64[20, 30, 10, 30, 20], [0, 4, 12, 20, 24]*3600.0; extrapolation=ExtrapolationType.Constant)(t)
224+
load3 = (t) -> LinearInterpolation(-1*Float64[40, 50, 30, 50, 40], [0, 4, 12, 20, 24]*3600.0; extrapolation=ExtrapolationType.Constant)(t)
227225
ModelingToolkit.get_unit(op::typeof(load2), _) = u"m^3/s"
228226
ModelingToolkit.get_unit(op::typeof(load3), _) = u"m^3/s"
229227
nothing #hide

0 commit comments

Comments
 (0)