From 5ed303bbba7f3801d968cbb5c08df883f3d52fd3 Mon Sep 17 00:00:00 2001 From: Junjie Zhang Date: Mon, 5 Nov 2018 13:03:40 +0100 Subject: [PATCH] script for comparing dpsim and neplan on WSCC9bus power flow --- .gitignore | 6 ++- .vscode/settings.json | 3 -- .../compare_neplan_dpsim_WSCC9bus.py | 51 +++++++++++++++++++ 3 files changed, 56 insertions(+), 4 deletions(-) delete mode 100644 .vscode/settings.json create mode 100644 examples/compareresults/compare_neplan_dpsim_WSCC9bus.py diff --git a/.gitignore b/.gitignore index ac7199b..1d4deb9 100644 --- a/.gitignore +++ b/.gitignore @@ -36,4 +36,8 @@ __pycache__ # ignore jupyter notebook files .ipynb_checkpoints -.eggs \ No newline at end of file +.eggs + +#IDEs +.vscode +.json \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index f7c1a80..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "python.pythonPath": "D:\\Anaconda3\\python.exe" -} \ No newline at end of file diff --git a/examples/compareresults/compare_neplan_dpsim_WSCC9bus.py b/examples/compareresults/compare_neplan_dpsim_WSCC9bus.py new file mode 100644 index 0000000..cc9a562 --- /dev/null +++ b/examples/compareresults/compare_neplan_dpsim_WSCC9bus.py @@ -0,0 +1,51 @@ +from villas.dataprocessing.readtools import * +from villas.dataprocessing.timeseries import * +import villas.dataprocessing.validationtools as validationtools + +# reference rtf data directory +file=r"..\..\..\reference-results\Neplan\ReferenceGrids\WSCC-09_RX.rlf" + +# Read in NEPLAN data + +print('************************ Test for read in all variable start ****************') +ts_NEPLAN = read_timeseries_NEPLAN_loadflow(file) +for i in range(len(ts_NEPLAN)): + print('%s is %s' % (ts_NEPLAN[i].name, ts_NEPLAN[i].values)) # result as list of TimeSeries +print('************************ Test for read in all variable end ****************') +print('\n') + +# Read in CIM powerflow data + +path = '..\\..\\..\\..\\dpsim_jzh_pfinteg\\dpsim\\build\\Dependencies\\fpotencia\\src\\test\\Logs\\' +logName = 'WSCC-09_Neplan'; +dataType = '.csv'; +logFilename = path + logName + dataType; +ts_dpsim = read_timeseries_csv(logFilename) +for ts,values in ts_dpsim.items(): + ts_abs = values.abs(ts + '.Vpp') + ts_phase = values.phase(ts + '.Vangle') + print(ts_abs.name + ': ' + str(ts_abs.values) + '\n' +ts_phase.name+' :'+ str(ts_phase.values)) + +# compare CIM-pf data with NEPLAN +net_name='WSCC-9bus' +threshold=0.5 +print('************************ convert neplan to modelica start ****************') +res_ref=validationtools.convert_neplan_to_modelica_timeseries(ts_NEPLAN) +for i in range(len(res_ref)): + print(res_ref[i].name) + print(res_ref[i].values) +print('************************ convert neplan to modelica end ****************') + + +print('************************ convert dpsim to modelica start ****************') + +ts_dpsimList=validationtools.convert_dpsim_to_modelica_timeseries(ts_dpsim) +for i in range(len(ts_dpsimList)): + print(ts_dpsimList[i].name) + print(ts_dpsimList[i].values) +print('************************ convert dpsim to modelica end ****************') + + +res_err=validationtools.compare_timeseries(res_ref,ts_dpsimList) +validationtools.assert_modelia_results(net_name,res_err,threshold) + -- GitLab