-
Notifications
You must be signed in to change notification settings - Fork 35
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
Initial HEMS agent implementation #52
base: master
Are you sure you want to change the base?
Conversation
@cyrus19901 I think you are the one most affected by this..please review... |
@@ -0,0 +1,440 @@ | |||
import datetime |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add copyright to the agent file.
Please rename HEMS_agent.py to simply agent.py and lowercase the hems folder as python packages should not be uppercase.
raise ValueError('Unknown timestamp value') | ||
return ts | ||
|
||
def HEMS_agent(config_path, **kwargs): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This pattern uses the old volttron wrapper pattern. It should be updated to have the constructor be called from this function where the external agent is created and returned using the default parameters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can easily move to new pattern by using the command volttron-pkg init which creates a wrapper and then you can add the rest of the code to it .
@cyrus19901 note I just started some of it...please finish looking at it. |
I also recommend removing some hard coded constants and reviewing for Python style.
Thanks
On Oct 23, 2017, at 9:44 AM, Craig <[email protected]<mailto:[email protected]>> wrote:
@craig8 requested changes on this pull request.
________________________________
In pnnl/HEMSAgent/HEMS/HEMS_agent.py<https://github.com/VOLTTRON/volttron-applications/pull/52#discussion_r146325532>:
@@ -0,0 +1,440 @@
+import datetime
Please add copyright to the agent file.
Please rename HEMS_agent.py to simply agent.py and lowercase the hems folder as python packages should not be uppercase.
________________________________
In pnnl/HEMSAgent/HEMS/HEMS_agent.py<https://github.com/VOLTTRON/volttron-applications/pull/52#discussion_r146325951>:
+utils.setup_logging()
+_log = logging.getLogger(__name__)
+__version__ = '0.1'
+
+def DatetimeFromValue(ts):
+ ''' Utility for dealing with time
+ '''
+ if isinstance(ts, (int, long)):
+ return datetime.utcfromtimestamp(ts)
+ elif isinstance(ts, float):
+ return datetime.utcfromtimestamp(ts)
+ elif not isinstance(ts, datetime):
+ raise ValueError('Unknown timestamp value')
+ return ts
+
+def HEMS_agent(config_path, **kwargs):
This pattern uses the old volttron wrapper pattern. It should be updated to have the constructor be called from this function where the external agent is created and returned using the default parameters.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub<https://github.com/VOLTTRON/volttron-applications/pull/52#pullrequestreview-71251792>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AFmm8Y2FMuDW43TN8gw1PnbVX6cDGIhOks5svMJTgaJpZM4QBC29>.
|
"""Subscribe to appliance setpoint and change the data accordingly | ||
""" | ||
# Update energy reduction value | ||
self.P_total = message[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be self.P_total = message
_log.info('Unit {0:s} beta value changed to {1} at time {2} '.format(device, beta, str(datetime.datetime.now()))) | ||
|
||
# Re-conduct optimization problem with the updated beta values, only before energy reduction happens | ||
if (self.energyReduced == false) : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change the bool type to "False" instead of "false" . "false" does is case sensitive
device = topic.split("/")[-2] | ||
|
||
# Update device beta value | ||
beta = message[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should again be beta = message
raise ValueError('Unknown timestamp value') | ||
return ts | ||
|
||
def HEMS_agent(config_path, **kwargs): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can easily move to new pattern by using the command volttron-pkg init which creates a wrapper and then you can add the rest of the code to it .
…ppliance parameters and names for now
Thanks
On Oct 23, 2017, at 9:44 AM, Craig <[email protected]mailto:[email protected]> wrote:
@craig8 requested changes on this pull request.
In pnnl/HEMSAgent/HEMS/HEMS_agent.pyhttps://github.com/VOLTTRON/volttron-applications/pull/52#discussion_r146325532:
In pnnl/HEMSAgent/HEMS/HEMS_agent.pyhttps://github.com/VOLTTRON/volttron-applications/pull/52#discussion_r146325951:
+def DatetimeFromValue(ts):
+def HEMS_agent(config_path, **kwargs):
This pattern uses the old volttron wrapper pattern. It should be updated to have the constructor be called from this function where the external agent is created and returned using the default parameters.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHubhttps://github.com/VOLTTRON/volttron-applications/pull/52#pullrequestreview-71251792, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AFmm8Y2FMuDW43TN8gw1PnbVX6cDGIhOks5svMJTgaJpZM4QBC29.
Please rename HEMS_agent.py to simply agent.py and lowercase the hems folder as python packages should not be uppercase.
This change is