# Mathematical model of power quality disturbances

## Description

This file includes a Matlab/Octave function (pqmodel) that implements the power quality model found in “R.Igual, C.Medrano, F.J.Arcega, G.Mantescu; Integral mathematical model of power quality disturbances". This function generates distorted signals following an integral mathematical model based on several power quality models found in the literature. In this function 29 different classes of distortions are implemented: Class 1 - Pure sinusoidal / Class 2 – Sag / Class 3 – Swell / Class 4 – Interruption / Class 5 - Transient/Impulse/Spike / Class 6 - Oscillatory transient / Class 7 – Harmonics / Class 8 - Harmonics with Sag / Class 9 - Harmonics with Swell / Class 10 - Flicker / Class 11 - Flicker with Sag / Class 12 - Flicker with Swell / Class 13 - Sag with Oscillatory transient / Class 14 - Swell with Oscillatory transient / Class 15 - Sag with Harmonics / Class 16 - Swell with Harmonics / Class 17 – Notch / Class 18 - Harmonics with Sag with Flicker / Class 19 - Harmonics with Swell with Flicker / Class 20 - Sag with Harmonics with Flicker / Class 21 - Swell with Harmonics with Flicker / Class 22 - Sag with Harmonics with Oscillatory transient / Class 23 - Swell with Harmonics with Oscillatory transient / Class 24 - Harmonics with Sag with Oscillatory transient / Class 25 - Harmonics with Swell with Oscillatory transient / Class 26 - Harmonics with Sag with Flicker with Oscillatory transient / Class 27 - Harmonics with Swell with Flicker with Oscillatory transient / Class 28 - Sag with Harmonics with Flicker with Oscillatory transient / Class 29 - Swell with Harmonics with Flicker with Oscillatory transient This function is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation.

## Files

## Steps to reproduce

The function (pqmodel) contained in this file can be called from the Command Window of Matlab/Octave: out=pqmodel(ns, fs, f, n, A) Being: ns: Number of total signals/samples to generate of each class f: Sampling frequency of the signals fs: Fundamental frequency of the electrical signal n: Number of total cycles (periods) of the fundamental frequency contained in each simple A: Amplitude Use example: To call the function and generate disturbances, e.g.: out=pqmodel(10,16000,50,10,1); A representation of a particular data in the out matrix can be obtained then by typing, e.g.: plot(out(2,:,18)). In this case all points of the 2nd sample of the 18th class (Harmonics with Sag with Flicker) are represented.