Skip to content

Commit 73d3527

Browse files
authored
Merge pull request #80 from ModiaSim/Remove_Unitful_u_str_workaround
Remove Unitful u_str workaround
2 parents c224c77 + 1f98b31 commit 73d3527

File tree

5 files changed

+41
-46
lines changed

5 files changed

+41
-46
lines changed

Manifest.toml

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ version = "0.5.3"
99

1010
[[CategoricalArrays]]
1111
deps = ["Compat", "Future", "Missings", "Printf", "Reexport", "Requires"]
12-
git-tree-sha1 = "11419d157ab75a54a8af63315e7a279a593971bc"
12+
git-tree-sha1 = "94d16e77dfacc59f6d6c1361866906dbb65b6f6b"
1313
uuid = "324d7699-5711-5eae-9e2f-1d82baa6b597"
14-
version = "0.5.1"
14+
version = "0.5.2"
1515

1616
[[CodecZlib]]
1717
deps = ["BinaryProvider", "Libdl", "Test", "TranscodingStreams"]
@@ -27,9 +27,9 @@ version = "1.4.0"
2727

2828
[[DataFrames]]
2929
deps = ["CategoricalArrays", "CodecZlib", "Compat", "DataStreams", "Dates", "InteractiveUtils", "IteratorInterfaceExtensions", "LinearAlgebra", "Missings", "Printf", "Random", "Reexport", "SortingAlgorithms", "Statistics", "StatsBase", "TableTraits", "Tables", "Test", "TranscodingStreams", "Unicode", "WeakRefStrings"]
30-
git-tree-sha1 = "60c2820c9ae93cc33e98cd820e0b449d551c7874"
30+
git-tree-sha1 = "7e032a76f3455e38660ac456791951ac2d0b1e70"
3131
uuid = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
32-
version = "0.15.1"
32+
version = "0.16.0"
3333

3434
[[DataStreams]]
3535
deps = ["Dates", "Missings", "Test", "WeakRefStrings"]
@@ -39,9 +39,9 @@ version = "0.4.1"
3939

4040
[[DataStructures]]
4141
deps = ["InteractiveUtils", "OrderedCollections", "Random", "Serialization", "Test"]
42-
git-tree-sha1 = "8fc6e166e24fda04b2b648d4260cdad241788c54"
42+
git-tree-sha1 = "ca971f03e146cf144a9e2f2ce59674f5bf0e8038"
4343
uuid = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
44-
version = "0.14.0"
44+
version = "0.15.0"
4545

4646
[[Dates]]
4747
deps = ["Printf"]
@@ -53,9 +53,9 @@ uuid = "8bb1440f-4735-579b-a4ab-409b98df4dab"
5353

5454
[[DiffEqBase]]
5555
deps = ["Compat", "IteratorInterfaceExtensions", "LinearAlgebra", "RecipesBase", "RecursiveArrayTools", "Requires", "Roots", "SparseArrays", "StaticArrays", "Statistics", "SuiteSparse", "TableTraits", "Test", "TreeViews"]
56-
git-tree-sha1 = "b8c9c5a296e426d0ad978e6e7ad699dde444d3a1"
56+
git-tree-sha1 = "9b077135e38482dcf74daf2406b9da4dc4dcb0ca"
5757
uuid = "2b5f629d-d688-5b77-993f-72d75c75574e"
58-
version = "4.31.1"
58+
version = "4.31.2"
5959

6060
[[Distributed]]
6161
deps = ["LinearAlgebra", "Random", "Serialization", "Sockets"]
@@ -143,9 +143,9 @@ version = "0.6.0"
143143

144144
[[RecursiveArrayTools]]
145145
deps = ["RecipesBase", "Requires", "StaticArrays", "Statistics", "Test"]
146-
git-tree-sha1 = "5ac1ea7d018bec90b0be614a9a37d1fd80dce8d9"
146+
git-tree-sha1 = "152afd0272d2f468c9f564d6f64cc3c10a8c1e94"
147147
uuid = "731186ca-8d62-57ce-b412-fbd966d074cd"
148-
version = "0.18.4"
148+
version = "0.18.5"
149149

150150
[[Reexport]]
151151
deps = ["Pkg"]
@@ -190,19 +190,19 @@ uuid = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
190190

191191
[[StaticArrays]]
192192
deps = ["InteractiveUtils", "LinearAlgebra", "Random", "Statistics", "Test"]
193-
git-tree-sha1 = "97c4bf0f647488dd7ac01ea12be5885f88762938"
193+
git-tree-sha1 = "1eb114d6e23a817cd3e99abc3226190876d7c898"
194194
uuid = "90137ffa-7385-5640-81b9-e52037218182"
195-
version = "0.10.0"
195+
version = "0.10.2"
196196

197197
[[Statistics]]
198198
deps = ["LinearAlgebra", "SparseArrays"]
199199
uuid = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
200200

201201
[[StatsBase]]
202-
deps = ["DataStructures", "LinearAlgebra", "Missings", "Printf", "Random", "SortingAlgorithms", "SparseArrays", "Statistics", "Test"]
203-
git-tree-sha1 = "2722397d88f8ffef551948f6c20e1d74a743298c"
202+
deps = ["DataStructures", "DelimitedFiles", "LinearAlgebra", "Missings", "Printf", "Random", "SortingAlgorithms", "SparseArrays", "Statistics", "Test"]
203+
git-tree-sha1 = "7b596062316c7d846b67bf625d5963a832528598"
204204
uuid = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
205-
version = "0.26.0"
205+
version = "0.27.0"
206206

207207
[[SuiteSparse]]
208208
deps = ["Libdl", "LinearAlgebra", "SparseArrays"]
@@ -216,15 +216,15 @@ version = "2.6.0"
216216

217217
[[TableTraits]]
218218
deps = ["IteratorInterfaceExtensions", "Test"]
219-
git-tree-sha1 = "da062a2c31f16178f68190243c24140801720a43"
219+
git-tree-sha1 = "eba4b1d0a82bdd773307d652c6e5f8c82104c676"
220220
uuid = "3783bdb8-4a98-5b6b-af9a-565f29a5fe9c"
221-
version = "0.4.0"
221+
version = "0.4.1"
222222

223223
[[Tables]]
224-
deps = ["Requires", "Test"]
225-
git-tree-sha1 = "940944e6b68a35046282897a2218891c7cf14a32"
224+
deps = ["IteratorInterfaceExtensions", "Requires", "TableTraits", "Test"]
225+
git-tree-sha1 = "89f8fde6394579580fb75088e45ad95551199c7c"
226226
uuid = "bd369af6-aec1-5ad0-b16a-f7cc5008161c"
227-
version = "0.1.12"
227+
version = "0.1.14"
228228

229229
[[Test]]
230230
deps = ["Distributed", "InteractiveUtils", "Logging", "Random"]
@@ -251,9 +251,9 @@ uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"
251251

252252
[[Unitful]]
253253
deps = ["LinearAlgebra", "Random", "Test"]
254-
git-tree-sha1 = "15c921708e19258fc9e7723aafc5f15c973ee77f"
254+
git-tree-sha1 = "ba654182cad07cd6c1f3ae969475e556db3283ea"
255255
uuid = "1986cc42-f94f-5a68-af5c-568840ba703d"
256-
version = "0.13.0"
256+
version = "0.14.0"
257257

258258
[[WeakRefStrings]]
259259
deps = ["Missings", "Random", "Test"]

src/Modia.jl

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,6 @@ import Unitful
9999
end
100100

101101

102-
103-
# Make string macro U_str available by "using Modia"
104-
include("language/Unitful_U_str.jl")
105-
using .Unitful_U_str
106-
export @U_str
107-
108-
109-
110102
# Include all sub-modules of Modia
111103
include("language/ModiaLogging.jl")
112104
include("language/Instantiation.jl")

src/language/Unitful_U_str.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ using Unitful
1111
using Modia # Unitful_U_str.jl is included in Modia.jl
1212
1313
const T1_type = u"N*m" # gives warning
14-
const T2_type = U"N*m" # gives no warning
14+
const T2_type = u"N*m" # gives no warning
1515
```
1616
"""
1717
module Unitful_U_str

src/models/Rotational.jl

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ using Modia
1717

1818
"Rotational angle variable"
1919
Angle(; args...) = Variable(; start = 0.0, size = (),
20-
T = U"rad", info = "Rotational angle", args...)
20+
T = u"rad", info = "Rotational angle", args...)
2121
TorqueVar(; args...) = Variable(; start = 0.0, size = (),
22-
T = U"N*m", info = "Torque", args...)
22+
T = u"N*m", info = "Torque", args...)
2323

2424
"""
2525
Connector for 1D rotational systems
@@ -33,14 +33,14 @@ end
3333
1D-rotational component with inertia
3434
"""
3535
@model Inertia begin
36-
J = Parameter(0, min=0, info = "Moment of inertia", T = U"kg*m^2")
36+
J = Parameter(0, min=0, info = "Moment of inertia", T = u"kg*m^2")
3737

3838
flange_a = Flange(info = "Left flange of shaft")
3939
flange_b = Flange(info = "Right flange of shaft")
4040

4141
phi = Angle()
42-
w = Var(start = 0.0, info = "Angular velocity", T = U"rad/s")
43-
a = Var(info = "Angular acceleration", T = U"rad/s^2")
42+
w = Var(start = 0.0, info = "Angular velocity", T = u"rad/s")
43+
a = Var(info = "Angular acceleration", T = u"rad/s^2")
4444
@equations begin
4545
phi = flange_a.phi
4646
phi = flange_b.phi
@@ -69,8 +69,8 @@ end
6969
Linear 1D rotational spring
7070
"""
7171
@model Spring begin
72-
c = Parameter(min = 0, start = 1.0e5, info = "Spring constant", T = U"N*m/rad")
73-
phi_rel0 = Parameter(0.0, start = 0.0, info = "Unstretched spring angle", T = U"rad")
72+
c = Parameter(min = 0, start = 1.0e5, info = "Spring constant", T = u"N*m/rad")
73+
phi_rel0 = Parameter(0.0, start = 0.0, info = "Unstretched spring angle", T = u"rad")
7474
@extends PartialCompliant()
7575
@inherits tau, phi_rel
7676
@equations begin
@@ -82,9 +82,9 @@ end
8282
Linear 1D rotational spring with damper
8383
"""
8484
@model SpringDamper begin
85-
c = Parameter(min = 0, start = 1.0e5, info = "Spring constant", T = U"N*m/rad")
86-
d = Parameter(info = "Damping constant", T = U"N*m*s/rad")
87-
phi_rel0 = Parameter(0.0, start = 0.0, info = "Unstretched spring angle", T = U"rad")
85+
c = Parameter(min = 0, start = 1.0e5, info = "Spring constant", T = u"N*m/rad")
86+
d = Parameter(info = "Damping constant", T = u"N*m*s/rad")
87+
phi_rel0 = Parameter(0.0, start = 0.0, info = "Unstretched spring angle", T = u"rad")
8888
@extends PartialCompliant(phi_rel=Angle(size=(), state=false))
8989
@inherits tau, phi_rel
9090
@equations begin
@@ -96,7 +96,7 @@ end
9696
Electromotoric force (electric/mechanic) transformer
9797
"""
9898
@model EMF begin
99-
k = Parameter(1.0, info = "Transformation coefficient", T = U"N*m/A")
99+
k = Parameter(1.0, info = "Transformation coefficient", T = u"N*m/A")
100100

101101
p = Pin(info = "Positive pin")
102102
n = Pin(info = "Negative pin")
@@ -105,7 +105,7 @@ Electromotoric force (electric/mechanic) transformer
105105
v = Voltage()
106106
i = Current()
107107
phi = Angle(state = false)
108-
w = Variable(T = U"rad/s", info = "Angular velocity")
108+
w = Variable(T = u"rad/s", info = "Angular velocity")
109109
@equations begin
110110
v = p.v - n.v
111111
0 = p.i + n.i

test/models/TestVariableTypes.jl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import Modia.Unitful:
3030
nm, μm, mm, cm, m, km, inch, ft, mi,
3131
ac,
3232
mg, g, kg, A,
33-
°Ra, °F, °C, K,
33+
Ra, °F, °C, K,
3434
rad, °,
3535
ms, s, minute, hr,
3636
J, A, N, mol, cd, V,
@@ -154,7 +154,8 @@ const Vec3 = SVector{3,Float64}
154154

155155
v4 = [1,2,3]
156156
v5 = [1,2,3]
157-
v6 = 10.0u"V"
157+
#v6 = 10.0u"V"
158+
v6 = 10.0
158159
end
159160
end
160161

@@ -164,7 +165,7 @@ const Vec3 = SVector{3,Float64}
164165

165166
# ----------------------
166167

167-
168+
#=
168169
@model TestVariableUnits1 begin
169170
# Real3 := Variable{Float64,3}
170171
# typealias Voltage Variable{Volt}
@@ -204,6 +205,8 @@ const Vec3 = SVector{3,Float64}
204205
205206
plot(result, ("v3", "v4", "a"), figure=1)
206207
208+
=#
209+
207210
end
208211

209212
end

0 commit comments

Comments
 (0)