Skip to content

Commit 78d4200

Browse files
committed
Implement hash for AnalysisPoint
1 parent 9a47c71 commit 78d4200

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

docs/src/tutorials/custom_component.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ function NonlinearResistor(; name, Ga, Gb, Ve)
4343
pars = @parameters Ga=Ga Gb=Gb Ve=Ve
4444
eqs = [
4545
i ~ ifelse(v < -Ve,
46-
Gb * (v + Ve) - Ga * Ve,
47-
ifelse(v > Ve,
48-
Gb * (v - Ve) + Ga * Ve,
49-
Ga * v))
46+
Gb * (v + Ve) - Ga * Ve,
47+
ifelse(v > Ve,
48+
Gb * (v - Ve) + Ga * Ve,
49+
Ga * v))
5050
]
5151
extend(ODESystem(eqs, t, [], pars; name = name), oneport)
5252
end

src/Blocks/analysis_points.jl

+6
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ if Base.isdefined(ModelingToolkit, :isconnection)
1010
end
1111

1212
Base.nameof(ap::AnalysisPoint) = ap.name
13+
function Base.hash(ap::AnalysisPoint, seed::UInt)
14+
h1 = hash(ap.in, seed)
15+
h2 = hash(ap.out, h1)
16+
h3 = hash(ap.name, h2)
17+
h3 (0xd29cdc51aa6562d4 % UInt)
18+
end
1319

1420
function ap_var(sys)
1521
if hasproperty(sys, :u)

0 commit comments

Comments
 (0)