Skip to content

Commit d74a4c3

Browse files
committed
Clean up deps on JSMO and MTK v8
1 parent 1317cf8 commit d74a4c3

File tree

6 files changed

+10
-53
lines changed

6 files changed

+10
-53
lines changed

Project.toml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "ModelTesting"
22
uuid = "726cd793-0c59-4a7a-97d2-1baad301d093"
33
authors = ["Ben Chung <benjamin.chung@juliahub.com> and contributors"]
4-
version = "1.0.4-DEV"
4+
version = "1.0.5-DEV"
55

66
[deps]
77
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
@@ -12,12 +12,6 @@ SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
1212
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
1313
SymbolicIndexingInterface = "2efcf032-c050-4f8e-a9bb-153293bab1f5"
1414

15-
[weakdeps]
16-
JuliaSimModelOptimizer = "e76a656c-db09-4a9a-8f5e-6a4d9ca4a950"
17-
18-
[extensions]
19-
ModelTestingCalibration = "JuliaSimModelOptimizer"
20-
2115
[compat]
2216
julia = "1.10"
2317
SymbolicIndexingInterface = "^0.3.15"
@@ -28,4 +22,4 @@ ModelingToolkitStandardLibrary = "16a59e39-deab-5bd0-87e4-056b12336739"
2822
DifferentialEquations = "0c46a032-eb83-5123-abaf-570d42b7fbaa"
2923

3024
[targets]
31-
test = ["Test", "JuliaSimModelOptimizer", "ModelingToolkitStandardLibrary", "DifferentialEquations"]
25+
test = ["Test", "ModelingToolkitStandardLibrary", "DifferentialEquations"]

src/problem_config/problem.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module ProblemHelpers
22
import SciMLBase
3-
using DataFrame
3+
using DataFrames
44
# some thin wrappers over remake
55
initial_condition(prob::SciMLBase.AbstractDEProblem, u0) = remake(prob, u0 = u0)
66
tspan(prob::SciMLBase.AbstractDEProblem, tspan) = remake(prob, tspan = tspan)

src/test/measured.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ end
3232
end
3333

3434
function Measurement(sensor; name)
35-
@assert length(sensor.states) == 1 "The Measurement helper requires that the measurement component have only one scalar-valued state"
35+
@assert length(variable_symbols(sensor)) == 1 "The Measurement helper requires that the measurement component have only one scalar-valued state"
3636
@variables t value(t) [measured = true]
3737
return ODESystem([
3838
value ~ first(sensor.states)

test/block_modeling.jl

Lines changed: 3 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
using ModelingToolkitStandardLibrary.Electrical
22
using ModelingToolkitStandardLibrary.Blocks: Constant
3-
3+
using SymbolicIndexingInterface
44
@testset "Block Modeling" begin
5-
@testset "RC Explicit" begin
5+
@testset "RC Functional" begin
66
R = 1.0
77
C = 1.0
88
V = 1.0
@@ -23,42 +23,6 @@ using ModelingToolkitStandardLibrary.Blocks: Constant
2323
connect(sensor.p, capacitor.p)
2424
sensor.phi ~ key_parameter.value]
2525

26-
@named rc_model = ODESystem(rc_eqs, t,
27-
systems = [resistor, capacitor, constant, source, ground, sensor, key_parameter])
28-
sys = structural_simplify(rc_model)
29-
prob1 = ODEProblem(sys, Pair[], (0, 10.0))
30-
sol1 = solve(prob1, Tsit5())
31-
prob2 = ODEProblem(sys, Pair[capacitor.C => 0.9], (0, 10.0))
32-
sol2 = solve(prob2, Tsit5())
33-
prob3 = ODEProblem(sys, Pair[capacitor.C => 5.0], (0, 10.0))
34-
sol3 = solve(prob3, Tsit5())
35-
36-
d1 = discretize_solution(sol1, sol1)
37-
d2 = discretize_solution(sol2, sol1)
38-
d3 = discretize_solution(sol3, sol1)
39-
results_good = compare_discrete(sys, d1, d2)
40-
results_bad = compare_discrete(sys, d1, d3)
41-
end
42-
@testset "RC Functional" begin
43-
R = 1.0
44-
C = 1.0
45-
V = 1.0
46-
@variables t
47-
@named resistor = Resistor(R = R)
48-
@named capacitor = Capacitor(C = C)
49-
@named source = Voltage()
50-
@named constant = Constant(k = V)
51-
@named ground = Ground()
52-
53-
@named sensor = PotentialSensor()
54-
@named key_parameter = Measurement(sensor)
55-
56-
rc_eqs = [connect(constant.output, source.V)
57-
connect(source.p, resistor.p)
58-
connect(resistor.n, capacitor.p)
59-
connect(capacitor.n, source.n, ground.g)
60-
connect(sensor.p, capacitor.p)]
61-
6226
@named rc_model = ODESystem(rc_eqs, t,
6327
systems = [resistor, capacitor, constant, source, ground, sensor, key_parameter])
6428
sys = structural_simplify(rc_model)
@@ -78,7 +42,7 @@ using ModelingToolkitStandardLibrary.Blocks: Constant
7842

7943
d1 = discretize_solution(sol1, sol1)
8044

81-
ds1 = discretize_solution(sol1, sol1; measured=states(sys))
45+
ds1 = discretize_solution(sol1, sol1; measured=SymbolicIndexingInterface.all_variable_symbols(sys))
8246
println(compare(sol3, ds1))
8347
println(compare(sol2, ds1))
8448
println(compare(sol1, ds1))

test/instantaneous.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
@named ground = Ground()
1212

1313
@named sensor = PotentialSensor()
14-
@named key_parameter = Measurement(sensor)
1514

1615
rc_eqs = [connect(constant.output, source.V)
1716
connect(source.p, resistor.p)
@@ -20,7 +19,7 @@
2019
connect(sensor.p, capacitor.p)]
2120

2221
@named rc_model = ODESystem(rc_eqs, t,
23-
systems = [resistor, capacitor, constant, source, ground, sensor, key_parameter])
22+
systems = [resistor, capacitor, constant, source, ground, sensor])
2423
sys = structural_simplify(rc_model)
2524
@test test_instantaneous(sys, [], [resistor.v]; t = 0.0)[1] > 0
2625
@test test_instantaneous(sys, [], [resistor.i]; t = 0.0)[1] > 0

test/runtests.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
using JuliaSimModelOptimizer
1+
#using JuliaSimModelOptimizer
22
using ModelTesting
33
using DifferentialEquations, DataFrames, ModelingToolkit
44
import SymbolicIndexingInterface
55
using Test
66

77
@testset "ModelTesting.jl" begin
8-
include("timeseries.jl")
8+
#include("timeseries.jl")
99
include("block_modeling.jl")
1010
include("instantaneous.jl")
1111
end

0 commit comments

Comments
 (0)