New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Numerical overflow due to replacement of 1/tanh with cosh/sinh #8005
Comments
The code responsible for this is (note that the comment on the first line is wrong compared with what the code actually does): OpenModelica/OMCompiler/Compiler/FrontEnd/ExpressionSimplify.mo Lines 4786 to 4792 in 28cd7de
I'm not sure what the purpose of this simplification rule is since it makes the expression bigger. Perhaps it enables further simplifications in some cases, but not in this case. |
This avoids two instead of one calls to builtin functions. It also avoids potential numerical overflows for large values of e2 when sinh returns inf. See: PowerSystems.Examples.AC3ph.Inverters.InverterToLoad See also issue OpenModelica#8005.
This avoids two instead of one calls to builtin functions. It also avoids potential numerical overflows for large values of e2 when sinh returns inf. See: PowerSystems.Examples.AC3ph.Inverters.InverterToLoad See also issue OpenModelica#8005.
This appears to go back to work by @vruge in 2014 first introducing I think that this rule should be removed. |
There are more strange simplifications in
besides
|
The first two make a lot of sense though. You remove divisions by zero at least |
Commit a2907a1 fixes the first two. |
I completely agree that the simplification rule I would definitely suggest to remove that rule. @rfranke, can you take care of that? |
This avoids two instead of one calls to builtin functions. It also avoids potential numerical overflows for large values of e2 when sinh returns inf. See: PowerSystems.Examples.AC3ph.Inverters.InverterToLoad See also issue #8005.
OK, I merged PR #8006. |
|
This avoids two instead of one calls to builtin functions. It also avoids potential numerical overflows for large values of e2 when sinh returns inf. See: PowerSystems.Examples.AC3ph.Inverters.InverterToLoad See also issue OpenModelica#8005.
This avoids two instead of one calls to builtin functions. It also avoids potential numerical overflows for large values of e2 when sinh returns inf. See: PowerSystems.Examples.AC3ph.Inverters.InverterToLoad See also issue #8005.
Some load models of the PowerSystems library adapt the load to make it independent of voltage. For instance
PowerSystems.AC3ph.Loads.PQindLoad
states:Only
Z
andv2
are time varying, whereas all other variables are parameters. OpenModelica replaces this with:During the solution of the example
PowerSystems.Examples.AC3ph.Inverters.InverterToLoad
with DASSL it happens thatv2
takes large values leading to an overflow ofsinh
. See the respective error message (sinh(...)
becomes$cse11
):The overflow would not happen with
tanh
stated in the model as it is limited by 1. See e.g. https://en.wikipedia.org/wiki/Hyperbolic_functions:The text was updated successfully, but these errors were encountered: