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

cleanup class_ems.py #103

Merged
merged 5 commits into from
Oct 6, 2024
Merged

cleanup class_ems.py #103

merged 5 commits into from
Oct 6, 2024

Conversation

NormannK
Copy link
Collaborator

@NormannK NormannK commented Oct 5, 2024

  • type hints added
  • translated to English
  • reduced not needed function calls

improves optimization time by 50%

- type hints added
- translated to English
- reduced not needed function calls 

improves optimization time by 50%
@NormannK NormannK marked this pull request as ready for review October 5, 2024 19:27
@NormannK
Copy link
Collaborator Author

NormannK commented Oct 5, 2024

["Last_Wh_pro_Stunde"][0], ["Netzeinspeisung_Wh_pro_Stunde"][0], ["Netzbezug_Wh_pro_Stunde"][0] were None . But those should be numbers afaik. The lists were initialized with NaN values which later got converted into None.
I changed it by initializing the lists with zeros avoiding the whole conversion.
please confirm.

@NormannK
Copy link
Collaborator Author

NormannK commented Oct 5, 2024

old Last_Wh_pro_Stunde result:
[None, 23759.13, 996.88, 531.38, 517.95, 483.15, 472.28, 1011.68, 995.0, 1053.07, 1063.91, 1320.56, 1132.03, 1163.67, 1176.82, 1216.22, 1103.78, 1129.12, 1178.71, 1050.98, 988.56, 912.38, 704.61, 516.37, 868.05, 694.34, 608.79, 556.31, 488.89, 506.91, 804.89, 1141.98, 1056.97, 992.46, 1155.99, 827.01, 1257.98, 1232.67, 871.26, 860.88, 1158.03, 1222.72, 1221.04, 949.99, 987.01, 733.99, 592.97]
new Last_Wh_pro_Stunde result:
[0.0, 23759.13, 996.88, 531.38, 517.95, 483.15, 472.28, 1011.68, 995.0, 1053.07, 1063.91, 1320.56, 1132.03, 1163.67, 1176.82, 1216.22, 1103.78, 1129.12, 1178.71, 1050.98, 988.56, 912.38, 704.61, 516.37, 868.05, 694.34, 608.79, 556.31, 488.89, 506.91, 804.89, 1141.98, 1056.97, 992.46, 1155.99, 827.01, 1257.98, 1232.67, 871.26, 860.88, 1158.03, 1222.72, 1221.04, 949.99, 987.01, 733.99, 592.97]

@danimo danimo requested a review from drbacke October 5, 2024 21:53
@michaelosthege michaelosthege added the optimization optimization component label Oct 5, 2024
@michaelosthege
Copy link
Collaborator

I haven't familiarized myself with the simulation and optimization yet, but my gut feeling is that NaN should be prefered over None.
For example, a np.array([1,None,3]) is of dtype=object whereas np.array([1, np.nan, 2]) is dtype=float.

@NormannK
Copy link
Collaborator Author

NormannK commented Oct 5, 2024

yeah i was also not that sure anymore. I read this article to remember things. NaN is a float by definition and None is a "None Type" so dtype must change.
But for the optimization in the end that would not matter since the last step in the class was/is to translate all NaN into None anyways.

I would understand if, if the first value is NaN or None if we dont want to have effect that value the current running operation. So basically saying "hey don't touch anything for the current hour we only want to have values for the next hour"
Be we only have no value there bc the line 103 in the old for stunde in range(start_stunde + 1, ende): starts one hour later and there is no documentation why it does that. (or i cant find it)

@drbacke
Copy link
Collaborator

drbacke commented Oct 6, 2024

Home Appliances not working anymore. They are ignored

Copy link
Collaborator

@drbacke drbacke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Home Appliances not working anymore

@NormannK
Copy link
Collaborator Author

NormannK commented Oct 6, 2024

the test_class_ems.py sets haushaltsgeraet = None so it assumes there are none.

also i did check the result vs single_test_optimization.py. Its the same.
The code does not touch any logic, could you provide the input data you used?

@drbacke
Copy link
Collaborator

drbacke commented Oct 6, 2024

I fixed it, the call (set_startzeitpunkt returns no object, that was the problem).
I also added the home appl. to the unit tests, so that we will see that problem in the future.

@drbacke drbacke merged commit 38a4f2f into Akkudoktor-EOS:main Oct 6, 2024
1 of 2 checks passed
@drbacke drbacke mentioned this pull request Oct 6, 2024
@NormannK NormannK deleted the patch-6 branch October 6, 2024 12:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
optimization optimization component
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants