Package: openpy-dsse
OpenPY_DSSEIt is an open-source library developed in Python for estimating distribution networks (DSSE). It communicates with the free software for the simulation of electrical networks (OpenDSS) and collects the results of power flow and distribution system parameters and executes the DSSE, obtaining an estimated state according to the type and location of measurements.It is developed within the framework of theOpenREiDproject (Integral software for simulation and optimization of electrical distribution networks), of theInstituto de Energía Eléctrica (IEE), UNSJ - CONICET, San Juan - Argentina.IndexWeighted Least SquaresInstallationHow to useMeasurementsDefinition and creation of metersGenerate metrics from OpenDSS resultsRun the state estimation algorithmSample testsLicenseWeighted Least Squares (WLS)The library uses a hybrid weighted least squares algorithm that incorporates traditional and D-PMU measurements. It supports single-phase and multiphase networks that are modeled as electromagnetically decoupled positive sequence impedances. More details can be found indocs/methodologyInstallationWith pippip install py-open-dsseWithout pip, clone or download the repository, in the dist folder is the .whl file, copy the location of the file, and in the CMD:pip install {path-save-files}/openpy_dsse-{version}-py3-none-any.whl’How to useFirst, in the IDE (Integrated Development Environment) of preference, we import the library:importopenpy_dsseThe object class that contains all the functions of the library is activated as follows:dsse=openpy_dsse.init_DSSE()The classinit_DSSE(), has default values as shown in table 1 and can be modified as appropriate.Table 1.Description and attributes of functioninit_DSSE()ParametersDescriptionDefault valueSbas3ph_MVAThree-phase system base power30toleranceConvergence tolerance of selected algorithm1e-3max_iterMaximum number of iterations of the selected algorithm30init_valuesInitial values for state estimation. Withflatstart with 1.0 p.u. / 0° on all buses and withdssstart with OpenDSS voltage and angle resultsflatOnce the class is initialized, we can use the functions described below.MeasurementsDefinition and creation of metersThe library supports meters and their respective error variance described in Table 2.Table 2.Measurement type of theopenpy_dsselibrary.MeterDescription$\left|V_{i}\right|$Node voltage magnitude.$PQ_{ft}$Branch power flow$\left|I_{ft}\right|$Magnitude of branch current.$PQ_{i}^{SM}$Injection power or node consumption obtained by a smart meter$PQ_{i}^{0}$Passive node or zero injection power.$PQ_{i}^{PSD}$Artificial node injection power known as pseudo-measurement$\left|V_{i}\right|\angle \theta$Voltage phasor measurement$\left|I_{ft}\right|\angle \delta$Current phasor measurementThe measurement data per phase𝜌 (1, 2, 3)and measurement error varianceRiiof a network modeled in OpenDSS. They must be entered in theMEAS_Bus_i.json,MEAS_Elem_ft.json,MEAS_Bus_i_PMU.jsonandMEAS_Elem_ft_PMU.jsonfiles. The.jsonmeasurement files without data are generated with theempty_MEAS_files()function and the parameters from table 3 must be entered.Table 3.Parameters and description ofempty_file_MEAS()functionParameterDescriptionDefault valueDSS_pathA path of the.DSSfiles of the circuit modeled in OpenDSSNoneMEAS_path_savePath where the measurement.jsonfiles will be savedNoneThe description of the identifiers that can be modified is detailed in tables 4, 5, 6, and 7. The other identifiers in the.jsonfiles, are node characteristics or elements extracted from the circuit modeled in OpenDSS, these data should not be modified since they would affect the result of the state estimation algorithm.Table 4.Description of identifiers of theMEAS_Bus_i.jsonfile.IdentifierDescriptionSTS_VmStatus (1: Enabled, 0: Disabled)Rii_VmVariance of voltage magnitude measurement error.Vρm(pu)Measurement of voltage magnitude voltage in phase 𝜌.STS_PQd(SM)Status (1: Enabled, 0: Disabled)Rii_SMMeasurement error variance of injection power or consumption of a smart meter.STS_PQd(0)Status (1: Enabled, 0: Disabled)Rii_0Zero or passive injection power measurement error variance.STS_PQd(Psd)Status (1: Enabled, 0: Disabled)Rii_PsdMeasurement error variance of pseudo power injection measurementPρmd(pu)Measurement of active power injection in phase 𝜌.Qρmd(pu)Measurement of reactive power injection in phase 𝜌.Table 5.Description of identifiers of theMEAS_Elem_ft.jsonfile.IdentifierDescriptionSTS_PQftStatus (1: Enabled, 0: Disabled)Rii_PQftBranch power flow measurement error variance.Pρmft(pu)Measurement of branch active power in phase 𝜌.Qρmft(pu)Measurement of branch reactive power in phase 𝜌.STS_IftStatus (1: Enabled, 0: Disabled)Rii_IftBranch current magnitude error variance.Iρmft(pu)Measurement of branch current magnitude in phase 𝜌.Table 6.Description of identifiers of theMEAS_Elem_ft_PMU.jsonfile.IdentifierDescriptionSTS_VmStatus (1: Enabled, 0: Disabled)Rii_VmVariance of voltage phasor measurement errorVρm(pu)Measurement of voltage magnitude in phase 𝜌Angρm(deg)Measurement of volage angle in phase 𝜌Table 7.Description of identifiers of theMEAS_Elem_ft_PMU.jsonfile.IdentifierDescriptionSTS_IftStatus (1: Enabled, 0: Disabled)Rii_IftVariance of current phasor measurement errorIρmft(pu)Measurement of current magnitude in phase 𝜌Angρm(deg)Measurement of current angle in phase 𝜌Generate metrics from OpenDSS resultsInitial measurements with uncertainty of measurement errorTheempty_init_files_MEAS_Unc()function generates.jsonfiles where all the nodes and elements that can participate as measurement in the state estimation algorithm are placed. For this purpose, the parameters of table 8 must be specified.Table 8.Parameters and description ofempty_file_MEAS()functionParametersDescriptionDefault valueDSS_pathA path of the.DSSfiles of the circuit modeled in OpenDSSNoneMEAS_path_savePath where the measurement.jsonfiles will be savedNoneIn theMEAS_path_savepath, it generates the filesInit_Bus_i.json,Init_Elem_ft.json,Init_Bus_i_PMU.jsonandInit_Elem_ft_PMU.json. Depending on the case study, theSTSmeter status (1: Enabled, 0: Disabled) and the measurement error rate inUnc(%)can be modified.Adding random errors and generating measurement filesWith the.jsonfiles generated by theempty_file_MEAS()function and the changes indicated by the user, with theadd_error_file_MEAS()function and the Parameters described in Table 9.Table 9.Description and attributes of functionadd_error_files_MEAS()ParametersDescriptionDefault valueDSS_pathA path of the.DSSfiles of the circuit modeled in OpenDSSNoneMEAS_pathPath of initial.jsonfilesNoneseed_DSRandom error generation seed1Adds random errors from a normal distribution to the OpenDSS power flow results, for use as a measurement. The result of generating random errors is contained in the filesMEAS_Bus_i.json,MEAS_Elem_ft.json,MEAS_Bus_i_PMU.jsonandMEAS_Elem_ft_PMU.json, stored inMEAS_path.Run the state estimation algorithmTo run the state estimation algorithm, functionestimate()is called, it is necessary to enter or change parameters detailed in table 10.Table 10.Parameters and description ofestimate()functionParametersDescriptionDefault valueDSS_pathA path of the.DSSfiles of the circuit modeled in OpenDSS.NoneMEAS_pathPath where measurement files are located.Nonepath_savePath where the results will be savedNoneTyp_cirCircuit type, can be1phorPos.NoneALGType of algorithm state variables. At the momentNVNVcoordType of coordinates to solve. For the momentpolar.PolarmethodSolution method, can benonlinear,linear_PMUandnonlinear_PMU.nonlinear_PMUname_projectProject nameDefaultView_resDisplays the result of the selected algorithm by consoleFalseDSS_collDisplays next to the estimated status, the actual status according to OpenDSSFalsesummaryDisplays a summary of the simulation by consoleFalseMEAS_PosTrueif it is aPoscircuit, take the.jsonfiles in positive sequence.FalseSample testsIn the path:{Python_library_path}/openpy_dsse/examples, the.DSSand.jsonfiles of single-phase (1ph) and positive sequence equivalent (Pos) circuit measurements detailed in Table 11 are located.Table 11.Sample testsCircuitTpy_circCase4Node1ph115NodeIEEE1ph213NodeIEEEPos137NodeIEEEPos2The functiontest_circuit(Typ_cir, case), returns a dictionary with the keys'DSS_file','MEAS_path','save_path','name_project'and'Typ_cir'which correspond to the.DSSfile path, measurement file path, path where results will be saved and circuit type respectively.importopenpy_dssedsse=openpy_dsse.init_DSSE()#Start the class.if__name__=='__main__':net=dsse.test_circuit(Typ_cir='1ph',case=1)#dsse.empty_init_files_MEAS_Unc(DSS_path=net['DSS_file'], MEAS_path=net['MEAS_path'])#dsse.add_error_files_MEAS(DSS_path=net['DSS_file'], MEAS_path=net['MEAS_path'])#dsse.empty_MEAS_files(DSS_path=net['DSS_file'], MEAS_path=net['MEAS_path'])#execute the state estimation algorithmResults=dsse.estimate(DSS_path=net['DSS_file'],MEAS_path=net['MEAS_path'],path_save=net['save_path'],Typ_cir=net['Typ_cir'],name_project=net['name_project'],View_res=True,summary=True,DSS_coll=True,#MEAS_Pos=True,#method='nonlinear'#method='linear_PMU',)LicenseLicense: CC BY-NC-SA 4.0This work has a licenseCreative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.