<jupyter_start><jupyter_text>Lesson XX: Difference MessagesThis tutorial introduces what are Difference Messages and how they are used to control equipment__Learning Objectives:__At the end of the tutorial, the user should be able to* * *<jupyter_code># Establish connection to GridAPPS-D Platform:
from gridappsd import GridAPPSD, utils
gridappsd_conn = GridAPPSD(utils.get_gridappsd_simulation_id(), address=utils.get_gridappsd_address(),
          username=utils.get_gridappsd_user(), password=utils.get_gridappsd_pass())
simulation_id = utils.get_gridappsd_simulation_id()
username=utils.get_gridappsd_user()
print(simulation_id)
print(username)

simulation_id='497699800'

gridappsd_conn = GridAPPSD(simulation_id, address=utils.get_gridappsd_address(),
          username=utils.get_gridappsd_user(), password=utils.get_gridappsd_pass())
    
topic = "/topic/goss.gridappsd.simulation.input."+simulation_id
    
difference_message_open='{ "command": "update", "input": { "simulation_id": simulation_id, "message": { "timestamp": 1357048800, "difference_mrid": "123a456b-789c-012d-345e-678f901a235c", "reverse_differences": [{ "object": "_6C1FDA90-1F4E-4716-BC90-1CCB59A6D5A9", "attribute": "Switch.open", "value": 0 } ], "forward_differences": [{ "object": "_6C1FDA90-1F4E-4716-BC90-1CCB59A6D5A9", "attribute": "Switch.open", "value": 1 } ] } } }'
    
gridappsd_conn.send(topic,difference_message_open)
    
difference_message_open='{ "command": "update", "input": { "simulation_id": simulation_id, "message": { "timestamp": 1357048800, "difference_mrid": "123a456b-789c-012d-345e-678f901a235c", "reverse_differences": [{ "object": "_6C1FDA90-1F4E-4716-BC90-1CCB59A6D5A9", "attribute": "Switch.open", "value": 0 } ], "forward_differences": [{ "object": "_6C1FDA90-1F4E-4716-BC90-1CCB59A6D5A9", "attribute": "Switch.open", "value": 1 } ] } } }'<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14688664183076106, 'fraction_numerical': 0.08142629058009579, 'mean_word_length': 7.392857142857143, 'pattern_counts': {'":': 28, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '136744', 'license': 'BSD-2-Clause', 'n_tokens_mistral': 775, 'n_tokens_neox': 694, 'n_words': 111, 'path': 'Lesson 3.XX. - Difference Messages.ipynb', 'repo_name': 'afisher1/gridappsd-hackathon', 'size': '1879'}