Skip to content

Commit bdbeb0e

Browse files
committed
Fix issue with unit on macOC (exponents in a string had been displayed as Unicode superscripts)
1 parent d43b8a3 commit bdbeb0e

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

docs/src/index.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,14 @@ julia> ]add ModiaPlot_PyPlot # if plotting with PyPlot desired
2424
add ModiaPlot_CairoMakie # if plotting with CairoMakie desired
2525
```
2626

27-
Note, Modia exports all exported symbols of
27+
Note, Modia reexports the following definitions
2828

29-
- [DifferentialEquations](https://github.com/SciML/DifferentialEquations.jl) and of
30-
- [Unitful](https://github.com/PainterQubits/Unitful.jl)
29+
- `using Unitful`
30+
- `using DifferentialEquations`
31+
- and exports functions `CVODE_BDF` and `IDA` of [Sundials.jl](https://github.com/SciML/Sundials.jl).
32+
33+
As a result, it is usually sufficient to have `using Modia` in a model to utilize the relevant
34+
functionalities of these packages.
3135

3236

3337
## Release Notes

src/ModiaLang.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,10 @@ function stateSelectionAndCodeGeneration(modStructure, Gexplicit, name, modelMod
550550
@assert all([un[i] == un[1] for i in 2:length(un)]) "The unit of all elements of state vector must be equal: $var::$(value)"
551551
un = un[1]
552552
end
553-
return replace(string(un), " " => "*") # Fix since Unitful removes * in unit strings
553+
# Transform unit to string representation that is parseable again (see also https://github.com/PainterQubits/Unitful.jl/issues/412):
554+
# - Display exponents on units not as superscripts (= default on macOS)
555+
# - Replace " " by "*", since Unitful removes "*" when converting to string
556+
return replace(repr(un,context = Pair(:fancy_exponent,false)), " " => "*")
554557
end
555558

556559
function var_startInitFixed(v_original)

0 commit comments

Comments
 (0)