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

remove stateSelect.prefer for T #160

Closed
mwetter opened this issue Feb 4, 2015 · 4 comments
Closed

remove stateSelect.prefer for T #160

mwetter opened this issue Feb 4, 2015 · 4 comments

Comments

@mwetter
Copy link
Contributor

mwetter commented Feb 4, 2015

This change is to test the computing time without the annotation

T(stateSelect=if preferredMediumStates then StateSelect.prefer else StateSelect.default)

@Mathadon reports that this gives smaller equations and faster computing time for
Buildings.Examples.VAVReheat.

mwetter added a commit that referenced this issue Feb 4, 2015
@mwetter
Copy link
Contributor Author

mwetter commented Feb 5, 2015

Removing stateSelect.prefer for T gives slightly faster simulation.

@Mathadon
Copy link
Member

Mathadon commented Feb 6, 2015

Another illustration of the effect of StateSelect:
If you run Buildings.Fluid.Storage.Examples.Stratified and enable Output information when differentiating for state reduction you get:

Differentiated the equation
tanEnh.vol[8].dynBal.U = 298.67580000000004*tanEnh.vol[8].dynBal.medium.u;

giving
der(tanEnh.vol[8].dynBal.U) = 298.67580000000004*der(tanEnh.vol[8].dynBal.medium.u);

Differentiated the equation
tanEnh.vol[9].dynBal.medium.u = 4184*(tanEnh.vol[9].dynBal.medium.T-273.15);

giving
der(tanEnh.vol[9].dynBal.medium.u) = 4184*der(tanEnh.vol[9].dynBal.medium.T);

for each mixing volume.

These differentiations disappear when using StateSelect.default for T and preferredMediumStates = false in ConservationEquation(medium). The model seems to become marginally faster and Number of F-evaluations : 912 is reduced by five.

@mwetter
Copy link
Contributor Author

mwetter commented Feb 6, 2015

@Mathadon : I run a few more tests and think that we should indeed remove stateSelect.prefer for T as it leads to smaller models.
In my tests, I was interested to see what the estimated operation count is that Dymola computes. I chose for sequential execution, as the parallel execution depends on the number of cores, and probably does not give much more insight.

I compiled the big models of the Buildings library using

openModel("package.mo");
Advanced.ParallelizeCode=true;
Advanced.TranslationInCommandLog=true;
translateModel("Buildings.Examples.ChillerPlant.DataCenterContinuousTimeControl");
translateModel("Buildings.Examples.DualFanDualDuct.ClosedLoop");
translateModel("Buildings.Examples.HydronicHeating.TwoRoomsWithStorage");
translateModel("Buildings.Examples.VAVReheat.ClosedLoop");

Putting the outputs in one file an running

grep '#\|transla\|after manipulation of the nonlinear\|sequential exe' statistics.log

gives the following summary

#################################################################
# master
#################################################################
translateModel("Buildings.Examples.ChillerPlant.DataCenterContinuousTimeControl");
  Sizes after manipulation of the nonlinear systems: {1, 0, 3, 1}
    Sizes after manipulation of the nonlinear systems: {1, 3, 1, 1, 17}
Estimated operation count for sequential execution: 17339
Estimated operation count for sequential execution: 39699
translateModel("Buildings.Examples.DualFanDualDuct.ClosedLoop");
  Sizes after manipulation of the nonlinear systems: {1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 0, 0, 0, 0, 2, 1, 1, 1, 1, 1, 1, 14, 14, 14, 14}
    Sizes after manipulation of the nonlinear systems: {1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 8, 14, 14, 14, 14, 1, 1, 1}
Estimated operation count for sequential execution: 17837
Estimated operation count for sequential execution: 254814
translateModel("Buildings.Examples.HydronicHeating.TwoRoomsWithStorage");
  Sizes after manipulation of the nonlinear systems: {1, 1, 1, 2, 1, 1, 1, 19, 19}
    Sizes after manipulation of the nonlinear systems: {5, 5, 3, 1, 1, 1, 1, 19, 19, 1}
Estimated operation count for sequential execution: 17349
Estimated operation count for sequential execution: 114789
translateModel("Buildings.Examples.VAVReheat.ClosedLoop");
  Sizes after manipulation of the nonlinear systems: {1, 2, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 14, 14, 14, 14, 8, 1, 1, 1, 1}
    Sizes after manipulation of the nonlinear systems: {2, 1, 1, 1, 1, 14, 14, 14, 8, 14, 1, 1, 1, 1, 1, 1, 1}
Estimated operation count for sequential execution: 17837
Estimated operation count for sequential execution: 162588
#################################################################
# issue354_stateSelectT
#################################################################
translateModel("Buildings.Examples.ChillerPlant.DataCenterContinuousTimeControl");
  Sizes after manipulation of the nonlinear systems: {1, 0, 3, 1}
    Sizes after manipulation of the nonlinear systems: {1, 3, 1, 1, 17}
Estimated operation count for sequential execution: 17339
Estimated operation count for sequential execution: 39690
translateModel("Buildings.Examples.DualFanDualDuct.ClosedLoop");
  Sizes after manipulation of the nonlinear systems: {1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 0, 0, 0, 0, 2, 1, 1, 1, 1, 1, 1, 14, 14, 14, 14}
    Sizes after manipulation of the nonlinear systems: {1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 8, 14, 14, 14, 14, 1, 1, 1}
Estimated operation count for sequential execution: 18337
Estimated operation count for sequential execution: 250480
translateModel("Buildings.Examples.HydronicHeating.TwoRoomsWithStorage");
  Sizes after manipulation of the nonlinear systems: {1, 1, 1, 2, 1, 1, 1, 19, 19}
    Sizes after manipulation of the nonlinear systems: {5, 5, 1, 3, 1, 1, 1, 1, 19, 19}
Estimated operation count for sequential execution: 17349
Estimated operation count for sequential execution: 102929
translateModel("Buildings.Examples.VAVReheat.ClosedLoop");
  Sizes after manipulation of the nonlinear systems: {1, 8, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 2, 1, 1, 1, 1, 1, 14, 14, 14, 14}
    Sizes after manipulation of the nonlinear systems: {2, 1, 1, 1, 1, 14, 14, 1, 1, 8, 14, 1, 1, 1, 14, 1, 1}
Estimated operation count for sequential execution: 18337
Estimated operation count for sequential execution: 159172

Hence, the branch issue354_stateSelectT (on the Buildings repository) gives the better performance. Hence, I suggest to remove stateSelect.prefer for T.

I added #164 for this.
Could you please review the changes.

@mwetter
Copy link
Contributor Author

mwetter commented Feb 9, 2015

Change accepted, process pull request.

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

No branches or pull requests

2 participants