-
Notifications
You must be signed in to change notification settings - Fork 36
Open
Description
in my example I tried to simulate an induction machines in a 3~ system with position dependent coupling/inductance's.
part of the model for testing
netz = Spannung | Map(U=:(U1v*sqrt(2.0/3.0))),
equations = :[
w = der(phi)
wt = Omegarated*time
Lsr = Interpol1(phi)
dLsr = Interpol2(phi)
Lrs = transpose(Lsr)
dLrs = transpose(dLsr)
==> netz.u =r1*i1 + Lss*der(i1)
u2 = w*dLrs*i1 + Lrs*der(i1)
# Moment = dot(i1, dLsr*i2)
Moment = 0.0
Imech*der(w) = Moment - LAST
power = dot(netz.u, i1)
code "saveCodeOnFile"
...
Lsr = Interpol1(phi)
dLsr = Interpol2(phi)
Lrs = transpose(Lsr)
dLrs = transpose(dLsr)
==> var"der(i1)" = -((var"netz.u" - _p[:r1]::SMatrix{3, 3, Float64, 9} * i1)) / -(_p[:Lss]::SMatrix{3, 3, Float64, 9})
u2 = (w * dLrs) * i1 + Lrs * var"der(i1)"
var"der(w)" = -((Float64)(_p[:LAST])::Float64) / (Float64)(_p[:Imech])::Float64
...
simplified: var"der(i1)" = SVector / SMatrix
the correct function should be: var"der(i1)" = SMatrix^-1 * SVector
errormessage
ERROR: LoadError: DimensionMismatch("Both inputs should have the same number of columns")
Stacktrace:
[1] /(A::SVector{3, Float64}, B::SMatrix{3, 3, Float64, 9})
@ LinearAlgebra ~/julia-1.7.1/share/julia/stdlib/v1.7/LinearAlgebra/src/generic.jl:1149
[2] getDerivatives(_x::Vector{Float64}, _m::SimulationModel{Float64, Float64}, _time::Float64)
@ Main ~/.julia/packages/Modia/2gNMw/src/A-CodeGeneration.jl:1685
[3] #invokelatest#2
@ ./essentials.jl:716 [inlined]
workaround
in my particular case an additional method was helping.
Base.:/(A::SVector, B::SMatrix) = B^-1 * A
Metadata
Metadata
Assignees
Labels
No labels