Skip to content

Commit 6c341ee

Browse files
committed
Merge branch 'development'
2 parents d47eb46 + 0c57392 commit 6c341ee

13 files changed

+666
-270
lines changed

Manifest.toml

Lines changed: 161 additions & 106 deletions
Large diffs are not rendered by default.

Project.toml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,24 @@
11
name = "ModiaBase"
22
uuid = "ec7bf1ca-419d-4510-bbab-199861c55244"
33
authors = ["Hilding Elmqvist <[email protected]>", "Martin Otter <[email protected]>"]
4-
version = "0.7.2-dev"
4+
version = "0.7.3"
55

66
[deps]
77
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
8-
DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
98
DiffRules = "b552c78f-8df3-52c6-915a-8e097449b14b"
109
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
1110
Measurements = "eff96d63-e80a-5855-80a2-b1b0885c5ab7"
1211
MonteCarloMeasurements = "0987c9cc-fe09-11e8-30f0-b96dd679fdca"
12+
OrderedCollections = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
13+
TimerOutputs = "a759f4b9-e2f1-59dc-863e-4aeb61b1ea8f"
1314
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"
1415

1516
[compat]
16-
DataFrames = "0.22, 0.21, 0.20, 0.19"
17-
DataStructures = "0.18, 0.17"
17+
DataFrames = "1.2, 1.1, 0.22, 0.21, 0.20, 0.19"
1818
DiffRules = "1.0"
19-
Measurements = "2.5, 2.4, 2.3"
20-
MonteCarloMeasurements = "0.10"
19+
Measurements = "2.6, 2.5, 2.4, 2.3"
20+
MonteCarloMeasurements = "0.10, 0.9"
21+
OrderedCollections = "1.4, 1.3"
22+
TimerOutputs = "0.5"
2123
Unitful = "1.6, 1.5, 1.4, 1.3"
22-
julia = "1.5, 1.6"
24+
julia = "1.6, 1.5"

docs/src/TransformationToODEs.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ CurrentModule = ModiaBase
5252
StateCategory
5353
ResidualCategory
5454
LinearEquations
55-
LinearEquationsIterator
55+
LinearEquationsIteration
5656
EquationInfo
5757
StateElementInfo
5858
```

docs/src/index.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,31 @@ julia> ]add Unitful, Measurements, MonteCarloMeasurements, Distributions
8888

8989
## Release Notes
9090

91+
### Version 0.7.3
92+
93+
- Speed improvements for structural and symbolic algorithms.
94+
95+
- Added support for state events, time events and synchronous operators
96+
(positive(), Clock(), after(), pre(), previous(), hold(), initial(), terminal())
97+
98+
- Added support for mixed linear equation systems having Real and Boolean unknowns.
99+
100+
- Simplified code for linear equation systems (while-loop instead of for-loop).
101+
102+
- Added TimerOutputs @timeit instrumentation to the solution of linear equation systems.
103+
104+
91105
### Version 0.7.2
92106

93107
- Support of parameters as hierarchical named tuples.
108+
94109
- Support of array comprehensions.
95-
- Support of array `end` (e.g. A[3:end])
110+
111+
- Support of array end (e.g. A[3:end])
112+
96113
- If one equation cannot be solved for one unknown (e.g. since function call),
97114
try to solve it as linear equation system.
115+
98116
- If variables with init values are explicitly solved for, print warning message
99117
only if log = true (in TinyModia.simulate! an error occurs, if the init value
100118
cannot be respected).

src/BLTandPantelides.jl

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,18 @@ using ..BLTandPantelidesUtilities
2727
const log = false
2828

2929
"""
30-
function augmentPath!(G, i, assign, vColour, eColour, vActive)
30+
function augmentPath!(G, i, assign, vColour, eColour, vPassive)
3131
Construction of augmenting path
3232
3333
Reference:
3434
Pantelides, C.: The consistent initialization of differential-algebraic systems. SIAM Journal
3535
of Scientific and Statistical Computing, 9(2), pp. 213–231 (1988).
3636
"""
37-
function augmentPath!(G, i, assign, vColour, eColour, vActive)
37+
function augmentPath!(G, i, assign, vColour, eColour, vPassive)
3838
# returns pathFound
3939
# assign: assign[j] contains the E-node to which V-node j is assigned or 0 if V-node j not assigned
4040
# i: E-node
41-
# vActive: set to false has the same effect as deleting V-node and corresponding edges
41+
# vPassive: set to != 0 has the same effect as deleting V-node and corresponding edges
4242
# j: V-node
4343

4444
if log
@@ -50,7 +50,7 @@ function augmentPath!(G, i, assign, vColour, eColour, vActive)
5050

5151
# If a V-node j exists such that edge (i-j) exists and assign[j] == 0
5252
for j in G[i]
53-
if vActive[j] && assign[j] == 0
53+
if vPassive[j] == 0 && assign[j] == 0
5454
pathFound = true
5555
assign[j] = i
5656
return pathFound
@@ -59,10 +59,10 @@ function augmentPath!(G, i, assign, vColour, eColour, vActive)
5959

6060
# For every j such that edge (i-j) exists and j is uncoloured
6161
for j in G[i]
62-
if vActive[j] && !vColour[j]
62+
if vPassive[j] == 0 && !vColour[j]
6363
vColour[j] = true
6464
k = assign[j]
65-
pathFound = augmentPath!(G, k, assign, vColour, eColour, vActive)
65+
pathFound = augmentPath!(G, k, assign, vColour, eColour, vPassive)
6666

6767
if pathFound
6868
assign[j] = i
@@ -74,11 +74,11 @@ function augmentPath!(G, i, assign, vColour, eColour, vActive)
7474
end
7575

7676

77-
function checkAssign(assign, VSizes, VTypes, ESizes, ETypes, equationsInfix, variableNames, A, vActive=[a == 0 for a in A])
77+
function checkAssign(assign, VSizes, VTypes, ESizes, ETypes, equationsInfix, variableNames, A, vPassive=A)
7878
println("Checking assignment")
7979
assignmentOK = true
8080
for j in 1:length(assign)
81-
if vActive[j]
81+
if vPassive[j] == 0
8282
i = assign[j]
8383
if i > 0 && VSizes[j] != ESizes[i]
8484
assignmentOK = false
@@ -114,10 +114,11 @@ function matching(G, M, vActive=fill(true, M))
114114
assign::Array{Int,1} = fill(0, M)
115115
eColour::Array{Bool,1} = fill(false, length(G))
116116
vColour::Array{Bool,1} = fill(false, M)
117+
vPassive::Array{Int,1} = [if va; 0 else 1 end for va in vActive]
117118
for i in 1:length(G)
118119
fill!(eColour, false)
119120
fill!(vColour, false)
120-
pathFound = augmentPath!(G, i, assign, vColour, eColour, vActive)
121+
pathFound = augmentPath!(G, i, assign, vColour, eColour, vPassive)
121122
end
122123
return assign
123124
end
@@ -142,18 +143,28 @@ of Scientific and Statistical Computing, 9(2), pp. 213–231 (1988).
142143
function pantelides!(G, M, A)
143144
assign::Array{Int,1} = fill(0, M)
144145
B::Array{Int,1} = fill(0, length(G))
146+
eColour::Array{Bool,1} = fill(false, length(G))
147+
vColour::Array{Bool,1} = fill(false, M)
145148
N = length(G)
146149
N2 = N
147150
for k in 1:N2
148151
pathFound = false
149152
i = k
150153
while !pathFound
151154
# Delete all V-nodes with A[.] != 0 and all their incidence edges from the graph
152-
vActive::Array{Bool,1} = [a == 0 for a in A]
153155
# Designate all nodes as "uncoloured"
154-
eColour::Array{Bool,1} = fill(false, length(G))
155-
vColour::Array{Bool,1} = fill(false, M)
156-
pathFound = augmentPath!(G, i, assign, vColour, eColour, vActive)
156+
if length(eColour) == length(G)
157+
fill!(eColour, false)
158+
else
159+
eColour = fill(false, length(G))
160+
end
161+
if length(vColour) == length(M)
162+
fill!(vColour, false)
163+
else
164+
vColour = fill(false, M)
165+
end
166+
167+
pathFound = augmentPath!(G, i, assign, vColour, eColour, A)
157168
if !pathFound
158169
if log
159170
println("\nDifferentiate:")

src/Differentiate.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,10 @@ function derivative(ex::Expr, timeInvariants=[])
8080
end
8181
if length(sum) > 1
8282
Expr(:call, :+, sum...)
83-
else
83+
elseif length(sum) == 1
8484
sum[1]
85+
else
86+
0
8587
end
8688
else
8789
:($d * $(derArguments[1]))

0 commit comments

Comments
 (0)