Skip to content
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

Model Buildings.Electrical.DC.Loads.Examples.LinearizedLoad fails in OM due to a wrong initialization #4048

Closed
AndreaBartolini opened this issue Nov 13, 2024 · 1 comment · Fixed by #4049

Comments

@AndreaBartolini
Copy link
Contributor

The simulation of the model Buildings.Electrical.DC.Loads.Examples.LinearizedLoad fails in OM by throwing the following error:

 division by zero at time 0, (a=-4999.489847974696) / (b=-0), where divisor b expression is: sen_nlin.P

more precisely, the error is thrown during the lambda-0 step of the homotopy process:

homotopy process ---------------------------
homotopy parameter lambda = 0
division by zero at time 0, (a=-4999.489847974696) / (b=-0), where divisor b expression is: sen_nlin.P

The equation that generates the issue is the following, placed at the top-level in the model:

Real error = (sen_nlin.P - sen_lin.P)*100/sen_nlin.P "Percentage of error between the linearized and actual power consumption";

where sen_nlin is the sensor connected in series to the NonlinearLoad, as shown in the following figure:
image

The problem arises because the NonlinearLoad is initialized by using the default zero_current initMode, that prescribes the current to be zero in the entire branch during the lambda-0 step, as shown in the initial equations of the NonlinearLoad model (i.e., of the Conductor model):

if initMode == Buildings.Electrical.Types.InitMode.zero_current then
  i[1] = - homotopy(actual= P/(v[1] - v[2]),  simplified= 0);
else
  i[1] = - homotopy(actual= P/(v[1] - v[2]),  simplified= P*(2/V_nominal - (v[1]-v[2])/V_nominal^2));
end if;
...
sum(i) = 0;

thus leading the sen_nlin.P=0 from the sensor sen_nlin during the lambda_0 step.

One solution can be to set the initMode to linearized in the NonlinearLoad, so that P is not equal to zero during the lambda-0 step.

BTW Dymola seems to be able to manage this singularity, but the right way is to remove them.

@mwetter
Copy link
Member

mwetter commented Nov 14, 2024

That for reporting. I will correct it and also in IBPSA (ibpsa/modelica-ibpsa#1942)

mwetter added a commit that referenced this issue Nov 14, 2024
This closes #4048. It also merges minor changes from IBPSA.
mwetter added a commit that referenced this issue Nov 18, 2024
This closes #4048. It also merges minor changes from IBPSA.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants