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

Warning about differentiation in dymola 2020 #1240

Closed
Mathadon opened this issue Nov 9, 2019 · 8 comments · Fixed by #1262
Closed

Warning about differentiation in dymola 2020 #1240

Mathadon opened this issue Nov 9, 2019 · 8 comments · Fixed by #1262
Assignees

Comments

@Mathadon
Copy link
Member

Mathadon commented Nov 9, 2019

In dymola 2020 I sometimes get:

Differentiating (if noEvent(abs(dp) > dp_turbulent) then noEvent((if dp > 0 then 1 else (if dp < 0 then -1 else 0)))*k*sqrt(abs(dp)) else (1.40625+(0.15625*dpNormSq-0.5625) *dpNormSq)*m_flow_turbulent*dpNorm)
under the assumption that it is continuous at switching.

which resides in IBPSA.Fluid.BaseClasses.FlowModels.basicFlowFunction_dp. Adding smooth(2, in the function body solves the problem, however we already have smooth=2 in the annotation so we should not get this error. Something to report to the developers?

@mwetter
Copy link
Contributor

mwetter commented Nov 13, 2019

Yes, this sounds like a bug (or missing feature) of the Modelica tool.

@Mathadon
Copy link
Member Author

reported

@Mathadon
Copy link
Member Author

Mathadon commented Nov 27, 2019

Feedback from Claytex: they consider the behavior to be ok and consider it a safety feature to avoid people not getting a warning. This does not seem to be in line with the Modelica specification:

smoothOrder defines the number of differentiations of the function, in order that all of the differentiated outputs are continuous provided all input arguments and their derivatives up to order smoothOrder are continuous

which implies that smoothOrder=2 results in continuous derivatives so I don't think there should be a need for this double-check.

Do we add the smooth(2,.) to our functions or do we want to argue further about this? Perhaps directly with Dassault.

@mwetter
Copy link
Contributor

mwetter commented Nov 27, 2019

@Mathadon : It would be best if you can directly contact Dassault. I see no need to double-declare the property with smoothOrder=2 and smooth(2, ...). This appears to be an improvement that should be added to Dymola.

@Mathadon
Copy link
Member Author

Forwarded to Dassault by Claytex. I propose to continue with the hotfix (smooth(2,) in the CheckValve pull request for now.

@mwetter
Copy link
Contributor

mwetter commented Nov 28, 2019

OK, I don't see any harm in using smooth(2, ...) until it is fixed.

@Mathadon
Copy link
Member Author

Mathadon commented Dec 5, 2019

then this is closed by #1224

@mwetter
Copy link
Contributor

mwetter commented Dec 9, 2019

@Mathadon : The same smooth(2, ...) annotation should be added to IBPSA.Fluid.BaseClasses.FlowModels.basicFlowFunction_m_flow which we require in some of our new models that we work on. I will make the change.

mwetter added a commit that referenced this issue Dec 9, 2019
mwetter added a commit that referenced this issue Dec 9, 2019
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