Skip to content

Commit ff2a4e2

Browse files
authored
Merge pull request #165 from ModiaSim/release0.10.0
Release0.10.0
2 parents ab99c83 + 863b13d commit ff2a4e2

15 files changed

+375
-113
lines changed

.github/workflows/test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
fail-fast: false
1515
matrix:
1616
version:
17-
- '1.8.1'
17+
- '1.8.5'
1818
os:
1919
- ubuntu-latest
2020
- windows-latest

Manifest.toml

+34-34
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,18 @@ version = "0.1.29"
3939

4040
[[deps.ArrayLayouts]]
4141
deps = ["FillArrays", "LinearAlgebra", "SparseArrays"]
42-
git-tree-sha1 = "4aff5fa660eb95c2e0deb6bcdabe4d9a96bc4667"
42+
git-tree-sha1 = "4efc22e4c299e49995a38d503d9dbb0544a37838"
4343
uuid = "4c555306-a7a7-4459-81d9-ec55ddd5c99a"
44-
version = "0.8.18"
44+
version = "1.0.4"
4545

4646
[[deps.Artifacts]]
4747
uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"
4848

4949
[[deps.BandedMatrices]]
50-
deps = ["ArrayLayouts", "FillArrays", "LinearAlgebra", "SnoopPrecompile", "SparseArrays"]
51-
git-tree-sha1 = "6ef8fc1d77b60f41041d59ce61ef9eb41ed97a83"
50+
deps = ["ArrayLayouts", "FillArrays", "LinearAlgebra", "PrecompileTools", "SparseArrays"]
51+
git-tree-sha1 = "b18febf0a34ba9192fdcd4fd2c57b535a48d3dd4"
5252
uuid = "aae01518-5342-5314-be14-df237901396f"
53-
version = "0.17.18"
53+
version = "0.17.24"
5454

5555
[[deps.Base64]]
5656
uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
@@ -73,10 +73,10 @@ uuid = "fa961155-64e5-5f13-b03f-caf6b980ea82"
7373
version = "0.4.2"
7474

7575
[[deps.CPUSummary]]
76-
deps = ["CpuId", "IfElse", "Static"]
77-
git-tree-sha1 = "2c144ddb46b552f72d7eafe7cc2f50746e41ea21"
76+
deps = ["CpuId", "IfElse", "PrecompileTools", "Static"]
77+
git-tree-sha1 = "89e0654ed8c7aebad6d5ad235d6242c2d737a928"
7878
uuid = "2a0fbf3d-bb9c-48f3-b0a9-814d99fd7ab9"
79-
version = "0.2.2"
79+
version = "0.2.3"
8080

8181
[[deps.Calculus]]
8282
deps = ["LinearAlgebra"]
@@ -227,9 +227,9 @@ uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b"
227227

228228
[[deps.Distributions]]
229229
deps = ["ChainRulesCore", "DensityInterface", "FillArrays", "LinearAlgebra", "PDMats", "Printf", "QuadGK", "Random", "SparseArrays", "SpecialFunctions", "Statistics", "StatsAPI", "StatsBase", "StatsFuns", "Test"]
230-
git-tree-sha1 = "5eeb2bd01e5065090ad591a205d8cad432ae6cb6"
230+
git-tree-sha1 = "c72970914c8a21b36bbc244e9df0ed1834a0360b"
231231
uuid = "31c24e10-a181-5473-b8eb-7969acd0382f"
232-
version = "0.25.93"
232+
version = "0.25.95"
233233

234234
[[deps.DocStringExtensions]]
235235
deps = ["LibGit2"]
@@ -286,15 +286,15 @@ uuid = "7b1f6079-737a-58dc-b8bc-7a2ca5c1b5ee"
286286

287287
[[deps.FillArrays]]
288288
deps = ["LinearAlgebra", "Random", "SparseArrays", "Statistics"]
289-
git-tree-sha1 = "7072f1e3e5a8be51d525d64f63d3ec1287ff2790"
289+
git-tree-sha1 = "ed569cb9e7e3590d5ba884da7edc50216aac5811"
290290
uuid = "1a297f60-69ca-5386-bcde-b61e274b549b"
291-
version = "0.13.11"
291+
version = "1.1.0"
292292

293293
[[deps.FiniteDiff]]
294294
deps = ["ArrayInterface", "LinearAlgebra", "Requires", "Setfield", "SparseArrays", "StaticArrays"]
295-
git-tree-sha1 = "6604e18a0220650dbbea7854938768f15955dd8e"
295+
git-tree-sha1 = "abfd952bdf92f6d7195c45dc46d50043bd0d7dbe"
296296
uuid = "6a86dc24-6348-571c-b903-95158fe2bd41"
297-
version = "2.20.0"
297+
version = "2.21.0"
298298

299299
[[deps.Formatting]]
300300
deps = ["Printf"]
@@ -325,9 +325,9 @@ uuid = "9fa8497b-333b-5362-9e8d-4d0656e87820"
325325

326326
[[deps.GPUArraysCore]]
327327
deps = ["Adapt"]
328-
git-tree-sha1 = "1cd7f0af1aa58abc02ea1d872953a97359cb87fa"
328+
git-tree-sha1 = "2d6ca471a6c7b536127afccfa7564b5b39227fe0"
329329
uuid = "46192b85-c4d5-4398-a991-12ede77f4527"
330-
version = "0.1.4"
330+
version = "0.1.5"
331331

332332
[[deps.GenericSchur]]
333333
deps = ["LinearAlgebra", "Printf"]
@@ -630,10 +630,10 @@ uuid = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
630630
version = "1.6.0"
631631

632632
[[deps.OrdinaryDiffEq]]
633-
deps = ["Adapt", "ArrayInterface", "DataStructures", "DiffEqBase", "DocStringExtensions", "ExponentialUtilities", "FastBroadcast", "FastClosures", "FiniteDiff", "ForwardDiff", "FunctionWrappersWrappers", "IfElse", "LineSearches", "LinearAlgebra", "LinearSolve", "Logging", "LoopVectorization", "MacroTools", "MuladdMacro", "NLsolve", "NonlinearSolve", "Polyester", "PreallocationTools", "PrecompileTools", "Preferences", "RecursiveArrayTools", "Reexport", "SciMLBase", "SciMLNLSolve", "SimpleNonlinearSolve", "SimpleUnPack", "SparseArrays", "SparseDiffTools", "StaticArrayInterface", "StaticArrays", "TruncatedStacktraces"]
634-
git-tree-sha1 = "6ffebfa8971546bace3fc312f9a703795f79f5b9"
633+
deps = ["ADTypes", "Adapt", "ArrayInterface", "DataStructures", "DiffEqBase", "DocStringExtensions", "ExponentialUtilities", "FastBroadcast", "FastClosures", "FiniteDiff", "ForwardDiff", "FunctionWrappersWrappers", "IfElse", "LineSearches", "LinearAlgebra", "LinearSolve", "Logging", "LoopVectorization", "MacroTools", "MuladdMacro", "NLsolve", "NonlinearSolve", "Polyester", "PreallocationTools", "PrecompileTools", "Preferences", "RecursiveArrayTools", "Reexport", "SciMLBase", "SciMLNLSolve", "SciMLOperators", "SimpleNonlinearSolve", "SimpleUnPack", "SparseArrays", "SparseDiffTools", "StaticArrayInterface", "StaticArrays", "TruncatedStacktraces"]
634+
git-tree-sha1 = "7f758238ce4202ced5e08aa2903d19d3a4f0dd7c"
635635
uuid = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
636-
version = "6.51.2"
636+
version = "6.52.0"
637637

638638
[[deps.PDMats]]
639639
deps = ["LinearAlgebra", "SparseArrays", "SuiteSparse"]
@@ -791,9 +791,9 @@ version = "0.4.0+0"
791791

792792
[[deps.RuntimeGeneratedFunctions]]
793793
deps = ["ExprTools", "SHA", "Serialization"]
794-
git-tree-sha1 = "d7d9ebe28062161c1e314ed643097b0c6fe657d9"
794+
git-tree-sha1 = "92fa1dd437690a5e2ac39c81b6353ef106affc0e"
795795
uuid = "7e49a35a-f44a-4d26-94aa-eba1b4ca6b47"
796-
version = "0.5.7"
796+
version = "0.5.8"
797797

798798
[[deps.SHA]]
799799
uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce"
@@ -824,9 +824,9 @@ version = "0.1.6"
824824

825825
[[deps.SciMLOperators]]
826826
deps = ["ArrayInterface", "DocStringExtensions", "Lazy", "LinearAlgebra", "Setfield", "SparseArrays", "StaticArraysCore", "Tricks"]
827-
git-tree-sha1 = "90163ebc767cba9f126ea00aeef1d75ed74fe7b0"
827+
git-tree-sha1 = "d9f0f6ce9bb899a657c4d218a846533910e9dea9"
828828
uuid = "c0aeaf25-5076-4817-a8d5-81caf7dfa961"
829-
version = "0.2.8"
829+
version = "0.2.9"
830830

831831
[[deps.SentinelArrays]]
832832
deps = ["Dates", "Random"]
@@ -854,10 +854,10 @@ uuid = "3201582d-3078-4276-ba5d-0a1254d79d7c"
854854
version = "0.4.2"
855855

856856
[[deps.SimpleNonlinearSolve]]
857-
deps = ["ArrayInterface", "DiffEqBase", "FiniteDiff", "ForwardDiff", "LinearAlgebra", "Reexport", "Requires", "SciMLBase", "SnoopPrecompile", "StaticArraysCore"]
858-
git-tree-sha1 = "54c78ac3cc0343a16785adabe5bbf4063c737967"
857+
deps = ["ArrayInterface", "DiffEqBase", "FiniteDiff", "ForwardDiff", "LinearAlgebra", "PrecompileTools", "Reexport", "Requires", "SciMLBase", "StaticArraysCore"]
858+
git-tree-sha1 = "7c55a3e65aad4ce6e610409cdd564b8d590b9726"
859859
uuid = "727e6d20-b764-4bd8-a329-72de5adea6c7"
860-
version = "0.1.14"
860+
version = "0.1.15"
861861

862862
[[deps.SimpleTraits]]
863863
deps = ["InteractiveUtils", "MacroTools"]
@@ -890,10 +890,10 @@ deps = ["LinearAlgebra", "Random"]
890890
uuid = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
891891

892892
[[deps.SparseDiffTools]]
893-
deps = ["Adapt", "ArrayInterface", "Compat", "DataStructures", "FiniteDiff", "ForwardDiff", "Graphs", "LinearAlgebra", "Requires", "SparseArrays", "StaticArrays", "VertexSafeGraphs"]
894-
git-tree-sha1 = "e19ac47477c9a8fcca06dab5e5471417d5d9d723"
893+
deps = ["ADTypes", "Adapt", "ArrayInterface", "Compat", "DataStructures", "FiniteDiff", "ForwardDiff", "Graphs", "LinearAlgebra", "Reexport", "Requires", "SciMLOperators", "SparseArrays", "StaticArrayInterface", "StaticArrays", "Tricks", "VertexSafeGraphs"]
894+
git-tree-sha1 = "04f060e66a61a909ed59efd79f64943688d7568d"
895895
uuid = "47a9eef4-7e08-11e9-0b38-333d64bd3804"
896-
version = "1.31.0"
896+
version = "2.3.0"
897897

898898
[[deps.Sparspak]]
899899
deps = ["Libdl", "LinearAlgebra", "Logging", "OffsetArrays", "Printf", "SparseArrays", "Test"]
@@ -959,10 +959,10 @@ uuid = "9672c7b4-1e72-59bd-8a11-6ac3964bc41f"
959959
version = "1.15.0"
960960

961961
[[deps.StochasticDiffEq]]
962-
deps = ["Adapt", "ArrayInterface", "DataStructures", "DiffEqBase", "DiffEqNoiseProcess", "DocStringExtensions", "FillArrays", "FiniteDiff", "ForwardDiff", "JumpProcesses", "LevyArea", "LinearAlgebra", "Logging", "MuladdMacro", "NLsolve", "OrdinaryDiffEq", "Random", "RandomNumbers", "RecursiveArrayTools", "Reexport", "SciMLBase", "SparseArrays", "SparseDiffTools", "StaticArrays", "UnPack"]
963-
git-tree-sha1 = "073da86200349ddf4ef8bc3e3f3acd62e1d554f7"
962+
deps = ["Adapt", "ArrayInterface", "DataStructures", "DiffEqBase", "DiffEqNoiseProcess", "DocStringExtensions", "FillArrays", "FiniteDiff", "ForwardDiff", "JumpProcesses", "LevyArea", "LinearAlgebra", "Logging", "MuladdMacro", "NLsolve", "OrdinaryDiffEq", "Random", "RandomNumbers", "RecursiveArrayTools", "Reexport", "SciMLBase", "SciMLOperators", "SparseArrays", "SparseDiffTools", "StaticArrays", "UnPack"]
963+
git-tree-sha1 = "619c846726548b7b2e8728b72f288acf10390121"
964964
uuid = "789caeaf-c7a9-5a7d-9973-96adeb23e2a0"
965-
version = "6.60.0"
965+
version = "6.61.0"
966966

967967
[[deps.StrideArraysCore]]
968968
deps = ["ArrayInterface", "CloseOpenIntervals", "IfElse", "LayoutPointers", "ManualMemory", "SIMDTypes", "Static", "StaticArrayInterface", "ThreadingUtilities"]
@@ -986,9 +986,9 @@ version = "5.10.1+0"
986986

987987
[[deps.Sundials]]
988988
deps = ["CEnum", "DataStructures", "DiffEqBase", "Libdl", "LinearAlgebra", "Logging", "PrecompileTools", "Reexport", "SciMLBase", "SparseArrays", "Sundials_jll"]
989-
git-tree-sha1 = "4289695031d663252f38fd114d3e0020d1461cee"
989+
git-tree-sha1 = "a982ee85e1908d39f58d7fff670e60f991ca2ddb"
990990
uuid = "c3572dad-4567-51f8-b174-8c6c989267f4"
991-
version = "4.18.0"
991+
version = "4.19.0"
992992

993993
[[deps.Sundials_jll]]
994994
deps = ["Artifacts", "CompilerSupportLibraries_jll", "JLLWrappers", "Libdl", "OpenBLAS_jll", "Pkg", "SuiteSparse_jll"]

Project.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
authors = ["Hilding Elmqvist <[email protected]>", "Martin Otter <[email protected]>"]
22
name = "Modia"
33
uuid = "cb905087-75eb-5f27-8515-1ce0ec8e839e"
4-
version = "0.9.4"
4+
version = "0.10.0"
55

66
[deps]
77
DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e"

docs/src/index.md

+17
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,23 @@ functionalities of these packages.
4242

4343
## Release Notes
4444

45+
### Version 0.10.0
46+
47+
- Initial support of segmented simulations where the number of states can change during simulation.
48+
For examples, see `Modia/test/TestHeatTransfer2.jl` and models in directory `Modia3D/test/Segmented`
49+
(of release 0.12.0 and later). The tutorial will be updated for this feature in an upcoming version.
50+
51+
52+
**Non-backwards** compatible changes
53+
54+
These changes should usually not influence user models.
55+
56+
- `_buildFunction = <functionName>` changed to `_buildFunction = Par(functionName = <functionName>)` and
57+
changed argument list of `<functionName>`.
58+
- `_instantiateFunction = Par(..)` changed to `_initSegmentFunction = Par(functionName = <functionName>)`
59+
and changed argument list of `<functionName>`.
60+
61+
4562
### Version 0.9.4
4663

4764
- Precompile statements included (compilation of Modia package takes more time, but startup of Modia model simulations is faster).

models/HeatTransfer.jl

+36
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,40 @@ InsulatedRod = Model(
7070
]
7171
)
7272

73+
74+
include("HeatTransfer/InsulatedRod2.jl")
75+
76+
"""
77+
insulatedRod = InsulatedRod2(; L, A, rho=7500.0u"kg/m^3", lambda=74.0u"W/(m*K)", c=450.0u"J/(kg*K), T0=293.15u"K", nT=1")
7378
79+
Generate a Model(..) instance of an insulated rod with length `L` and cross sectional area `A` that
80+
models 1D heat transfer from port_a to port_b. The rod is discretized with `nT` internal temperature nodes that are initialized with `T0`.
81+
This is an acausal built-in component where the code size does not depend on `nT` and
82+
`nT` can still be changed after model code is generated and compiled.
83+
84+
For more details see Appendix B1 of [DOI: 10.3390/electronics12030500](https://doi.org/10.3390/electronics12030500).
85+
86+
# Optional Arguments:
87+
- `rho`: density of rod material
88+
- `lambda`: thermal conductivity of rod material
89+
- `c`: specific heat capacity of rod material
90+
- `T0`: initial temperature of internal temperature nodes
91+
- `nT`: number of temperature nodes (`nT > 0`).
92+
93+
# Internal variables that can be inquired/plotted:
94+
- `T`: Vector of temperatures at the internal temperature nodes
95+
- `der(T)': Vector of derivatives of `T`.
96+
"""
97+
InsulatedRod2 = Model(;
98+
_buildFunction = Par(functionName = :(build_InsulatedRod2!)), # Called once in @instantiateModel(..) before getDerivatives!(..) is generated
99+
_initSegmentFunction = Par(functionName = :(initSegment_InsulatedRod2!)), # Called once before initialization of a new simulation segment
100+
L = 1.0u"m", # Length of rod
101+
A = 0.0004u"m^2", # Rod area
102+
rho = 7500.0u"kg/m^3", # Density of rod material
103+
lambda = 74.0u"W/(m*K)", # Thermal conductivity of rod material
104+
c = 450.0u"J/(kg*K)", # Specific heat capacity of rod material
105+
T0 = 293.15u"K", # Initial temperature of internal temperature nodes
106+
nT = 1, # Number of temperature nodes (nT > 0).
107+
port_a = HeatPort, # heat port on left side
108+
port_b = HeatPort # heat port on right side
109+
)

models/HeatTransfer/InsulatedRod2.jl

+131
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
# License for this file: MIT (expat)
2+
# Copyright 2023, DLR Institute of System Dynamics and Control
3+
#
4+
# This file is included in Modia/models/HeatTranser.jl
5+
6+
7+
# Structure holding the internal memory of the insulated rod
8+
mutable struct InsulatedRodStruct{FloatType}
9+
# Parameters
10+
Ge::FloatType # = lambda*A/dx
11+
Ge2::FloatType # = 2*Ge
12+
k::FloatType # = Ge / (c*rho*A*dx)
13+
T_init::Vector{FloatType} # initial states
14+
15+
# Internal states and state deriatives
16+
T::Vector{FloatType} # states
17+
der_T::Vector{FloatType} # state derivatives
18+
19+
# Start index of state and state derivative vectors
20+
T_startIndex::Int
21+
22+
InsulatedRodStruct{FloatType}() where {FloatType} = new()
23+
end
24+
25+
26+
# Called from @instantiateModel(..) before getDerivatives!(..) is generated
27+
function build_InsulatedRod2!(model::AbstractDict, FloatType, TimeType, unitless::Bool, ID, pathAST)
28+
model = model | Model(
29+
insRod = Var(hideResult=true), # InsulatedRodStruct instance (an equation to return this variable is generated by _buildFunction)
30+
success = Var(hideResult=true), # Dummy return argument
31+
equations = :[
32+
# copy states into insRod.T and return insRod
33+
insRod = openInsulatedRod!(instantiatedModel, $ID)
34+
35+
# equations at the boundaries
36+
port_a.Q_flow = getGe2(insRod, Val($unitless))*(port_a.T - getT1( insRod, Val($unitless)))
37+
port_b.Q_flow = getGe2(insRod, Val($unitless))*(port_b.T - getTend(insRod, Val($unitless)))
38+
39+
# compute insRod.der_T and copy it into state derivatives
40+
success = computeInsulatedRodDerivatives!(instantiatedModel, insRod, port_a.T, port_b.T) # instantiatedModel is provided in the generated code
41+
])
42+
43+
return (model, InsulatedRodStruct{FloatType}())
44+
end
45+
46+
47+
# Called once before initialization of first simulation segment
48+
function initFirstSegment_InsulatedRod2!(obj::InsulatedRodStruct{FloatType}; L, A, rho, lambda, c, T0, nT)::Nothing where {FloatType}
49+
# Convert to SI units, strip units and check that values are positives
50+
#=
51+
@show L
52+
@Modia.strippedPositive!(path, L)
53+
@Modia.strippedPositive!(path, A)
54+
@Modia.strippedPositive!(path, rho)
55+
@Modia.strippedPositive!(path, lambda)
56+
@Modia.strippedPositive!(path, c)
57+
@Modia.strippedPositive!(path, T0)
58+
@Modia.strippedPositive!(path, nT)
59+
@show L
60+
@show A
61+
@show rho
62+
@show lambda
63+
=#
64+
L = stripUnit(L)
65+
A = stripUnit(A)
66+
rho = stripUnit(rho)
67+
lambda = stripUnit(lambda)
68+
c = stripUnit(c)
69+
T0 = stripUnit(T0)
70+
71+
# Compute derived parameters
72+
dx = L/nT
73+
obj.Ge = lambda*A/dx
74+
obj.Ge2 = 2*obj.Ge
75+
obj.k = obj.Ge / ( c*rho*A*dx )
76+
obj.T_init = fill(T0, nT)
77+
78+
# Allocate and initialize internal states
79+
obj.T = copy(obj.T_init)
80+
obj.der_T = zeros(nT)
81+
return nothing
82+
end
83+
84+
85+
# Called once before initialization of a new simulation segment
86+
function initSegment_InsulatedRod2!(instantiatedModel::SimulationModel{FloatType,TimeType}, path::String, ID,
87+
parameters::AbstractDict; log=false)::Nothing where {FloatType,TimeType}
88+
obj::InsulatedRodStruct{FloatType} = Modia.get_instantiatedSubmodel(instantiatedModel, ID)
89+
90+
if Modia.isFirstInitialOfAllSegments(instantiatedModel)
91+
initFirstSegment_InsulatedRod2!(obj; parameters...)
92+
end
93+
94+
# Define a vector of new state and state derivative variables
95+
obj.T_startIndex = Modia.new_x_segmented_variable!(instantiatedModel, path*".T", path*".der(T)", obj.T, "K")
96+
return nothing
97+
end
98+
99+
100+
# Open an initialized InsulatedRod2 model and return a reference to it
101+
function openInsulatedRod!(instantiatedModel::SimulationModel{FloatType,TimeType}, ID)::InsulatedRodStruct{FloatType} where {FloatType,TimeType}
102+
obj::InsulatedRodStruct{FloatType} = Modia.get_instantiatedSubmodel(instantiatedModel, ID)
103+
Modia.get_Vector_x_segmented_value!(instantiatedModel, obj.T_startIndex, obj.T)
104+
return obj
105+
end
106+
107+
108+
# Functions to inquire values from InsulatedRodStruct
109+
getT1( insRod::InsulatedRodStruct, Unitless::Val{true}) = insRod.T[1]
110+
getT1( insRod::InsulatedRodStruct, Unitless::Val{false}) = insRod.T[1]*u"K"
111+
112+
getTend(insRod::InsulatedRodStruct, Unitless::Val{true}) = insRod.T[end]
113+
getTend(insRod::InsulatedRodStruct, Unitless::Val{false}) = insRod.T[end]*u"K"
114+
115+
getGe2( insRod::InsulatedRodStruct, Unitless::Val{true}) = insRod.Ge2
116+
getGe2( insRod::InsulatedRodStruct, Unitless::Val{false}) = insRod.Ge2*u"W/K"
117+
118+
T_grad1(T,Ta,i) = if i == 1 ; (Ta - T[1])*2 else T[i-1] - T[i] end
119+
T_grad2(T,Tb,i) = if i == length(T); (T[i] - Tb)*2 else T[i] - T[i+1] end
120+
121+
function computeInsulatedRodDerivatives!(instantiatedModel, obj::InsulatedRodStruct{FloatType}, Ta, Tb)::Bool where {FloatType}
122+
Ta::FloatType = stripUnit(Ta)
123+
Tb::FloatType = stripUnit(Tb)
124+
T = obj.T
125+
k = obj.k
126+
for i in 1:length(T)
127+
obj.der_T[i] = k*(T_grad1(T,Ta,i) - T_grad2(T,Tb,i))
128+
end
129+
Modia.add_der_x_segmented_value!(instantiatedModel, obj.T_startIndex, obj.der_T)
130+
return true
131+
end

0 commit comments

Comments
 (0)