Open DarioSlaifsteinSk opened 1 month ago
So, apparently the (cs_max .- Cseₙ)
is going negative which means that the following is not working properly:
Results.Cseₙ[i + 1, :] = (SOCₙ .* Cell.Neg.cs_max .+
Results.y[i + 1, CseNegInd]) >
ones(size(Results.Cseₙ, 2)) * Cell.Neg.cs_max ?
ones(size(Results.Cseₙ, 2)) * Cell.Neg.cs_max :
(SOCₙ .* Cell.Neg.cs_max .+
Results.y[i + 1, CseNegInd])
Two possible fixes. If we want to keep replacing the whole row:
Results.Cseₙ[i + 1, :] = any((SOCₙ .* Cell.Neg.cs_max .+
Results.y[i + 1, CseNegInd]) .> Cell.Neg.cs_max) ?
ones(size(Results.Cseₙ, 2)) * Cell.Neg.cs_max :
(SOCₙ .* Cell.Neg.cs_max .+
Results.y[i + 1, CseNegInd])
If we only want to replace the values out of the bounds:
# first define the concentration
Results.Cseₙ[i + 1, :] = SOCₙ .* Cell.Neg.cs_max .+ Results.y[i + 1, CseNegInd]
# then check and correct
any(Results.Cseₙ[i + 1, :] .> Cell.Neg.cs_max) ?
Results.Cseₙ[i+1, Results.Cseₙ[i + 1, :] .> Cell.Neg.cs_max] .= Cell.Neg.cs_max :
nothing
Was there any reason to replace the whole row?
Hi! I'm getting
from line 224 in
Simulate.jl
. This is probably because one of the concentrationsCseₙ
,Ce
or(cs_max .- Cseₙ)
is going negative.