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

Initial HEMS agent implementation #52

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

YingyingTang111
Copy link

@YingyingTang111 YingyingTang111 commented Oct 20, 2017



In pnnl/HEMSAgent/HEMS/HEMS_agent.pyhttps://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.pyhttps://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 GitHubhttps://github.com/VOLTTRON/volttron-applications/pull/52#pullrequestreview-71251792, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AFmm8Y2FMuDW43TN8gw1PnbVX6cDGIhOks5svMJTgaJpZM4QBC29.

  


This change is Reviewable






@craig8
Copy link
Contributor

craig8 commented Oct 23, 2017

@cyrus19901 I think you are the one most affected by this..please review...

@@ -0,0 +1,440 @@
import datetime
Copy link
Contributor

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):
Copy link
Contributor

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.

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 .

@craig8
Copy link
Contributor

craig8 commented Oct 23, 2017

@cyrus19901 note I just started some of it...please finish looking at it.

@fstshrk
Copy link

fstshrk commented Oct 23, 2017 via email

"""Subscribe to appliance setpoint and change the data accordingly
"""
# Update energy reduction value
self.P_total = message[0]

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) :

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]

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):

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 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants