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
256 stars 80 forks source link

Report progress and results with the logger object #391

Closed jowr closed 1 year ago

jowr commented 1 year ago

General

This PR is a follow-up on #390 - it should be merged after #390 has been integrated.

The main purpose of this PR is to silence stdout when running TESPy. For compatibility reasons, the default settings make the system run as before, but it is now possible to send iteration progress reports via the logging framework. The same is the case for the results.

Documentation

Some internal functions have been renamed, but the external interface of TESPy is unchanged. The only noticeable change is that the iteration output now contains a progress indicator.

fwitte commented 1 year ago

Hi @jowr, @Vily-ipu,

thanks for your efforts and contribution, really appreciate that!

I already merged #390, but something is weird here. Your commits up until 37a5abfb075e76373088ce1150a93090e582dd6c are all in dev, but git does not really recognize that... I need to figure out what is wrong once the PR is ready. Maybe it will be resolved by merging the current dev into this branch. Just let me know, once you want to move forward!

Thanks and have a sunny week!

fwitte commented 1 year ago

@jowr: you can run python -m tox -e check to make the flake testing and everything locally, if you installed the dev dependencies of TESPy

jowr commented 1 year ago

Thanks, unfortunately I cannot run the tests locally because our project folders have spaces in their paths and that breaks tox...

jowr commented 1 year ago

Hi @fwitte - Is there anything more I can do? I think the failing test is not related to the changes in this PR.

fwitte commented 1 year ago

@jowr, thank you for reminding me and sorry for my delays. I am in holidays right now, I will scoop up the open points next week.

jowr commented 1 year ago

No worries - I was just wondering whether I overlooked a change request.

fwitte commented 1 year ago

Got it, thank you.

For the moment I'll take care about those tests and I will make some minor adjustments in style. There should be nothing to do from your side for now.

fwitte commented 1 year ago

@jowr: Merged, thanks again!

fwitte commented 1 year ago

@jowr: On doing some more things with this merged into dev, I just noticed, that the progressvalue sometimes does not seem to make too much sense. Or I have some misunderstanding... I will try to get some time next weekend to look into it, and I may come back to you for some questions later :).

jowr commented 1 year ago

That is correct - I currently only look at the stop criterion and assume that the solver progresses exponentially (linearly in terms of the log of the residual value). This is more an indicator than a real value. If you think this confuses more than it helps, we can remove it again. However, I think it would be super cool if we could come up with a correct definition of the progress value...