Skip to content

Commit

Permalink
Merge pull request lbl-srg#90 from lbl-srg/issue85_verification_spec
Browse files Browse the repository at this point in the history
request to merge cdl verification tool to master
  • Loading branch information
mwetter authored Mar 15, 2021
2 parents bd2eae1 + d401727 commit 3c277cd
Show file tree
Hide file tree
Showing 6 changed files with 24,443 additions and 17 deletions.
33 changes: 33 additions & 0 deletions software/verification/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"references": [
{
"model": "Buildings.Controls.OBC.ASHRAE.G36_PR1.AHUs.SingleZone.VAV.SetPoints.Validation.Supply_u",
"sequence": "setPoiVAV",
"pointNameMapping": "realControllerPointMapping.json",
"run_controller": false,
"controller_output": "test/real_outputs.csv"
},
{
"model": "Buildings.Controls.OBC.ASHRAE.G36_PR1.TerminalUnits.SetPoints.Validation.ZoneTemperatures",
"sequence": "TZonSet",
"pointNameMapping": "realControllerPointMapping.json",
"run_controller": true,
"controller_output": "test/real_outputs.csv",
"outputs": {
"TZonSet.TZon*": { "atoly": 0.5 }
},
"indicators": {
"TZonSet.TZon*": [ "uOccSen" ]
},
"sampling": 60
}
],
"modelJsonDirectory": "test",
"tolerances": { "rtolx": 0.002, "rtoly": 0.002, "atolx": 10, "atoly": 0 },
"sampling": 120,
"controller": {
"network_address": "192.168.0.115/24",
"device_address": "192.168.0.227",
"device_id": 240001
}
}
117 changes: 117 additions & 0 deletions software/verification/plotter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
from plotly.offline import init_notebook_mode, iplot
from plotly import graph_objects as go


def verification_plot(output_folder, plot_filename, y_label='Value'):

data_ref = pd.read_csv(output_folder+'/reference.csv', index_col=0)
data_test = pd.read_csv(output_folder+'/test.csv', index_col=0)
data_err = pd.read_csv(output_folder+'/errors.csv', index_col=0)
data_low = pd.read_csv(output_folder+'/lowerBound.csv', index_col=0)
data_upp = pd.read_csv(output_folder+'/upperBound.csv', index_col=0)

data = [
go.Scatter(
x=data_err.index.values,
y=data_err.y.values,
name='Error',
xaxis='x',
yaxis='y2',
line={'width': 5}
),
go.Scatter(
x=data_test.index.values,
y=data_test.y.values,
name='Controller Output',
line={'width': 5}
),
go.Scatter(
x=data_low.index.values,
y=data_low.y.values,
showlegend=False,
mode= 'lines',
line={'width': 0}
),
go.Scatter(
x=data_ref.index.values,
y=data_ref.y.values,
name='CDL Reference Output',
fillcolor='rgba(68, 68, 68, 0.3)',
fill='tonexty',
line={'width': 5}
),
go.Scatter(
x=data_upp.index.values,
y=data_upp.y.values,
fillcolor='rgba(68, 68, 68, 0.3)',
fill='tonexty',
showlegend=False,
mode= 'lines',
line={'width': 0}
)
]

layout = go.Layout(
legend={
'font': {
'size':24
},
'yanchor': 'top',
'y': 1.1,
'xanchor': 'right',
'x': 0.95
},
grid={
'rows': 2,
'columns': 1,
# 'subplots': [['xy1'], ['xy2']]
},
xaxis1={
'ticks': 'outside',
'showline': True,
'zeroline': False,
'title': 'time [seconds]',
'anchor': 'y1',
'tickfont': {
'size': 24,
},
'titlefont': {
'size': 24
},
},
yaxis1= {
'automargin': True,
'domain': [0.3, 1],
'ticks': 'outside',
'showline': True,
'zeroline': False,
'title': {
'text': y_label,
},
'tickfont': {
'size': 24,
},
'titlefont': {
'size': 24
},
},
yaxis2= {
'automargin': True,
'domain': [0, 0.15],
'ticks': 'outside',
'showline': True,
'zeroline': False,
'title': 'error [y]',
'tickfont': {
'size': 24,
},
'titlefont': {
'size': 24
},
},
height=750,
width=1200,
template='plotly_white'
)
fig = go.Figure(data=data, layout=layout)
fig.write_image(plot_filename)
42 changes: 42 additions & 0 deletions software/verification/realControllerPointMapping.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
[
{
"cdl": {"name": "TZonCooSetOcc", "unit": "K", "type": "float"},
"device": {"name": "Occupied Cooling Setpoint_1", "unit": "degF", "type": "float"}
},
{
"cdl": {"name": "TZonHeaSetOcc", "unit": "K", "type": "float"},
"device": {"name": "Occupied Heating Setpoint_1", "unit": "degF", "type": "float"}
},
{
"cdl": {"name": "TZonCooSetUno", "unit": "K", "type": "float"},
"device": {"name": "Unoccupied Cooling Setpoint_1", "unit": "degF", "type": "float"}
},
{
"cdl": {"name": "TZonHeaSetUno", "unit": "K", "type": "float"},
"device": {"name": "Unoccupied Heating Setpoint_1", "unit": "degF", "type": "float"}
},
{
"cdl": {"name": "setAdj", "unit": "K", "type": "float"},
"device": {"name": "setpt_adj_1", "unit": "degF", "type": "float"}
},
{
"cdl": {"name": "heaSetAdj", "unit": "K", "type": "float"},
"device": {"name": "Heating Adjustment_1", "unit": "degF", "type": "float"}
},
{
"cdl": {"name": "uOccSen", "type": "int"},
"device": {"name": "occ_sensor_bni_1", "type": "bool"}
},
{
"cdl": {"name": "uWinSta", "type": "int"},
"device": {"name": "window_sw_1", "type": "bool"}
},
{
"cdl": {"name": "TZonCooSet", "unit": "K", "type": "float"},
"device": {"name": "Effective Cooling Setpoint_1", "unit": "degF", "type": "float"}
},
{
"cdl": {"name": "TZonHeaSet", "unit": "K", "type": "float"},
"device": {"name": "Effective Heating Setpoint_1", "unit": "degF", "type": "float"}
}
]
Loading

0 comments on commit 3c277cd

Please sign in to comment.