Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
{
"expectedResults": {
"output": {
"1248156002": {
"simulation_id": "559402036",
"message": {
"timestamp": 1248156002,
"measurements": [
{
"measurement_mrid": "_000b01a1-8238-4372-95c0-82aad26ea311",
"angle": -5.066423674487563,
"magnitude": 2388.676720682955,
"simulation_id": "1961648576",
"time": 1248156002},
{
"measurement_mrid": "_00347396-b4b0-4218-9aba-b363f2cda841",
"angle": 118.66041090126667,
"magnitude": 2425.4464236409276,
"simulation_id": "1961648576",
"time": 1248156002},
{
"measurement_mrid": "_0044ae64-1c72-4e81-b412-d7349ce267d3",
"angle": -38.44540074843378,
"magnitude": 374545.4981119089,
"simulation_id": "1961648576",
"time": 1248156002}
]
}
}
},
"input": {
"1248156016": {
"simulation_id": "559402036",
"message": {
"timestamp": 1248156016,
"measurements": [
{"hasMeasurementDifference": "FORWARD",
"difference_mrid": "1fae379c-d0e2-4c80-8f2c-c5d7a70ff4d4",
"simulation_id": "1961648576",
"time": 1248156016,
"attribute": "ShuntCompensator.sections",
"value": 1.0,
"object": "_939CA567-AA3D-4972-AABC-1D0AAF4859FE"},
{"hasMeasurementDifference": "REVERSE",
"difference_mrid": "1fae379c-d0e2-4c80-8f2c-c5d7a70ff4d4",
"simulation_id": "1961648576",
"time": 1248156016,
"attribute": "ShuntCompensator.sections",
"value": 0.0,
"object": "_939CA567-AA3D-4972-AABC-1D0AAF4859FE"}
]
}
},
"1248156029": {
"simulation_id": "559402036",
"message": {
"timestamp": 1248156029,
"measurements": [
{"hasMeasurementDifference": "FORWARD",
"difference_mrid": "1fae379c-d0e2-4c80-8f2c-c5d7a70ff4d4",
"simulation_id": "1961648576",
"time": 1248156029,
"attribute": "ShuntCompensator.sections",
"value": 0.0,
"object": "_939CA567-AA3D-4972-AABC-1D0AAF4859FE"},
{"hasMeasurementDifference": "REVERSE",
"difference_mrid": "1fae379c-d0e2-4c80-8f2c-c5d7a70ff4d4",
"simulation_id": "1961648576",
"time": 1248156029,
"attribute": "ShuntCompensator.sections",
"value": 1.0,
"object": "_939CA567-AA3D-4972-AABC-1D0AAF4859FE"},
{"hasMeasurementDifference": "FORWARD",
"difference_mrid": "1fae379c-d0e2-4c80-8f2c-c5d7a70ff4d4",
"simulation_id": "1961648576",
"time": 1248156029,
"attribute": "ShuntCompensator.sections",
"value": 0.0,
"object": "_only_in_expected_MRID_time_does_not_matches"},
{"hasMeasurementDifference": "REVERSE",
"difference_mrid": "1fae379c-d0e2-4c80-8f2c-c5d7a70ff4d4",
"simulation_id": "1961648576",
"time": 1248156029,
"attribute": "ShuntCompensator.sections",
"value": 1.0,
"object": "_only_in_expected_MRID_time_does_not_matches"}
]
}
},

"27": {
"simulation_id": "559402036",
"message": {
"timestamp": 1587670665,
"measurements": [
{"hasMeasurementDifference": "FORWARD",
"difference_mrid": "1fae379c-d0e2-4c80-8f2c-c5d7a70ff4d4",
"simulation_id": "1961648576",
"time": 1587670665,
"attribute": "ShuntCompensator.sections",
"value": 0.0,
"object": "_939CA567-AA3D-4972-AABC-1D0AAF4859FE"},
{"hasMeasurementDifference": "REVERSE",
"difference_mrid": "1fae379c-d0e2-4c80-8f2c-c5d7a70ff4d4",
"simulation_id": "1961648576",
"time": 1587670665,
"attribute": "ShuntCompensator.sections",
"value": 1.0,
"object": "_939CA567-AA3D-4972-AABC-1D0AAF4859FE"}
]
}
},
"1248156044": {
"simulation_id": "559402036",
"message": {
"timestamp": 1248156044,
"measurements": [
{"hasMeasurementDifference": "FORWARD",
"difference_mrid": "1fae379c-d0e2-4c80-8f2c-c5d7a70ff4d4",
"simulation_id": "1961648576",
"time": 1248156044,
"attribute": "ShuntCompensator.sections",
"value": 0.0,
"object": "_939CA567-AA3D-4972-AABC-1D0AAF4859FE"},
{"hasMeasurementDifference": "REVERSE",
"difference_mrid": "1fae379c-d0e2-4c80-8f2c-c5d7a70ff4d4",
"simulation_id": "1961648576",
"time": 1248156044,
"attribute": "ShuntCompensator.sections",
"value": 1.0,
"object": "_939CA567-AA3D-4972-AABC-1D0AAF4859FE"}
]
}
}
}
}
}


124 changes: 124 additions & 0 deletions expected_results/expected_result_series_filtered_9500.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
{
"expectedResults": {
"output": {
"1248156002": {
"simulation_id": "559402036",
"message": {
"timestamp": 1535574871,
"measurements": [
{
"measurement_mrid": "_00064508-231d-407d-b492-e85dc0d97c15",
"angle": -5.066423674487563,
"magnitude": 2361.0733024639117,
"simulation_id": "1961648576",
"time": 1248156002},
{
"measurement_mrid": "_0009930b-245c-47ee-a1cb-277c5519923b",
"angle": -122.80107769837849,
"magnitude": 2520.2169329056983,
"simulation_id": "1961648576",
"time": 1248156002},
{
"measurement_mrid": "_0010732c-c37a-4459-947b-423e1f28a76a",
"angle": -122.70461031091335,
"magnitude": 2522.818525429715,
"simulation_id": "1961648576",
"time": 1248156002}
]
}
}
},
"input": {
"0": {
"simulation_id": "559402036",
"message": {
"timestamp": 1587670650,
"measurements": [
{"hasMeasurementDifference": "FORWARD",
"difference_mrid": "1fae379c-d0e2-4c80-8f2c-c5d7a70ff4d4",
"simulation_id": "1961648576",
"time": 1587670650,
"attribute": "ShuntCompensator.sections",
"value": 1,
"object": "_F73D0A88-C00D-42A2-820B-A8C0A2B899AB"},
{"hasMeasurementDifference": "REVERSE",
"difference_mrid": "1fae379c-d0e2-4c80-8f2c-c5d7a70ff4d4",
"simulation_id": "1961648576",
"time": 1587670650,
"attribute": "ShuntCompensator.sections",
"value": 0,
"object": "_F73D0A88-C00D-42A2-820B-A8C0A2B899AB"}
]
}
},
"16": {
"simulation_id": "559402036",
"message": {
"timestamp": 1587670665,
"measurements": [
{"hasMeasurementDifference": "FORWARD",
"difference_mrid": "1fae379c-d0e2-4c80-8f2c-c5d7a70ff4d4",
"simulation_id": "1961648576",
"time": 1587670665,
"attribute": "ShuntCompensator.sections",
"value": 0,
"object": "_F73D0A88-C00D-42A2-820B-A8C0A2B899AB"},
{"hasMeasurementDifference": "REVERSE",
"difference_mrid": "1fae379c-d0e2-4c80-8f2c-c5d7a70ff4d4",
"simulation_id": "1961648576",
"time": 1587670665,
"attribute": "ShuntCompensator.sections",
"value": 1,
"object": "_F73D0A88-C00D-42A2-820B-A8C0A2B899AB"}
]
}
},
"27": {
"simulation_id": "559402036",
"message": {
"timestamp": 1587670665,
"measurements": [
{"hasMeasurementDifference": "FORWARD",
"difference_mrid": "1fae379c-d0e2-4c80-8f2c-c5d7a70ff4d4",
"simulation_id": "1961648576",
"time": 1587670665,
"attribute": "ShuntCompensator.sections",
"value": 0,
"object": "_F73D0A88-C00D-42A2-820B-A8C0A2B899AB"},
{"hasMeasurementDifference": "REVERSE",
"difference_mrid": "1fae379c-d0e2-4c80-8f2c-c5d7a70ff4d4",
"simulation_id": "1961648576",
"time": 1587670665,
"attribute": "ShuntCompensator.sections",
"value": 1,
"object": "_F73D0A88-C00D-42A2-820B-A8C0A2B899AB"}
]
}
},
"32": {
"simulation_id": "559402036",
"message": {
"timestamp": 1587670665,
"measurements": [
{"hasMeasurementDifference": "FORWARD",
"difference_mrid": "1fae379c-d0e2-4c80-8f2c-c5d7a70ff4d4",
"simulation_id": "1961648576",
"time": 1587670665,
"attribute": "ShuntCompensator.sections",
"value": 0,
"object": "_F73D0A88-C00D-42A2-820B-A8C0A2B899AB"},
{"hasMeasurementDifference": "REVERSE",
"difference_mrid": "1fae379c-d0e2-4c80-8f2c-c5d7a70ff4d4",
"simulation_id": "1961648576",
"time": 1587670665,
"attribute": "ShuntCompensator.sections",
"value": 1,
"object": "_F73D0A88-C00D-42A2-820B-A8C0A2B899AB"}
]
}
}
}
}
}


94 changes: 94 additions & 0 deletions expected_results/request_test_expected_vs_running.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
import json
import time
import os
import argparse
from gridappsd import GOSS
import random
goss_sim = "goss.gridappsd.process.request.simulation"
test_topic = 'goss.gridappsd.test'
responseQueueTopic = '/temp-queue/response-queue'
goss_simulation_status_topic = '/topic/goss.gridappsd/simulation/status/'

def start_test(app_name='sample_app', testOutput=True, start_time='1248156000',duration='60',feeder_name='_C1C3E687-6FFD-C753-582B-632A27E28507',expected_file="expected_result_series_filtered_123_normal_small_4.json"):
loc = os.path.realpath(__file__)
loc = os.path.dirname(loc)
print(loc)

events = [{
"message": {
"forward_differences": [
{
"object": "_307E4291-5FEA-4388-B2E0-2B3D22FE8183",
"attribute": "ShuntCompensator.sections",
"value": "0"
}
],
"reverse_differences": [
{
"object": "_307E4291-5FEA-4388-B2E0-2B3D22FE8183",
"attribute": "ShuntCompensator.sections",
"value": "1"
}
]
},
"event_type": "ScheduledCommandEvent",
"occuredDateTime": 1248156002 + 6,
"stopDateTime": 1248156002 + 21
}]

test_id = str(random.getrandbits(32))
testCfgAll = {
"appId": "sample_app",
"testId": str(test_id),
"testOutput": testOutput,
}

# with open("expected_result_series_filtered_9500.json") as f:
with open(os.path.join(loc, expected_file)) as f:
expectedJson = json.load(f)

testCfgAll['expectedResults'] = expectedJson['expectedResults']
print(json.dumps(testCfgAll,indent=2))
# exit(0)
# testCfgAll['events'] = events

req_template = {"power_system_config":{"SubGeographicalRegion_name":"_1CD7D2EE-3C91-3248-5662-A43EFEFAC224","GeographicalRegion_name":"_24809814-4EC6-29D2-B509-7F8BFB646437","Line_name":"_C1C3E687-6FFD-C753-582B-632A27E28507"},"simulation_config":{"power_flow_solver_method":"NR","duration":120,"simulation_name":"ieee123","simulator":"GridLAB-D","start_time":1248156000,"run_realtime":True,"simulation_output":{},"model_creation_config":{"load_scaling_factor":1.0,"triplex":"y","encoding":"u","system_frequency":60,"voltage_multiplier":1.0,"power_unit_conversion":1.0,"unique_names":"y","schedule_name":"ieeezipload","z_fraction":0.0,"i_fraction":1.0,"p_fraction":0.0,"randomize_zipload_fractions":False,"use_houses":False},"simulation_broker_port":52798,"simulation_broker_location":"127.0.0.1"},"application_config":{"applications":[{"name":"sample_app","config_string":""}]},"simulation_request_type":"NEW"}
req_template['simulation_config']['start_time'] = start_time
req_template['simulation_config']['duration'] = duration
req_template['power_system_config']['Line_name'] = feeder_name #'_C1C3E687-6FFD-C753-582B-632A27E28507' # IEEE 123
# req_template['power_system_config']['Line_name'] = '_AAE94E4A-2465-6F5E-37B1-3E72183A4E44' # test9500new

req_template["application_config"]["applications"][0]['name'] = app_name
# req_template["application_config"]["applications"][0]['name'] = 'sample_app_opp'

testCfgAll['start_time'] = req_template['simulation_config']['start_time']
testCfgAll['duration'] = req_template['simulation_config']['duration']
req_template['test_config'] = testCfgAll

simCfg13pv = json.dumps(req_template)

print("request")
print(json.dumps(req_template,indent=2))
# exit(0)
username = "app_user"
password = "1234App"
goss = GOSS(username=username, password=password)
goss.connect()

simulationId = goss.get_response(goss_sim, simCfg13pv, timeout=10)
print('sent simulation request')
print('simulation id ', simulationId)

return(simulationId['simulationId'],test_id)

if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("-t","--topic", type=str, help="topic, the default is input", default="input", required=False)
parser.add_argument("-p","--port", type=int, help="port number, the default is 5000", default=5000, required=False)
parser.add_argument("-i", "--id", type=int, help="simulation id", required=False)
# parser.add_argument("--start_date", type=str, help="Simulation start date", default="2017-07-21 12:00:00", required=False)
# parser.add_argument("--end_date", type=str, help="Simulation end date" , default="2017-07-22 12:00:00", required=False)
# parser.add_argument('-o', '--options', type=str, default='{}')
args = parser.parse_args()

start_test()
Loading