Skip to content

Commit 89c3992

Browse files
committed
change usage of some packages
1 parent 2e7b5cf commit 89c3992

4 files changed

Lines changed: 30 additions & 34 deletions

File tree

Project.toml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ uuid = "cb905087-75eb-5f27-8515-1ce0ec8e839e"
44
version = "0.12.2"
55

66
[deps]
7-
DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e"
87
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
98
DifferentialEquations = "0c46a032-eb83-5123-abaf-570d42b7fbaa"
109
FiniteDiff = "6a86dc24-6348-571c-b903-95158fe2bd41"
@@ -21,17 +20,15 @@ StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
2120
Sundials = "c3572dad-4567-51f8-b174-8c6c989267f4"
2221
TimerOutputs = "a759f4b9-e2f1-59dc-863e-4aeb61b1ea8f"
2322
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"
23+
SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
2424
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
25-
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
2625
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
2726
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
28-
OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8"
29-
3027

3128
[compat]
32-
DiffEqBase = "6"
3329
DataFrames = "1"
3430
DifferentialEquations = "7"
31+
SciMLBase = "2"
3532
FiniteDiff = "2"
3633
ForwardDiff = "1"
3734
JSON = "1"
@@ -46,12 +43,14 @@ StaticArrays = "1"
4643
Sundials = "5"
4744
TimerOutputs = "0.5"
4845
Unitful = "1"
49-
Test = "1"
50-
InteractiveUtils = "1"
46+
CPUSummary = "0.2"
5147
LinearAlgebra = "1"
5248
Printf = "1"
53-
OrdinaryDiffEqCore = "3.0 - 3.99"
5449
julia = "1.10"
5550

51+
5652
[extras]
5753
CPUSummary = "2a0fbf3d-bb9c-48f3-b0a9-814d99fd7ab9"
54+
55+
[targets]
56+
test = ["Test", "CPUSummary"]

examples/CauerLowPassFilter.jl

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
module CauerLowPassFilterModel
22

33
using Modia
4-
using Test
54
@usingModiaPlot
65

76
include("$(Modia.modelsPath)/Electric.jl")
@@ -17,11 +16,11 @@ c5 = 0.7262*1u"F"
1716
CauerLowPassOPVWithoutNodes(i=1) = Model(
1817
# Cauer low pass filter with operational amplifiers
1918

20-
C1 = Capacitor | Map(C=c1 + c2),
19+
C1 = Capacitor | Map(C=c1 + c2),
2120
C2 = Capacitor | Map(C=c2, v=Var(init=nothing)),
22-
C3 = Capacitor | Map(C=l1*1u"F"),
21+
C3 = Capacitor | Map(C=l1*1u"F"),
2322
C4 = Capacitor | Map(C=c4*i, v=Var(init=nothing)),
24-
C5 = Capacitor | Map(C=c2, v=Var(init=nothing)),
23+
C5 = Capacitor | Map(C=c2, v=Var(init=nothing)),
2524
R1 = Resistor | Map(R=1u"Ω"),
2625
R2 = Resistor | Map(R=1u"Ω"),
2726
R3 = Resistor | Map(R=1u"Ω"),
@@ -40,9 +39,9 @@ CauerLowPassOPVWithoutNodes(i=1) = Model(
4039
R10 = Resistor | Map(R=1u"Ω"),
4140
Op4 = IdealOpAmp3Pin,
4241
Op5 = IdealOpAmp3Pin,
43-
C7 = Capacitor | Map(C=l2*1u"F"),
44-
C8 = Capacitor | Map(C=c4, i=Var(start=0u"A")),
45-
C9 = Capacitor | Map(C=c4 + c5),
42+
C7 = Capacitor | Map(C=l2*1u"F"),
43+
C8 = Capacitor | Map(C=c4, i=Var(start=0u"A")),
44+
C9 = Capacitor | Map(C=c4 + c5),
4645
R11 = Resistor | Map(R=1u"Ω"),
4746

4847
G2 = Ground,
@@ -51,23 +50,23 @@ CauerLowPassOPVWithoutNodes(i=1) = Model(
5150
V = ConstantVoltage | Map(V=1.0u"V"),
5251
Ground1 = Ground,
5352

54-
connect = :[
55-
(Op1.in_p, G.p)
56-
(G1.p, Op2.in_p)
57-
(R1.n, Op1.in_n, C2.n, R2.n, C1.p, R3.p)
58-
(R3.n, C1.n, Op1.out, R4.p, C5.p)
59-
(R4.n, Op2.in_n, C3.p, R5.n)
60-
(C2.p, R5.p, Op3.out, C6.n, R9.p, C8.p)
53+
connect = :[
54+
(Op1.in_p, G.p)
55+
(G1.p, Op2.in_p)
56+
(R1.n, Op1.in_n, C2.n, R2.n, C1.p, R3.p)
57+
(R3.n, C1.n, Op1.out, R4.p, C5.p)
58+
(R4.n, Op2.in_n, C3.p, R5.n)
59+
(C2.p, R5.p, Op3.out, C6.n, R9.p, C8.p)
6160
(C3.n, Op2.out, R2.p, R7.p)
62-
(R7.n, Op3.in_n, C5.n, R6.n, C6.p, C4.n)
61+
(R7.n, Op3.in_n, C5.n, R6.n, C6.p, C4.n)
6362
(C4.p, R8.p, R11.n, C9.n, Op5.out)
64-
(R9.n, R8.n, Op4.in_n, C7.p)
63+
(R9.n, R8.n, Op4.in_n, C7.p)
6564
(R6.p, C7.n, Op4.out, R10.p)
66-
(G2.p, Op3.in_p)
67-
(R11.p, C9.p, R10.n, Op5.in_n, C8.n)
68-
(Op4.in_p, G3.p)
69-
(Op5.in_p, G4.p)
70-
(V.p, Ground1.p)
65+
(G2.p, Op3.in_p)
66+
(R11.p, C9.p, R10.n, Op5.in_n, C8.n)
67+
(Op4.in_p, G3.p)
68+
(Op5.in_p, G4.p)
69+
(V.p, Ground1.p)
7170
(V.n, R1.p) ]
7271
)
7372

@@ -82,7 +81,7 @@ println("Build array of $n Cauer low pass filters")
8281
model = @instantiateModel(Filters, logDetails=false, logTiming=true, unitless=true)
8382
8483
println("Simulate")
85-
@time simulate!(model, Tsit5(), stopTime = 60, requiredFinalStates =
84+
@time simulate!(model, Tsit5(), stopTime = 60, requiredFinalStates =
8685
[-0.5000732186007855, -0.5002239998029879, 0.4996923410661849, -0.4996706636198064, -0.5000929741546876, -0.5001255383344897, -0.500147742207576, 0.49981113006573824, -0.4996196061432069, -0.5001392063603706, -0.5001815616147427, -0.5000459266587362, 0.49996685095395915, -0.49958392015463465, -0.5001886259176451, -0.5002389821958331, -0.4999173001411904, 0.5001611780149184, -0.49957016523210945, -0.5002393712119582, -0.5002944833191254, -0.49976183273648583, 0.5003940588092074, -0.49958591550449066, -0.5002887040151874, -0.500343478728503, -0.4995812991530469, 0.5006629055320556, -0.49963969356758026, -0.5003327561376948, -0.50037980690654, -0.49938004306850625, 0.5009615326279456, -0.4997407922705924, -0.5003662177501006, -0.500395375828166, -0.4991659724894459, 0.5012787730322307, -0.4998989295998676, -0.5003819572251011, -0.5003797586125351, -0.49895184523346914, 0.5015966895590688, -0.5001236602409048, -0.5003705619890064, -0.5003197458974357, -0.49875691633150787, 0.5018882791340892, -0.5004234377294563, -0.5003197904255381])
8786
plot(model, ["filters_1.C9.v", "filters_2.C9.v", "filters_3.C9.v"])
8887
end

src/CodeGeneration.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33

44
using OrderedCollections: OrderedDict, OrderedSet
55
using DataFrames
6-
using OrdinaryDiffEqCore
7-
6+
using SciMLBase
87
#=
98
fieldnames(typeof(integrator)) = (:sol, :u, :du, :k, :t, :dt, :f, :p, :uprev, :uprev2, :duprev, :tprev, :alg,
109
:dtcache, :dtchangeable, :dtpropose, :tdir, :eigen_est, :EEst, :qold, :q11,
@@ -1523,7 +1522,7 @@ function affectEvent!(integrator, stateEvent::Bool, eventIndex::Int)::Nothing
15231522
end
15241523

15251524
# Adapt step size
1526-
if eh.restart != NoRestart && supertype(typeof(integrator.alg)) == OrdinaryDiffEqCore.OrdinaryDiffEqAdaptiveAlgorithm
1525+
if eh.restart != NoRestart && SciMLBase.isadaptive(integrator)
15271526
DifferentialEquations.auto_dt_reset!(integrator)
15281527
DifferentialEquations.set_proposed_dt!(integrator, integrator.dt)
15291528
end

src/Modia.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,6 @@ using JSON
147147
#using Profile
148148
import Test
149149
using TimerOutputs
150-
using InteractiveUtils
151150

152151
global to = TimerOutput()
153152

0 commit comments

Comments
 (0)