oemof / tespy

Thermal Engineering Systems in Python (TESPy). This package provides a powerful simulation toolkit for thermal engineering plants such as power plants, district heating systems or heat pumps.
https://tespy.readthedocs.io
MIT License
272 stars 85 forks source link

Maximum iterations in solve() method using max_iter parameter #269

Closed govind-menon110 closed 2 years ago

govind-menon110 commented 3 years ago

Hi @fwitte, Is max_iter statically fixed at 50 and any value above 50 in nw.solve(max_iter=num) ignored if num > 50?

Regards, Govind

fwitte commented 3 years ago

Hi, it should not, see

https://github.com/oemof/tespy/blob/2df2b6a4f239acf31dfbcc6ba30be13660609a70/src/tespy/networks/network.py#L1682

However, There is a termination criterion, if the iteration count is larger than 40 and no progress in residual value is found (some 10 lines below).

https://github.com/oemof/tespy/blob/2df2b6a4f239acf31dfbcc6ba30be13660609a70/src/tespy/networks/network.py#L1695-L1699

In general, 10 to 20 Newton iterations should always find the solution in a well determined model. Maybe you need to double-check the model specifications?

fwitte commented 3 years ago

Hi @govind-menon110, any news on this? Best Francesco

govind-menon110 commented 3 years ago

Hi @govind-menon110, any news on this? Best Francesco

Hi @fwitte , I tried changing the parameters and the design case solved pretty quick. However an offdesign case with changed mass flow rates still cut off at 50 iterations though the maximum iterations were 100. Will update you again in a while.

Regards, Govind

fwitte commented 3 years ago

Well, my guess is that there are some specifications regarding design/offdesign parameters, that do not work well/as intended. The algorithm should really be able to find the solution within less than 10 to 20 iterations. Good luck on finding the issue :).

fwitte commented 2 years ago

@govind-menon110: I will close this for the time being, if you still need help please feel free to comment or open a discussion :)