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
TwoWayValve model division by 0 error #1376
Comments
@EttoreZ General debugging approach:
|
@EttoreZ : Please let me know if you are still stuck after following the advice of @Mathadon .
|
@mwetter I downloaded it and it unpacked fine. I made it with winRar though. This is the same file made with WinZip IssueTwoWayValveKValTotal_fin.zip . ValDayZ.phi := max(0, homotopy(IBPSA.Fluid.Actuators.BaseClasses.equalPercentage However from the simulations results it does not seem that y_actual approaches 0. If you want we can talk about it before/after today's coordination meeting |
I also receive very often a similar error. However, it seems as the solver is able to overcome the error through further iterations and the simulation continues. Error: The following error was detected at time: 4385.110851261505
Model error - division by zero: (m_flow_turbulent) / (k) = (0.000160471) / (0)
The stack of functions is:
AixLib.Fluid.BaseClasses.FlowModels.basicFlowFunction_m_flow
AixLib.Fluid.BaseClasses.FlowModels.basicFlowFunction_m_flow(hydronicsRadiatorsValves.volRet.ports[9].m_flow, hydronicsRadiatorsValves.val[9].kVal, hydronicsRadiatorsValves.val[9].m_flow_turbulent)
First evaluation failed for non-linear solver. |
@PMehrfeld in my case the solver manages to get past it too. However I wonder in complex models that have to run for a while (in my case the two zone apartment model has to run for a yearly simulation), how much does this recurring error slows down the simulation? @Mathadon Just a quick update after briefly talking with @mwetter. I was not able to figurate out how to extract the failed step data (in the results I have only the results where y_actual never becomes negative). However by modifiying the equation for phi from : to The error disappears. @mwetter raised the issue that putting the value at exactly the leakage value would be a problem for the derivative estimation around the leakage point due to max oscillating near the leakage value. He suggested it could be still changed but to a smaller value (0.1*l) for example. It should be tested on larger models to see if there is an actual reduction of the simulation time, else the documentation could be updated to just mention that is a normal error that the user should not be too bothered by. |
I'd be in favor of adding a max() that enforces the k to be positive and indeed, it's better to use |
@EttoreZ : The development branch is |
I report below a .zip file containing preliminary test on the buildings library with the suggested modification |
I am working on a small hydronic floor heating system for two thermal zones. It is a closed circuit that branches into two floor heating slabs (in the example approximated as resistances). The control is a simple on-off that in the example is given by a boolean pulse function. While working on the model I encountered the problem shown below:
Error: The following error was detected at time: XXX
Model error - division by zero: (1.0) / (ValDayZ.kVal^2) = (1) / (0)
The equation that raises the issue seems to be:
k = sqrt(1/(1/kFixed^2 + 1/kVal^2)); in the PartialTwoWayValveKv model where the variable k is computed as a function of kVal^2.
I tried to narrow down the possible causes but I am a stuck. A few things to mention:
The error happens only when the circuit has two valves and the flow splitters (if you try to remove one of the two valves it disappears)
The error sometimes happens on one valve or the other. However plotting the variables involved the values seem exactly the same.
I attach the total model to showcase the encountered error.
IssueTwoWayValveKValTotal.zip
The text was updated successfully, but these errors were encountered: