open-ideas / IDEAS

Modelica library allowing simultaneous transient simulation of thermal and electrical systems at both building and feeder level.
126 stars 51 forks source link

states on layer surfaces #289

Closed Mathadon closed 8 years ago

Mathadon commented 9 years ago

I changed the implementation of IDEAS.Buildings.Components.BaseClasses.MonoLayerOpaqueNf so that layer surfaces contain a state (instead of a resistance). This reduced the simulation time of IDEAS.Buildings.Validation.Tests.Case600from 85s to 60s. Depending on the case I think that the gain can be larger. We will need to look further into this.

Mathadon commented 9 years ago

The reason is the following. Before:

Sizes of linear systems of equations: {63, 4, 2, 2, 2, 4, 2, 2, 4, 2, 2, 4, 2, 2, 4, 2, 2}
Sizes after manipulation of the linear systems: {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
Sizes of nonlinear systems of equations: {1, 12, 10}
Sizes after manipulation of the nonlinear systems: {0, 2, 4}

After:

Sizes of linear systems of equations: {39, 2, 3, 3, 3, 3, 3}
Sizes after manipulation of the linear systems: {0, 0, 0, 0, 0, 0, 0}
Sizes of nonlinear systems of equations: {1, 12, 10}
Sizes after manipulation of the nonlinear systems: {0, 2, 4}

Dymola does not like large linear systems..

rubenbaetens commented 9 years ago

@Mathadon How do the unittests behave with states on the surfaces ? Btw, the sizes after manipulation are exactly equal, so are you sure this has anything to do with it ?

Mathadon commented 9 years ago

It has a lot to do with it :)

Unit tests produce similar results.

rubenbaetens commented 9 years ago

Why did you close this @Mathadon ?

Mathadon commented 9 years ago

I figured it could be closed since the branch is merged, no?

rubenbaetens commented 9 years ago

Ah, ik had het gemerged naar een 'trial' branch, nog niet in develop ... not convinced yet.

Mathadon commented 9 years ago

@mathadon need to give some good examples

Mathadon commented 8 years ago

For IDEAS.Buildings.Validation.Tests.Case920 I get:

with Evaluate=false

old implementation

Sizes of linear systems of equations: {4, 2, 2, 4, 63, 4, 2, 2, 4, 2, 2, 4, 2, 2, 4, 2, 2, 2, 2}
Sizes after manipulation of the linear systems: {0, 0, 0, 0, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}

cputime = 30.4s

new implementation

Sizes of linear systems of equations: {4, 43, 2}
Sizes after manipulation of the linear systems: {0, 10, 2}

Cputime = 20.2 s

with Evaluate=true

old implementation

Sizes of linear systems of equations: {4, 2, 2, 4, 63, 2, 4, 2, 2, 4, 2, 2, 4, 2, 2, 4, 2, 2}
Sizes after manipulation of the linear systems: {0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}

cputime = 20s

new implementation

Sizes of linear systems of equations: {4, 43}
Sizes after manipulation of the linear systems: {0, 0}

cputime = 13 s

In both cases the size and number of linear systems is significantly reduced, which leads to significant speed improvements.

Simulations were using: simulateModel("IDEAS.Buildings.Validation.Tests.Case920", stopTime=3.1536e+07, numberOfIntervals=0, outputInterval=3600, method="dassl", resultFile="Case920");

Mathadon commented 8 years ago

@rubenbaetens can you give feedback?

Mathadon commented 8 years ago

Unit tests give very similar results, although not exactly the same of course.

rubenbaetens commented 8 years ago

@Mathadon what exactly causes the difference in set of equations between Evaluate=true and Evaluate=false ?

Mathadon commented 8 years ago

When Evaluate=true Dymola will assume that all parameter values are fixed. This allows more symbolic manipulation since dymola may for instance know that a certain parameter will never be zero, so it can safely divide by this parameter, which may otherwise lead to a division by zero.

rubenbaetens commented 8 years ago

I meant, which each is the main evaluation here that causes this ? E.g. that the number of states is always fixed and can't be changed ?

Mathadon commented 8 years ago

I'm not sure what you mean.

The number of states will indeed not change due to Evaluate=true or false.

rubenbaetens commented 8 years ago

Solved in #372.