From dd5141481c692e27cc5ec49a52f4762d27ebbd31 Mon Sep 17 00:00:00 2001 From: Tin Rabuzin Date: Fri, 27 Nov 2015 10:32:26 +0100 Subject: [PATCH] Rolling back Eurostar machine models for issue #15 --- .../Machines/Eurostag/DYNModelM1S_INIT.mo | 869 ++++++++-------- .../Machines/Eurostag/DYNModelM2S_INIT.mo | 935 +++++++++--------- .../Machines/Eurostag/PwExtIntParameters.mo | 235 +++-- .../Machines/Eurostag/PwGenerator.mo | 255 +++-- .../Machines/Eurostag/PwGeneratorM1S.mo | 534 +++++----- .../Machines/Eurostag/PwGeneratorM2S.mo | 584 ++++++----- .../Machines/Eurostag/PwMachineM10.mo | 346 +++---- .../Machines/Eurostag/package.order | 14 +- 8 files changed, 1878 insertions(+), 1894 deletions(-) diff --git a/iPSL/Electrical/Machines/Eurostag/DYNModelM1S_INIT.mo b/iPSL/Electrical/Machines/Eurostag/DYNModelM1S_INIT.mo index 0619b9c37..c328bcc3a 100644 --- a/iPSL/Electrical/Machines/Eurostag/DYNModelM1S_INIT.mo +++ b/iPSL/Electrical/Machines/Eurostag/DYNModelM1S_INIT.mo @@ -1,409 +1,460 @@ -within iPSL.Electrical.Machines.Eurostag; -model DYNModelM1S_INIT "Initialization model for synchronous mahine M1S. - Developed by RTE and adapted by AIA. 2014/03/10" - - Modelica.Blocks.Interfaces.RealInput pin_CM; - Modelica.Blocks.Interfaces.RealInput pin_EFD; - Modelica.Blocks.Interfaces.RealOutput pin_LAMBDAF; - Modelica.Blocks.Interfaces.RealOutput pin_LAMBDAD; - Modelica.Blocks.Interfaces.RealOutput pin_LAMBDAQ1; - Modelica.Blocks.Interfaces.RealOutput pin_LAMBDAQ2; - Modelica.Blocks.Interfaces.RealOutput pin_LAMBDAAD; - Modelica.Blocks.Interfaces.RealOutput pin_LAMBDAAQ; - Modelica.Blocks.Interfaces.RealOutput pin_OMEGA; - Modelica.Blocks.Interfaces.RealOutput pin_TETA; - Modelica.Blocks.Interfaces.RealOutput pin_IQ; - Modelica.Blocks.Interfaces.RealOutput pin_ID; - Modelica.Blocks.Interfaces.RealOutput pin_UR; - Modelica.Blocks.Interfaces.RealOutput pin_UI; - Modelica.Blocks.Interfaces.RealOutput pin_TerminalVoltage; - - Modelica.Blocks.Interfaces.RealOutput pin_FieldCurrent; - Modelica.Blocks.Interfaces.RealOutput pin_ActivePowerPNALT; - Modelica.Blocks.Interfaces.RealOutput pin_ActivePowerPN; - Modelica.Blocks.Interfaces.RealOutput pin_ActivePowerSNREF; - Modelica.Blocks.Interfaces.RealOutput pin_ReactivePowerPNALT; - Modelica.Blocks.Interfaces.RealOutput pin_ReactivePowerPN; - Modelica.Blocks.Interfaces.RealOutput pin_ReactivePowerSNREF; - Modelica.Blocks.Interfaces.RealOutput pin_Current; - Modelica.Blocks.Interfaces.RealOutput pin_ActivePowerSN; - Modelica.Blocks.Interfaces.RealOutput pin_ReactivePowerSN; - - parameter Real SNREF(fixed=false); - parameter Real SN(fixed=false); // puissance apparente nominale (SNOMG) - parameter Real PN(fixed=false); - parameter Real PNALT; - parameter Real sNTfo(fixed=false); - parameter Real ur0(fixed = false); - parameter Real ui0(fixed = false); - parameter Real p0(fixed = false); - parameter Real q0(fixed = false); - parameter Real uNResTfo(fixed = false); - parameter Real uNomNw(fixed = false); - parameter Real uNMacTfo(fixed = false); - parameter Real uBMac(fixed = false); - parameter Real rTfoIn(fixed = false); - parameter Real xTfoIn(fixed = false); - parameter Real nDSat;//(fixed = false); - parameter Real nQSat;//(fixed = false); - parameter Real mDSatIn;//(fixed = false); - parameter Real mQSatIn;//(fixed = false); - parameter Real rStatIn(fixed = false); - parameter Real lStatIn(fixed = false); - parameter Real mQ0Pu(fixed=false); - parameter Real mD0Pu(fixed=false); - //parameter Real pNomAlt(fixed = false); - //parameter Real pNom(fixed = false); - parameter Real lDPu(fixed=false); - parameter Real rRotIn(fixed=false); - parameter Real lRotIn(fixed=false); - parameter Real rQ1Pu(fixed=false); - parameter Real lQ1Pu(fixed=false); - parameter Real rQ2Pu(fixed=false); - parameter Real lQ2Pu(fixed=false); - parameter Real mCanPu(fixed=false); - //parameter Real omega0(fixed=false); - parameter Real omega_0(fixed=false); - parameter Real pPuWLMDV(fixed=false); - parameter Real mrc = 0; - parameter Real ONE = 1; - parameter Real PI = 3.14159265; - parameter Integer IWLMDV = 3; - parameter Boolean Saturated = true; - - // paramètres calcules - parameter Real yScaleNom = SNREF/SN; // YSCALE - parameter Real rStatNom = rStatIn * yScaleNom; // YI = RESARM * YSCALE; - parameter Real lStatNom = lStatIn * yScaleNom; // YLAMDI = READST * YSCALE - parameter Real lQINom = lStatIn * yScaleNom; // YLQI = REAQST avec REAQST=READST (puing1.f) - parameter Real mQ0Nom = mQ0Pu*yScaleNom; // YMQI = FMUQST(INB2) * YSCALE (YMQINS) - parameter Real mD0Nom = mD0Pu*yScaleNom; // YMDI = FMUDST(INB2) * YSCALE (YMDINS) - parameter Real urNom = 1.0; // YE - parameter Real uiNom = 0.0; // YF - parameter Real qPuWLMDV = (SN^2 - pPuWLMDV^2)^(1/2); // QUNIT (pucalif.f) - parameter Real pNomWLMDV = pPuWLMDV / SNREF; // YPG (pucalif.f) - parameter Real qNomWLMDV = qPuWLMDV / SNREF; // YQG (pucalif.f) - parameter Real irNom = (pNomWLMDV * urNom + qNomWLMDV * uiNom); // YIR (pucalif.f) - parameter Real iiNom = (pNomWLMDV * uiNom - qNomWLMDV * urNom); // YII - parameter Real omegaNom = 1.0; // OMEGA - parameter Real rTfoNom = 0.0; // YTI - parameter Real xTfoNom = 0.0; // YXTI - // per unitage complementaire, calcul de rrTfo (puingc.f) - // ------------------------------------------------------ - parameter Real ri = if - ( rTfoIn > 0. or xTfoIn > 0.) then (uNResTfo/uNomNw) / (uNMacTfo/uBMac) else 1.; - parameter Real rs = if - ( rTfoIn > 0. or xTfoIn > 0.) then (uNResTfo/uNomNw)^2 * SNREF / sNTfo else 1.; - parameter Real mSalNom = mD0Nom - mQ0Nom; - parameter Real xQNom0 = mQ0Nom + lQINom; - parameter Real tetaNomNum0 = uiNom + omegaNom*(xTfoNom+xQNom0)*irNom + (rTfoNom+rStatNom)*iiNom; - parameter Real tetaNomDenom0 = urNom + (rTfoNom+rStatNom)*irNom - omegaNom*(xTfoNom+xQNom0)*iiNom; - parameter Real lambdaADNom0 = -(urNom + (rStatNom+rTfoNom)*irNom + omegaNom*(lStatNom+xTfoNom)*(-iiNom))/omegaNom; - parameter Real lambdaAQNom0 = (-uiNom + (rStatNom+rTfoNom)*(-iiNom) - omegaNom*(lQINom+xTfoNom)*irNom)/omegaNom; - parameter Real lambdaADNom20 = lambdaADNom0*lambdaADNom0; - parameter Real lambdaAQNom20 = lambdaAQNom0*lambdaAQNom0; - - Real u2(start = 1.0); - Real tetaNomNum(start = tetaNomNum0); - Real tetaNomDenom(start = tetaNomDenom0); - Real tetaNom(start = 0); - Real iDNom(start=-iiNom); - Real iQNom(start=irNom); // YIQ - Real uDNom(start=-uiNom); // YUD - Real uQNom(start=urNom); // YUQ - Real lambdaADNom(start=lambdaADNom0); // YLAMAD - Real lambdaAQNom(start=lambdaAQNom0); // YLAMAQ - Real lambdaADNom2(start=lambdaADNom0*lambdaADNom0); // YV72 - Real lambdaAQNom2(start=lambdaAQNom0*lambdaAQNom0); // YV82 - Real ENom2(start= lambdaADNom20 + lambdaAQNom20); // YNN2 - Real mDSNom; // YXADS - Real mQSNom; // YXAQS - Real cosNuNom2; // YCODQ2 - Real sinNuNom2; // YSIDQ2 - Real mINom; // YMC - Real mDNom(start = mD0Nom); // YMDI / YMDINS - Real mQNom(start = mQ0Nom); // YMQI / YMQINS - Real ifNom(start = 1.0); - Real mDVPu(start = 1.0); - //Real mDV(start=1.0); - Real rStat( start = rStatIn); - Real lStat( start = lStatIn); - Real lD(start = lDPu); - Real lQI(start = lStatIn); - Real lRot(start = lRotIn); - Real mQ0(start = mQ0Pu); - Real lQ1(start = lQ1Pu); - Real lQ2(start = lQ2Pu); - Real mD0(start = mD0Pu); - Real mCan( start = mCanPu); - Real xQ; // YXQ = mQ + lQI - Real teta0Num; // YNUM - Real teta0Denom; // YDENOM - Real uD0(start = - ui0); // YUD - Real uQ0(start = ur0); // YUQ - Real lambdaAD02; // YV72 - Real lambdaAQ02; // YV82 - Real E02; // YNN2 - Real cosNu2; // YCODQ2 - Real sinNu2; // YSIDQ2 - Real mD(start = mD0Pu); // YMDINS - Real mQ(start = mQ0Pu); // YMQINS - Real if0(start = 1.0); - Real DET(start = 1.0); - Real u1r(start = ur0); - Real u1i(start = ui0); - Real mSal; // YMSAL - - // variables conservées par le compilateur: - // --------------------------------------- - parameter Real ir0_0 = p0*ur0 + q0*ui0; - parameter Real ii0_0 = p0*ui0 - q0*ur0; - Real ir0(start = ir0_0); - Real ii0(start = ii0_0); - Real mDSat(start = mDSatIn); - Real mQSat(start = mQSatIn); - Real xQNom(start = xQNom0); - Real yScale(start = SNREF / SN); - Real rrTfo(start = ri); - Real rTfo(start = rTfoIn * rs); - Real xTfo(start = xTfoIn * rs); - - parameter Real xQ0 = mQ0Pu - lStatIn; - Real mDV(start = 1.0); - Real teta0(start = 0.0); // YTETA = ATAN2(YNUM,YDENOM) - Real tetaInterne0(start = 0.0); - Real iD0(start = -ii0_0); // YID - Real iQ0(start = ir0_0); // YIQ - - parameter Real lambdaAD0_0 = -(ur0 + (rStatIn+rTfoIn)*ir0_0 + (lStatIn+xTfoIn)*(-ii0_0)) / omega_0; - parameter Real lambdaAQ0_0 = ( -ui0 + (rStatIn+rTfoIn)*(-ii0_0) - (lStatIn+xTfoIn)*ir0_0) / omega_0; - Real lambdaAD0(start = lambdaAD0_0); // YLAMAD - Real lambdaAQ0(start = lambdaAQ0_0); // YLAMAQ - parameter Real E0_0 = (lambdaAD0_0*lambdaAD0_0 + lambdaAQ0_0*lambdaAQ0_0)^(1/2); - Real E0(start = E0_0); - - Real mDS0(start = 1.0); // YXADS - Real mQS0(start = 1.0); // YXAQS - Real mI0(start = 1.0); // YMC - Real lambdaQ10(start = 1.0); - Real lambdaQ20(start = 1.0); - Real lambdaD0(start = 1.0); // YLAMD - Real lambdaF0(start = 1.0); // YLAMF - Real cm0(start = 1.0); - Real efd0(start = 1.0); - Real lMD0(start = 1.0); - Real lMQ0(start = 1.0); - Real mD_0(start = 1.0); - Real mQ_0(start = 1.0); - Real urReg0(start = ur0); - Real uiReg0(start = ui0); - - Real ir; - Real ii; -equation - // per unitage des donnees d'entree - // -------------------------------- - // - (ur0Nw, ui0Nw) en kV*Ub/Un -> (ur0, ui0) en kV/Un - // - (p0Nw, q0Nw) en MW/MVAr -> (p0, q0) en MW/MVAr/SNREF - // -> (ir0, ii0) en kA*Un/SNREF - - u2 = ur0*ur0 + ui0*ui0; // YN = YE*YE + YF*YF - ONE*ir0 = (p0*ur0 + q0*ui0) / u2; // YIR - ONE*ii0 = (p0*ui0 - q0*ur0) / u2; // YII - - ONE*rrTfo = ri; // YRI = RTFO - ONE*rTfo = rTfoIn * rs; // RESTFO(INB3) = RESTFO(INB3) * YS - ONE*xTfo = xTfoIn * rs; // REATFO(INB3) = REATFO(INB3) * YS - - ONE*mDSat = mDSatIn / ri^nDSat; // RMD - ONE*mQSat = mQSatIn / ri^nQSat; // RMQ - - // calcul de WLMDV (FMUDMA) (pucalif.f) - // ------------------------------------ - - //{ - xQNom = mQNom + lQINom; // YXQ - tetaNomNum = uiNom + omegaNom*(xTfoNom+xQNom)*irNom + (rTfoNom+rStatNom)*iiNom; // YNUM - tetaNomDenom = urNom + (rTfoNom+rStatNom)*irNom - omegaNom*(xTfoNom+xQNom)*iiNom; // YDENOM - //tetaNom = atan2(tetaNomNum,tetaNomDenom); // YTETA - tetaNom = 2*atan(tetaNomNum/(sqrt(tetaNomNum*tetaNomNum+tetaNomDenom*tetaNomDenom)+tetaNomDenom)); - - iDNom = sin(tetaNom)*irNom - cos(tetaNom)*iiNom; // YID - iQNom = cos(tetaNom)*irNom + sin(tetaNom)*iiNom; // YIQ - uDNom = sin(tetaNom)*urNom - cos(tetaNom)*uiNom; // YUD - uQNom = cos(tetaNom)*urNom + sin(tetaNom)*uiNom; // YUQ - - lambdaADNom = -(uQNom + (rStatNom+rTfoNom)*iQNom + omegaNom*(lStatNom+xTfoNom)*iDNom)/omegaNom; // YLAMAD - lambdaAQNom = (uDNom + (rStatNom+rTfoNom)*iDNom - omegaNom*(lQINom+xTfoNom)*iQNom)/omegaNom; // YLAMAQ - - lambdaADNom2 = lambdaADNom*lambdaADNom; // YV72 - lambdaAQNom2 = lambdaAQNom*lambdaAQNom; // YV82 - ENom2 = lambdaADNom2 + lambdaAQNom2; // YNN2 - - mDSNom = mD0Nom / (1. + mDSat*ENom2^(nDSat/2.)); // YXADS - mQSNom = mQ0Nom / (1. + mQSat*ENom2^(nQSat/2.)); // YXAQS - - cosNuNom2 = lambdaADNom2/ENom2; // YCODQ2 - sinNuNom2 = lambdaAQNom2/ENom2; // YSIDQ2 - - mINom = mDSNom * cosNuNom2 + mQSNom * sinNuNom2; // YMC - - mDNom = mINom + mSalNom * sinNuNom2; - mQNom = mINom - mSalNom * cosNuNom2; - //} - ifNom = lambdaADNom/mDNom - iDNom; // YRIF - if Saturated==false and IWLMDV==2 then - mDVPu = mD0Pu; - elseif Saturated==true and IWLMDV==2 then - mDVPu = mD0Pu/(1+mDSatIn); - elseif IWLMDV==1 then - mDVPu = mD0Pu; - else - mDVPu = -1. / (ifNom * yScaleNom); // FMUDMA (calcule dans puingc.f) - end if; - - // per unitage de parametres (park2.f) - // ----------------------------------- - ONE* yScale = if - ( rTfoIn > 0. or xTfoIn > 0.) then SNREF/SN*rrTfo*rrTfo else SNREF/SN; // YSCALE - - rStat = rStatIn * yScale; // YI = RESARM * yScale; - lStat = lStatIn * yScale; // YLAMDI = READST * yScale - lD = lDPu * yScale; // YLDI = READDI * YSCALE - lQI = lStatIn * yScale; // YLQI = REAQST avec REAQST=READST (puing1.f) - lRot = lRotIn * yScale; // YLFI = lRotIn * yScale; - mQ0 = mQ0Pu*yScale; // YMQI = FMUQST(INB2) * YSCALE (YMQINS) - lQ1 = lQ1Pu * yScale; // YLQ1I - lQ2 = lQ2Pu * yScale; // YLQ2I - mD0 = mD0Pu*yScale; // YMDI = FMUDST(INB2) * YSCALE (YMDINS) - ONE*mDV = mDVPu * yScale; // YMDIM - mCan = mCanPu * yScale; // YMRCI = mCan * yScale; - - // calcul des valeurs initiales des variables machine (park2.f) - // ------------------------------------------------------------ - mSal = mD0 - mQ0; - //{ - xQ = mQ + lQI; // YXQ = mQ + lQI - - teta0Num = ui0 + omega_0*(xTfo+xQ)*ir0 + (rTfo+rStat)*ii0; // YNUM - teta0Denom = ur0 + (rTfo+rStat)*ir0 - omega_0*(xTfo+xQ)*ii0; // YDENOM - //expression ange moitié - //ONE*teta0 = atan2(teta0Num ,teta0Denom); // YTETA = ATAN2(YNUM,YDENOM) - ONE*teta0 = 2*atan(teta0Num/(sqrt(teta0Num*teta0Num+teta0Denom*teta0Denom)+teta0Denom)); - - ONE*iD0 = sin(teta0)*ir0 - cos(teta0)*ii0; // YID - ONE* iQ0 = cos(teta0)*ir0 + sin(teta0)*ii0; // YIQ - uD0 = sin(teta0)*ur0 - cos(teta0)*ui0; // YUD - uQ0 = cos(teta0)*ur0 + sin(teta0)*ui0; // YUQ - - // expression angle moitié - //ONE*tetaInterne0 = atan2(uD0,uQ0); - ONE*tetaInterne0 = 2*atan(uD0/(sqrt(uD0*uD0 + uQ0*uQ0)+uQ0)); - - ONE*lambdaAD0 = -(uQ0 + (rStat+rTfo)*iQ0 + (lStat+xTfo)*iD0) / omega_0; // YLAMAD - ONE*lambdaAQ0 = (uD0 + (rStat+rTfo)*iD0 - (lQI+xTfo)*iQ0) / omega_0; // YLAMAQ - - lambdaAD02 = lambdaAD0*lambdaAD0; // YV72 - lambdaAQ02 = lambdaAQ0*lambdaAQ0; // YV82 - E02 = lambdaAD02 + lambdaAQ02; // YNN2 - ONE*E0= sqrt(E02); - - ONE*mDS0 = mD0 / ( 1.+ mDSat*E02^(nDSat/2)); // YXADS - ONE*mQS0 = mQ0 / ( 1.+ mQSat*E02^(nQSat/2)); // YXAQS - - cosNu2 = lambdaAD02 / E02; // YCODQ2 - sinNu2 = lambdaAQ02 / E02; // YSIDQ2 - - ONE* mI0 = mDS0 * cosNu2 + mQS0 * sinNu2; // YMC - - mD = mI0 + mSal * sinNu2; - mQ = mI0 - mSal * cosNu2; - //} - - if0 = lambdaAD0/mD - iD0; // YRIF - - ONE*lambdaQ10 = lambdaAQ0; - ONE*lambdaQ20 = lambdaAQ0; - ONE*lambdaD0 = lambdaAD0 + mCan*if0; // YLAMD - ONE*lambdaF0 = lambdaAD0 + (lRot+mCan)*if0; // YLAMF - - ONE*cm0 = (-lambdaAD0 * iQ0 + lambdaAQ0 * iD0) * SNREF / PN; // YCM - - ONE*efd0 = - mDV * if0 / rrTfo; // YEFD = - YMDIM * YRIF / YRI - DET = lRot*lD + mCan*(lRot+lD); - ONE*lMD0 = lambdaAD0 / (iD0 + lD*lambdaF0/DET + lRot*lambdaD0/DET); - ONE*lMQ0 = lambdaAQ0 / (iQ0 + lambdaQ10/lQ1 + lambdaQ20/lQ2); - - ONE*mD_0 = mDS0; - ONE*mQ_0 = mQS0; - - // calcul du ureg0 - u1r =ur0 + rTfo*ir0 -xTfo*ii0; - u1i =ui0 + rTfo*ii0 +xTfo*ir0; - ONE*urReg0 = 1/rrTfo*u1r; - ONE*uiReg0 = 1/rrTfo*u1i; - - ir = -(sin(pin_TETA)*pin_ID+cos(pin_TETA)*pin_IQ); - ii=-(-cos(pin_TETA)*pin_ID+sin(pin_TETA)*pin_IQ); - - pin_TerminalVoltage = sqrt((pin_UR-rTfo*ir+xTfo*ii)*(pin_UR-rTfo*ir+xTfo*ii) + (pin_UI-rTfo*ii-xTfo*ir)*(pin_UI-rTfo*ii-xTfo*ir))*1/rrTfo; - - pin_CM = cm0; - pin_EFD = efd0; - pin_LAMBDAF = lambdaF0; - pin_LAMBDAD = lambdaD0; - pin_LAMBDAQ1 = lambdaQ10; - pin_LAMBDAQ2 = lambdaQ20; - pin_LAMBDAAD = lambdaAD0; - pin_LAMBDAAQ = lambdaAQ0; - pin_OMEGA = omega_0; - pin_TETA = teta0; - pin_IQ = iQ0; - pin_ID = iD0; - pin_UR = ur0; - pin_UI = ui0; - - pin_ActivePowerPN = (pin_UR*(-ir)+pin_UI*(-ii))*SNREF/PN; - - if PNALT == 0 then - pin_ActivePowerPNALT = 0; - pin_ReactivePowerPNALT = 0; - else - pin_ActivePowerPNALT = (pin_UR*(-ir)+pin_UI*(-ii))*SNREF/PNALT; - pin_ReactivePowerPNALT = (pin_UI*(-ir)-pin_UR*(-ii))*SNREF/PNALT; - end if; - - pin_ActivePowerSNREF = (pin_UR*(-ir)+pin_UI*(-ii)); - pin_ReactivePowerPN = (pin_UI*(-ir)-pin_UR*(-ii))*SNREF/PN; - pin_ReactivePowerSNREF = (pin_UI*(-ir)-pin_UR*(-ii)); - pin_Current = sqrt(ir*ir+ii*ii); - - //ActivePower SN - pin_ActivePowerSN = (pin_UR*(-ir)+pin_UI*(-ii))*SNREF/SN; - - //ReactivePower SN - pin_ReactivePowerSN = (pin_UI*(-ir)-pin_UR*(-ii))*SNREF/SN; - - //Field Current - if mDSatIn==0 and mQSatIn==0 and nDSat==0 and nQSat==0 then - pin_FieldCurrent = -(mDV/rrTfo)*((mD0+lD+mrc)*pin_LAMBDAF-(mD0+mrc)*pin_LAMBDAD-mD0*lD*pin_ID)/((mD0+mrc)*(lRot+lD)+lRot*lD); - else - pin_FieldCurrent = -(mDV/rrTfo)*((lD+mrc)*pin_LAMBDAF- mrc*pin_LAMBDAD-lD*pin_LAMBDAAD)/(mrc*(lRot+lD)+lRot*lD); - end if; - - annotation (Documentation(info=" -


<iPSL: iTesla Power System Library>

-

Copyright 2015 RTE (France), AIA (Spain), KTH (Sweden) and DTU (Denmark)

- -

The authors can be contacted by email: info at itesla-ipsl dot org

-

This package is part of the iTesla Power System Library ("iPSL") .

-

The iPSL is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

-

The iPSL is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

-

You should have received a copy of the GNU Lesser General Public License along with the iPSL. If not, see <http://www.gnu.org/licenses/>.

-")); -end DYNModelM1S_INIT; +within iPSL.Electrical.Machines.Eurostag; +model DYNModelM1S_INIT + PowerSystems.Connectors.ImPin pin_CM; + PowerSystems.Connectors.ImPin pin_EFD; + PowerSystems.Connectors.ImPin pin_LAMBDAF; + PowerSystems.Connectors.ImPin pin_LAMBDAD; + PowerSystems.Connectors.ImPin pin_LAMBDAQ1; + PowerSystems.Connectors.ImPin pin_LAMBDAQ2; + PowerSystems.Connectors.ImPin pin_LAMBDAAD; + PowerSystems.Connectors.ImPin pin_LAMBDAAQ; + PowerSystems.Connectors.ImPin pin_OMEGA; + PowerSystems.Connectors.ImPin pin_TETA; + PowerSystems.Connectors.ImPin pin_IQ; + PowerSystems.Connectors.ImPin pin_ID; + PowerSystems.Connectors.ImPin pin_UR; + PowerSystems.Connectors.ImPin pin_UI; + PowerSystems.Connectors.ImPin pin_TerminalVoltage; + PowerSystems.Connectors.ImPin pin_FieldCurrent; + PowerSystems.Connectors.ImPin pin_ActivePowerPNALT; + PowerSystems.Connectors.ImPin pin_ActivePowerPN; + PowerSystems.Connectors.ImPin pin_ActivePowerSNREF; + PowerSystems.Connectors.ImPin pin_ReactivePowerPNALT; + PowerSystems.Connectors.ImPin pin_ReactivePowerPN; + PowerSystems.Connectors.ImPin pin_ReactivePowerSNREF; + PowerSystems.Connectors.ImPin pin_Current; + PowerSystems.Connectors.ImPin pin_ActivePowerSN; + PowerSystems.Connectors.ImPin pin_ReactivePowerSN; + parameter Real SNREF(fixed = false); + parameter Real SN(fixed = false); + // puissance apparente nominale (SNOMG) + parameter Real PN(fixed = false); + parameter Real PNALT; + parameter Real sNTfo(fixed = false); + parameter Real ur0(fixed = false); + parameter Real ui0(fixed = false); + parameter Real p0(fixed = false); + parameter Real q0(fixed = false); + parameter Real uNResTfo(fixed = false); + parameter Real uNomNw(fixed = false); + parameter Real uNMacTfo(fixed = false); + parameter Real uBMac(fixed = false); + parameter Real rTfoIn(fixed = false); + parameter Real xTfoIn(fixed = false); + parameter Real nDSat; + //(fixed = false); + parameter Real nQSat; + //(fixed = false); + parameter Real mDSatIn; + //(fixed = false); + parameter Real mQSatIn; + //(fixed = false); + parameter Real rStatIn(fixed = false); + parameter Real lStatIn(fixed = false); + parameter Real mQ0Pu(fixed = false); + parameter Real mD0Pu(fixed = false); + //parameter Real pNomAlt(fixed = false); + //parameter Real pNom(fixed = false); + parameter Real lDPu(fixed = false); + parameter Real rRotIn(fixed = false); + parameter Real lRotIn(fixed = false); + parameter Real rQ1Pu(fixed = false); + parameter Real lQ1Pu(fixed = false); + parameter Real rQ2Pu(fixed = false); + parameter Real lQ2Pu(fixed = false); + parameter Real mCanPu(fixed = false); + //parameter Real omega0(fixed=false); + parameter Real omega_0(fixed = false); + parameter Real pPuWLMDV(fixed = false); + parameter Real mrc = 0; + parameter Real ONE = 1; + parameter Real PI = 3.14159265; + parameter Integer IWLMDV = 3; + parameter Boolean Saturated = true; + // paramètres calcules + parameter Real yScaleNom = SNREF / SN; + // YSCALE + parameter Real rStatNom = rStatIn * yScaleNom; + // YI = RESARM * YSCALE; + parameter Real lStatNom = lStatIn * yScaleNom; + // YLAMDI = READST * YSCALE + parameter Real lQINom = lStatIn * yScaleNom; + // YLQI = REAQST avec REAQST=READST (puing1.f) + parameter Real mQ0Nom = mQ0Pu * yScaleNom; + // YMQI = FMUQST(INB2) * YSCALE (YMQINS) + parameter Real mD0Nom = mD0Pu * yScaleNom; + // YMDI = FMUDST(INB2) * YSCALE (YMDINS) + parameter Real urNom = 1.0; + // YE + parameter Real uiNom = 0.0; + // YF + parameter Real qPuWLMDV = (SN ^ 2 - pPuWLMDV ^ 2) ^ (1 / 2); + // QUNIT (pucalif.f) + parameter Real pNomWLMDV = pPuWLMDV / SNREF; + // YPG (pucalif.f) + parameter Real qNomWLMDV = qPuWLMDV / SNREF; + // YQG (pucalif.f) + parameter Real irNom = pNomWLMDV * urNom + qNomWLMDV * uiNom; + // YIR (pucalif.f) + parameter Real iiNom = pNomWLMDV * uiNom - qNomWLMDV * urNom; + // YII + parameter Real omegaNom = 1.0; + // OMEGA + parameter Real rTfoNom = 0.0; + // YTI + parameter Real xTfoNom = 0.0; + // YXTI + // per unitage complementaire, calcul de rrTfo (puingc.f) + // ------------------------------------------------------ + parameter Real ri = if rTfoIn > 0.0 or xTfoIn > 0.0 then uNResTfo / uNomNw / uNMacTfo / uBMac else 1.0; + parameter Real rs = if rTfoIn > 0.0 or xTfoIn > 0.0 then (uNResTfo / uNomNw) ^ 2 * SNREF / sNTfo else 1.0; + parameter Real mSalNom = mD0Nom - mQ0Nom; + parameter Real xQNom0 = mQ0Nom + lQINom; + parameter Real tetaNomNum0 = uiNom + omegaNom * (xTfoNom + xQNom0) * irNom + (rTfoNom + rStatNom) * iiNom; + parameter Real tetaNomDenom0 = urNom + (rTfoNom + rStatNom) * irNom - omegaNom * (xTfoNom + xQNom0) * iiNom; + parameter Real lambdaADNom0 = -(urNom + (rStatNom + rTfoNom) * irNom + omegaNom * (lStatNom + xTfoNom) * (-iiNom)) / omegaNom; + parameter Real lambdaAQNom0 = ((-uiNom) + (rStatNom + rTfoNom) * (-iiNom) - omegaNom * (lQINom + xTfoNom) * irNom) / omegaNom; + parameter Real lambdaADNom20 = lambdaADNom0 * lambdaADNom0; + parameter Real lambdaAQNom20 = lambdaAQNom0 * lambdaAQNom0; + Real u2(start = 1.0); + Real tetaNomNum(start = tetaNomNum0); + Real tetaNomDenom(start = tetaNomDenom0); + Real tetaNom(start = 0); + Real iDNom(start = -iiNom); + Real iQNom(start = irNom); + // YIQ + Real uDNom(start = -uiNom); + // YUD + Real uQNom(start = urNom); + // YUQ + Real lambdaADNom(start = lambdaADNom0); + // YLAMAD + Real lambdaAQNom(start = lambdaAQNom0); + // YLAMAQ + Real lambdaADNom2(start = lambdaADNom0 * lambdaADNom0); + // YV72 + Real lambdaAQNom2(start = lambdaAQNom0 * lambdaAQNom0); + // YV82 + Real ENom2(start = lambdaADNom20 + lambdaAQNom20); + // YNN2 + Real mDSNom; + // YXADS + Real mQSNom; + // YXAQS + Real cosNuNom2; + // YCODQ2 + Real sinNuNom2; + // YSIDQ2 + Real mINom; + // YMC + Real mDNom(start = mD0Nom); + // YMDI / YMDINS + Real mQNom(start = mQ0Nom); + // YMQI / YMQINS + Real ifNom(start = 1.0); + Real mDVPu(start = 1.0); + //Real mDV(start=1.0); + Real rStat(start = rStatIn); + Real lStat(start = lStatIn); + Real lD(start = lDPu); + Real lQI(start = lStatIn); + Real lRot(start = lRotIn); + Real mQ0(start = mQ0Pu); + Real lQ1(start = lQ1Pu); + Real lQ2(start = lQ2Pu); + Real mD0(start = mD0Pu); + Real mCan(start = mCanPu); + Real xQ; + // YXQ = mQ + lQI + Real teta0Num; + // YNUM + Real teta0Denom; + // YDENOM + Real uD0(start = -ui0); + // YUD + Real uQ0(start = ur0); + // YUQ + Real lambdaAD02; + // YV72 + Real lambdaAQ02; + // YV82 + Real E02; + // YNN2 + Real cosNu2; + // YCODQ2 + Real sinNu2; + // YSIDQ2 + Real mD(start = mD0Pu); + // YMDINS + Real mQ(start = mQ0Pu); + // YMQINS + Real if0(start = 1.0); + Real DET(start = 1.0); + Real u1r(start = ur0); + Real u1i(start = ui0); + Real mSal; + // YMSAL + // variables conservées par le compilateur: + // --------------------------------------- + parameter Real ir0_0 = p0 * ur0 + q0 * ui0; + parameter Real ii0_0 = p0 * ui0 - q0 * ur0; + Real ir0(start = ir0_0); + Real ii0(start = ii0_0); + Real mDSat(start = mDSatIn); + Real mQSat(start = mQSatIn); + Real xQNom(start = xQNom0); + Real yScale(start = SNREF / SN); + Real rrTfo(start = ri); + Real rTfo(start = rTfoIn * rs); + Real xTfo(start = xTfoIn * rs); + parameter Real xQ0 = mQ0Pu - lStatIn; + Real mDV(start = 1.0); + Real teta0(start = 0.0); + // YTETA = ATAN2(YNUM,YDENOM) + Real tetaInterne0(start = 0.0); + Real iD0(start = -ii0_0); + // YID + Real iQ0(start = ir0_0); + // YIQ + parameter Real lambdaAD0_0 = -(ur0 + (rStatIn + rTfoIn) * ir0_0 + (lStatIn + xTfoIn) * (-ii0_0)) / omega_0; + parameter Real lambdaAQ0_0 = ((-ui0) + (rStatIn + rTfoIn) * (-ii0_0) - (lStatIn + xTfoIn) * ir0_0) / omega_0; + Real lambdaAD0(start = lambdaAD0_0); + // YLAMAD + Real lambdaAQ0(start = lambdaAQ0_0); + // YLAMAQ + parameter Real E0_0 = (lambdaAD0_0 * lambdaAD0_0 + lambdaAQ0_0 * lambdaAQ0_0) ^ (1 / 2); + Real E0(start = E0_0); + Real mDS0(start = 1.0); + // YXADS + Real mQS0(start = 1.0); + // YXAQS + Real mI0(start = 1.0); + // YMC + Real lambdaQ10(start = 1.0); + Real lambdaQ20(start = 1.0); + Real lambdaD0(start = 1.0); + // YLAMD + Real lambdaF0(start = 1.0); + // YLAMF + Real cm0(start = 1.0); + Real efd0(start = 1.0); + Real lMD0(start = 1.0); + Real lMQ0(start = 1.0); + Real mD_0(start = 1.0); + Real mQ_0(start = 1.0); + Real urReg0(start = ur0); + Real uiReg0(start = ui0); + Real ir; + Real ii; +equation + // per unitage des donnees d'entree + // -------------------------------- + // - (ur0Nw, ui0Nw) en kV*Ub/Un -> (ur0, ui0) en kV/Un + // - (p0Nw, q0Nw) en MW/MVAr -> (p0, q0) en MW/MVAr/SNREF + // -> (ir0, ii0) en kA*Un/SNREF + u2 = ur0 * ur0 + ui0 * ui0; + // YN = YE*YE + YF*YF + ONE * ir0 = (p0 * ur0 + q0 * ui0) / u2; + // YIR + ONE * ii0 = (p0 * ui0 - q0 * ur0) / u2; + // YII + ONE * rrTfo = ri; + // YRI = RTFO + ONE * rTfo = rTfoIn * rs; + // RESTFO(INB3) = RESTFO(INB3) * YS + ONE * xTfo = xTfoIn * rs; + // REATFO(INB3) = REATFO(INB3) * YS + ONE * mDSat = mDSatIn / ri ^ nDSat; + // RMD + ONE * mQSat = mQSatIn / ri ^ nQSat; + // RMQ + // calcul de WLMDV (FMUDMA) (pucalif.f) + // ------------------------------------ + //{ + xQNom = mQNom + lQINom; + // YXQ + tetaNomNum = uiNom + omegaNom * (xTfoNom + xQNom) * irNom + (rTfoNom + rStatNom) * iiNom; + // YNUM + tetaNomDenom = urNom + (rTfoNom + rStatNom) * irNom - omegaNom * (xTfoNom + xQNom) * iiNom; + // YDENOM + //tetaNom = atan2(tetaNomNum,tetaNomDenom); // YTETA + tetaNom = 2 * atan(tetaNomNum / (sqrt(tetaNomNum * tetaNomNum + tetaNomDenom * tetaNomDenom) + tetaNomDenom)); + iDNom = sin(tetaNom) * irNom - cos(tetaNom) * iiNom; + // YID + iQNom = cos(tetaNom) * irNom + sin(tetaNom) * iiNom; + // YIQ + uDNom = sin(tetaNom) * urNom - cos(tetaNom) * uiNom; + // YUD + uQNom = cos(tetaNom) * urNom + sin(tetaNom) * uiNom; + // YUQ + lambdaADNom = -(uQNom + (rStatNom + rTfoNom) * iQNom + omegaNom * (lStatNom + xTfoNom) * iDNom) / omegaNom; + // YLAMAD + lambdaAQNom = (uDNom + (rStatNom + rTfoNom) * iDNom - omegaNom * (lQINom + xTfoNom) * iQNom) / omegaNom; + // YLAMAQ + lambdaADNom2 = lambdaADNom * lambdaADNom; + // YV72 + lambdaAQNom2 = lambdaAQNom * lambdaAQNom; + // YV82 + ENom2 = lambdaADNom2 + lambdaAQNom2; + // YNN2 + mDSNom = mD0Nom / (1.0 + mDSat * ENom2 ^ (nDSat / 2.0)); + // YXADS + mQSNom = mQ0Nom / (1.0 + mQSat * ENom2 ^ (nQSat / 2.0)); + // YXAQS + cosNuNom2 = lambdaADNom2 / ENom2; + // YCODQ2 + sinNuNom2 = lambdaAQNom2 / ENom2; + // YSIDQ2 + mINom = mDSNom * cosNuNom2 + mQSNom * sinNuNom2; + // YMC + mDNom = mINom + mSalNom * sinNuNom2; + mQNom = mINom - mSalNom * cosNuNom2; + //} + ifNom = lambdaADNom / mDNom - iDNom; + // YRIF + if Saturated == false and IWLMDV == 2 then + mDVPu = mD0Pu; + elseif Saturated == true and IWLMDV == 2 then + mDVPu = mD0Pu / (1 + mDSatIn); + elseif IWLMDV == 1 then + mDVPu = mD0Pu; + else + mDVPu = -1.0 / (ifNom * yScaleNom); + end if; + // FMUDMA (calcule dans puingc.f) + // per unitage de parametres (park2.f) + // ----------------------------------- + ONE * yScale = if rTfoIn > 0.0 or xTfoIn > 0.0 then SNREF / SN * rrTfo * rrTfo else SNREF / SN; + // YSCALE + rStat = rStatIn * yScale; + // YI = RESARM * yScale; + lStat = lStatIn * yScale; + // YLAMDI = READST * yScale + lD = lDPu * yScale; + // YLDI = READDI * YSCALE + lQI = lStatIn * yScale; + // YLQI = REAQST avec REAQST=READST (puing1.f) + lRot = lRotIn * yScale; + // YLFI = lRotIn * yScale; + mQ0 = mQ0Pu * yScale; + // YMQI = FMUQST(INB2) * YSCALE (YMQINS) + lQ1 = lQ1Pu * yScale; + // YLQ1I + lQ2 = lQ2Pu * yScale; + // YLQ2I + mD0 = mD0Pu * yScale; + // YMDI = FMUDST(INB2) * YSCALE (YMDINS) + ONE * mDV = mDVPu * yScale; + // YMDIM + mCan = mCanPu * yScale; + // YMRCI = mCan * yScale; + // calcul des valeurs initiales des variables machine (park2.f) + // ------------------------------------------------------------ + mSal = mD0 - mQ0; + //{ + xQ = mQ + lQI; + // YXQ = mQ + lQI + teta0Num = ui0 + omega_0 * (xTfo + xQ) * ir0 + (rTfo + rStat) * ii0; + // YNUM + teta0Denom = ur0 + (rTfo + rStat) * ir0 - omega_0 * (xTfo + xQ) * ii0; + // YDENOM + //expression ange moitié + //ONE*teta0 = atan2(teta0Num ,teta0Denom); // YTETA = ATAN2(YNUM,YDENOM) + ONE * teta0 = 2 * atan(teta0Num / (sqrt(teta0Num * teta0Num + teta0Denom * teta0Denom) + teta0Denom)); + ONE * iD0 = sin(teta0) * ir0 - cos(teta0) * ii0; + // YID + ONE * iQ0 = cos(teta0) * ir0 + sin(teta0) * ii0; + // YIQ + uD0 = sin(teta0) * ur0 - cos(teta0) * ui0; + // YUD + uQ0 = cos(teta0) * ur0 + sin(teta0) * ui0; + // YUQ + // expression angle moitié + //ONE*tetaInterne0 = atan2(uD0,uQ0); + ONE * tetaInterne0 = 2 * atan(uD0 / (sqrt(uD0 * uD0 + uQ0 * uQ0) + uQ0)); + ONE * lambdaAD0 = -(uQ0 + (rStat + rTfo) * iQ0 + (lStat + xTfo) * iD0) / omega_0; + // YLAMAD + ONE * lambdaAQ0 = (uD0 + (rStat + rTfo) * iD0 - (lQI + xTfo) * iQ0) / omega_0; + // YLAMAQ + lambdaAD02 = lambdaAD0 * lambdaAD0; + // YV72 + lambdaAQ02 = lambdaAQ0 * lambdaAQ0; + // YV82 + E02 = lambdaAD02 + lambdaAQ02; + // YNN2 + ONE * E0 = sqrt(E02); + ONE * mDS0 = mD0 / (1.0 + mDSat * E02 ^ (nDSat / 2)); + // YXADS + ONE * mQS0 = mQ0 / (1.0 + mQSat * E02 ^ (nQSat / 2)); + // YXAQS + cosNu2 = lambdaAD02 / E02; + // YCODQ2 + sinNu2 = lambdaAQ02 / E02; + // YSIDQ2 + ONE * mI0 = mDS0 * cosNu2 + mQS0 * sinNu2; + // YMC + mD = mI0 + mSal * sinNu2; + mQ = mI0 - mSal * cosNu2; + //} + if0 = lambdaAD0 / mD - iD0; + // YRIF + ONE * lambdaQ10 = lambdaAQ0; + ONE * lambdaQ20 = lambdaAQ0; + ONE * lambdaD0 = lambdaAD0 + mCan * if0; + // YLAMD + ONE * lambdaF0 = lambdaAD0 + (lRot + mCan) * if0; + // YLAMF + ONE * cm0 = ((-lambdaAD0 * iQ0) + lambdaAQ0 * iD0) * SNREF / PN; + // YCM + ONE * efd0 = -mDV * if0 / rrTfo; + // YEFD = - YMDIM * YRIF / YRI + DET = lRot * lD + mCan * (lRot + lD); + ONE * lMD0 = lambdaAD0 / (iD0 + lD * lambdaF0 / DET + lRot * lambdaD0 / DET); + ONE * lMQ0 = lambdaAQ0 / (iQ0 + lambdaQ10 / lQ1 + lambdaQ20 / lQ2); + ONE * mD_0 = mDS0; + ONE * mQ_0 = mQS0; + // calcul du ureg0 + u1r = ur0 + rTfo * ir0 - xTfo * ii0; + u1i = ui0 + rTfo * ii0 + xTfo * ir0; + ONE * urReg0 = 1 / rrTfo * u1r; + ONE * uiReg0 = 1 / rrTfo * u1i; + ir = -(sin(pin_TETA) * pin_ID + cos(pin_TETA) * pin_IQ); + ii = -((-cos(pin_TETA) * pin_ID) + sin(pin_TETA) * pin_IQ); + pin_TerminalVoltage = sqrt((pin_UR - rTfo * ir + xTfo * ii) * (pin_UR - rTfo * ir + xTfo * ii) + (pin_UI - rTfo * ii - xTfo * ir) * (pin_UI - rTfo * ii - xTfo * ir)) * 1 / rrTfo; + pin_CM = cm0; + pin_EFD = efd0; + pin_LAMBDAF = lambdaF0; + pin_LAMBDAD = lambdaD0; + pin_LAMBDAQ1 = lambdaQ10; + pin_LAMBDAQ2 = lambdaQ20; + pin_LAMBDAAD = lambdaAD0; + pin_LAMBDAAQ = lambdaAQ0; + pin_OMEGA = omega_0; + pin_TETA = teta0; + pin_IQ = iQ0; + pin_ID = iD0; + pin_UR = ur0; + pin_UI = ui0; + pin_ActivePowerPN = (pin_UR * (-ir) + pin_UI * (-ii)) * SNREF / PN; + if PNALT == 0 then + pin_ActivePowerPNALT = 0; + pin_ReactivePowerPNALT = 0; + else + pin_ActivePowerPNALT = (pin_UR * (-ir) + pin_UI * (-ii)) * SNREF / PNALT; + pin_ReactivePowerPNALT = (pin_UI * (-ir) - pin_UR * (-ii)) * SNREF / PNALT; + end if; + pin_ActivePowerSNREF = pin_UR * (-ir) + pin_UI * (-ii); + pin_ReactivePowerPN = (pin_UI * (-ir) - pin_UR * (-ii)) * SNREF / PN; + pin_ReactivePowerSNREF = pin_UI * (-ir) - pin_UR * (-ii); + pin_Current = sqrt(ir * ir + ii * ii); + //ActivePower SN + pin_ActivePowerSN = (pin_UR * (-ir) + pin_UI * (-ii)) * SNREF / SN; + //ReactivePower SN + pin_ReactivePowerSN = (pin_UI * (-ir) - pin_UR * (-ii)) * SNREF / SN; + //Field Current + if mDSatIn == 0 and mQSatIn == 0 and nDSat == 0 and nQSat == 0 then + pin_FieldCurrent = -mDV / rrTfo * ((mD0 + lD + mrc) * pin_LAMBDAF - (mD0 + mrc) * pin_LAMBDAD - mD0 * lD * pin_ID) / ((mD0 + mrc) * (lRot + lD) + lRot * lD); + else + pin_FieldCurrent = -mDV / rrTfo * ((lD + mrc) * pin_LAMBDAF - mrc * pin_LAMBDAD - lD * pin_LAMBDAAD) / (mrc * (lRot + lD) + lRot * lD); + end if; +end DYNModelM1S_INIT; diff --git a/iPSL/Electrical/Machines/Eurostag/DYNModelM2S_INIT.mo b/iPSL/Electrical/Machines/Eurostag/DYNModelM2S_INIT.mo index b91465bc7..4812a8005 100644 --- a/iPSL/Electrical/Machines/Eurostag/DYNModelM2S_INIT.mo +++ b/iPSL/Electrical/Machines/Eurostag/DYNModelM2S_INIT.mo @@ -1,452 +1,483 @@ -within iPSL.Electrical.Machines.Eurostag; -model DYNModelM2S_INIT "Initialization model for synchronous mahine M2S. - Developed by RTE and adapted by AIA. 2014/03/10" - - Modelica.Blocks.Interfaces.RealInput pin_CM; - Modelica.Blocks.Interfaces.RealInput pin_EFD; - Modelica.Blocks.Interfaces.RealOutput pin_LAMBDAF; - Modelica.Blocks.Interfaces.RealOutput pin_LAMBDAD; - Modelica.Blocks.Interfaces.RealOutput pin_LAMBDAQ1; - Modelica.Blocks.Interfaces.RealOutput pin_LAMBDAQ2; - Modelica.Blocks.Interfaces.RealOutput pin_LAMBDAAD; - Modelica.Blocks.Interfaces.RealOutput pin_LAMBDAAQ; - Modelica.Blocks.Interfaces.RealOutput pin_OMEGA; - Modelica.Blocks.Interfaces.RealOutput pin_TETA; - Modelica.Blocks.Interfaces.RealOutput pin_IQ; - Modelica.Blocks.Interfaces.RealOutput pin_ID; - Modelica.Blocks.Interfaces.RealOutput pin_UR; - Modelica.Blocks.Interfaces.RealOutput pin_UI; - Modelica.Blocks.Interfaces.RealOutput pin_TerminalVoltage; - - Modelica.Blocks.Interfaces.RealOutput pin_FieldCurrent; - Modelica.Blocks.Interfaces.RealOutput pin_ActivePowerPNALT; - Modelica.Blocks.Interfaces.RealOutput pin_ActivePowerPN; - Modelica.Blocks.Interfaces.RealOutput pin_ActivePowerSNREF; - Modelica.Blocks.Interfaces.RealOutput pin_ReactivePowerPNALT; - Modelica.Blocks.Interfaces.RealOutput pin_ReactivePowerPN; - Modelica.Blocks.Interfaces.RealOutput pin_ReactivePowerSNREF; - Modelica.Blocks.Interfaces.RealOutput pin_Current; - Modelica.Blocks.Interfaces.RealOutput pin_ActivePowerSN; - Modelica.Blocks.Interfaces.RealOutput pin_ReactivePowerSN; - - //external parameters - parameter Real XD "Direct reactance"; - parameter Real XPD "Direct trans. reactance"; - parameter Real XSD "Direct subtrans. reactance"; - parameter Real TPD0 "Direct trans. time const"; - parameter Real TSD0 "Direct subtrans. time const"; - parameter Real TX "Damping time constant"; - parameter Real XQ "Quadrat reactance"; - parameter Real XPQ "Quadrat trans. reactance"; - parameter Real XSQ "Quadrat subtrans. reactance"; - parameter Real TPQ0 "Quadrat trans. time const"; - parameter Real TSQ0 "Quadrat subtrans. time const"; - parameter Real IENR; - - parameter Real SNREF(fixed=false); - parameter Real SN(fixed=false); // puissance apparente nominale (SNOMG) - parameter Real PN(fixed=false); - parameter Real PNALT; - parameter Real sNTfo(fixed=false); - parameter Real ur0(fixed = false); - parameter Real ui0(fixed = false); - parameter Real p0(fixed = false); - parameter Real q0(fixed = false); - parameter Real uNResTfo(fixed = false); - parameter Real uNomNw(fixed = false); - parameter Real uNMacTfo(fixed = false); - parameter Real uBMac(fixed = false); - parameter Real rTfoIn(fixed = false); - parameter Real xTfoIn(fixed = false); - parameter Real nDSat;//(fixed = false); - parameter Real nQSat;//(fixed = false); - parameter Real mDSatIn;//(fixed = false); - parameter Real mQSatIn;//(fixed = false); - parameter Real rStatIn(fixed = false); - parameter Real lStatIn(fixed = false); - parameter Real omega_0(fixed=false); - parameter Real pPuWLMDV(fixed=false); - parameter Real ONE = 1; - parameter Real mrc = 0; - parameter Real PI = 3.14159265; - parameter Integer IWLMDV = 3; - parameter Boolean Saturated = true; - - iPSL.Electrical.Machines.Eurostag.PwExtIntParameters extern( - rStatIn_=rStatIn, - lStatIn_=lStatIn, - xDPu_=XD, - xpDPu_=XPD, - xppDPu_=XSD, - tpDO_=TPD0, - tppDO_=TSD0, - xQPu_=XQ, - xpQPu_=XPQ, - xppQPu_=XSQ, - tpQO_=TPQ0, - tppQO_=TSQ0, - tX_=TX, - IENR=IENR); - - // INTERNAL PARAMETERS (COMPUTED) per-unit in the machine SN base. - - parameter Real mD0Pu = extern.mD0Pu_ - "d axis mutual inductance p.u. in the machine SN base"; - parameter Real mQ0Pu = extern.mQ0Pu_ - "q axis mutual inductance p.u. in the machine SN base"; - //parameter Real pNom(fixed = false); - parameter Real lDPu = extern.lD - "d axis damper winding leakage p.u. in the machine SN base"; - parameter Real rRotIn = extern.rf - "Rotor resistance p.u. in the machine SN base"; - parameter Real lRotIn = extern.lf - "Rotor leakage p.u. in the machine SN base"; - parameter Real rQ1Pu = extern.rQ1 - "q axis damper 1 winding resistance p.u. in the machine SN base"; - parameter Real lQ1Pu = extern.lQ1 - "q axis damper 1 winding leakeage p.u. in the machine SN base"; - parameter Real rQ2Pu = extern.rQ2 - "q axis damper 2 winding resistance p.u. in the machine SN base"; - parameter Real lQ2Pu = extern.lQ2 - "q axis damper 2 winding leakeage p.u. in the machine SN base"; - parameter Real mCanPu=extern.mrc - "CANAY's inductance p.u. in the machine SN base"; - - //parameter Real omega0(fixed=false); - - // Computed parameters - parameter Real yScaleNom = SNREF/SN; // YSCALE - parameter Real rStatNom = rStatIn * yScaleNom; // YI = RESARM * YSCALE; - parameter Real lStatNom = lStatIn * yScaleNom; // YLAMDI = READST * YSCALE - parameter Real lQINom = lStatIn * yScaleNom; // YLQI = REAQST avec REAQST=READST (puing1.f) - parameter Real mQ0Nom = mQ0Pu*yScaleNom; // YMQI = FMUQST(INB2) * YSCALE (YMQINS) - parameter Real mD0Nom = mD0Pu*yScaleNom; // YMDI = FMUDST(INB2) * YSCALE (YMDINS) - parameter Real urNom = 1.0; // YE - parameter Real uiNom = 0.0; // YF - parameter Real qPuWLMDV = (SN^2 - pPuWLMDV^2)^(1/2); // QUNIT (pucalif.f) - parameter Real pNomWLMDV = pPuWLMDV / SNREF; // YPG (pucalif.f) - parameter Real qNomWLMDV = qPuWLMDV / SNREF; // YQG (pucalif.f) - parameter Real irNom = (pNomWLMDV * urNom + qNomWLMDV * uiNom); // YIR (pucalif.f) - parameter Real iiNom = (pNomWLMDV * uiNom - qNomWLMDV * urNom); // YII - parameter Real omegaNom = 1.0; // OMEGA - parameter Real rTfoNom = 0.0; // YTI - parameter Real xTfoNom = 0.0; // YXTI - // per unitage complementaire, calcul de rrTfo (puingc.f) - // ------------------------------------------------------ - parameter Real ri = if - ( rTfoIn > 0. or xTfoIn > 0.) then (uNResTfo/uNomNw) / (uNMacTfo/uBMac) else 1.; - parameter Real rs = if - ( rTfoIn > 0. or xTfoIn > 0.) then (uNResTfo/uNomNw)^2 * SNREF / sNTfo else 1.; - parameter Real mSalNom = mD0Nom - mQ0Nom; - parameter Real xQNom0 = mQ0Nom + lQINom; - parameter Real tetaNomNum0 = uiNom + omegaNom*(xTfoNom+xQNom0)*irNom + (rTfoNom+rStatNom)*iiNom; - parameter Real tetaNomDenom0 = urNom + (rTfoNom+rStatNom)*irNom - omegaNom*(xTfoNom+xQNom0)*iiNom; - parameter Real lambdaADNom0 = -(urNom + (rStatNom+rTfoNom)*irNom + omegaNom*(lStatNom+xTfoNom)*(-iiNom))/omegaNom; - parameter Real lambdaAQNom0 = (-uiNom + (rStatNom+rTfoNom)*(-iiNom) - omegaNom*(lQINom+xTfoNom)*irNom)/omegaNom; - parameter Real lambdaADNom20 = lambdaADNom0*lambdaADNom0; - parameter Real lambdaAQNom20 = lambdaAQNom0*lambdaAQNom0; - - Real u2(start = 1.0); - Real tetaNomNum(start = tetaNomNum0); - Real tetaNomDenom(start = tetaNomDenom0); - Real tetaNom(start = 0); - Real iDNom(start=-iiNom); - Real iQNom(start=irNom); // YIQ - Real uDNom(start=-uiNom); // YUD - Real uQNom(start=urNom); // YUQ - Real lambdaADNom(start=lambdaADNom0); // YLAMAD - Real lambdaAQNom(start=lambdaAQNom0); // YLAMAQ - Real lambdaADNom2(start=lambdaADNom0*lambdaADNom0); // YV72 - Real lambdaAQNom2(start=lambdaAQNom0*lambdaAQNom0); // YV82 - Real ENom2(start= lambdaADNom20 + lambdaAQNom20); // YNN2 - Real mDSNom; // YXADS - Real mQSNom; // YXAQS - Real cosNuNom2; // YCODQ2 - Real sinNuNom2; // YSIDQ2 - Real mINom; // YMC - Real mDNom(start = mD0Nom); // YMDI / YMDINS - Real mQNom(start = mQ0Nom); // YMQI / YMQINS - Real ifNom(start = 1.0); - Real mDVPu(start = 1.0); - Real rStat( start = rStatIn); - Real lStat( start = lStatIn); - Real lD(start = lDPu); - Real lQI(start = lStatIn); - Real lRot(start = lRotIn); - Real mQ0(start = mQ0Pu); - Real lQ1(start = lQ1Pu); - Real lQ2(start = lQ2Pu); - Real mD0(start = mD0Pu); - Real mCan( start = mCanPu); - Real xQ; // YXQ = mQ + lQI - Real teta0Num; // YNUM - Real teta0Denom; // YDENOM - Real uD0(start = - ui0); // YUD - Real uQ0(start = ur0); // YUQ - Real lambdaAD02; // YV72 - Real lambdaAQ02; // YV82 - Real E02; // YNN2 - Real cosNu2; // YCODQ2 - Real sinNu2; // YSIDQ2 - Real mD(start = mD0Pu); // YMDINS - Real mQ(start = mQ0Pu); // YMQINS - Real if0(start = 1.0); - Real DET(start = 1.0); - Real u1r(start = ur0); - Real u1i(start = ui0); - Real mSal; // YMSAL - - // variables conservées par le compilateur: - // --------------------------------------- - parameter Real ir0_0 = p0*ur0 + q0*ui0; - parameter Real ii0_0 = p0*ui0 - q0*ur0; - Real ir0(start = ir0_0); - Real ii0(start = ii0_0); - Real mDSat(start = mDSatIn); - Real mQSat(start = mQSatIn); - Real xQNom(start = xQNom0); - Real yScale(start = SNREF / SN); - Real rrTfo(start = ri); - Real rTfo(start = rTfoIn * rs); - Real xTfo(start = xTfoIn * rs); - - parameter Real xQ0 = mQ0Pu - lStatIn; - Real mDV(start = 1.0); - Real teta0(start = 0.0); // YTETA = ATAN2(YNUM,YDENOM) - Real tetaInterne0(start = 0.0); - Real iD0(start = -ii0_0); // YID - Real iQ0(start = ir0_0); // YIQ - - parameter Real lambdaAD0_0 = -(ur0 + (rStatIn+rTfoIn)*ir0_0 + (lStatIn+xTfoIn)*(-ii0_0)) / omega_0; - parameter Real lambdaAQ0_0 = ( -ui0 + (rStatIn+rTfoIn)*(-ii0_0) - (lStatIn+xTfoIn)*ir0_0) / omega_0; - Real lambdaAD0(start = lambdaAD0_0); // YLAMAD - Real lambdaAQ0(start = lambdaAQ0_0); // YLAMAQ - parameter Real E0_0 = (lambdaAD0_0*lambdaAD0_0 + lambdaAQ0_0*lambdaAQ0_0)^(1/2); - Real E0(start = E0_0); - - Real mDS0(start = 1.0); // YXADS - Real mQS0(start = 1.0); // YXAQS - Real mI0(start = 1.0); // YMC - Real lambdaQ10(start = 1.0); - Real lambdaQ20(start = 1.0); - Real lambdaD0(start = 1.0); // YLAMD - Real lambdaF0(start = 1.0); // YLAMF - Real cm0(start = 1.0); - Real efd0(start = 1.0); - Real lMD0(start = 1.0); - Real lMQ0(start = 1.0); - Real mD_0(start = 1.0); - Real mQ_0(start = 1.0); - Real urReg0(start = ur0); - Real uiReg0(start = ui0); - Real ir; - Real ii; - -equation - // per unitage des donnees d'entree - // -------------------------------- - // - (ur0Nw, ui0Nw) en kV*Ub/Un -> (ur0, ui0) en kV/Un - // - (p0Nw, q0Nw) en MW/MVAr -> (p0, q0) en MW/MVAr/SNREF - // -> (ir0, ii0) en kA*Un/SNREF - - u2 = ur0*ur0 + ui0*ui0; // YN = YE*YE + YF*YF - ONE*ir0 = (p0*ur0 + q0*ui0) / u2; // YIR - ONE*ii0 = (p0*ui0 - q0*ur0) / u2; // YII - - ONE*rrTfo = ri; // YRI = RTFO - ONE*rTfo = rTfoIn * rs; // RESTFO(INB3) = RESTFO(INB3) * YS - ONE*xTfo = xTfoIn * rs; // REATFO(INB3) = REATFO(INB3) * YS - - ONE*mDSat = mDSatIn / ri^nDSat; // RMD - ONE*mQSat = mQSatIn / ri^nQSat; // RMQ - - // calcul de WLMDV (FMUDMA) (pucalif.f) - // ------------------------------------ - - //{ - xQNom = mQNom + lQINom; // YXQ - tetaNomNum = uiNom + omegaNom*(xTfoNom+xQNom)*irNom + (rTfoNom+rStatNom)*iiNom; // YNUM - tetaNomDenom = urNom + (rTfoNom+rStatNom)*irNom - omegaNom*(xTfoNom+xQNom)*iiNom; // YDENOM - //tetaNom = atan2(tetaNomNum,tetaNomDenom); // YTETA - tetaNom = 2*atan(tetaNomNum/(sqrt(tetaNomNum*tetaNomNum+tetaNomDenom*tetaNomDenom)+tetaNomDenom)); - - iDNom = sin(tetaNom)*irNom - cos(tetaNom)*iiNom; // YID - iQNom = cos(tetaNom)*irNom + sin(tetaNom)*iiNom; // YIQ - uDNom = sin(tetaNom)*urNom - cos(tetaNom)*uiNom; // YUD - uQNom = cos(tetaNom)*urNom + sin(tetaNom)*uiNom; // YUQ - - lambdaADNom = -(uQNom + (rStatNom+rTfoNom)*iQNom + omegaNom*(lStatNom+xTfoNom)*iDNom)/omegaNom; // YLAMAD - lambdaAQNom = (uDNom + (rStatNom+rTfoNom)*iDNom - omegaNom*(lQINom+xTfoNom)*iQNom)/omegaNom; // YLAMAQ - - lambdaADNom2 = lambdaADNom*lambdaADNom; // YV72 - lambdaAQNom2 = lambdaAQNom*lambdaAQNom; // YV82 - ENom2 = lambdaADNom2 + lambdaAQNom2; // YNN2 - - mDSNom = mD0Nom / (1. + mDSat*ENom2^(nDSat/2.)); // YXADS - mQSNom = mQ0Nom / (1. + mQSat*ENom2^(nQSat/2.)); // YXAQS - - cosNuNom2 = lambdaADNom2/ENom2; // YCODQ2 - sinNuNom2 = lambdaAQNom2/ENom2; // YSIDQ2 - - mINom = mDSNom * cosNuNom2 + mQSNom * sinNuNom2; // YMC - - mDNom = mINom + mSalNom * sinNuNom2; - mQNom = mINom - mSalNom * cosNuNom2; - //} - ifNom = lambdaADNom/mDNom - iDNom; // YRIF - //mDVPu = -1. / (ifNom * yScaleNom); // FMUDMA (calcule dans puingc.f) - - if (Saturated==false and IWLMDV==2) then - mDVPu = mD0Pu; - elseif Saturated==true and IWLMDV==2 then - mDVPu = mD0Pu/(1+mDSatIn); - elseif IWLMDV==1 then - mDVPu = mD0Pu; - else - mDVPu = -1. / (ifNom * yScaleNom); // FMUDMA (calcule dans puingc.f) - end if; - - // per unitage de parametres (park2.f) - // ----------------------------------- - ONE* yScale = if - ( rTfoIn > 0. or xTfoIn > 0.) then SNREF/SN*rrTfo*rrTfo else SNREF/SN; // YSCALE - - rStat = rStatIn * yScale; // YI = RESARM * yScale; - lStat = lStatIn * yScale; // YLAMDI = READST * yScale - lD = lDPu * yScale; // YLDI = READDI * YSCALE - lQI = lStatIn * yScale; // YLQI = REAQST avec REAQST=READST (puing1.f) - lRot = lRotIn * yScale; // YLFI = lRotIn * yScale; - mQ0 = mQ0Pu*yScale; // YMQI = FMUQST(INB2) * YSCALE (YMQINS) - lQ1 = lQ1Pu * yScale; // YLQ1I - lQ2 = lQ2Pu * yScale; // YLQ2I - mD0 = mD0Pu*yScale; // YMDI = FMUDST(INB2) * YSCALE (YMDINS) - ONE*mDV = mDVPu * yScale; // YMDIM - mCan = mCanPu * yScale; // YMRCI = mCan * yScale; - - // calcul des valeurs initiales des variables machine (park2.f) - // ------------------------------------------------------------ - mSal = mD0 - mQ0; - //{ - xQ = mQ + lQI; // YXQ = mQ + lQI - - teta0Num = ui0 + omega_0*(xTfo+xQ)*ir0 + (rTfo+rStat)*ii0; // YNUM - teta0Denom = ur0 + (rTfo+rStat)*ir0 - omega_0*(xTfo+xQ)*ii0; // YDENOM - //expression ange moitié - //ONE*teta0 = atan2(teta0Num ,teta0Denom); // YTETA = ATAN2(YNUM,YDENOM) - ONE*teta0 = 2*atan(teta0Num/(sqrt(teta0Num*teta0Num+teta0Denom*teta0Denom)+teta0Denom)); - - ONE*iD0 = sin(teta0)*ir0 - cos(teta0)*ii0; // YID - ONE* iQ0 = cos(teta0)*ir0 + sin(teta0)*ii0; // YIQ - uD0 = sin(teta0)*ur0 - cos(teta0)*ui0; // YUD - uQ0 = cos(teta0)*ur0 + sin(teta0)*ui0; // YUQ - - // expression angle moitié - //ONE*tetaInterne0 = atan2(uD0,uQ0); - ONE*tetaInterne0 = 2*atan(uD0/(sqrt(uD0*uD0 + uQ0*uQ0)+uQ0)); - - ONE*lambdaAD0 = -(uQ0 + (rStat+rTfo)*iQ0 + (lStat+xTfo)*iD0) / omega_0; // YLAMAD - ONE*lambdaAQ0 = (uD0 + (rStat+rTfo)*iD0 - (lQI+xTfo)*iQ0) / omega_0; // YLAMAQ - - lambdaAD02 = lambdaAD0*lambdaAD0; // YV72 - lambdaAQ02 = lambdaAQ0*lambdaAQ0; // YV82 - E02 = lambdaAD02 + lambdaAQ02; // YNN2 - ONE*E0= sqrt(E02); - - ONE*mDS0 = mD0 / ( 1.+ mDSat*E02^(nDSat/2)); // YXADS - ONE*mQS0 = mQ0 / ( 1.+ mQSat*E02^(nQSat/2)); // YXAQS - - cosNu2 = lambdaAD02 / E02; // YCODQ2 - sinNu2 = lambdaAQ02 / E02; // YSIDQ2 - - ONE* mI0 = mDS0 * cosNu2 + mQS0 * sinNu2; // YMC - - mD = mI0 + mSal * sinNu2; - mQ = mI0 - mSal * cosNu2; - //} - - if0 = lambdaAD0/mD - iD0; // YRIF - - ONE*lambdaQ10 = lambdaAQ0; - ONE*lambdaQ20 = lambdaAQ0; - ONE*lambdaD0 = lambdaAD0 + mCan*if0; // YLAMD - ONE*lambdaF0 = lambdaAD0 + (lRot+mCan)*if0; // YLAMF - - ONE*cm0 = (-lambdaAD0 * iQ0 + lambdaAQ0 * iD0) * SNREF / PN; // YCM - - ONE*efd0 = - mDV * if0 / rrTfo; // YEFD = - YMDIM * YRIF / YRI - DET = lRot*lD + mCan*(lRot+lD); - ONE*lMD0 = lambdaAD0 / (iD0 + lD*lambdaF0/DET + lRot*lambdaD0/DET); - ONE*lMQ0 = lambdaAQ0 / (iQ0 + lambdaQ10/lQ1 + lambdaQ20/lQ2); - - ONE*mD_0 = mDS0; - ONE*mQ_0 = mQS0; - - // calcul du ureg0 - u1r =ur0 + rTfo*ir0 -xTfo*ii0; - u1i =ui0 + rTfo*ii0 +xTfo*ir0; - ONE*urReg0 = 1/rrTfo*u1r; - ONE*uiReg0 = 1/rrTfo*u1i; - - ir = -(sin(pin_TETA)*pin_ID+cos(pin_TETA)*pin_IQ); - ii=-(-cos(pin_TETA)*pin_ID+sin(pin_TETA)*pin_IQ); - - pin_TerminalVoltage = sqrt((pin_UR-rTfo*ir+xTfo*ii)*(pin_UR-rTfo*ir+xTfo*ii) + (pin_UI-rTfo*ii-xTfo*ir)*(pin_UI-rTfo*ii-xTfo*ir))*1/rrTfo; - - pin_CM = cm0; - pin_EFD = efd0; - pin_LAMBDAF = lambdaF0; - pin_LAMBDAD = lambdaD0; - pin_LAMBDAQ1 = lambdaQ10; - pin_LAMBDAQ2 = lambdaQ20; - pin_LAMBDAAD = lambdaAD0; - pin_LAMBDAAQ = lambdaAQ0; - pin_OMEGA = omega_0; - pin_TETA = teta0; - pin_IQ = iQ0; - pin_ID = iD0; - pin_UR = ur0; - pin_UI = ui0; - - pin_ActivePowerPN = (pin_UR*(-ir)+pin_UI*(-ii))*SNREF/PN; - - if PNALT == 0 then - pin_ActivePowerPNALT = 0; - pin_ReactivePowerPNALT = 0; - else - pin_ActivePowerPNALT = (pin_UR*(-ir)+pin_UI*(-ii))*SNREF/PNALT; - pin_ReactivePowerPNALT = (pin_UI*(-ir)-pin_UR*(-ii))*SNREF/PNALT; - end if; - pin_ActivePowerSNREF = (pin_UR*(-ir)+pin_UI*(-ii)); - pin_ReactivePowerPN = (pin_UI*(-ir)-pin_UR*(-ii))*SNREF/PN; - pin_ReactivePowerSNREF = (pin_UI*(-ir)-pin_UR*(-ii)); - pin_Current = sqrt(ir*ir+ii*ii); - - //ActivePower SN - pin_ActivePowerSN = (pin_UR*(-ir)+pin_UI*(-ii))*SNREF/SN; - - //ReactivePower SN - pin_ReactivePowerSN = (pin_UI*(-ir)-pin_UR*(-ii))*SNREF/SN; - - //Field Current - if mDSatIn==0 and mQSatIn==0 and nDSat==0 and nQSat==0 then - pin_FieldCurrent = -(mDV/rrTfo)*((mD0+lD+mrc)*pin_LAMBDAF-(mD0+mrc)*pin_LAMBDAD-mD0*lD*pin_ID)/((mD0+mrc)*(lRot+lD)+lRot*lD); - else - pin_FieldCurrent = -(mDV/rrTfo)*((lD+mrc)*pin_LAMBDAF- mrc*pin_LAMBDAD-lD*pin_LAMBDAAD)/(mrc*(lRot+lD)+lRot*lD); - end if; - - annotation (Documentation(info=" -


<iPSL: iTesla Power System Library>

-

Copyright 2015 RTE (France), AIA (Spain), KTH (Sweden) and DTU (Denmark)

- -

The authors can be contacted by email: info at itesla-ipsl dot org

-

This package is part of the iTesla Power System Library ("iPSL") .

-

The iPSL is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

-

The iPSL is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

-

You should have received a copy of the GNU Lesser General Public License along with the iPSL. If not, see <http://www.gnu.org/licenses/>.

-")); -end DYNModelM2S_INIT; +within iPSL.Electrical.Machines.Eurostag; +model DYNModelM2S_INIT + PowerSystems.Connectors.ImPin pin_CM; + PowerSystems.Connectors.ImPin pin_EFD; + PowerSystems.Connectors.ImPin pin_LAMBDAF; + PowerSystems.Connectors.ImPin pin_LAMBDAD; + PowerSystems.Connectors.ImPin pin_LAMBDAQ1; + PowerSystems.Connectors.ImPin pin_LAMBDAQ2; + PowerSystems.Connectors.ImPin pin_LAMBDAAD; + PowerSystems.Connectors.ImPin pin_LAMBDAAQ; + PowerSystems.Connectors.ImPin pin_OMEGA; + PowerSystems.Connectors.ImPin pin_TETA; + PowerSystems.Connectors.ImPin pin_IQ; + PowerSystems.Connectors.ImPin pin_ID; + PowerSystems.Connectors.ImPin pin_UR; + PowerSystems.Connectors.ImPin pin_UI; + PowerSystems.Connectors.ImPin pin_TerminalVoltage; + PowerSystems.Connectors.ImPin pin_FieldCurrent; + PowerSystems.Connectors.ImPin pin_ActivePowerPNALT; + PowerSystems.Connectors.ImPin pin_ActivePowerPN; + PowerSystems.Connectors.ImPin pin_ActivePowerSNREF; + PowerSystems.Connectors.ImPin pin_ReactivePowerPNALT; + PowerSystems.Connectors.ImPin pin_ReactivePowerPN; + PowerSystems.Connectors.ImPin pin_ReactivePowerSNREF; + PowerSystems.Connectors.ImPin pin_Current; + PowerSystems.Connectors.ImPin pin_ActivePowerSN; + PowerSystems.Connectors.ImPin pin_ReactivePowerSN; + //external parameters + parameter Real XD "Direct reactance"; + parameter Real XPD "Direct trans. reactance"; + parameter Real XSD "Direct subtrans. reactance"; + parameter Real TPD0 "Direct trans. time const"; + parameter Real TSD0 "Direct subtrans. time const"; + parameter Real TX "Damping time constant"; + parameter Real XQ "Quadrat reactance"; + parameter Real XPQ "Quadrat trans. reactance"; + parameter Real XSQ "Quadrat subtrans. reactance"; + parameter Real TPQ0 "Quadrat trans. time const"; + parameter Real TSQ0 "Quadrat subtrans. time const"; + parameter Real IENR; + parameter Real SNREF(fixed = false); + parameter Real SN(fixed = false); + // puissance apparente nominale (SNOMG) + parameter Real PN(fixed = false); + parameter Real PNALT; + parameter Real sNTfo(fixed = false); + parameter Real ur0(fixed = false); + parameter Real ui0(fixed = false); + parameter Real p0(fixed = false); + parameter Real q0(fixed = false); + parameter Real uNResTfo(fixed = false); + parameter Real uNomNw(fixed = false); + parameter Real uNMacTfo(fixed = false); + parameter Real uBMac(fixed = false); + parameter Real rTfoIn(fixed = false); + parameter Real xTfoIn(fixed = false); + parameter Real nDSat; + //(fixed = false); + parameter Real nQSat; + //(fixed = false); + parameter Real mDSatIn; + //(fixed = false); + parameter Real mQSatIn; + //(fixed = false); + parameter Real rStatIn(fixed = false); + parameter Real lStatIn(fixed = false); + parameter Real omega_0(fixed = false); + parameter Real pPuWLMDV(fixed = false); + parameter Real ONE = 1; + parameter Real mrc = 0; + parameter Real PI = 3.14159265; + parameter Integer IWLMDV = 3; + parameter Boolean Saturated = true; + PowerSystems.Electrical.Machines.Eurostag.PwExtIntParameters extern(rStatIn_ = rStatIn, lStatIn_ = lStatIn, xDPu_ = XD, xpDPu_ = XPD, xppDPu_ = XSD, tpDO_ = TPD0, tppDO_ = TSD0, xQPu_ = XQ, xpQPu_ = XPQ, xppQPu_ = XSQ, tpQO_ = TPQ0, tppQO_ = TSQ0, tX_ = TX, IENR = IENR); + // INTERNAL PARAMETERS (COMPUTED) per-unit in the machine SN base. + parameter Real mD0Pu = extern.mD0Pu_ + "d axis mutual inductance p.u. in the machine SN base"; + parameter Real mQ0Pu = extern.mQ0Pu_ + "q axis mutual inductance p.u. in the machine SN base"; + //parameter Real pNom(fixed = false); + parameter Real lDPu = extern.lD + "d axis damper winding leakage p.u. in the machine SN base"; + parameter Real rRotIn = extern.rf + "Rotor resistance p.u. in the machine SN base"; + parameter Real lRotIn = extern.lf "Rotor leakage p.u. in the machine SN base"; + parameter Real rQ1Pu = extern.rQ1 + "q axis damper 1 winding resistance p.u. in the machine SN base"; + parameter Real lQ1Pu = extern.lQ1 + "q axis damper 1 winding leakeage p.u. in the machine SN base"; + parameter Real rQ2Pu = extern.rQ2 + "q axis damper 2 winding resistance p.u. in the machine SN base"; + parameter Real lQ2Pu = extern.lQ2 + "q axis damper 2 winding leakeage p.u. in the machine SN base"; + parameter Real mCanPu = extern.mrc + "CANAY's inductance p.u. in the machine SN base"; + //parameter Real omega0(fixed=false); + // Computed parameters + parameter Real yScaleNom = SNREF / SN; + // YSCALE + parameter Real rStatNom = rStatIn * yScaleNom; + // YI = RESARM * YSCALE; + parameter Real lStatNom = lStatIn * yScaleNom; + // YLAMDI = READST * YSCALE + parameter Real lQINom = lStatIn * yScaleNom; + // YLQI = REAQST avec REAQST=READST (puing1.f) + parameter Real mQ0Nom = mQ0Pu * yScaleNom; + // YMQI = FMUQST(INB2) * YSCALE (YMQINS) + parameter Real mD0Nom = mD0Pu * yScaleNom; + // YMDI = FMUDST(INB2) * YSCALE (YMDINS) + parameter Real urNom = 1.0; + // YE + parameter Real uiNom = 0.0; + // YF + parameter Real qPuWLMDV = (SN ^ 2 - pPuWLMDV ^ 2) ^ (1 / 2); + // QUNIT (pucalif.f) + parameter Real pNomWLMDV = pPuWLMDV / SNREF; + // YPG (pucalif.f) + parameter Real qNomWLMDV = qPuWLMDV / SNREF; + // YQG (pucalif.f) + parameter Real irNom = pNomWLMDV * urNom + qNomWLMDV * uiNom; + // YIR (pucalif.f) + parameter Real iiNom = pNomWLMDV * uiNom - qNomWLMDV * urNom; + // YII + parameter Real omegaNom = 1.0; + // OMEGA + parameter Real rTfoNom = 0.0; + // YTI + parameter Real xTfoNom = 0.0; + // YXTI + // per unitage complementaire, calcul de rrTfo (puingc.f) + // ------------------------------------------------------ + parameter Real ri = if rTfoIn > 0.0 or xTfoIn > 0.0 then uNResTfo / uNomNw / uNMacTfo / uBMac else 1.0; + parameter Real rs = if rTfoIn > 0.0 or xTfoIn > 0.0 then (uNResTfo / uNomNw) ^ 2 * SNREF / sNTfo else 1.0; + parameter Real mSalNom = mD0Nom - mQ0Nom; + parameter Real xQNom0 = mQ0Nom + lQINom; + parameter Real tetaNomNum0 = uiNom + omegaNom * (xTfoNom + xQNom0) * irNom + (rTfoNom + rStatNom) * iiNom; + parameter Real tetaNomDenom0 = urNom + (rTfoNom + rStatNom) * irNom - omegaNom * (xTfoNom + xQNom0) * iiNom; + parameter Real lambdaADNom0 = -(urNom + (rStatNom + rTfoNom) * irNom + omegaNom * (lStatNom + xTfoNom) * (-iiNom)) / omegaNom; + parameter Real lambdaAQNom0 = ((-uiNom) + (rStatNom + rTfoNom) * (-iiNom) - omegaNom * (lQINom + xTfoNom) * irNom) / omegaNom; + parameter Real lambdaADNom20 = lambdaADNom0 * lambdaADNom0; + parameter Real lambdaAQNom20 = lambdaAQNom0 * lambdaAQNom0; + Real u2(start = 1.0); + Real tetaNomNum(start = tetaNomNum0); + Real tetaNomDenom(start = tetaNomDenom0); + Real tetaNom(start = 0); + Real iDNom(start = -iiNom); + Real iQNom(start = irNom); + // YIQ + Real uDNom(start = -uiNom); + // YUD + Real uQNom(start = urNom); + // YUQ + Real lambdaADNom(start = lambdaADNom0); + // YLAMAD + Real lambdaAQNom(start = lambdaAQNom0); + // YLAMAQ + Real lambdaADNom2(start = lambdaADNom0 * lambdaADNom0); + // YV72 + Real lambdaAQNom2(start = lambdaAQNom0 * lambdaAQNom0); + // YV82 + Real ENom2(start = lambdaADNom20 + lambdaAQNom20); + // YNN2 + Real mDSNom; + // YXADS + Real mQSNom; + // YXAQS + Real cosNuNom2; + // YCODQ2 + Real sinNuNom2; + // YSIDQ2 + Real mINom; + // YMC + Real mDNom(start = mD0Nom); + // YMDI / YMDINS + Real mQNom(start = mQ0Nom); + // YMQI / YMQINS + Real ifNom(start = 1.0); + Real mDVPu(start = 1.0); + Real rStat(start = rStatIn); + Real lStat(start = lStatIn); + Real lD(start = lDPu); + Real lQI(start = lStatIn); + Real lRot(start = lRotIn); + Real mQ0(start = mQ0Pu); + Real lQ1(start = lQ1Pu); + Real lQ2(start = lQ2Pu); + Real mD0(start = mD0Pu); + Real mCan(start = mCanPu); + Real xQ; + // YXQ = mQ + lQI + Real teta0Num; + // YNUM + Real teta0Denom; + // YDENOM + Real uD0(start = -ui0); + // YUD + Real uQ0(start = ur0); + // YUQ + Real lambdaAD02; + // YV72 + Real lambdaAQ02; + // YV82 + Real E02; + // YNN2 + Real cosNu2; + // YCODQ2 + Real sinNu2; + // YSIDQ2 + Real mD(start = mD0Pu); + // YMDINS + Real mQ(start = mQ0Pu); + // YMQINS + Real if0(start = 1.0); + Real DET(start = 1.0); + Real u1r(start = ur0); + Real u1i(start = ui0); + Real mSal; + // YMSAL + // variables conservées par le compilateur: + // --------------------------------------- + parameter Real ir0_0 = p0 * ur0 + q0 * ui0; + parameter Real ii0_0 = p0 * ui0 - q0 * ur0; + Real ir0(start = ir0_0); + Real ii0(start = ii0_0); + Real mDSat(start = mDSatIn); + Real mQSat(start = mQSatIn); + Real xQNom(start = xQNom0); + Real yScale(start = SNREF / SN); + Real rrTfo(start = ri); + Real rTfo(start = rTfoIn * rs); + Real xTfo(start = xTfoIn * rs); + parameter Real xQ0 = mQ0Pu - lStatIn; + Real mDV(start = 1.0); + Real teta0(start = 0.0); + // YTETA = ATAN2(YNUM,YDENOM) + Real tetaInterne0(start = 0.0); + Real iD0(start = -ii0_0); + // YID + Real iQ0(start = ir0_0); + // YIQ + parameter Real lambdaAD0_0 = -(ur0 + (rStatIn + rTfoIn) * ir0_0 + (lStatIn + xTfoIn) * (-ii0_0)) / omega_0; + parameter Real lambdaAQ0_0 = ((-ui0) + (rStatIn + rTfoIn) * (-ii0_0) - (lStatIn + xTfoIn) * ir0_0) / omega_0; + Real lambdaAD0(start = lambdaAD0_0); + // YLAMAD + Real lambdaAQ0(start = lambdaAQ0_0); + // YLAMAQ + parameter Real E0_0 = (lambdaAD0_0 * lambdaAD0_0 + lambdaAQ0_0 * lambdaAQ0_0) ^ (1 / 2); + Real E0(start = E0_0); + Real mDS0(start = 1.0); + // YXADS + Real mQS0(start = 1.0); + // YXAQS + Real mI0(start = 1.0); + // YMC + Real lambdaQ10(start = 1.0); + Real lambdaQ20(start = 1.0); + Real lambdaD0(start = 1.0); + // YLAMD + Real lambdaF0(start = 1.0); + // YLAMF + Real cm0(start = 1.0); + Real efd0(start = 1.0); + Real lMD0(start = 1.0); + Real lMQ0(start = 1.0); + Real mD_0(start = 1.0); + Real mQ_0(start = 1.0); + Real urReg0(start = ur0); + Real uiReg0(start = ui0); + Real ir; + Real ii; +equation + // per unitage des donnees d'entree + // -------------------------------- + // - (ur0Nw, ui0Nw) en kV*Ub/Un -> (ur0, ui0) en kV/Un + // - (p0Nw, q0Nw) en MW/MVAr -> (p0, q0) en MW/MVAr/SNREF + // -> (ir0, ii0) en kA*Un/SNREF + u2 = ur0 * ur0 + ui0 * ui0; + // YN = YE*YE + YF*YF + ONE * ir0 = (p0 * ur0 + q0 * ui0) / u2; + // YIR + ONE * ii0 = (p0 * ui0 - q0 * ur0) / u2; + // YII + ONE * rrTfo = ri; + // YRI = RTFO + ONE * rTfo = rTfoIn * rs; + // RESTFO(INB3) = RESTFO(INB3) * YS + ONE * xTfo = xTfoIn * rs; + // REATFO(INB3) = REATFO(INB3) * YS + ONE * mDSat = mDSatIn / ri ^ nDSat; + // RMD + ONE * mQSat = mQSatIn / ri ^ nQSat; + // RMQ + // calcul de WLMDV (FMUDMA) (pucalif.f) + // ------------------------------------ + //{ + xQNom = mQNom + lQINom; + // YXQ + tetaNomNum = uiNom + omegaNom * (xTfoNom + xQNom) * irNom + (rTfoNom + rStatNom) * iiNom; + // YNUM + tetaNomDenom = urNom + (rTfoNom + rStatNom) * irNom - omegaNom * (xTfoNom + xQNom) * iiNom; + // YDENOM + //tetaNom = atan2(tetaNomNum,tetaNomDenom); // YTETA + tetaNom = 2 * atan(tetaNomNum / (sqrt(tetaNomNum * tetaNomNum + tetaNomDenom * tetaNomDenom) + tetaNomDenom)); + iDNom = sin(tetaNom) * irNom - cos(tetaNom) * iiNom; + // YID + iQNom = cos(tetaNom) * irNom + sin(tetaNom) * iiNom; + // YIQ + uDNom = sin(tetaNom) * urNom - cos(tetaNom) * uiNom; + // YUD + uQNom = cos(tetaNom) * urNom + sin(tetaNom) * uiNom; + // YUQ + lambdaADNom = -(uQNom + (rStatNom + rTfoNom) * iQNom + omegaNom * (lStatNom + xTfoNom) * iDNom) / omegaNom; + // YLAMAD + lambdaAQNom = (uDNom + (rStatNom + rTfoNom) * iDNom - omegaNom * (lQINom + xTfoNom) * iQNom) / omegaNom; + // YLAMAQ + lambdaADNom2 = lambdaADNom * lambdaADNom; + // YV72 + lambdaAQNom2 = lambdaAQNom * lambdaAQNom; + // YV82 + ENom2 = lambdaADNom2 + lambdaAQNom2; + // YNN2 + mDSNom = mD0Nom / (1.0 + mDSat * ENom2 ^ (nDSat / 2.0)); + // YXADS + mQSNom = mQ0Nom / (1.0 + mQSat * ENom2 ^ (nQSat / 2.0)); + // YXAQS + cosNuNom2 = lambdaADNom2 / ENom2; + // YCODQ2 + sinNuNom2 = lambdaAQNom2 / ENom2; + // YSIDQ2 + mINom = mDSNom * cosNuNom2 + mQSNom * sinNuNom2; + // YMC + mDNom = mINom + mSalNom * sinNuNom2; + mQNom = mINom - mSalNom * cosNuNom2; + //} + ifNom = lambdaADNom / mDNom - iDNom; + // YRIF + //mDVPu = -1. / (ifNom * yScaleNom); // FMUDMA (calcule dans puingc.f) + if Saturated == false and IWLMDV == 2 then + mDVPu = mD0Pu; + elseif Saturated == true and IWLMDV == 2 then + mDVPu = mD0Pu / (1 + mDSatIn); + elseif IWLMDV == 1 then + mDVPu = mD0Pu; + else + mDVPu = -1.0 / (ifNom * yScaleNom); + end if; + // FMUDMA (calcule dans puingc.f) + // per unitage de parametres (park2.f) + // ----------------------------------- + ONE * yScale = if rTfoIn > 0.0 or xTfoIn > 0.0 then SNREF / SN * rrTfo * rrTfo else SNREF / SN; + // YSCALE + rStat = rStatIn * yScale; + // YI = RESARM * yScale; + lStat = lStatIn * yScale; + // YLAMDI = READST * yScale + lD = lDPu * yScale; + // YLDI = READDI * YSCALE + lQI = lStatIn * yScale; + // YLQI = REAQST avec REAQST=READST (puing1.f) + lRot = lRotIn * yScale; + // YLFI = lRotIn * yScale; + mQ0 = mQ0Pu * yScale; + // YMQI = FMUQST(INB2) * YSCALE (YMQINS) + lQ1 = lQ1Pu * yScale; + // YLQ1I + lQ2 = lQ2Pu * yScale; + // YLQ2I + mD0 = mD0Pu * yScale; + // YMDI = FMUDST(INB2) * YSCALE (YMDINS) + ONE * mDV = mDVPu * yScale; + // YMDIM + mCan = mCanPu * yScale; + // YMRCI = mCan * yScale; + // calcul des valeurs initiales des variables machine (park2.f) + // ------------------------------------------------------------ + mSal = mD0 - mQ0; + //{ + xQ = mQ + lQI; + // YXQ = mQ + lQI + teta0Num = ui0 + omega_0 * (xTfo + xQ) * ir0 + (rTfo + rStat) * ii0; + // YNUM + teta0Denom = ur0 + (rTfo + rStat) * ir0 - omega_0 * (xTfo + xQ) * ii0; + // YDENOM + //expression ange moitié + //ONE*teta0 = atan2(teta0Num ,teta0Denom); // YTETA = ATAN2(YNUM,YDENOM) + ONE * teta0 = 2 * atan(teta0Num / (sqrt(teta0Num * teta0Num + teta0Denom * teta0Denom) + teta0Denom)); + ONE * iD0 = sin(teta0) * ir0 - cos(teta0) * ii0; + // YID + ONE * iQ0 = cos(teta0) * ir0 + sin(teta0) * ii0; + // YIQ + uD0 = sin(teta0) * ur0 - cos(teta0) * ui0; + // YUD + uQ0 = cos(teta0) * ur0 + sin(teta0) * ui0; + // YUQ + // expression angle moitié + //ONE*tetaInterne0 = atan2(uD0,uQ0); + ONE * tetaInterne0 = 2 * atan(uD0 / (sqrt(uD0 * uD0 + uQ0 * uQ0) + uQ0)); + ONE * lambdaAD0 = -(uQ0 + (rStat + rTfo) * iQ0 + (lStat + xTfo) * iD0) / omega_0; + // YLAMAD + ONE * lambdaAQ0 = (uD0 + (rStat + rTfo) * iD0 - (lQI + xTfo) * iQ0) / omega_0; + // YLAMAQ + lambdaAD02 = lambdaAD0 * lambdaAD0; + // YV72 + lambdaAQ02 = lambdaAQ0 * lambdaAQ0; + // YV82 + E02 = lambdaAD02 + lambdaAQ02; + // YNN2 + ONE * E0 = sqrt(E02); + ONE * mDS0 = mD0 / (1.0 + mDSat * E02 ^ (nDSat / 2)); + // YXADS + ONE * mQS0 = mQ0 / (1.0 + mQSat * E02 ^ (nQSat / 2)); + // YXAQS + cosNu2 = lambdaAD02 / E02; + // YCODQ2 + sinNu2 = lambdaAQ02 / E02; + // YSIDQ2 + ONE * mI0 = mDS0 * cosNu2 + mQS0 * sinNu2; + // YMC + mD = mI0 + mSal * sinNu2; + mQ = mI0 - mSal * cosNu2; + //} + if0 = lambdaAD0 / mD - iD0; + // YRIF + ONE * lambdaQ10 = lambdaAQ0; + ONE * lambdaQ20 = lambdaAQ0; + ONE * lambdaD0 = lambdaAD0 + mCan * if0; + // YLAMD + ONE * lambdaF0 = lambdaAD0 + (lRot + mCan) * if0; + // YLAMF + ONE * cm0 = ((-lambdaAD0 * iQ0) + lambdaAQ0 * iD0) * SNREF / PN; + // YCM + ONE * efd0 = -mDV * if0 / rrTfo; + // YEFD = - YMDIM * YRIF / YRI + DET = lRot * lD + mCan * (lRot + lD); + ONE * lMD0 = lambdaAD0 / (iD0 + lD * lambdaF0 / DET + lRot * lambdaD0 / DET); + ONE * lMQ0 = lambdaAQ0 / (iQ0 + lambdaQ10 / lQ1 + lambdaQ20 / lQ2); + ONE * mD_0 = mDS0; + ONE * mQ_0 = mQS0; + // calcul du ureg0 + u1r = ur0 + rTfo * ir0 - xTfo * ii0; + u1i = ui0 + rTfo * ii0 + xTfo * ir0; + ONE * urReg0 = 1 / rrTfo * u1r; + ONE * uiReg0 = 1 / rrTfo * u1i; + ir = -(sin(pin_TETA) * pin_ID + cos(pin_TETA) * pin_IQ); + ii = -((-cos(pin_TETA) * pin_ID) + sin(pin_TETA) * pin_IQ); + pin_TerminalVoltage = sqrt((pin_UR - rTfo * ir + xTfo * ii) * (pin_UR - rTfo * ir + xTfo * ii) + (pin_UI - rTfo * ii - xTfo * ir) * (pin_UI - rTfo * ii - xTfo * ir)) * 1 / rrTfo; + pin_CM = cm0; + pin_EFD = efd0; + pin_LAMBDAF = lambdaF0; + pin_LAMBDAD = lambdaD0; + pin_LAMBDAQ1 = lambdaQ10; + pin_LAMBDAQ2 = lambdaQ20; + pin_LAMBDAAD = lambdaAD0; + pin_LAMBDAAQ = lambdaAQ0; + pin_OMEGA = omega_0; + pin_TETA = teta0; + pin_IQ = iQ0; + pin_ID = iD0; + pin_UR = ur0; + pin_UI = ui0; + pin_ActivePowerPN = (pin_UR * (-ir) + pin_UI * (-ii)) * SNREF / PN; + if PNALT == 0 then + pin_ActivePowerPNALT = 0; + pin_ReactivePowerPNALT = 0; + else + pin_ActivePowerPNALT = (pin_UR * (-ir) + pin_UI * (-ii)) * SNREF / PNALT; + pin_ReactivePowerPNALT = (pin_UI * (-ir) - pin_UR * (-ii)) * SNREF / PNALT; + end if; + pin_ActivePowerSNREF = pin_UR * (-ir) + pin_UI * (-ii); + pin_ReactivePowerPN = (pin_UI * (-ir) - pin_UR * (-ii)) * SNREF / PN; + pin_ReactivePowerSNREF = pin_UI * (-ir) - pin_UR * (-ii); + pin_Current = sqrt(ir * ir + ii * ii); + //ActivePower SN + pin_ActivePowerSN = (pin_UR * (-ir) + pin_UI * (-ii)) * SNREF / SN; + //ReactivePower SN + pin_ReactivePowerSN = (pin_UI * (-ir) - pin_UR * (-ii)) * SNREF / SN; + //Field Current + if mDSatIn == 0 and mQSatIn == 0 and nDSat == 0 and nQSat == 0 then + pin_FieldCurrent = -mDV / rrTfo * ((mD0 + lD + mrc) * pin_LAMBDAF - (mD0 + mrc) * pin_LAMBDAD - mD0 * lD * pin_ID) / ((mD0 + mrc) * (lRot + lD) + lRot * lD); + else + pin_FieldCurrent = -mDV / rrTfo * ((lD + mrc) * pin_LAMBDAF - mrc * pin_LAMBDAD - lD * pin_LAMBDAAD) / (mrc * (lRot + lD) + lRot * lD); + end if; +end DYNModelM2S_INIT; diff --git a/iPSL/Electrical/Machines/Eurostag/PwExtIntParameters.mo b/iPSL/Electrical/Machines/Eurostag/PwExtIntParameters.mo index 373f4e246..ddc41a3c9 100644 --- a/iPSL/Electrical/Machines/Eurostag/PwExtIntParameters.mo +++ b/iPSL/Electrical/Machines/Eurostag/PwExtIntParameters.mo @@ -1,125 +1,110 @@ -within iPSL.Electrical.Machines.Eurostag; -model PwExtIntParameters "Transformation of external parameters to internal parameters for M2S synchronous machine. - 2014/03/10" - parameter Real omega0_ = 2 * 3.14159265 * 50; - parameter Real epsilon = 0.0000000001; - //external parameters - parameter Real rStatIn_; - parameter Real lStatIn_ "stator leakage (READST)"; - parameter Real xDPu_ "direct reactance (FXD)"; - parameter Real xpDPu_ "direct transient reactance (FXPD)"; - parameter Real xppDPu_ "direct subtransient reactance (FXSD)"; - parameter Real tpDO_; - parameter Real tppDO_; - parameter Real xQPu_ "quadrature reactance"; - parameter Real xpQPu_ "transient reactance quadrature"; - parameter Real xppQPu_ "subtransient reactance quadrature"; - parameter Real tpQO_; - parameter Real tppQO_; - parameter Real tX_; - parameter Real IENR; - //axis d - parameter Real tpd = xpDPu_ * tpDO_ / xDPu_; - parameter Real tppd = xppDPu_ * tppDO_ / xpDPu_; - parameter Real B1d = (tpDO_ + tppDO_) * omega0_; - parameter Real B2d = (tpd + tppd) * omega0_; - parameter Real C1d = tpDO_ * tppDO_ * omega0_ * omega0_; - parameter Real C2d = tpd * tppd * omega0_ * omega0_; - parameter Real mD0Pu_ = xDPu_ - lStatIn_; - parameter Real wtx = omega0_ * tX_; - parameter Real Ad = (xDPu_ * B2d - lStatIn_ * B1d) / mD0Pu_; - parameter Real Bd = if tX_ > 0 then (xDPu_ * C2d - lStatIn_ * C1d) / mD0Pu_ else C2d - C1d * lStatIn_ / xDPu_; - parameter Real Cd = xDPu_ * (B1d - B2d) / mD0Pu_ * mD0Pu_; - parameter Real Dd = (C1d - C2d) / (B1d - B2d); - parameter Real denom1 = (Dd * Ad - Dd * Dd - Bd) * Cd; - parameter Real denom2 = Dd * Cd * Ed; - parameter Real xd = mD0Pu_ * lStatIn_ / xDPu_; - parameter Real Pd = B1d / mD0Pu_ - B2d / xd; - parameter Real Qd = 1 / xd - 1 / mD0Pu_; - parameter Real determ = 1 - 4 * Bd * lStatIn_ * Qd * Qd / (xd * Pd * Pd); - parameter Real rad = sqrt(determ); - parameter Real V1d = -0.5 * Pd * (1 + rad) / Qd; - parameter Real V2d = -0.5 * Pd * (1 - rad) / Qd; - parameter Real denom3 = xd * V1d; - parameter Real U1d = Bd * lStatIn_ / denom3; - parameter Real denom4 = xd * V2d; - parameter Real U2d = Bd * lStatIn_ / denom4; - parameter Real Z1d = Bd * lStatIn_ + mD0Pu_ * (B2d + Pd / Qd) * V1d; - parameter Real Z2d = Bd * lStatIn_ + mD0Pu_ * (B2d + Pd / Qd) * V2d; - parameter Real denom5 = (U1d - V1d) * mD0Pu_; - parameter Real E1d = (C1d - Z1d / xd) / denom5; - parameter Real denom6 = (U2d - V2d) * mD0Pu_; - parameter Real E2d = (C1d - Z2d / xd) / denom6; - parameter Real rf1d = 1 / E1d; - parameter Real rf2d = 1 / E2d; - parameter Real alf = (tpd * mD0Pu_ - tpDO_ * xd) / (tpDO_ - tpd); - parameter Real arf = (mD0Pu_ + alf) / (tpDO_ * omega0_); - parameter Real err1d = abs(arf - rf1d); - parameter Real err2d = abs(arf - rf2d); - parameter Real Vd = if err1d < err2d then V1d else V2d; - parameter Real Ud = if err1d < err2d then U1d else U2d; - parameter Real Ed = if tX_ > 0 then Cd * rf - 1 elseif err1d < err2d then E1d else E2d; - parameter Real rf = if tX_ > 0 then (Ad * Dd + wtx * wtx - 2 * wtx * Dd - Bd) / denom1 elseif err1d < err2d then rf1d else rf2d; - parameter Real Fd = (B2d + Pd / Qd) / xd - Ed; - parameter Real rD = if tX_ > 0 then rf / Ed else 1 / Fd; - parameter Real lD = if tX_ > 0 then wtx * rD else Ud * rD; - parameter Real lf = if tX_ > 0 then rf * (Dd * Cd * rf - wtx) / Ed else Vd * rf; - parameter Real mrc = if tX_ > 0 then (Bd * Ed - wtx * Dd * Cd * rf + wtx * wtx) / denom2 else 0; - //axe q - parameter Real tpq = xpQPu_ * tpQO_ / xQPu_; - parameter Real tppq = if IENR == 4 then xppQPu_ * tppQO_ / xpQPu_ else xppQPu_ * tppQO_ / xQPu_; - parameter Real B1q = (tpQO_ + tppQO_) * omega0_; - parameter Real B2q = (tpq + tppq) * omega0_; - parameter Real C1q = tpQO_ * tppQO_ * omega0_ * omega0_; - parameter Real C2q = tpq * tppq * omega0_ * omega0_; - parameter Real mQ0Pu_ = xQPu_ - lStatIn_; - parameter Real xq = mQ0Pu_ * lStatIn_ / xQPu_; - parameter Real Pq = B1q / mQ0Pu_ - B2q / xq; - parameter Real Qq = 1 / xq - 1 / mQ0Pu_; - parameter Real Bq = C2q - C1q * lStatIn_ / xQPu_; - parameter Real determ2 = 1 - 4 * Bq * lStatIn_ * Qq * Qq / (xq * Pq * Pq); - parameter Real rad2 = sqrt(determ2); - parameter Real V1q = -0.5 * Pq * (1 + rad2) / Qq; - parameter Real V2q = -0.5 * Pq * (1 - rad2) / Qq; - parameter Real denom7 = if IENR == 4 then xq * V1q else 1; - parameter Real U1q = Bq * lStatIn_ / denom7; - parameter Real denom8 = if IENR == 4 then xq * V2q else 1; - parameter Real U2q = Bq * lStatIn_ / denom8; - parameter Real Z1q = Bq * lStatIn_ + mQ0Pu_ * (B2q + Pq / Qq) * V1q; - parameter Real Z2q = Bq * lStatIn_ + mQ0Pu_ * (B2q + Pq / Qq) * V2q; - parameter Real denom9 = if IENR == 4 then (U1q - V1q) * mQ0Pu_ else 1; - parameter Real E1q = (C1q - Z1q / xq) / denom9; - parameter Real denom10 = if IENR == 4 then (U2q - V2q) * mQ0Pu_ else 1; - parameter Real E2q = if IENR == 4 then (C1q - Z2q / xq) / denom10 else 1; - parameter Real rf1q = 1 / E1q; - parameter Real rf2q = 1 / E2q; - parameter Real alfq = if IENR == 4 then (tpq * mQ0Pu_ - tpQO_ * xq) / (tpQO_ - tpq) else 0; - parameter Real arfq = if IENR == 4 then (mQ0Pu_ + alfq) / (tpQO_ * omega0_) else 0; - parameter Real err1q = abs(arfq - rf1q); - parameter Real err2q = abs(arfq - rf2q); - parameter Real Vq = if err1q < err2q then V1q else V2q; - parameter Real Uq = if err1q < err2q then U1q else U2q; - parameter Real Eq = if err1q < err2q then E1q else E2q; - parameter Real rQ1 = if IENR == 4 then if err1q < err2q then rf1q else rf2q else (mQ0Pu_ + lQ1) / (omega0_ * tppQO_); - parameter Real Fq = (B2q + Pq / Qq) / xq - Eq; - parameter Real rQ2 = if IENR == 4 then 1 / Fq else 0; - parameter Real lQ2 = if IENR == 4 then Uq * rQ2 else 100000000; - parameter Real lQ1 = if IENR == 4 then Vq * rQ1 else (tppq * mQ0Pu_ - tppQO_ * Y) / (tppQO_ - tppq); - parameter Real lq = lStatIn_; - parameter Real Y = mQ0Pu_ * lq / xQPu_; - annotation (Documentation(info=" -


<iPSL: iTesla Power System Library>

-

Copyright 2015 RTE (France), AIA (Spain), KTH (Sweden) and DTU (Denmark)

- -

The authors can be contacted by email: info at itesla-ipsl dot org

-

This package is part of the iTesla Power System Library ("iPSL") .

-

The iPSL is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

-

The iPSL is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

-

You should have received a copy of the GNU Lesser General Public License along with the iPSL. If not, see <http://www.gnu.org/licenses/>.

-")); -end PwExtIntParameters; +within iPSL.Electrical.Machines.Eurostag; +class PwExtIntParameters "Transformation of external parameters to internal parameters for M2S synchronous machine. + 2014/03/10" + parameter Real omega0_ = 2 * 3.14159265 * 50; + parameter Real epsilon = 0.0000000001; + //external parameters + parameter Real rStatIn_; + parameter Real lStatIn_ "stator leakage (READST)"; + parameter Real xDPu_ "direct reactance (FXD)"; + parameter Real xpDPu_ "direct transient reactance (FXPD)"; + parameter Real xppDPu_ "direct subtransient reactance (FXSD)"; + parameter Real tpDO_; + parameter Real tppDO_; + parameter Real xQPu_ "quadrature reactance"; + parameter Real xpQPu_ "transient reactance quadrature"; + parameter Real xppQPu_ "subtransient reactance quadrature"; + parameter Real tpQO_; + parameter Real tppQO_; + parameter Real tX_; + parameter Real IENR; + //axis d + parameter Real tpd = xpDPu_ * tpDO_ / xDPu_; + parameter Real tppd = xppDPu_ * tppDO_ / xpDPu_; + parameter Real B1d = (tpDO_ + tppDO_) * omega0_; + parameter Real B2d = (tpd + tppd) * omega0_; + parameter Real C1d = tpDO_ * tppDO_ * omega0_ * omega0_; + parameter Real C2d = tpd * tppd * omega0_ * omega0_; + parameter Real mD0Pu_ = xDPu_ - lStatIn_; + parameter Real wtx = omega0_ * tX_; + parameter Real Ad = (xDPu_ * B2d - lStatIn_ * B1d) / mD0Pu_; + parameter Real Bd = if tX_ > 0 then (xDPu_ * C2d - lStatIn_ * C1d) / mD0Pu_ else C2d - C1d * lStatIn_ / xDPu_; + parameter Real Cd = xDPu_ * (B1d - B2d) / mD0Pu_ * mD0Pu_; + parameter Real Dd = (C1d - C2d) / (B1d - B2d); + parameter Real denom1 = (Dd * Ad - Dd * Dd - Bd) * Cd; + parameter Real denom2 = Dd * Cd * Ed; + parameter Real xd = mD0Pu_ * lStatIn_ / xDPu_; + parameter Real Pd = B1d / mD0Pu_ - B2d / xd; + parameter Real Qd = 1 / xd - 1 / mD0Pu_; + parameter Real determ = 1 - 4 * Bd * lStatIn_ * Qd * Qd / (xd * Pd * Pd); + parameter Real rad = sqrt(determ); + parameter Real V1d = -0.5 * Pd * (1 + rad) / Qd; + parameter Real V2d = -0.5 * Pd * (1 - rad) / Qd; + parameter Real denom3 = xd * V1d; + parameter Real U1d = Bd * lStatIn_ / denom3; + parameter Real denom4 = xd * V2d; + parameter Real U2d = Bd * lStatIn_ / denom4; + parameter Real Z1d = Bd * lStatIn_ + mD0Pu_ * (B2d + Pd / Qd) * V1d; + parameter Real Z2d = Bd * lStatIn_ + mD0Pu_ * (B2d + Pd / Qd) * V2d; + parameter Real denom5 = (U1d - V1d) * mD0Pu_; + parameter Real E1d = (C1d - Z1d / xd) / denom5; + parameter Real denom6 = (U2d - V2d) * mD0Pu_; + parameter Real E2d = (C1d - Z2d / xd) / denom6; + parameter Real rf1d = 1 / E1d; + parameter Real rf2d = 1 / E2d; + parameter Real alf = (tpd * mD0Pu_ - tpDO_ * xd) / (tpDO_ - tpd); + parameter Real arf = (mD0Pu_ + alf) / (tpDO_ * omega0_); + parameter Real err1d = abs(arf - rf1d); + parameter Real err2d = abs(arf - rf2d); + parameter Real Vd = if err1d < err2d then V1d else V2d; + parameter Real Ud = if err1d < err2d then U1d else U2d; + parameter Real Ed = if tX_ > 0 then Cd * rf - 1 elseif err1d < err2d then E1d else E2d; + parameter Real rf = if tX_ > 0 then (Ad * Dd + wtx * wtx - 2 * wtx * Dd - Bd) / denom1 elseif err1d < err2d then rf1d else rf2d; + parameter Real Fd = (B2d + Pd / Qd) / xd - Ed; + parameter Real rD = if tX_ > 0 then rf / Ed else 1 / Fd; + parameter Real lD = if tX_ > 0 then wtx * rD else Ud * rD; + parameter Real lf = if tX_ > 0 then rf * (Dd * Cd * rf - wtx) / Ed else Vd * rf; + parameter Real mrc = if tX_ > 0 then (Bd * Ed - wtx * Dd * Cd * rf + wtx * wtx) / denom2 else 0; + //axe q + parameter Real tpq = xpQPu_ * tpQO_ / xQPu_; + parameter Real tppq = if IENR == 4 then xppQPu_ * tppQO_ / xpQPu_ else xppQPu_ * tppQO_ / xQPu_; + parameter Real B1q = (tpQO_ + tppQO_) * omega0_; + parameter Real B2q = (tpq + tppq) * omega0_; + parameter Real C1q = tpQO_ * tppQO_ * omega0_ * omega0_; + parameter Real C2q = tpq * tppq * omega0_ * omega0_; + parameter Real mQ0Pu_ = xQPu_ - lStatIn_; + parameter Real xq = mQ0Pu_ * lStatIn_ / xQPu_; + parameter Real Pq = B1q / mQ0Pu_ - B2q / xq; + parameter Real Qq = 1 / xq - 1 / mQ0Pu_; + parameter Real Bq = C2q - C1q * lStatIn_ / xQPu_; + parameter Real determ2 = 1 - 4 * Bq * lStatIn_ * Qq * Qq / (xq * Pq * Pq); + parameter Real rad2 = sqrt(determ2); + parameter Real V1q = -0.5 * Pq * (1 + rad2) / Qq; + parameter Real V2q = -0.5 * Pq * (1 - rad2) / Qq; + parameter Real denom7 = if IENR == 4 then xq * V1q else 1; + parameter Real U1q = Bq * lStatIn_ / denom7; + parameter Real denom8 = if IENR == 4 then xq * V2q else 1; + parameter Real U2q = Bq * lStatIn_ / denom8; + parameter Real Z1q = Bq * lStatIn_ + mQ0Pu_ * (B2q + Pq / Qq) * V1q; + parameter Real Z2q = Bq * lStatIn_ + mQ0Pu_ * (B2q + Pq / Qq) * V2q; + parameter Real denom9 = if IENR == 4 then (U1q - V1q) * mQ0Pu_ else 1; + parameter Real E1q = (C1q - Z1q / xq) / denom9; + parameter Real denom10 = if IENR == 4 then (U2q - V2q) * mQ0Pu_ else 1; + parameter Real E2q = if IENR == 4 then (C1q - Z2q / xq) / denom10 else 1; + parameter Real rf1q = 1 / E1q; + parameter Real rf2q = 1 / E2q; + parameter Real alfq = if IENR == 4 then (tpq * mQ0Pu_ - tpQO_ * xq) / (tpQO_ - tpq) else 0; + parameter Real arfq = if IENR == 4 then (mQ0Pu_ + alfq) / (tpQO_ * omega0_) else 0; + parameter Real err1q = abs(arfq - rf1q); + parameter Real err2q = abs(arfq - rf2q); + parameter Real Vq = if err1q < err2q then V1q else V2q; + parameter Real Uq = if err1q < err2q then U1q else U2q; + parameter Real Eq = if err1q < err2q then E1q else E2q; + parameter Real rQ1 = if IENR == 4 then if err1q < err2q then rf1q else rf2q else (mQ0Pu_ + lQ1) / (omega0_ * tppQO_); + parameter Real Fq = (B2q + Pq / Qq) / xq - Eq; + parameter Real rQ2 = if IENR == 4 then 1 / Fq else 0; + parameter Real lQ2 = if IENR == 4 then Uq * rQ2 else 100000000; + parameter Real lQ1 = if IENR == 4 then Vq * rQ1 else (tppq * mQ0Pu_ - tppQO_ * Y) / (tppQO_ - tppq); + parameter Real lq = lStatIn_; + parameter Real Y = mQ0Pu_ * lq / xQPu_; +end PwExtIntParameters; diff --git a/iPSL/Electrical/Machines/Eurostag/PwGenerator.mo b/iPSL/Electrical/Machines/Eurostag/PwGenerator.mo index be74da44c..9246037df 100644 --- a/iPSL/Electrical/Machines/Eurostag/PwGenerator.mo +++ b/iPSL/Electrical/Machines/Eurostag/PwGenerator.mo @@ -1,136 +1,119 @@ -within iPSL.Electrical.Machines.Eurostag; -model PwGenerator "Synchronous machine model according to Park's classical theory (Full model description). - The model corresponds to Eurostag's full model for M1S machine - (defined by internal parameters). Initial values must be inserted manually. - Developed by RTE and adapted by AIA. 2014/03/10" - - iPSL.Connectors.PwPin sortie(vr(start=1), vi(start=0)) annotation (Placement( - transformation(extent={{40,10},{60,30}}), iconTransformation(extent={{ - 40,10},{60,30}}))); - Modelica.Blocks.Interfaces.RealInput eefd annotation(Placement(transformation(extent = {{-61, -40}, {-41, -20}}), iconTransformation(extent = {{-61, -40}, {-41, -20}}))); - Modelica.Blocks.Interfaces.RealInput oomega annotation(Placement(transformation(extent = {{-61, -10}, {-41, 10}}), iconTransformation(extent = {{-61, -10}, {-41, 10}}))); - Modelica.Blocks.Interfaces.RealInput ccm annotation(Placement(transformation(extent = {{-61, 20}, {-41, 40}}), iconTransformation(extent = {{-61, 20}, {-41, 40}}))); - Modelica.Blocks.Interfaces.RealOutput ttheta annotation(Placement(transformation(extent = {{39, -30}, {59, -10}}), iconTransformation(extent = {{39, -30}, {59, -10}}))); - Real cm(start = 0.60139); - Real efd(start = 0.66174); - Real ur(start = 1); - Real ui(start = 0); - Real lambdaf(start = -1.0797); - Real lambdad(start = -0.86452); - Real lambdaad(start = -0.86452); - Real lambdaaq(start = 0.58946); - Real lambdaq1(start = 0.58946); - Real lambdaq2(start = 0.58946); - Real id(start = 5.4186); - Real iq(start = 3.2618); - Real theta(start = 0.70718); - Real omega(start = 1.0); - Real E; - Real Mds; - Real Mqs; - Real Md; - Real Mq; - Real Mi; - Real LMD; - Real LMQ; - parameter Real omega0 = 2 * 3.14159265 * 50 - "Nominal network angular frequency"; - parameter Real SNREF = 100 "MVA system base"; - parameter Real SN = 1150 "Nominal apparent power (MVA)"; - parameter Real PN = 1000 "Nominal turbine (active) power (MW)"; - parameter Real yscale = SNREF / SN; - parameter Real SNtfo = 1300 "Machine transformer rating"; - parameter Real r = 0.004 * yscale "Stator Resistance"; - parameter Real rf = 0.00113 * yscale "Rotor Resistance"; - parameter Real lld = 0.219 * yscale "Stator leakage"; - parameter Real lf = 0.24253 * yscale "Rotor leakage"; - parameter Real mrc = 0.0 * yscale "CANAY's inductance"; - parameter Real lD = 0.12825 * yscale "d axis damper winding leakage"; - parameter Real rD = 0.01723 * yscale "d axis damper winding resistance"; - parameter Real rQ1 = 0.0193 * yscale "q axis damper 1 winding resistance"; - parameter Real rQ2 = 0.03923 * yscale "q axis damper 2 winding resistance"; - parameter Real lQ1 = 0.08921 * yscale "q axis damper 1 winding leakeage"; - parameter Real lQ2 = 1.78484 * yscale "q axis damper 2 winding leakeage"; - parameter Real RT = 0 - "Machine transformer resistance (pu), enter value*SNREF/SNtfo"; - parameter Real XT = 0 - "Machine transformer reactance (pu), enter value*SNREF/SNtfo"; - parameter Real Md0 = 2.351 * yscale "d axis mutual inductance"; - parameter Real Mq0 = 2.351 * yscale "q axis mutual inductance"; - parameter Real Mdv = 0.7459 * yscale; - parameter Real md = 0.1 "Coefficient md of the saturation curve"; - parameter Real mq = 0.1 "Coefficient mq of the saturation curve"; - parameter Real snd = 6 "Coefficient nd of the saturation curve"; - parameter Real snq = 6 "Coefficient nq of the saturation curve"; - parameter Real D = 0.0 / yscale "Mechanical damping coefficient"; - parameter Real H = 6.3 / yscale "Constant of inertia"; - parameter Real rtfo = 1 "Transformer ratio"; - parameter Real DET = lf * lD + mrc * lf + mrc * lD; - parameter Real Mdif = Md0 - Mq0; - parameter Real Sdet = lf / DET + lD / DET; - parameter Real Slq = 1.0 / lQ1 + 1.0 / lQ2; - parameter Real Lddet = lD / DET; - parameter Real Lfdet = lf / DET; - parameter Real Lq1inv = 1.0 / lQ1; - parameter Real Lq2inv = 1.0 / lQ2; - parameter Real Sr = r + RT; - parameter Real Sx = lld + XT; - parameter Real Coef11 = rtfo * omega0 * rf / Mdv; - parameter Real Coef12 = rf * omega0 * (lD + mrc) / DET; - parameter Real Coef13 = rf * omega0 * mrc / DET; - parameter Real Coef14 = omega0 * rf * lD / DET; - parameter Real Coef21 = omega0 * rD * mrc / DET; - parameter Real Coef22 = omega0 * rD * (lf + mrc) / DET; - parameter Real Coef23 = omega0 * rD * lf / DET; - parameter Real Coef31 = omega0 * rQ1 / lQ1; - parameter Real Coef32 = omega0 * rQ1 / lQ1; - parameter Real Coef41 = omega0 * rQ2 / lQ2; - parameter Real Coef42 = omega0 * rQ2 / lQ2; - parameter Real Coef51 = PN / (SNREF * 2 * H); - parameter Real Coef52 = D / (2 * H); - parameter Real Coef53 = 1.0 / (2 * H); -equation - der(lambdaf) = (-efd * Coef11) - lambdaf * Coef12 + lambdad * Coef13 + lambdaad * Coef14; - der(lambdad) = lambdaf * Coef21 - lambdad * Coef22 + lambdaad * Coef23; - der(lambdaq1) = (-lambdaq1 * Coef31) + lambdaaq * Coef32; - der(lambdaq2) = (-lambdaq2 * Coef41) + lambdaaq * Coef42; - der(omega) = cm * Coef51 + (1 - omega) * Coef52 + lambdaad * iq * Coef53 - lambdaaq * id * Coef53; - der(theta) = (omega - 1) * omega0; - E = sqrt(lambdaad * lambdaad + lambdaaq * lambdaaq); - Mds = Md0 / (1 + md * E ^ snd); - Mqs = Mq0 / (1 + mq * E ^ snq); - Mi = Mds * lambdaad * lambdaad / (E * E) + Mqs * lambdaaq * lambdaaq / (E * E); - Md = Mi + Mdif * lambdaaq * lambdaaq / (E * E); - Mq = Mi - Mdif * lambdaad * lambdaad / (E * E); - LMD = 1.0 / (1.0 / Md + Sdet); - LMQ = 1.0 / (1.0 / Mq + Slq); - 0 = (-lambdaad) + LMD * (id + lambdaf * Lddet + lambdad * Lfdet); - 0 = (-lambdaaq) + LMQ * (iq + lambdaq1 * Lq1inv + lambdaq2 * Lq2inv); - 0 = sin(theta) * ur - cos(theta) * ui + id * Sr - iq * omega * Sx - omega * lambdaaq; - 0 = cos(theta) * ur + sin(theta) * ui + iq * Sr + id * omega * Sx + omega * lambdaad; - sortie.ir = -(sin(theta) * id + cos(theta) * iq); - sortie.ii = -((-cos(theta) * id) + sin(theta) * iq); - oomega = omega; - ccm = cm; - eefd = efd; - ttheta = theta; - sortie.vr = ur; - sortie.vi = ui; - annotation(Icon(graphics={ Rectangle(extent = {{-40, 40}, {40, -40}}, lineColor = {0, 0, 255}), Ellipse(extent = {{-24, 22}, {24, -24}}, lineColor = {0, 0, 255}, - lineThickness = 1), Line(points = {{-16, 0}, {-12, 8}, {-6, 8}, {6, -10}, {12, -10}, {16, 0}}, color = {0, 0, 255}, smooth = Smooth.Bezier, thickness = 1), Text(extent = {{-68, 46}, {-60, 40}}, lineColor = {0, 0, 255}, textString = "ccm"), Text(extent = {{-74, 18}, {-60, 10}}, lineColor = {0, 0, 255}, textString = "oomega"), Text(extent = {{-70, -14}, {-60, -20}}, lineColor = {0, 0, 255}, textString = "eefd"), Text(extent = {{54, 38}, {68, 32}}, lineColor = {0, 0, 255}, textString = "sortie"), Text(extent = {{50, -6}, {64, -12}}, lineColor = {0, 0, 255}, textString = "ttheta")}), Diagram(graphics), - Documentation(info=" -


<iPSL: iTesla Power System Library>

-

Copyright 2015 RTE (France), AIA (Spain), KTH (Sweden) and DTU (Denmark)

- -

The authors can be contacted by email: info at itesla-ipsl dot org

-

This package is part of the iTesla Power System Library ("iPSL") .

-

The iPSL is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

-

The iPSL is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

-

You should have received a copy of the GNU Lesser General Public License along with the iPSL. If not, see <http://www.gnu.org/licenses/>.

-")); -end PwGenerator; +within iPSL.Electrical.Machines.Eurostag; +class PwGenerator "Synchronous machine model according to Park's classical theory (Full model description). + The model corresponds to Eurostag's full model for M1S machine + (defined by internal parameters). Initial values must be inserted manually. + 2014/03/10" + + PowerSystems.Connectors.PwPin sortie(vr(start = 1), vi(start = 0)) annotation(Placement(transformation(extent = {{40, 10}, {60, 30}}), iconTransformation(extent = {{40, 10}, {60, 30}}))); + PowerSystems.Connectors.ImPin eefd annotation(Placement(transformation(extent = {{-61, -40}, {-41, -20}}), iconTransformation(extent = {{-61, -40}, {-41, -20}}))); + PowerSystems.Connectors.ImPin oomega annotation(Placement(transformation(extent = {{-61, -10}, {-41, 10}}), iconTransformation(extent = {{-61, -10}, {-41, 10}}))); + PowerSystems.Connectors.ImPin ccm annotation(Placement(transformation(extent = {{-61, 20}, {-41, 40}}), iconTransformation(extent = {{-61, 20}, {-41, 40}}))); + PowerSystems.Connectors.ImPin ttheta annotation(Placement(transformation(extent = {{39, -30}, {59, -10}}), iconTransformation(extent = {{39, -30}, {59, -10}}))); + Real cm(start = 0.60139); + Real efd(start = 0.66174); + Real ur(start = 1); + Real ui(start = 0); + Real lambdaf(start = -1.0797); + Real lambdad(start = -0.86452); + Real lambdaad(start = -0.86452); + Real lambdaaq(start = 0.58946); + Real lambdaq1(start = 0.58946); + Real lambdaq2(start = 0.58946); + Real id(start = 5.4186); + Real iq(start = 3.2618); + Real theta(start = 0.70718); + Real omega(start = 1.0); + Real E; + Real Mds; + Real Mqs; + Real Md; + Real Mq; + Real Mi; + Real LMD; + Real LMQ; + parameter Real omega0 = 2 * 3.14159265 * 50 + "Nominal network angular frequency"; + parameter Real SNREF = 100 "MVA system base"; + parameter Real SN = 1150 "Nominal apparent power (MVA)"; + parameter Real PN = 1000 "Nominal turbine (active) power (MW)"; + parameter Real yscale = SNREF / SN; + parameter Real SNtfo = 1300 "Machine transformer rating"; + parameter Real r = 0.004 * yscale "Stator Resistance"; + parameter Real rf = 0.00113 * yscale "Rotor Resistance"; + parameter Real lld = 0.219 * yscale "Stator leakage"; + parameter Real lf = 0.24253 * yscale "Rotor leakage"; + parameter Real mrc = 0.0 * yscale "CANAY's inductance"; + parameter Real lD = 0.12825 * yscale "d axis damper winding leakage"; + parameter Real rD = 0.01723 * yscale "d axis damper winding resistance"; + parameter Real rQ1 = 0.0193 * yscale "q axis damper 1 winding resistance"; + parameter Real rQ2 = 0.03923 * yscale "q axis damper 2 winding resistance"; + parameter Real lQ1 = 0.08921 * yscale "q axis damper 1 winding leakeage"; + parameter Real lQ2 = 1.78484 * yscale "q axis damper 2 winding leakeage"; + parameter Real RT = 0 + "Machine transformer resistance (p.u.), enter value*SNREF/SNtfo"; + parameter Real XT = 0 + "Machine transformer reactance (p.u.), enter value*SNREF/SNtfo"; + parameter Real Md0 = 2.351 * yscale "d axis mutual inductance"; + parameter Real Mq0 = 2.351 * yscale "q axis mutual inductance"; + parameter Real Mdv = 0.7459 * yscale; + parameter Real md = 0.1 "Coefficient md of the saturation curve"; + parameter Real mq = 0.1 "Coefficient mq of the saturation curve"; + parameter Real snd = 6 "Coefficient nd of the saturation curve"; + parameter Real snq = 6 "Coefficient nq of the saturation curve"; + parameter Real D = 0.0 / yscale "Mechanical damping coefficient"; + parameter Real H = 6.3 / yscale "Constant of inertia"; + parameter Real rtfo = 1 "Transformer ratio"; + parameter Real DET = lf * lD + mrc * lf + mrc * lD; + parameter Real Mdif = Md0 - Mq0; + parameter Real Sdet = lf / DET + lD / DET; + parameter Real Slq = 1.0 / lQ1 + 1.0 / lQ2; + parameter Real Lddet = lD / DET; + parameter Real Lfdet = lf / DET; + parameter Real Lq1inv = 1.0 / lQ1; + parameter Real Lq2inv = 1.0 / lQ2; + parameter Real Sr = r + RT; + parameter Real Sx = lld + XT; + parameter Real Coef11 = rtfo * omega0 * rf / Mdv; + parameter Real Coef12 = rf * omega0 * (lD + mrc) / DET; + parameter Real Coef13 = rf * omega0 * mrc / DET; + parameter Real Coef14 = omega0 * rf * lD / DET; + parameter Real Coef21 = omega0 * rD * mrc / DET; + parameter Real Coef22 = omega0 * rD * (lf + mrc) / DET; + parameter Real Coef23 = omega0 * rD * lf / DET; + parameter Real Coef31 = omega0 * rQ1 / lQ1; + parameter Real Coef32 = omega0 * rQ1 / lQ1; + parameter Real Coef41 = omega0 * rQ2 / lQ2; + parameter Real Coef42 = omega0 * rQ2 / lQ2; + parameter Real Coef51 = PN / (SNREF * 2 * H); + parameter Real Coef52 = D / (2 * H); + parameter Real Coef53 = 1.0 / (2 * H); +equation + der(lambdaf) = (-efd * Coef11) - lambdaf * Coef12 + lambdad * Coef13 + lambdaad * Coef14; + der(lambdad) = lambdaf * Coef21 - lambdad * Coef22 + lambdaad * Coef23; + der(lambdaq1) = (-lambdaq1 * Coef31) + lambdaaq * Coef32; + der(lambdaq2) = (-lambdaq2 * Coef41) + lambdaaq * Coef42; + der(omega) = cm * Coef51 + (1 - omega) * Coef52 + lambdaad * iq * Coef53 - lambdaaq * id * Coef53; + der(theta) = (omega - 1) * omega0; + E = sqrt(lambdaad * lambdaad + lambdaaq * lambdaaq); + Mds = Md0 / (1 + md * E ^ snd); + Mqs = Mq0 / (1 + mq * E ^ snq); + Mi = Mds * lambdaad * lambdaad / (E * E) + Mqs * lambdaaq * lambdaaq / (E * E); + Md = Mi + Mdif * lambdaaq * lambdaaq / (E * E); + Mq = Mi - Mdif * lambdaad * lambdaad / (E * E); + LMD = 1.0 / (1.0 / Md + Sdet); + LMQ = 1.0 / (1.0 / Mq + Slq); + 0 = (-lambdaad) + LMD * (id + lambdaf * Lddet + lambdad * Lfdet); + 0 = (-lambdaaq) + LMQ * (iq + lambdaq1 * Lq1inv + lambdaq2 * Lq2inv); + 0 = sin(theta) * ur - cos(theta) * ui + id * Sr - iq * omega * Sx - omega * lambdaaq; + 0 = cos(theta) * ur + sin(theta) * ui + iq * Sr + id * omega * Sx + omega * lambdaad; + sortie.ir = -(sin(theta) * id + cos(theta) * iq); + sortie.ii = -((-cos(theta) * id) + sin(theta) * iq); + oomega = omega; + ccm = cm; + eefd = efd; + ttheta = theta; + sortie.vr = ur; + sortie.vi = ui; + annotation(Icon(graphics={ Rectangle(extent = {{-40, 40}, {40, -40}}, lineColor = {0, 0, 255}), Ellipse(extent = {{-24, 22}, {24, -24}}, lineColor = {0, 0, 255}, + lineThickness = 1), Line(points = {{-16, 0}, {-12, 8}, {-6, 8}, {6, -10}, {12, -10}, {16, 0}}, color = {0, 0, 255}, smooth = Smooth.Bezier, thickness = 1), Text(extent = {{-68, 46}, {-60, 40}}, lineColor = {0, 0, 255}, textString = "ccm"), Text(extent = {{-74, 18}, {-60, 10}}, lineColor = {0, 0, 255}, textString = "oomega"), Text(extent = {{-70, -14}, {-60, -20}}, lineColor = {0, 0, 255}, textString = "eefd"), Text(extent = {{54, 38}, {68, 32}}, lineColor = {0, 0, 255}, textString = "sortie"), Text(extent = {{50, -6}, {64, -12}}, lineColor = {0, 0, 255}, textString = "ttheta")}), Diagram(graphics)); +end PwGenerator; diff --git a/iPSL/Electrical/Machines/Eurostag/PwGeneratorM1S.mo b/iPSL/Electrical/Machines/Eurostag/PwGeneratorM1S.mo index 3b9913a65..bd4d4541e 100644 --- a/iPSL/Electrical/Machines/Eurostag/PwGeneratorM1S.mo +++ b/iPSL/Electrical/Machines/Eurostag/PwGeneratorM1S.mo @@ -1,275 +1,259 @@ -within iPSL.Electrical.Machines.Eurostag; -model PwGeneratorM1S "Synchronous machine model according to Park's classical theory (Full model description). - The model corresponds to Eurostag's full model for M1S machine - (defined by internal parameters). Developed by RTE and adapted by AIA. - 2014/03/10" - - iPSL.Connectors.PwPin sortie annotation (Placement(transformation(extent={{40, - 10},{60,30}}), iconTransformation(extent={{40,10},{60,30}}))); - Modelica.Blocks.Interfaces.RealInput pin_EFD annotation(Placement(transformation(extent = {{-61, -40}, {-41, -20}}), iconTransformation(extent = {{-61, -40}, {-41, -20}}))); - Modelica.Blocks.Interfaces.RealInput pin_OMEGA annotation(Placement(transformation(extent = {{-61, 20}, {-41, 40}}), iconTransformation(extent = {{-61, 20}, {-41, 40}}))); - Modelica.Blocks.Interfaces.RealInput pin_CM annotation(Placement(transformation(extent = {{-61, -10}, {-41, 10}}), iconTransformation(extent = {{-61, -10}, {-41, 10}}))); - Modelica.Blocks.Interfaces.RealInput omegaRef; - Real cm(start = init_cm); - Real efd(start = init_efd); - Real ur(start = ur0); - Real ui(start = ui0); - Real lambdaf(start = init_lambdaf); - Real lambdad(start = init_lambdad); - Real lambdaad(start = init_lambdaad); - Real lambdaaq(start = init_lambdaaq); - Real lambdaq1(start = init_lambdaq1); - Real lambdaq2(start = init_lambdaq2); - Real id(start = init_id); - Real iq(start = init_iq); - Real theta(start = init_theta); - Real omega(start = init_omega); - Real E; - Real Mds; - Real Mqs; - Real Md; - Real Mq; - Real Mi; - Real LMD; - Real LMQ; - //Initial values - parameter Real init_lambdaf = 0; - parameter Real init_lambdad = 0; - parameter Real init_lambdaad = 0; - parameter Real init_lambdaaq = 0; - parameter Real init_lambdaq1 = 0; - parameter Real init_lambdaq2 = 0; - parameter Real init_id = 0; - parameter Real init_iq = 0; - parameter Real init_theta = 0; - parameter Real init_omega = 1; - parameter Real init_cm = 0; - parameter Real init_efd = 0; - //parameters coming from .lf - parameter Real ur0 = 1 - "Initial real voltage component p.u. in the SNREF base"; - parameter Real ui0 = 0 - "Initial imaginary voltage component p.u. in the SNREF base"; - //parameter Real ir0 = 1; - //parameter Real ii0 = 0; - //parameter Real p0_0 = 0 "Initial active power"; - //parameter Real q0_0 = 0 "Initial active power"; - //General parameters. - parameter Real omega0 = 2 * 3.14159265 * 50 - "Nominal network angular frequency"; - parameter Real SNREF = 100 "MVA system base"; - parameter Real SN = 1150 "Nominal apparent power (MVA)"; - parameter Real PN = 1000 "Nominal turbine (active) power (MW)"; - parameter Real PNALT = 1100; - //per-unit in the machine SN base - parameter Real rStatIn = 0.004 - "Stator resistance p.u. in the machine SN base"; - parameter Real lStatIn = 0.219 "Stator leakage p.u. in the machine SN base"; - parameter Real mD0Pu = 2.351 - "d axis mutual inductance p.u. in the machine SN base"; - parameter Real WLMDVPu = 0.7459 - "d axis mutual inductance corresponding to magnetic condition taken for setting the voltage regulator"; - parameter Real mCanPu = 0.0 "CANAY's inductance p.u. in the machine SN base"; - parameter Real rDPu = 0.01723 - "d axis damper winding resistance p.u. in the machine SN base"; - parameter Real lDPu = 0.12825 - "d axis damper winding leakage p.u. in the machine SN base"; - parameter Real rRotIn = 0.00113 - "Rotor resistance p.u. in the machine SN base"; - parameter Real lRotIn = 0.24253 "Rotor leakage p.u. in the machine SN base"; - parameter Real mQ0Pu = 2.351 - "q axis mutual inductance p.u. in the machine SN base"; - parameter Real rQ1Pu = 0.0193 - "q axis damper 1 winding resistance p.u. in the machine SN base"; - parameter Real lQ1Pu = 0.08921 - "q axis damper 1 winding leakeage p.u. in the machine SN base"; - parameter Real rQ2Pu = 0.03923 - "q axis damper 2 winding resistance p.u. in the machine SN base"; - parameter Real lQ2Pu = 1.78484 - "q axis damper 2 winding leakeage p.u. in the machine SN base"; - parameter Real md = 0.1 "Coefficient md of the saturation curve"; - parameter Real mq = 0.1 "Coefficient mq of the saturation curve"; - parameter Real snd = 6 "Coefficient nd of the saturation curve"; - parameter Real snq = 6 "Coefficient nq of the saturation curve"; - parameter Real DIn = 0.0 "mechanical damping coefficient"; - parameter Real HIn = 6.3 "Constant of inertia"; - parameter Real U1N = 24 "nominal voltage machine side"; - parameter Real V1 = 24 "base voltage machine side"; - parameter Real U2N = 400 "nominal voltage machine side"; - parameter Real V2 = 380 "base voltage machine side"; - parameter Boolean transformerIncluded = false; - parameter Real RTfoPu = if transformerIncluded then 0.000185 else 0 - "Machine transoformer resistance p.u. in the SNTfo base"; - parameter Real XTfoPu = if transformerIncluded then 0.00769 else 0 - "Machine transoformer resistance p.u. in the SNTfo base"; - parameter Integer IWLMDV = 3; - parameter Boolean Saturated = true; - //Calculation and per-uniting of parameters. - //parameter Real yscale=SNREF/SN; - parameter Real yscale = if RT > 0.0 or XT > 0.0 then SNREF / SN * rtfo * rtfo else SNREF / SN; - parameter Real SNtfo = 1300 "Machine transformer rating"; - parameter Real r = rStatIn * yscale "Stator Resistance"; - parameter Real rf = rRotIn * yscale "Rotor Resistance"; - parameter Real lld = lStatIn * yscale "Stator leakage"; - parameter Real lf = lRotIn * yscale "Rotor leakage"; - parameter Real mrc = mCanPu * yscale "CANAY's inductance"; - parameter Real lD = lDPu * yscale "d axis damper winding leakage"; - parameter Real rD = rDPu * yscale "d axis damper winding resistance"; - parameter Real rQ1 = rQ1Pu * yscale "q axis damper 1 winding resistance"; - parameter Real rQ2 = rQ2Pu * yscale "q axis damper 2 winding resistance"; - parameter Real lQ1 = lQ1Pu * yscale "q axis damper 1 winding leakeage"; - parameter Real lQ2 = lQ2Pu * yscale "q axis damper 2 winding leakeage"; - parameter Real RT = RTfoPu * SNREF / SNtfo * rtfo * rtfo - "Machine transformer resistance (pu), enter value*SNREF/SNtfo"; - parameter Real XT = XTfoPu * SNREF / SNtfo * rtfo * rtfo - "Machine transformer reactance (pu), enter value*SNREF/SNtfo"; - parameter Real Md0 = mD0Pu * yscale "d axis mutual inductance"; - parameter Real Mq0 = mQ0Pu * yscale "q axis mutual inductance"; - parameter Real Mdv = WLMDVPu * yscale; - parameter Real D = DIn * SN / SNREF "Mechanical damping coefficient"; - parameter Real H = HIn * SN / SNREF "Constant of inertia"; - parameter Real rtfo = if transformerIncluded then (U2N / V2) / (U1N / V1) else 1 - "Transformer ratio"; - parameter Real DET = lf * lD + mrc * lf + mrc * lD; - parameter Real Mdif = Md0 - Mq0; - parameter Real Sdet = lf / DET + lD / DET; - parameter Real Slq = 1.0 / lQ1 + 1.0 / lQ2; - parameter Real Lddet = lD / DET; - parameter Real Lfdet = lf / DET; - parameter Real Lq1inv = 1.0 / lQ1; - parameter Real Lq2inv = 1.0 / lQ2; - parameter Real Sr = r + RT; - parameter Real Sx = lld + XT; - parameter Real Coef11 = rtfo * omega0 * rf / Mdv; - parameter Real Coef12 = rf * omega0 * (lD + mrc) / DET; - parameter Real Coef13 = rf * omega0 * mrc / DET; - parameter Real Coef14 = omega0 * rf * lD / DET; - parameter Real Coef21 = omega0 * rD * mrc / DET; - parameter Real Coef22 = omega0 * rD * (lf + mrc) / DET; - parameter Real Coef23 = omega0 * rD * lf / DET; - parameter Real Coef31 = omega0 * rQ1 / lQ1; - parameter Real Coef32 = omega0 * rQ1 / lQ1; - parameter Real Coef41 = omega0 * rQ2 / lQ2; - parameter Real Coef42 = omega0 * rQ2 / lQ2; - parameter Real Coef51 = PN / (SNREF * 2 * H); - parameter Real Coef52 = D / (2 * H); - parameter Real Coef53 = 1.0 / (2 * H); - Modelica.Blocks.Interfaces.RealOutput pin_TETA annotation(Placement(transformation(extent = {{39, -30}, {59, -10}}), iconTransformation(extent = {{39, -30}, {59, -10}}))); - Modelica.Blocks.Interfaces.RealOutput pin_UR annotation(Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = -90, origin = {-30, -49}), iconTransformation(extent = {{-10, -10}, {10, 10}}, rotation = -90, origin = {-30, -49}))); - Modelica.Blocks.Interfaces.RealOutput pin_UI annotation(Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = -90, origin = {0, -49}), iconTransformation(extent = {{-10, -10}, {10, 10}}, rotation = -90, origin = {0, -49}))); - Modelica.Blocks.Interfaces.RealOutput pin_FieldCurrent annotation(Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 90, origin = {-30, 49}), iconTransformation(extent = {{-10, -10}, {10, 10}}, rotation = 90, origin = {-30, 49}))); - Modelica.Blocks.Interfaces.RealOutput pin_TerminalVoltage annotation(Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = -90, origin = {30, -49}))); - Modelica.Blocks.Interfaces.RealOutput pin_ActivePowerPNALT annotation(Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 90, origin = {0, 49}))); - Modelica.Blocks.Interfaces.RealOutput pin_ActivePowerPN annotation(Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 90, origin = {30, 49}))); - Modelica.Blocks.Interfaces.RealOutput pin_ActivePowerSNREF; - Modelica.Blocks.Interfaces.RealOutput pin_ReactivePowerPNALT; - Modelica.Blocks.Interfaces.RealOutput pin_ReactivePowerPN; - Modelica.Blocks.Interfaces.RealOutput pin_ReactivePowerSNREF; - Modelica.Blocks.Interfaces.RealOutput pin_ActivePowerSN; - Modelica.Blocks.Interfaces.RealOutput pin_ReactivePowerSN; - Modelica.Blocks.Interfaces.RealOutput pin_Current; - Modelica.Blocks.Interfaces.RealOutput pin_FRZPU; - Modelica.Blocks.Interfaces.RealOutput pin_FRZHZ; -equation - der(lambdaf) = (-efd * Coef11) - lambdaf * Coef12 + lambdad * Coef13 + lambdaad * Coef14; - der(lambdad) = lambdaf * Coef21 - lambdad * Coef22 + lambdaad * Coef23; - der(lambdaq1) = (-lambdaq1 * Coef31) + lambdaaq * Coef32; - der(lambdaq2) = (-lambdaq2 * Coef41) + lambdaaq * Coef42; - der(omega) = cm * Coef51 + (omegaRef - omega) * Coef52 + lambdaad * iq * Coef53 - lambdaaq * id * Coef53; - der(theta) = (omega - omegaRef) * omega0; - E = sqrt(lambdaad * lambdaad + lambdaaq * lambdaaq); - if Saturated then - Mds = Md0 / (1 + md / rtfo ^ snd * E ^ snd); - Mqs = Mq0 / (1 + mq / rtfo ^ snq * E ^ snq); - else - Mds = Md0; - Mqs = Mq0; - end if; - Mi = Mds * lambdaad * lambdaad / (E * E) + Mqs * lambdaaq * lambdaaq / (E * E); - Md = Mi + Mdif * lambdaaq * lambdaaq / (E * E); - Mq = Mi - Mdif * lambdaad * lambdaad / (E * E); - LMD = 1.0 / (1.0 / Md + Sdet); - LMQ = 1.0 / (1.0 / Mq + Slq); - 0 = (-lambdaad) + LMD * (id + lambdaf * Lddet + lambdad * Lfdet); - 0 = (-lambdaaq) + LMQ * (iq + lambdaq1 * Lq1inv + lambdaq2 * Lq2inv); - 0 = sin(theta) * ur - cos(theta) * ui + id * Sr - iq * Sx - omega * lambdaaq; - 0 = cos(theta) * ur + sin(theta) * ui + iq * Sr + id * Sx + omega * lambdaad; - sortie.ir = -(sin(theta) * id + cos(theta) * iq); - sortie.ii = -((-cos(theta) * id) + sin(theta) * iq); - pin_TETA = theta; - pin_OMEGA = omega; - pin_CM = cm; - pin_EFD = efd; - pin_UR = ur; - pin_UI = ui; - sortie.vr = ur; - sortie.vi = ui; - //Terminal Voltage - pin_TerminalVoltage = sqrt((sortie.vr - RT * sortie.ir + XT * sortie.ii) * (sortie.vr - RT * sortie.ir + XT * sortie.ii) + (sortie.vi - RT * sortie.ii - XT * sortie.ir) * (sortie.vi - RT * sortie.ii - XT * sortie.ir)) * 1 / rtfo; - //TerminalVoltage = sqrt(sortie.vr*sortie.vr+sortie.vi*sortie.vi); - //ActivePower PN-base - pin_ActivePowerPN = (sortie.vr * (-sortie.ir) + sortie.vi * (-sortie.ii)) * SNREF / PN; - //ActivePower PNALT-base - if PNALT == 0 then - pin_ActivePowerPNALT = 0; - else - pin_ActivePowerPNALT = (sortie.vr * (-sortie.ir) + sortie.vi * (-sortie.ii)) * SNREF / PNALT; - end if; - //ActivePower SNREF-base - pin_ActivePowerSNREF = sortie.vr * (-sortie.ir) + sortie.vi * (-sortie.ii); - //ReactivePower PN-base - pin_ReactivePowerPN = (sortie.vi * (-sortie.ir) - sortie.vr * (-sortie.ii)) * SNREF / PN; - //ReactivePower PNALT-base - if PNALT == 0 then - pin_ReactivePowerPNALT = 0; - else - pin_ReactivePowerPNALT = (sortie.vi * (-sortie.ir) - sortie.vr * (-sortie.ii)) * SNREF / PNALT; - end if; - //ReactivePower SNREF-base - pin_ReactivePowerSNREF = sortie.vi * (-sortie.ir) - sortie.vr * (-sortie.ii); - //ActivePower SN - pin_ActivePowerSN = (sortie.vr * (-sortie.ir) + sortie.vi * (-sortie.ii)) * SNREF / SN; - //ReactivePower SN - pin_ReactivePowerSN = (sortie.vi * (-sortie.ir) - sortie.vr * (-sortie.ii)) * SNREF / SN; - //Field Current - if md == 0 and mq == 0 and snd == 0 and snq == 0 then - pin_FieldCurrent = -Mdv / rtfo * ((Md0 + lD + mrc) * lambdaf - (Md0 + mrc) * lambdad - Md0 * lD * id) / ((Md0 + mrc) * (lf + lD) + lf * lD); - else - pin_FieldCurrent = -Mdv / rtfo * ((lD + mrc) * lambdaf - mrc * lambdad - lD * lambdaad) / (mrc * (lf + lD) + lf * lD); - end if; - //Current module - pin_Current = sqrt(sortie.ir * sortie.ir + sortie.ii * sortie.ii); - //Frequency - pin_FRZPU = omegaRef; - pin_FRZHZ = omegaRef * omega0; - annotation(Icon(graphics={ Rectangle(extent = {{-40, 40}, {40, -40}}, lineColor = {0, 0, 255}), Ellipse(extent = {{-24, 22}, {24, -24}}, lineColor = {0, 0, 255}, - lineThickness = 1), Line(points = {{-16, 0}, {-12, 8}, {-6, 8}, {6, -10}, {12, -10}, {16, 0}}, color = {0, 0, 255}, smooth = Smooth.Bezier, thickness = 1), Text(extent = {{-74, 48}, {-54, 42}}, lineColor = {0, 0, 255}, textString = "pin_OMEGA"), Text(extent = {{-70, 16}, {-60, 10}}, lineColor = {0, 0, 255}, textString = "pin_CM"), Text(extent = {{-70, -14}, {-60, -20}}, lineColor = {0, 0, 255}, textString = "pin_EFD"), Text(extent = {{54, 38}, {70, 32}}, lineColor = {0, 0, 255}, textString = "sortie"), Text(extent = {{52, -8}, {70, -16}}, lineColor = {0, 0, 255}, textString = "pin_THETA"), Text(extent = {{-52, -46}, {-42, -52}}, lineColor = {0, 0, 255}, textString = "ur"), Text(extent = {{4, -48}, {14, -54}}, lineColor = {0, 0, 255}, textString = "ui -"), Text( - extent={{-56,56},{-36,52}}, - lineColor={0,0,255}, - textString="FieldCurrent"),Text( - extent={{34,-50},{54,-54}}, - lineColor={0,0,255}, - textString="TerminalVoltage"),Text( - extent={{-24,56},{-4,52}}, - lineColor={0,0,255}, - textString="ActivePowerPNALT"),Text( - extent={{8,56},{28,52}}, - lineColor={0,0,255}, - textString="ActivePowerPN")}), Diagram(graphics), - Documentation(info=" -


<iPSL: iTesla Power System Library>

-

Copyright 2015 RTE (France), AIA (Spain), KTH (Sweden) and DTU (Denmark)

- -

The authors can be contacted by email: info at itesla-ipsl dot org

-

This package is part of the iTesla Power System Library ("iPSL") .

-

The iPSL is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

-

The iPSL is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

-

You should have received a copy of the GNU Lesser General Public License along with the iPSL. If not, see <http://www.gnu.org/licenses/>.

-")); -end PwGeneratorM1S; +within iPSL.Electrical.Machines.Eurostag; +class PwGeneratorM1S "Synchronous machine model according to Park's classical theory (Full model description). + The model corresponds to Eurostag's full model for M1S machine + (defined by internal parameters). Initialization included in the model. + 2014/03/10" + + PowerSystems.Connectors.PwPin sortie annotation(Placement(transformation(extent = {{40, 10}, {60, 30}}), iconTransformation(extent = {{40, 10}, {60, 30}}))); + PowerSystems.Connectors.ImPin pin_EFD annotation(Placement(transformation(extent = {{-61, -40}, {-41, -20}}), iconTransformation(extent = {{-61, -40}, {-41, -20}}))); + PowerSystems.Connectors.ImPin pin_OMEGA annotation(Placement(transformation(extent = {{-61, 20}, {-41, 40}}), iconTransformation(extent = {{-61, 20}, {-41, 40}}))); + PowerSystems.Connectors.ImPin pin_CM annotation(Placement(transformation(extent = {{-61, -10}, {-41, 10}}), iconTransformation(extent = {{-61, -10}, {-41, 10}}))); + PowerSystems.Connectors.ImPin omegaRef; + Real cm(start = init_cm); + Real efd(start = init_efd); + Real ur(start = ur0); + Real ui(start = ui0); + Real lambdaf(start = init_lambdaf); + Real lambdad(start = init_lambdad); + Real lambdaad(start = init_lambdaad); + Real lambdaaq(start = init_lambdaaq); + Real lambdaq1(start = init_lambdaq1); + Real lambdaq2(start = init_lambdaq2); + Real id(start = init_id); + Real iq(start = init_iq); + Real theta(start = init_theta); + Real omega(start = init_omega); + Real E; + Real Mds; + Real Mqs; + Real Md; + Real Mq; + Real Mi; + Real LMD; + Real LMQ; + //Initial values + parameter Real init_lambdaf = 0; + parameter Real init_lambdad = 0; + parameter Real init_lambdaad = 0; + parameter Real init_lambdaaq = 0; + parameter Real init_lambdaq1 = 0; + parameter Real init_lambdaq2 = 0; + parameter Real init_id = 0; + parameter Real init_iq = 0; + parameter Real init_theta = 0; + parameter Real init_omega = 1; + parameter Real init_cm = 0; + parameter Real init_efd = 0; + //parameters coming from .lf + parameter Real ur0 = 1 + "Initial real voltage component p.u. in the SNREF base"; + parameter Real ui0 = 0 + "Initial imaginary voltage component p.u. in the SNREF base"; + //parameter Real ir0 = 1; + //parameter Real ii0 = 0; + //parameter Real p0_0 = 0 "Initial active power"; + //parameter Real q0_0 = 0 "Initial active power"; + //General parameters. + parameter Real omega0 = 2 * 3.14159265 * 50 + "Nominal network angular frequency"; + parameter Real SNREF = 100 "MVA system base"; + parameter Real SN = 1150 "Nominal apparent power (MVA)"; + parameter Real PN = 1000 "Nominal turbine (active) power (MW)"; + parameter Real PNALT = 1100; + //per-unit in the machine SN base + parameter Real rStatIn = 0.004 + "Stator resistance p.u. in the machine SN base"; + parameter Real lStatIn = 0.219 "Stator leakage p.u. in the machine SN base"; + parameter Real mD0Pu = 2.351 + "d axis mutual inductance p.u. in the machine SN base"; + parameter Real WLMDVPu = 0.7459 + "d axis mutual inductance corresponding to magnetic condition taken for setting the voltage regulator"; + parameter Real mCanPu = 0.0 "CANAY's inductance p.u. in the machine SN base"; + parameter Real rDPu = 0.01723 + "d axis damper winding resistance p.u. in the machine SN base"; + parameter Real lDPu = 0.12825 + "d axis damper winding leakage p.u. in the machine SN base"; + parameter Real rRotIn = 0.00113 + "Rotor resistance p.u. in the machine SN base"; + parameter Real lRotIn = 0.24253 "Rotor leakage p.u. in the machine SN base"; + parameter Real mQ0Pu = 2.351 + "q axis mutual inductance p.u. in the machine SN base"; + parameter Real rQ1Pu = 0.0193 + "q axis damper 1 winding resistance p.u. in the machine SN base"; + parameter Real lQ1Pu = 0.08921 + "q axis damper 1 winding leakeage p.u. in the machine SN base"; + parameter Real rQ2Pu = 0.03923 + "q axis damper 2 winding resistance p.u. in the machine SN base"; + parameter Real lQ2Pu = 1.78484 + "q axis damper 2 winding leakeage p.u. in the machine SN base"; + parameter Real md = 0.1 "Coefficient md of the saturation curve"; + parameter Real mq = 0.1 "Coefficient mq of the saturation curve"; + parameter Real snd = 6 "Coefficient nd of the saturation curve"; + parameter Real snq = 6 "Coefficient nq of the saturation curve"; + parameter Real DIn = 0.0 "mechanical damping coefficient"; + parameter Real HIn = 6.3 "Constant of inertia"; + parameter Real U1N = 24 "nominal voltage machine side"; + parameter Real V1 = 24 "base voltage machine side"; + parameter Real U2N = 400 "nominal voltage machine side"; + parameter Real V2 = 380 "base voltage machine side"; + parameter Boolean transformerIncluded = false; + parameter Real RTfoPu = if transformerIncluded then 0.000185 else 0 + "Machine transoformer resistance p.u. in the SNTfo base"; + parameter Real XTfoPu = if transformerIncluded then 0.00769 else 0 + "Machine transoformer resistance p.u. in the SNTfo base"; + parameter Integer IWLMDV = 3; + parameter Boolean Saturated = true; + //Calculation and per-uniting of parameters. + //parameter Real yscale=SNREF/SN; + parameter Real yscale = if RT > 0.0 or XT > 0.0 then SNREF / SN * rtfo * rtfo else SNREF / SN; + parameter Real SNtfo = 1300 "Machine transformer rating"; + parameter Real r = rStatIn * yscale "Stator Resistance"; + parameter Real rf = rRotIn * yscale "Rotor Resistance"; + parameter Real lld = lStatIn * yscale "Stator leakage"; + parameter Real lf = lRotIn * yscale "Rotor leakage"; + parameter Real mrc = mCanPu * yscale "CANAY's inductance"; + parameter Real lD = lDPu * yscale "d axis damper winding leakage"; + parameter Real rD = rDPu * yscale "d axis damper winding resistance"; + parameter Real rQ1 = rQ1Pu * yscale "q axis damper 1 winding resistance"; + parameter Real rQ2 = rQ2Pu * yscale "q axis damper 2 winding resistance"; + parameter Real lQ1 = lQ1Pu * yscale "q axis damper 1 winding leakeage"; + parameter Real lQ2 = lQ2Pu * yscale "q axis damper 2 winding leakeage"; + parameter Real RT = RTfoPu * SNREF / SNtfo * rtfo * rtfo + "Machine transformer resistance (p.u.), enter value*SNREF/SNtfo"; + parameter Real XT = XTfoPu * SNREF / SNtfo * rtfo * rtfo + "Machine transformer reactance (p.u.), enter value*SNREF/SNtfo"; + parameter Real Md0 = mD0Pu * yscale "d axis mutual inductance"; + parameter Real Mq0 = mQ0Pu * yscale "q axis mutual inductance"; + parameter Real Mdv = WLMDVPu * yscale; + parameter Real D = DIn * SN / SNREF "Mechanical damping coefficient"; + parameter Real H = HIn * SN / SNREF "Constant of inertia"; + parameter Real rtfo = if transformerIncluded then U2N / V2 / U1N / V1 else 1 + "Transformer ratio"; + parameter Real DET = lf * lD + mrc * lf + mrc * lD; + parameter Real Mdif = Md0 - Mq0; + parameter Real Sdet = lf / DET + lD / DET; + parameter Real Slq = 1.0 / lQ1 + 1.0 / lQ2; + parameter Real Lddet = lD / DET; + parameter Real Lfdet = lf / DET; + parameter Real Lq1inv = 1.0 / lQ1; + parameter Real Lq2inv = 1.0 / lQ2; + parameter Real Sr = r + RT; + parameter Real Sx = lld + XT; + parameter Real Coef11 = rtfo * omega0 * rf / Mdv; + parameter Real Coef12 = rf * omega0 * (lD + mrc) / DET; + parameter Real Coef13 = rf * omega0 * mrc / DET; + parameter Real Coef14 = omega0 * rf * lD / DET; + parameter Real Coef21 = omega0 * rD * mrc / DET; + parameter Real Coef22 = omega0 * rD * (lf + mrc) / DET; + parameter Real Coef23 = omega0 * rD * lf / DET; + parameter Real Coef31 = omega0 * rQ1 / lQ1; + parameter Real Coef32 = omega0 * rQ1 / lQ1; + parameter Real Coef41 = omega0 * rQ2 / lQ2; + parameter Real Coef42 = omega0 * rQ2 / lQ2; + parameter Real Coef51 = PN / (SNREF * 2 * H); + parameter Real Coef52 = D / (2 * H); + parameter Real Coef53 = 1.0 / (2 * H); + Connectors.ImPin pin_TETA annotation(Placement(transformation(extent = {{39, -30}, {59, -10}}), iconTransformation(extent = {{39, -30}, {59, -10}}))); + Connectors.ImPin pin_UR annotation(Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = -90, origin = {-30, -49}), iconTransformation(extent = {{-10, -10}, {10, 10}}, rotation = -90, origin = {-30, -49}))); + Connectors.ImPin pin_UI annotation(Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = -90, origin = {0, -49}), iconTransformation(extent = {{-10, -10}, {10, 10}}, rotation = -90, origin = {0, -49}))); + Connectors.ImPin pin_FieldCurrent annotation(Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 90, origin = {-30, 49}), iconTransformation(extent = {{-10, -10}, {10, 10}}, rotation = 90, origin = {-30, 49}))); + Connectors.ImPin pin_TerminalVoltage annotation(Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = -90, origin = {30, -49}))); + Connectors.ImPin pin_ActivePowerPNALT annotation(Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 90, origin = {0, 49}))); + Connectors.ImPin pin_ActivePowerPN annotation(Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 90, origin = {30, 49}))); + Connectors.ImPin pin_ActivePowerSNREF; + Connectors.ImPin pin_ReactivePowerPNALT; + Connectors.ImPin pin_ReactivePowerPN; + Connectors.ImPin pin_ReactivePowerSNREF; + PowerSystems.Connectors.ImPin pin_ActivePowerSN; + PowerSystems.Connectors.ImPin pin_ReactivePowerSN; + Connectors.ImPin pin_Current; + Connectors.ImPin pin_FRZPU; + Connectors.ImPin pin_FRZHZ; +equation + der(lambdaf) = (-efd * Coef11) - lambdaf * Coef12 + lambdad * Coef13 + lambdaad * Coef14; + der(lambdad) = lambdaf * Coef21 - lambdad * Coef22 + lambdaad * Coef23; + der(lambdaq1) = (-lambdaq1 * Coef31) + lambdaaq * Coef32; + der(lambdaq2) = (-lambdaq2 * Coef41) + lambdaaq * Coef42; + der(omega) = cm * Coef51 + (omegaRef - omega) * Coef52 + lambdaad * iq * Coef53 - lambdaaq * id * Coef53; + der(theta) = (omega - omegaRef) * omega0; + E = sqrt(lambdaad * lambdaad + lambdaaq * lambdaaq); + if Saturated then + Mds = Md0 / (1 + md / rtfo ^ snd * E ^ snd); + Mqs = Mq0 / (1 + mq / rtfo ^ snq * E ^ snq); + else + Mds = Md0; + Mqs = Mq0; + end if; + Mi = Mds * lambdaad * lambdaad / (E * E) + Mqs * lambdaaq * lambdaaq / (E * E); + Md = Mi + Mdif * lambdaaq * lambdaaq / (E * E); + Mq = Mi - Mdif * lambdaad * lambdaad / (E * E); + LMD = 1.0 / (1.0 / Md + Sdet); + LMQ = 1.0 / (1.0 / Mq + Slq); + 0 = (-lambdaad) + LMD * (id + lambdaf * Lddet + lambdad * Lfdet); + 0 = (-lambdaaq) + LMQ * (iq + lambdaq1 * Lq1inv + lambdaq2 * Lq2inv); + 0 = sin(theta) * ur - cos(theta) * ui + id * Sr - iq * Sx - omega * lambdaaq; + 0 = cos(theta) * ur + sin(theta) * ui + iq * Sr + id * Sx + omega * lambdaad; + sortie.ir = -(sin(theta) * id + cos(theta) * iq); + sortie.ii = -((-cos(theta) * id) + sin(theta) * iq); + pin_TETA = theta; + pin_OMEGA = omega; + pin_CM = cm; + pin_EFD = efd; + pin_UR = ur; + pin_UI = ui; + sortie.vr = ur; + sortie.vi = ui; + //Terminal Voltage + pin_TerminalVoltage = sqrt((sortie.vr - RT * sortie.ir + XT * sortie.ii) * (sortie.vr - RT * sortie.ir + XT * sortie.ii) + (sortie.vi - RT * sortie.ii - XT * sortie.ir) * (sortie.vi - RT * sortie.ii - XT * sortie.ir)) * 1 / rtfo; + //TerminalVoltage = sqrt(sortie.vr*sortie.vr+sortie.vi*sortie.vi); + //ActivePower PN-base + pin_ActivePowerPN = (sortie.vr * (-sortie.ir) + sortie.vi * (-sortie.ii)) * SNREF / PN; + //ActivePower PNALT-base + if PNALT == 0 then + pin_ActivePowerPNALT = 0; + else + pin_ActivePowerPNALT = (sortie.vr * (-sortie.ir) + sortie.vi * (-sortie.ii)) * SNREF / PNALT; + end if; + //ActivePower SNREF-base + pin_ActivePowerSNREF = sortie.vr * (-sortie.ir) + sortie.vi * (-sortie.ii); + //ReactivePower PN-base + pin_ReactivePowerPN = (sortie.vi * (-sortie.ir) - sortie.vr * (-sortie.ii)) * SNREF / PN; + //ReactivePower PNALT-base + if PNALT == 0 then + pin_ReactivePowerPNALT = 0; + else + pin_ReactivePowerPNALT = (sortie.vi * (-sortie.ir) - sortie.vr * (-sortie.ii)) * SNREF / PNALT; + end if; + //ReactivePower SNREF-base + pin_ReactivePowerSNREF = sortie.vi * (-sortie.ir) - sortie.vr * (-sortie.ii); + //ActivePower SN + pin_ActivePowerSN = (sortie.vr * (-sortie.ir) + sortie.vi * (-sortie.ii)) * SNREF / SN; + //ReactivePower SN + pin_ReactivePowerSN = (sortie.vi * (-sortie.ir) - sortie.vr * (-sortie.ii)) * SNREF / SN; + //Field Current + if md == 0 and mq == 0 and snd == 0 and snq == 0 then + pin_FieldCurrent = -Mdv / rtfo * ((Md0 + lD + mrc) * lambdaf - (Md0 + mrc) * lambdad - Md0 * lD * id) / ((Md0 + mrc) * (lf + lD) + lf * lD); + else + pin_FieldCurrent = -Mdv / rtfo * ((lD + mrc) * lambdaf - mrc * lambdad - lD * lambdaad) / (mrc * (lf + lD) + lf * lD); + end if; + //Current module + pin_Current = sqrt(sortie.ir * sortie.ir + sortie.ii * sortie.ii); + //Frequency + pin_FRZPU = omegaRef; + pin_FRZHZ = omegaRef * omega0; + annotation(Icon(graphics={ Rectangle(extent = {{-40, 40}, {40, -40}}, lineColor = {0, 0, 255}), Ellipse(extent = {{-24, 22}, {24, -24}}, lineColor = {0, 0, 255}, + lineThickness = 1), Line(points = {{-16, 0}, {-12, 8}, {-6, 8}, {6, -10}, {12, -10}, {16, 0}}, color = {0, 0, 255}, smooth = Smooth.Bezier, thickness = 1), Text(extent = {{-74, 48}, {-54, 42}}, lineColor = {0, 0, 255}, textString = "pin_OMEGA"), Text(extent = {{-70, 16}, {-60, 10}}, lineColor = {0, 0, 255}, textString = "pin_CM"), Text(extent = {{-70, -14}, {-60, -20}}, lineColor = {0, 0, 255}, textString = "pin_EFD"), Text(extent = {{54, 38}, {70, 32}}, lineColor = {0, 0, 255}, textString = "sortie"), Text(extent = {{52, -8}, {70, -16}}, lineColor = {0, 0, 255}, textString = "pin_THETA"), Text(extent = {{-52, -46}, {-42, -52}}, lineColor = {0, 0, 255}, textString = "ur"), Text(extent = {{4, -48}, {14, -54}}, lineColor = {0, 0, 255}, textString = "ui +"), Text( + extent={{-56,56},{-36,52}}, + lineColor={0,0,255}, + textString="FieldCurrent"),Text( + extent={{34,-50},{54,-54}}, + lineColor={0,0,255}, + textString="TerminalVoltage"),Text( + extent={{-24,56},{-4,52}}, + lineColor={0,0,255}, + textString="ActivePowerPNALT"),Text( + extent={{8,56},{28,52}}, + lineColor={0,0,255}, + textString="ActivePowerPN")}), Diagram(graphics)); +end PwGeneratorM1S; diff --git a/iPSL/Electrical/Machines/Eurostag/PwGeneratorM2S.mo b/iPSL/Electrical/Machines/Eurostag/PwGeneratorM2S.mo index 90a53ac19..82a5fc7b9 100644 --- a/iPSL/Electrical/Machines/Eurostag/PwGeneratorM2S.mo +++ b/iPSL/Electrical/Machines/Eurostag/PwGeneratorM2S.mo @@ -1,307 +1,277 @@ -within iPSL.Electrical.Machines.Eurostag; -model PwGeneratorM2S "Synchronous machine model according to Park's classical theory (Full model description). - The model corresponds to Eurostag's full model for M2S machine - (defined by external parameters). Developed by RTE and adapted by AIA. - 2014/03/10" - - iPSL.Connectors.PwPin sortie annotation (Placement(transformation(extent={{40, - 10},{60,30}}), iconTransformation(extent={{40,10},{60,30}}))); - Modelica.Blocks.Interfaces.RealInput pin_EFD annotation(Placement(transformation(extent = {{-61, -40}, {-41, -20}}), iconTransformation(extent = {{-61, -40}, {-41, -20}}))); - Modelica.Blocks.Interfaces.RealInput pin_OMEGA annotation(Placement(transformation(extent = {{-61, 20}, {-41, 40}}), iconTransformation(extent = {{-61, 20}, {-41, 40}}))); - Modelica.Blocks.Interfaces.RealInput pin_CM annotation(Placement(transformation(extent = {{-61, -10}, {-41, 10}}), iconTransformation(extent = {{-61, -10}, {-41, 10}}))); - Modelica.Blocks.Interfaces.RealInput omegaRef; - // EXTERNAL TO INTERNAL COMPUTATION - iPSL.Electrical.Machines.Eurostag.PwExtIntParameters extern( - rStatIn_=rStatIn, - lStatIn_=lStatIn, - xDPu_=XD, - xpDPu_=XPD, - xppDPu_=XSD, - tpDO_=TPD0, - tppDO_=TSD0, - xQPu_=XQ, - xpQPu_=XPQ, - xppQPu_=XSQ, - tpQO_=TPQ0, - tppQO_=TSQ0, - tX_=TX, - IENR=IENR); - Real cm(start = init_cm); - Real efd(start = init_efd); - Real ur; - //(start = ur0); - Real ui; - //(start=ui0); - Real lambdaf(start = init_lambdaf); - Real lambdad(start = init_lambdad); - Real lambdaad(start = init_lambdaad); - Real lambdaaq(start = init_lambdaaq); - Real lambdaq1(start = init_lambdaq1); - Real lambdaq2(start = init_lambdaq2); - Real id(start = init_id); - Real iq(start = init_iq); - Real theta(start = init_theta); - Real omega(start = init_omega); - Real E; - Real Mds; - Real Mqs; - Real Md; - Real Mq; - Real Mi; - Real LMD; - Real LMQ; - //INITIAL VALUES - parameter Real init_lambdaf = 0; - parameter Real init_lambdad = 0; - parameter Real init_lambdaad = 0; - parameter Real init_lambdaaq = 0; - parameter Real init_lambdaq1 = 0; - parameter Real init_lambdaq2 = 0; - parameter Real init_id = 0; - parameter Real init_iq = 0; - parameter Real init_theta = 0; - parameter Real init_omega = 1; - parameter Real init_cm = 0; - parameter Real init_efd = 0; - // GENERAL PARAMETERS - parameter Real omega0 = 2 * 3.14159265 * 50 - "Nominal network angular frequency"; - parameter Real SNREF = 100 "MVA system base"; - parameter Real SN = 1150 "Nominal apparent power (MVA)"; - parameter Real PN = 1000 "Nominal turbine (active) power (MW)"; - parameter Real PNALT = 1100; - parameter Real DIn = 0.0 "mechanical damping coefficient"; - parameter Real HIn = 6.3 "Constant of inertia"; - parameter Real IENR = 3 "number of windings"; - // PARAMETERS COMING FROM LF - // parameter Real ur0 = 1 - // "Initial real voltage component p.u. in the SNREF base"; - // parameter Real ui0 = 0 - // "Initial imaginary voltage component p.u. in the SNREF base"; - // parameter Real ir0 = 1; - // parameter Real ii0 = 0; - parameter Real p0_0 = 0 "Initial active power"; - parameter Real q0_0 = 0 "Initial active power"; - // EXTERNAL PARAMETERS (GIVEN) per-unit in the machine SN base. - parameter Real rStatIn = 0 "Stator resistance p.u. in the machine SN base"; - parameter Real lStatIn = 0 "Stator leakage p.u. in the machine SN base"; - parameter Real WLMDVPu = 0 - "d axis mutual inductance corresponding to magnetic condition taken for setting the voltage regulator"; - parameter Real XD = 0 "Direct reactance"; - parameter Real XPD = 0 "Direct trans. reactance"; - parameter Real XSD = 0 "Direct subtrans. reactance"; - parameter Real TPD0 = 0 "Direct trans. time const"; - parameter Real TSD0 = 0 "Direct subtrans. time const"; - parameter Real TX = 0 "Damping time constant"; - parameter Real XQ = 0 "Quadrat reactance"; - parameter Real XPQ = 0 "Quadrat trans. reactance"; - parameter Real XSQ = 0 "Quadrat subtrans. reactance"; - parameter Real TPQ0 = 0 "Quadrat trans. time const"; - parameter Real TSQ0 = 0 "Quadrat subtrans. time const"; - parameter Integer IWLMDV = 3; - parameter Boolean Saturated = true; - // SATURATION - parameter Real md = 0.1 "Coefficient md of the saturation curve"; - parameter Real mq = 0.1 "Coefficient mq of the saturation curve"; - parameter Real snd = 6 "Coefficient nd of the saturation curve"; - parameter Real snq = 6 "Coefficient nq of the saturation curve"; - // INTERNAL PARAMETERS (COMPUTED) per-unit in the machine SN base. - parameter Real mCanPu = extern.mrc - "CANAY's inductance p.u. in the machine SN base"; - parameter Real rDPu = extern.rD - "d axis damper winding resistance p.u. in the machine SN base"; - parameter Real lDPu = extern.lD - "d axis damper winding leakage p.u. in the machine SN base"; - parameter Real rRotIn = extern.rf - "Rotor resistance p.u. in the machine SN base"; - parameter Real lRotIn = extern.lf "Rotor leakage p.u. in the machine SN base"; - parameter Real mQ0Pu = extern.mQ0Pu_ - "q axis mutual inductance p.u. in the machine SN base"; - parameter Real mD0Pu = extern.mD0Pu_ - "d axis mutual inductance p.u. in the machine SN base"; - parameter Real rQ1Pu = extern.rQ1 - "q axis damper 1 winding resistance p.u. in the machine SN base"; - parameter Real lQ1Pu = extern.lQ1 - "q axis damper 1 winding leakeage p.u. in the machine SN base"; - parameter Real rQ2Pu = extern.rQ2 - "q axis damper 2 winding resistance p.u. in the machine SN base"; - parameter Real lQ2Pu = extern.lQ2 - "q axis damper 2 winding leakeage p.u. in the machine SN base"; - parameter Real U1N = 24 "nominal voltage machine side"; - parameter Real V1 = 24 "base voltage machine side"; - parameter Real U2N = 400 "nominal voltage machine side"; - parameter Real V2 = 380 "base voltage machine side"; - parameter Boolean transformerIncluded = false; - parameter Real RTfoPu = if transformerIncluded then 0.000185 else 0 - "Machine transoformer resistance p.u. in the SNTfo base"; - parameter Real XTfoPu = if transformerIncluded then 0.00769 else 0 - "Machine transoformer resistance p.u. in the SNTfo base"; - // CALCULATION AND PER-UNITING OF PARAMETERS. - //parameter Real yscale=SNREF/SN; - parameter Real yscale = if RT > 0.0 or XT > 0.0 then SNREF / SN * rtfo * rtfo else SNREF / SN; - parameter Real SNtfo = 1300 "Machine transformer rating"; - parameter Real r = rStatIn * yscale "Stator Resistance"; - parameter Real rf = rRotIn * yscale "Rotor Resistance"; - parameter Real lld = lStatIn * yscale "Stator leakage"; - parameter Real lf = lRotIn * yscale "Rotor leakage"; - parameter Real mrc = mCanPu * yscale "CANAY's inductance"; - parameter Real lD = lDPu * yscale "d axis damper winding leakage"; - parameter Real rD = rDPu * yscale "d axis damper winding resistance"; - parameter Real rQ1 = rQ1Pu * yscale "q axis damper 1 winding resistance"; - parameter Real rQ2 = rQ2Pu * yscale "q axis damper 2 winding resistance"; - parameter Real lQ1 = lQ1Pu * yscale "q axis damper 1 winding leakeage"; - parameter Real lQ2 = lQ2Pu * yscale "q axis damper 2 winding leakeage"; - parameter Real RT = RTfoPu * SNREF / SNtfo * rtfo * rtfo - "Machine transformer resistance (pu), enter value*SNREF/SNtfo"; - parameter Real XT = XTfoPu * SNREF / SNtfo * rtfo * rtfo - "Machine transformer reactance (pu), enter value*SNREF/SNtfo"; - parameter Real Md0 = mD0Pu * yscale "d axis mutual inductance"; - parameter Real Mq0 = mQ0Pu * yscale "q axis mutual inductance"; - parameter Real Mdv = WLMDVPu * yscale; - parameter Real D = DIn * SN / SNREF "Mechanical damping coefficient"; - parameter Real H = HIn * SN / SNREF "Constant of inertia"; - parameter Real rtfo = if transformerIncluded then (U2N / V2) / (U1N / V1) else 1 - "Transformer ratio"; - parameter Real DET = lf * lD + mrc * lf + mrc * lD; - parameter Real Mdif = Md0 - Mq0; - parameter Real Sdet = lf / DET + lD / DET; - parameter Real Slq = 1.0 / lQ1 + 1.0 / lQ2; - parameter Real Lddet = lD / DET; - parameter Real Lfdet = lf / DET; - parameter Real Lq1inv = 1.0 / lQ1; - parameter Real Lq2inv = 1.0 / lQ2; - parameter Real Sr = r + RT; - parameter Real Sx = lld + XT; - parameter Real Coef11 = rtfo * omega0 * rf / Mdv; - parameter Real Coef12 = rf * omega0 * (lD + mrc) / DET; - parameter Real Coef13 = rf * omega0 * mrc / DET; - parameter Real Coef14 = omega0 * rf * lD / DET; - parameter Real Coef21 = omega0 * rD * mrc / DET; - parameter Real Coef22 = omega0 * rD * (lf + mrc) / DET; - parameter Real Coef23 = omega0 * rD * lf / DET; - parameter Real Coef31 = omega0 * rQ1 / lQ1; - parameter Real Coef32 = omega0 * rQ1 / lQ1; - parameter Real Coef41 = omega0 * rQ2 / lQ2; - parameter Real Coef42 = omega0 * rQ2 / lQ2; - parameter Real Coef51 = PN / (SNREF * 2 * H); - parameter Real Coef52 = D / (2 * H); - parameter Real Coef53 = 1.0 / (2 * H); - Modelica.Blocks.Interfaces.RealOutput pin_TETA annotation(Placement(transformation(extent = {{39, -30}, {59, -10}}), iconTransformation(extent = {{39, -30}, {59, -10}}))); - Modelica.Blocks.Interfaces.RealOutput pin_UR annotation(Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = -90, origin = {-30, -49}), iconTransformation(extent = {{-10, -10}, {10, 10}}, rotation = -90, origin = {-30, -49}))); - Modelica.Blocks.Interfaces.RealOutput pin_UI annotation(Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = -90, origin = {0, -49}), iconTransformation(extent = {{-10, -10}, {10, 10}}, rotation = -90, origin = {0, -49}))); - Modelica.Blocks.Interfaces.RealOutput pin_FieldCurrent annotation(Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 90, origin = {-30, 49}), iconTransformation(extent = {{-10, -10}, {10, 10}}, rotation = 90, origin = {-30, 49}))); - Modelica.Blocks.Interfaces.RealOutput pin_TerminalVoltage annotation(Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = -90, origin = {30, -49}))); - Modelica.Blocks.Interfaces.RealOutput pin_ActivePowerPNALT annotation(Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 90, origin = {0, 49}))); - Modelica.Blocks.Interfaces.RealOutput pin_ActivePowerPN annotation(Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 90, origin = {30, 49}))); - Modelica.Blocks.Interfaces.RealOutput pin_ActivePowerSNREF; - Modelica.Blocks.Interfaces.RealOutput pin_ReactivePowerPNALT; - Modelica.Blocks.Interfaces.RealOutput pin_ReactivePowerPN; - Modelica.Blocks.Interfaces.RealOutput pin_ReactivePowerSNREF; - Modelica.Blocks.Interfaces.RealOutput pin_ActivePowerSN; - Modelica.Blocks.Interfaces.RealOutput pin_ReactivePowerSN; - Modelica.Blocks.Interfaces.RealOutput pin_Current; - Modelica.Blocks.Interfaces.RealOutput pin_FRZPU; - Modelica.Blocks.Interfaces.RealOutput pin_FRZHZ; -equation - der(lambdaf) = (-efd * Coef11) - lambdaf * Coef12 + lambdad * Coef13 + lambdaad * Coef14; - der(lambdad) = lambdaf * Coef21 - lambdad * Coef22 + lambdaad * Coef23; - der(lambdaq1) = (-lambdaq1 * Coef31) + lambdaaq * Coef32; - der(lambdaq2) = (-lambdaq2 * Coef41) + lambdaaq * Coef42; - der(omega) = cm * Coef51 + (omegaRef - omega) * Coef52 + lambdaad * iq * Coef53 - lambdaaq * id * Coef53; - der(theta) = (omega - omegaRef) * omega0; - E = sqrt(lambdaad * lambdaad + lambdaaq * lambdaaq); - if Saturated then - Mds = Md0 / (1 + md / rtfo ^ snd * E ^ snd); - Mqs = Mq0 / (1 + mq / rtfo ^ snq * E ^ snq); - else - Mds = Md0; - Mqs = Mq0; - end if; - Mi = Mds * lambdaad * lambdaad / (E * E) + Mqs * lambdaaq * lambdaaq / (E * E); - Md = Mi + Mdif * lambdaaq * lambdaaq / (E * E); - Mq = Mi - Mdif * lambdaad * lambdaad / (E * E); - LMD = 1.0 / (1.0 / Md + Sdet); - LMQ = 1.0 / (1.0 / Mq + Slq); - 0 = (-lambdaad) + LMD * (id + lambdaf * Lddet + lambdad * Lfdet); - 0 = (-lambdaaq) + LMQ * (iq + lambdaq1 * Lq1inv + lambdaq2 * Lq2inv); - 0 = sin(theta) * ur - cos(theta) * ui + id * Sr - iq * Sx - omega * lambdaaq; - 0 = cos(theta) * ur + sin(theta) * ui + iq * Sr + id * Sx + omega * lambdaad; - sortie.ir = -(sin(theta) * id + cos(theta) * iq); - sortie.ii = -((-cos(theta) * id) + sin(theta) * iq); - pin_TETA = theta; - pin_OMEGA = omega; - pin_CM = cm; - pin_EFD = efd; - pin_UR = ur; - pin_UI = ui; - sortie.vr = ur; - sortie.vi = ui; - //Terminal Voltage - pin_TerminalVoltage = sqrt((sortie.vr - RT * sortie.ir + XT * sortie.ii) * (sortie.vr - RT * sortie.ir + XT * sortie.ii) + (sortie.vi - RT * sortie.ii - XT * sortie.ir) * (sortie.vi - RT * sortie.ii - XT * sortie.ir)) * 1 / rtfo; - //TerminalVoltage = sqrt(sortie.vr*sortie.vr+sortie.vi*sortie.vi); - //ActivePower PN-base - pin_ActivePowerPN = (sortie.vr * (-sortie.ir) + sortie.vi * (-sortie.ii)) * SNREF / PN; - //ActivePower PNALT-base - if PNALT == 0 then - pin_ActivePowerPNALT = 0; - else - pin_ActivePowerPNALT = (sortie.vr * (-sortie.ir) + sortie.vi * (-sortie.ii)) * SNREF / PNALT; - end if; - //ActivePower SNREF-base - pin_ActivePowerSNREF = sortie.vr * (-sortie.ir) + sortie.vi * (-sortie.ii); - //ReactivePower PN-base - pin_ReactivePowerPN = (sortie.vi * (-sortie.ir) - sortie.vr * (-sortie.ii)) * SNREF / PN; - //ReactivePower PNALT-base - if PNALT == 0 then - pin_ReactivePowerPNALT = 0; - else - pin_ReactivePowerPNALT = (sortie.vi * (-sortie.ir) - sortie.vr * (-sortie.ii)) * SNREF / PNALT; - end if; - //ReactivePower SNREF-base - pin_ReactivePowerSNREF = sortie.vi * (-sortie.ir) - sortie.vr * (-sortie.ii); - //ActivePower SN - pin_ActivePowerSN = (sortie.vr * (-sortie.ir) + sortie.vi * (-sortie.ii)) * SNREF / SN; - //ReactivePower SN - pin_ReactivePowerSN = (sortie.vi * (-sortie.ir) - sortie.vr * (-sortie.ii)) * SNREF / SN; - //Field Current - if md == 0 and mq == 0 and snd == 0 and snq == 0 then - pin_FieldCurrent = -Mdv / rtfo * ((Md0 + lD + mrc) * lambdaf - (Md0 + mrc) * lambdad - Md0 * lD * id) / ((Md0 + mrc) * (lf + lD) + lf * lD); - else - pin_FieldCurrent = -Mdv / rtfo * ((lD + mrc) * lambdaf - mrc * lambdad - lD * lambdaad) / (mrc * (lf + lD) + lf * lD); - end if; - //Current module - pin_Current = sqrt(sortie.ir * sortie.ir + sortie.ii * sortie.ii); - //Frequency - pin_FRZPU = omegaRef; - pin_FRZHZ = omegaRef * omega0; - annotation(Icon(graphics={ Rectangle(extent = {{-40, 40}, {40, -40}}, lineColor = {0, 0, 255}), Ellipse(extent = {{-24, 22}, {24, -24}}, lineColor = {0, 0, 255}, - lineThickness = 1), Line(points = {{-16, 0}, {-12, 8}, {-6, 8}, {6, -10}, {12, -10}, {16, 0}}, color = {0, 0, 255}, smooth = Smooth.Bezier, thickness = 1), Text(extent = {{-74, 48}, {-54, 42}}, lineColor = {0, 0, 255}, textString = "pin_OMEGA"), Text(extent = {{-70, 16}, {-60, 10}}, lineColor = {0, 0, 255}, textString = "pin_CM"), Text(extent = {{-70, -14}, {-60, -20}}, lineColor = {0, 0, 255}, textString = "pin_EFD"), Text(extent = {{54, 38}, {70, 32}}, lineColor = {0, 0, 255}, textString = "sortie"), Text(extent = {{52, -8}, {70, -16}}, lineColor = {0, 0, 255}, textString = "pin_THETA"), Text(extent = {{-52, -46}, {-42, -52}}, lineColor = {0, 0, 255}, textString = "ur"), Text(extent = {{4, -48}, {14, -54}}, lineColor = {0, 0, 255}, textString = "ui -"), Text( - extent={{-56,56},{-36,52}}, - lineColor={0,0,255}, - textString="FieldCurrent"),Text( - extent={{34,-50},{54,-54}}, - lineColor={0,0,255}, - textString="TerminalVoltage"),Text( - extent={{-24,56},{-4,52}}, - lineColor={0,0,255}, - textString="ActivePowerPNALT"),Text( - extent={{8,56},{28,52}}, - lineColor={0,0,255}, - textString="ActivePowerPN")}), Diagram(graphics), - Documentation(info=" -


<iPSL: iTesla Power System Library>

-

Copyright 2015 RTE (France), AIA (Spain), KTH (Sweden) and DTU (Denmark)

- -

The authors can be contacted by email: info at itesla-ipsl dot org

-

This package is part of the iTesla Power System Library ("iPSL") .

-

The iPSL is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

-

The iPSL is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

-

You should have received a copy of the GNU Lesser General Public License along with the iPSL. If not, see <http://www.gnu.org/licenses/>.

-")); -end PwGeneratorM2S; +within iPSL.Electrical.Machines.Eurostag; +class PwGeneratorM2S "Synchronous machine model according to Park's classical theory (Full model description). + The model corresponds to Eurostag's full model for M2S machine + (defined by external parameters). Initialization included in the model. + 2014/03/10" + + PowerSystems.Connectors.PwPin sortie annotation(Placement(transformation(extent = {{40, 10}, {60, 30}}), iconTransformation(extent = {{40, 10}, {60, 30}}))); + PowerSystems.Connectors.ImPin pin_EFD annotation(Placement(transformation(extent = {{-61, -40}, {-41, -20}}), iconTransformation(extent = {{-61, -40}, {-41, -20}}))); + PowerSystems.Connectors.ImPin pin_OMEGA annotation(Placement(transformation(extent = {{-61, 20}, {-41, 40}}), iconTransformation(extent = {{-61, 20}, {-41, 40}}))); + PowerSystems.Connectors.ImPin pin_CM annotation(Placement(transformation(extent = {{-61, -10}, {-41, 10}}), iconTransformation(extent = {{-61, -10}, {-41, 10}}))); + PowerSystems.Connectors.ImPin omegaRef; + // EXTERNAL TO INTERNAL COMPUTATION + PowerSystems.Electrical.Machines.Eurostag.PwExtIntParameters extern(rStatIn_ = rStatIn, lStatIn_ = lStatIn, xDPu_ = XD, xpDPu_ = XPD, xppDPu_ = XSD, tpDO_ = TPD0, tppDO_ = TSD0, xQPu_ = XQ, xpQPu_ = XPQ, xppQPu_ = XSQ, tpQO_ = TPQ0, tppQO_ = TSQ0, tX_ = TX, IENR = IENR); + Real cm(start = init_cm); + Real efd(start = init_efd); + Real ur; + //(start = ur0); + Real ui; + //(start=ui0); + Real lambdaf(start = init_lambdaf); + Real lambdad(start = init_lambdad); + Real lambdaad(start = init_lambdaad); + Real lambdaaq(start = init_lambdaaq); + Real lambdaq1(start = init_lambdaq1); + Real lambdaq2(start = init_lambdaq2); + Real id(start = init_id); + Real iq(start = init_iq); + Real theta(start = init_theta); + Real omega(start = init_omega); + Real E; + Real Mds; + Real Mqs; + Real Md; + Real Mq; + Real Mi; + Real LMD; + Real LMQ; + //INITIAL VALUES + parameter Real init_lambdaf = 0; + parameter Real init_lambdad = 0; + parameter Real init_lambdaad = 0; + parameter Real init_lambdaaq = 0; + parameter Real init_lambdaq1 = 0; + parameter Real init_lambdaq2 = 0; + parameter Real init_id = 0; + parameter Real init_iq = 0; + parameter Real init_theta = 0; + parameter Real init_omega = 1; + parameter Real init_cm = 0; + parameter Real init_efd = 0; + // GENERAL PARAMETERS + parameter Real omega0 = 2 * 3.14159265 * 50 + "Nominal network angular frequency"; + parameter Real SNREF = 100 "MVA system base"; + parameter Real SN = 1150 "Nominal apparent power (MVA)"; + parameter Real PN = 1000 "Nominal turbine (active) power (MW)"; + parameter Real PNALT = 1100; + parameter Real DIn = 0.0 "mechanical damping coefficient"; + parameter Real HIn = 6.3 "Constant of inertia"; + parameter Real IENR = 3 "number of windings"; + // PARAMETERS COMING FROM LF + // parameter Real ur0 = 1 + // "Initial real voltage component p.u. in the SNREF base"; + // parameter Real ui0 = 0 + // "Initial imaginary voltage component p.u. in the SNREF base"; + // parameter Real ir0 = 1; + // parameter Real ii0 = 0; + parameter Real p0_0 = 0 "Initial active power"; + parameter Real q0_0 = 0 "Initial active power"; + // EXTERNAL PARAMETERS (GIVEN) per-unit in the machine SN base. + parameter Real rStatIn = 0 "Stator resistance p.u. in the machine SN base"; + parameter Real lStatIn = 0 "Stator leakage p.u. in the machine SN base"; + parameter Real WLMDVPu = 0 + "d axis mutual inductance corresponding to magnetic condition taken for setting the voltage regulator"; + parameter Real XD = 0 "Direct reactance"; + parameter Real XPD = 0 "Direct trans. reactance"; + parameter Real XSD = 0 "Direct subtrans. reactance"; + parameter Real TPD0 = 0 "Direct trans. time const"; + parameter Real TSD0 = 0 "Direct subtrans. time const"; + parameter Real TX = 0 "Damping time constant"; + parameter Real XQ = 0 "Quadrat reactance"; + parameter Real XPQ = 0 "Quadrat trans. reactance"; + parameter Real XSQ = 0 "Quadrat subtrans. reactance"; + parameter Real TPQ0 = 0 "Quadrat trans. time const"; + parameter Real TSQ0 = 0 "Quadrat subtrans. time const"; + parameter Integer IWLMDV = 3; + parameter Boolean Saturated = true; + // SATURATION + parameter Real md = 0.1 "Coefficient md of the saturation curve"; + parameter Real mq = 0.1 "Coefficient mq of the saturation curve"; + parameter Real snd = 6 "Coefficient nd of the saturation curve"; + parameter Real snq = 6 "Coefficient nq of the saturation curve"; + // INTERNAL PARAMETERS (COMPUTED) per-unit in the machine SN base. + parameter Real mCanPu = extern.mrc + "CANAY's inductance p.u. in the machine SN base"; + parameter Real rDPu = extern.rD + "d axis damper winding resistance p.u. in the machine SN base"; + parameter Real lDPu = extern.lD + "d axis damper winding leakage p.u. in the machine SN base"; + parameter Real rRotIn = extern.rf + "Rotor resistance p.u. in the machine SN base"; + parameter Real lRotIn = extern.lf "Rotor leakage p.u. in the machine SN base"; + parameter Real mQ0Pu = extern.mQ0Pu_ + "q axis mutual inductance p.u. in the machine SN base"; + parameter Real mD0Pu = extern.mD0Pu_ + "d axis mutual inductance p.u. in the machine SN base"; + parameter Real rQ1Pu = extern.rQ1 + "q axis damper 1 winding resistance p.u. in the machine SN base"; + parameter Real lQ1Pu = extern.lQ1 + "q axis damper 1 winding leakeage p.u. in the machine SN base"; + parameter Real rQ2Pu = extern.rQ2 + "q axis damper 2 winding resistance p.u. in the machine SN base"; + parameter Real lQ2Pu = extern.lQ2 + "q axis damper 2 winding leakeage p.u. in the machine SN base"; + parameter Real U1N = 24 "nominal voltage machine side"; + parameter Real V1 = 24 "base voltage machine side"; + parameter Real U2N = 400 "nominal voltage machine side"; + parameter Real V2 = 380 "base voltage machine side"; + parameter Boolean transformerIncluded = false; + parameter Real RTfoPu = if transformerIncluded then 0.000185 else 0 + "Machine transoformer resistance p.u. in the SNTfo base"; + parameter Real XTfoPu = if transformerIncluded then 0.00769 else 0 + "Machine transoformer resistance p.u. in the SNTfo base"; + // CALCULATION AND PER-UNITING OF PARAMETERS. + //parameter Real yscale=SNREF/SN; + parameter Real yscale = if RT > 0.0 or XT > 0.0 then SNREF / SN * rtfo * rtfo else SNREF / SN; + parameter Real SNtfo = 1300 "Machine transformer rating"; + parameter Real r = rStatIn * yscale "Stator Resistance"; + parameter Real rf = rRotIn * yscale "Rotor Resistance"; + parameter Real lld = lStatIn * yscale "Stator leakage"; + parameter Real lf = lRotIn * yscale "Rotor leakage"; + parameter Real mrc = mCanPu * yscale "CANAY's inductance"; + parameter Real lD = lDPu * yscale "d axis damper winding leakage"; + parameter Real rD = rDPu * yscale "d axis damper winding resistance"; + parameter Real rQ1 = rQ1Pu * yscale "q axis damper 1 winding resistance"; + parameter Real rQ2 = rQ2Pu * yscale "q axis damper 2 winding resistance"; + parameter Real lQ1 = lQ1Pu * yscale "q axis damper 1 winding leakeage"; + parameter Real lQ2 = lQ2Pu * yscale "q axis damper 2 winding leakeage"; + parameter Real RT = RTfoPu * SNREF / SNtfo * rtfo * rtfo + "Machine transformer resistance (p.u.), enter value*SNREF/SNtfo"; + parameter Real XT = XTfoPu * SNREF / SNtfo * rtfo * rtfo + "Machine transformer reactance (p.u.), enter value*SNREF/SNtfo"; + parameter Real Md0 = mD0Pu * yscale "d axis mutual inductance"; + parameter Real Mq0 = mQ0Pu * yscale "q axis mutual inductance"; + parameter Real Mdv = WLMDVPu * yscale; + parameter Real D = DIn * SN / SNREF "Mechanical damping coefficient"; + parameter Real H = HIn * SN / SNREF "Constant of inertia"; + parameter Real rtfo = if transformerIncluded then U2N / V2 / U1N / V1 else 1 + "Transformer ratio"; + parameter Real DET = lf * lD + mrc * lf + mrc * lD; + parameter Real Mdif = Md0 - Mq0; + parameter Real Sdet = lf / DET + lD / DET; + parameter Real Slq = 1.0 / lQ1 + 1.0 / lQ2; + parameter Real Lddet = lD / DET; + parameter Real Lfdet = lf / DET; + parameter Real Lq1inv = 1.0 / lQ1; + parameter Real Lq2inv = 1.0 / lQ2; + parameter Real Sr = r + RT; + parameter Real Sx = lld + XT; + parameter Real Coef11 = rtfo * omega0 * rf / Mdv; + parameter Real Coef12 = rf * omega0 * (lD + mrc) / DET; + parameter Real Coef13 = rf * omega0 * mrc / DET; + parameter Real Coef14 = omega0 * rf * lD / DET; + parameter Real Coef21 = omega0 * rD * mrc / DET; + parameter Real Coef22 = omega0 * rD * (lf + mrc) / DET; + parameter Real Coef23 = omega0 * rD * lf / DET; + parameter Real Coef31 = omega0 * rQ1 / lQ1; + parameter Real Coef32 = omega0 * rQ1 / lQ1; + parameter Real Coef41 = omega0 * rQ2 / lQ2; + parameter Real Coef42 = omega0 * rQ2 / lQ2; + parameter Real Coef51 = PN / (SNREF * 2 * H); + parameter Real Coef52 = D / (2 * H); + parameter Real Coef53 = 1.0 / (2 * H); + PowerSystems.Connectors.ImPin pin_TETA annotation(Placement(transformation(extent = {{39, -30}, {59, -10}}), iconTransformation(extent = {{39, -30}, {59, -10}}))); + PowerSystems.Connectors.ImPin pin_UR annotation(Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = -90, origin = {-30, -49}), iconTransformation(extent = {{-10, -10}, {10, 10}}, rotation = -90, origin = {-30, -49}))); + PowerSystems.Connectors.ImPin pin_UI annotation(Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = -90, origin = {0, -49}), iconTransformation(extent = {{-10, -10}, {10, 10}}, rotation = -90, origin = {0, -49}))); + PowerSystems.Connectors.ImPin pin_FieldCurrent annotation(Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 90, origin = {-30, 49}), iconTransformation(extent = {{-10, -10}, {10, 10}}, rotation = 90, origin = {-30, 49}))); + PowerSystems.Connectors.ImPin pin_TerminalVoltage annotation(Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = -90, origin = {30, -49}))); + PowerSystems.Connectors.ImPin pin_ActivePowerPNALT annotation(Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 90, origin = {0, 49}))); + PowerSystems.Connectors.ImPin pin_ActivePowerPN annotation(Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 90, origin = {30, 49}))); + Connectors.ImPin pin_ActivePowerSNREF; + Connectors.ImPin pin_ReactivePowerPNALT; + Connectors.ImPin pin_ReactivePowerPN; + Connectors.ImPin pin_ReactivePowerSNREF; + PowerSystems.Connectors.ImPin pin_ActivePowerSN; + PowerSystems.Connectors.ImPin pin_ReactivePowerSN; + Connectors.ImPin pin_Current; + Connectors.ImPin pin_FRZPU; + Connectors.ImPin pin_FRZHZ; +equation + der(lambdaf) = (-efd * Coef11) - lambdaf * Coef12 + lambdad * Coef13 + lambdaad * Coef14; + der(lambdad) = lambdaf * Coef21 - lambdad * Coef22 + lambdaad * Coef23; + der(lambdaq1) = (-lambdaq1 * Coef31) + lambdaaq * Coef32; + der(lambdaq2) = (-lambdaq2 * Coef41) + lambdaaq * Coef42; + der(omega) = cm * Coef51 + (omegaRef - omega) * Coef52 + lambdaad * iq * Coef53 - lambdaaq * id * Coef53; + der(theta) = (omega - omegaRef) * omega0; + E = sqrt(lambdaad * lambdaad + lambdaaq * lambdaaq); + if Saturated then + Mds = Md0 / (1 + md / rtfo ^ snd * E ^ snd); + Mqs = Mq0 / (1 + mq / rtfo ^ snq * E ^ snq); + else + Mds = Md0; + Mqs = Mq0; + end if; + Mi = Mds * lambdaad * lambdaad / (E * E) + Mqs * lambdaaq * lambdaaq / (E * E); + Md = Mi + Mdif * lambdaaq * lambdaaq / (E * E); + Mq = Mi - Mdif * lambdaad * lambdaad / (E * E); + LMD = 1.0 / (1.0 / Md + Sdet); + LMQ = 1.0 / (1.0 / Mq + Slq); + 0 = (-lambdaad) + LMD * (id + lambdaf * Lddet + lambdad * Lfdet); + 0 = (-lambdaaq) + LMQ * (iq + lambdaq1 * Lq1inv + lambdaq2 * Lq2inv); + 0 = sin(theta) * ur - cos(theta) * ui + id * Sr - iq * Sx - omega * lambdaaq; + 0 = cos(theta) * ur + sin(theta) * ui + iq * Sr + id * Sx + omega * lambdaad; + sortie.ir = -(sin(theta) * id + cos(theta) * iq); + sortie.ii = -((-cos(theta) * id) + sin(theta) * iq); + pin_TETA = theta; + pin_OMEGA = omega; + pin_CM = cm; + pin_EFD = efd; + pin_UR = ur; + pin_UI = ui; + sortie.vr = ur; + sortie.vi = ui; + //Terminal Voltage + pin_TerminalVoltage = sqrt((sortie.vr - RT * sortie.ir + XT * sortie.ii) * (sortie.vr - RT * sortie.ir + XT * sortie.ii) + (sortie.vi - RT * sortie.ii - XT * sortie.ir) * (sortie.vi - RT * sortie.ii - XT * sortie.ir)) * 1 / rtfo; + //TerminalVoltage = sqrt(sortie.vr*sortie.vr+sortie.vi*sortie.vi); + //ActivePower PN-base + pin_ActivePowerPN = (sortie.vr * (-sortie.ir) + sortie.vi * (-sortie.ii)) * SNREF / PN; + //ActivePower PNALT-base + if PNALT == 0 then + pin_ActivePowerPNALT = 0; + else + pin_ActivePowerPNALT = (sortie.vr * (-sortie.ir) + sortie.vi * (-sortie.ii)) * SNREF / PNALT; + end if; + //ActivePower SNREF-base + pin_ActivePowerSNREF = sortie.vr * (-sortie.ir) + sortie.vi * (-sortie.ii); + //ReactivePower PN-base + pin_ReactivePowerPN = (sortie.vi * (-sortie.ir) - sortie.vr * (-sortie.ii)) * SNREF / PN; + //ReactivePower PNALT-base + if PNALT == 0 then + pin_ReactivePowerPNALT = 0; + else + pin_ReactivePowerPNALT = (sortie.vi * (-sortie.ir) - sortie.vr * (-sortie.ii)) * SNREF / PNALT; + end if; + //ReactivePower SNREF-base + pin_ReactivePowerSNREF = sortie.vi * (-sortie.ir) - sortie.vr * (-sortie.ii); + //ActivePower SN + pin_ActivePowerSN = (sortie.vr * (-sortie.ir) + sortie.vi * (-sortie.ii)) * SNREF / SN; + //ReactivePower SN + pin_ReactivePowerSN = (sortie.vi * (-sortie.ir) - sortie.vr * (-sortie.ii)) * SNREF / SN; + //Field Current + if md == 0 and mq == 0 and snd == 0 and snq == 0 then + pin_FieldCurrent = -Mdv / rtfo * ((Md0 + lD + mrc) * lambdaf - (Md0 + mrc) * lambdad - Md0 * lD * id) / ((Md0 + mrc) * (lf + lD) + lf * lD); + else + pin_FieldCurrent = -Mdv / rtfo * ((lD + mrc) * lambdaf - mrc * lambdad - lD * lambdaad) / (mrc * (lf + lD) + lf * lD); + end if; + //Current module + pin_Current = sqrt(sortie.ir * sortie.ir + sortie.ii * sortie.ii); + //Frequency + pin_FRZPU = omegaRef; + pin_FRZHZ = omegaRef * omega0; + annotation(Icon(graphics={ Rectangle(extent = {{-40, 40}, {40, -40}}, lineColor = {0, 0, 255}), Ellipse(extent = {{-24, 22}, {24, -24}}, lineColor = {0, 0, 255}, + lineThickness = 1), Line(points = {{-16, 0}, {-12, 8}, {-6, 8}, {6, -10}, {12, -10}, {16, 0}}, color = {0, 0, 255}, smooth = Smooth.Bezier, thickness = 1), Text(extent = {{-74, 48}, {-54, 42}}, lineColor = {0, 0, 255}, textString = "pin_OMEGA"), Text(extent = {{-70, 16}, {-60, 10}}, lineColor = {0, 0, 255}, textString = "pin_CM"), Text(extent = {{-70, -14}, {-60, -20}}, lineColor = {0, 0, 255}, textString = "pin_EFD"), Text(extent = {{54, 38}, {70, 32}}, lineColor = {0, 0, 255}, textString = "sortie"), Text(extent = {{52, -8}, {70, -16}}, lineColor = {0, 0, 255}, textString = "pin_THETA"), Text(extent = {{-52, -46}, {-42, -52}}, lineColor = {0, 0, 255}, textString = "ur"), Text(extent = {{4, -48}, {14, -54}}, lineColor = {0, 0, 255}, textString = "ui +"), Text( + extent={{-56,56},{-36,52}}, + lineColor={0,0,255}, + textString="FieldCurrent"),Text( + extent={{34,-50},{54,-54}}, + lineColor={0,0,255}, + textString="TerminalVoltage"),Text( + extent={{-24,56},{-4,52}}, + lineColor={0,0,255}, + textString="ActivePowerPNALT"),Text( + extent={{8,56},{28,52}}, + lineColor={0,0,255}, + textString="ActivePowerPN")}), Diagram(graphics)); +end PwGeneratorM2S; diff --git a/iPSL/Electrical/Machines/Eurostag/PwMachineM10.mo b/iPSL/Electrical/Machines/Eurostag/PwMachineM10.mo index 8aa751e04..c8fe0a059 100644 --- a/iPSL/Electrical/Machines/Eurostag/PwMachineM10.mo +++ b/iPSL/Electrical/Machines/Eurostag/PwMachineM10.mo @@ -1,183 +1,163 @@ -within iPSL.Electrical.Machines.Eurostag; -model PwMachineM10 "Induction Machine. The model corresponds to Eurostag's full model for M10 machine. - Developed by RTE and adapted by AIA. 2014/03/10" - // Connectors - Modelica.Blocks.Interfaces.RealInput omegaRef(start = omegaRef0) annotation(Placement(transformation(extent = {{-61, -10}, {-41, 10}}))); - iPSL.Connectors.PwPin sortie( - vr(start=ur0), - vi(start=ui0), - ir(start=ir0), - ii(start=ii0)) - annotation (Placement(transformation(extent={{40,-10},{60,10}}))); - // - // Generic parameters for simulation - // -------------------------------- - parameter Real sNRef(fixed = false); - // (100.) - parameter Real omega0(fixed = false); - // (2*pi*50) different to omega_0=omega(t0)~=1. (in p.u.) - // - // Parametres describing the machine - // -------------------------------------------------- - parameter Real SN(fixed = false); - //Nominal apparent power (MVA) - parameter Real HIn(fixed = false); - // Constant of Inertia (CINERT) - parameter Real rStatIn(fixed = false); - // Stator leakage resistance (RESARM) - parameter Real lStatIn(fixed = false); - // Stator leakage reactance (READST) - parameter Real mQ0Pu(fixed = false); - // Rotor-stator mutual reactance (FMUQST) (le champ REAQST est sauté puis =READST) - parameter Real rQ1Pu(fixed = false); - // Leakage resistance - winding 1 (RESQA1) - parameter Real lQ1Pu(fixed = false); - // Leakage reactance - winding 1 (REAQA1) - parameter Real rQ2Pu(fixed = false); - // Leakage resistance - winding 2 (RESQA2) - parameter Real lQ2Pu(fixed = false); - // Leakage reactance - winding 2 (REAQA2) - parameter Real kSll(fixed = false); - // Stray load losses factor - parameter Real eSll(fixed = false); - // Stray load losses exponent - parameter Real nbPtsCM(fixed = false); - // nb of point in CM curve (currently fixed to 3) - parameter Real cmX1(fixed = false); - // First Abscissa for CM - parameter Real cmX2(fixed = false); - // Second Abscissa for CM - parameter Real cmX3(fixed = false); - // Third Abscissa for CM - parameter Real cmY1(fixed = false); - // First Ordinate for CM - parameter Real cmY2(fixed = false); - // Second Ordinate for CM - parameter Real cmY3(fixed = false); - // Third Ordinate for CM - parameter Real isLoad(fixed = false); - // 1 if type Load ; -1 if type generator - // Inputs for initialization calculation: parametres from lf - // ----------------------------------------------------------- - parameter Real ur0(fixed = false); - parameter Real ui0(fixed = false); - parameter Real omegaRef0(fixed = false); - // Outputs for initialization calculation: initial values for machine - // ---------------------------------------------------------------------------- - parameter Real psi2R0(fixed = false); - parameter Real psi2I0(fixed = false); - parameter Real psi3R0(fixed = false); - parameter Real psi3I0(fixed = false); - parameter Real cm0(fixed = false); - parameter Real omega_0(fixed = false); - // (~1. in p.u.) do not mix with omega0=2*pi*50Hz - parameter Real ir0(fixed = false); - parameter Real ii0(fixed = false); - // calculation and per unit for parameters - // ------------------------------------ - parameter Real yScale = sNRef / SN; - parameter Real yScaleI = SN / sNRef; - parameter Real r1 = rStatIn * yScale; - parameter Real l1 = lStatIn * yScale; - parameter Real lm = mQ0Pu * yScale; - parameter Real r2 = rQ1Pu * yScale; - parameter Real l2 = lQ1Pu * yScale; - parameter Real r3 = rQ2Pu * yScale; - parameter Real l3 = lQ2Pu * yScale; - parameter Real H = HIn * yScaleI; - // attention to per unit - // Machine's ve - // ---------------- - Real ur(start = ur0); - Real ui(start = ui0); - Real ir(start = ir0); - Real ii(start = ii0); - Real psi2R(start = psi2R0); - Real psi2I(start = psi2I0); - Real psi3R(start = psi3R0); - Real psi3I(start = psi3I0); - Real omega(start = omega_0); - Real cm(start = cm0); - // Internal coefficients used in machine's eqs - // ------------------------------------------------- - parameter Real A = l2 * l3 + (l2 + l3) * lm; - parameter Real B = lm * l2 * l3 / A; - parameter Real Coef11 = r1; - parameter Real Coef12 = l1 + B; - parameter Real Coef13 = lm * l3 / A; - parameter Real Coef14 = lm * l2 / A; - parameter Real Coef31 = omega0 * r2 * B / l2; - parameter Real Coef32 = omega0 * r2 * (lm + l3) / A; - parameter Real Coef33 = omega0 * r2 * B / (l2 * l3); - parameter Real Coef51 = omega0 * r3 * B / l3; - parameter Real Coef52 = omega0 * r3 * B / (l2 * l3); - parameter Real Coef53 = omega0 * r3 * (lm + l2) / A; - parameter Real Coef71 = 1.0 / (2 * H); - parameter Real Coef72 = lm * l3 / (2 * H * A); - parameter Real Coef73 = lm * l2 / (2 * H * A); - parameter Real Coef74 = kSll * yScale ^ (eSll - 1.0) / (2 * H); - parameter Real Coef75 = eSll / 2.0; - // coefficients for curve CM - parameter Real Coefcm1 = yScaleI * (cmY2 - cmY1) / (cmX2 - cmX1); - parameter Real Coefcm2 = yScaleI * (cmY3 - cmY2) / (cmX3 - cmX2); - parameter Real CoefcmY1 = yScaleI * cmY1; - parameter Real CoefcmY2 = yScaleI * cmY2; - parameter Real CoefcmY3 = yScaleI * cmY3; - // outputs - // ------- - output Real output_Q; - output Real output_P; - output Real output_u; - output Real output_cm; - output Real output_omega; - output Real output_omegaRef; -equation - // outputs - // ------- - output_u = sqrt(sortie.vr * sortie.vr + sortie.vi * sortie.vi); - output_Q = sortie.vi * sortie.ir - sortie.vr * sortie.ii; - output_P = sortie.vr * sortie.ir + sortie.vi * sortie.ii; - output_cm = cm; - output_omega = omega; - output_omegaRef = omegaRef; - // asynchronous machine - // ------------------ - // Interconnexion equations - ur = Coef11 * ir - omegaRef * (Coef12 * ii + Coef13 * psi2I + Coef14 * psi3I); - ui = Coef11 * ii + omegaRef * (Coef12 * ir + Coef13 * psi2R + Coef14 * psi3R); - // Park's equations - der(psi2R) = Coef31 * ir - Coef32 * psi2R + (omegaRef - omega) * psi2I * omega0 + Coef33 * psi3R; - der(psi2I) = Coef31 * ii - Coef32 * psi2I - (omegaRef - omega) * psi2R * omega0 + Coef33 * psi3I; - der(psi3R) = Coef51 * ir + Coef52 * psi2R + (omegaRef - omega) * psi3I * omega0 - Coef53 * psi3R; - der(psi3I) = Coef51 * ii + Coef52 * psi2I - (omegaRef - omega) * psi3R * omega0 - Coef53 * psi3I; - // equation of the rotating masses - if omega < cmX2 then - cm = isLoad * (Coefcm1 * (omega - cmX1) + CoefcmY1); - else - cm = isLoad * (Coefcm2 * (omega - cmX2) + CoefcmY2); - end if; - der(omega) = (-Coef71 * cm) + Coef72 * (psi2R * ii - psi2I * ir) + Coef73 * (psi3R * ii - psi3I * ir) - Coef74 * (ir * ir + ii * ii) ^ Coef75; - // connecteur PwPin - // ---------------- - ur = sortie.vr; - ui = sortie.vi; - ir = sortie.ir; - ii = sortie.ii; - annotation(Diagram(graphics), Icon(graphics={ Rectangle(extent = {{-40, 40}, {40, -40}}, lineColor = {0, 0, 255}), Ellipse(extent = {{-24, 22}, {24, -24}}, lineColor = {0, 0, 255}, - lineThickness = 1), Text(extent = {{-12, -7}, {12, 7}}, lineColor = {0, 0, 255}, textString = "M10")}), - Documentation(info=" -


<iPSL: iTesla Power System Library>

-

Copyright 2015 RTE (France), AIA (Spain), KTH (Sweden) and DTU (Denmark)

- -

The authors can be contacted by email: info at itesla-ipsl dot org

-

This package is part of the iTesla Power System Library ("iPSL") .

-

The iPSL is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

-

The iPSL is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

-

You should have received a copy of the GNU Lesser General Public License along with the iPSL. If not, see <http://www.gnu.org/licenses/>.

-")); -end PwMachineM10; +within iPSL.Electrical.Machines.Eurostag; +model PwMachineM10 "Induction Machine. The model corresponds to Eurostag's full model for M10 machine. + 2014/03/10" + // Connectors + PowerSystems.Connectors.ImPin omegaRef(start = omegaRef0) annotation(Placement(transformation(extent = {{-61, -10}, {-41, 10}}))); + PowerSystems.Connectors.PwPin sortie(vr(start = ur0), vi(start = ui0), ir(start = ir0), ii(start = ii0)) annotation(Placement(transformation(extent = {{40, -10}, {60, 10}}))); + // + // Generic parameters for simulation + // -------------------------------- + parameter Real sNRef(fixed = false); + // (100.) + parameter Real omega0(fixed = false); + // (2*pi*50) different to omega_0=omega(t0)~=1. (in p.u.) + // + // Parametres describing the machine + // -------------------------------------------------- + parameter Real SN(fixed = false); + //Nominal apparent power (MVA) + parameter Real HIn(fixed = false); + // Constant of Inertia (CINERT) + parameter Real rStatIn(fixed = false); + // Stator leakage resistance (RESARM) + parameter Real lStatIn(fixed = false); + // Stator leakage reactance (READST) + parameter Real mQ0Pu(fixed = false); + // Rotor-stator mutual reactance (FMUQST) (le champ REAQST est sauté puis =READST) + parameter Real rQ1Pu(fixed = false); + // Leakage resistance - winding 1 (RESQA1) + parameter Real lQ1Pu(fixed = false); + // Leakage reactance - winding 1 (REAQA1) + parameter Real rQ2Pu(fixed = false); + // Leakage resistance - winding 2 (RESQA2) + parameter Real lQ2Pu(fixed = false); + // Leakage reactance - winding 2 (REAQA2) + parameter Real kSll(fixed = false); + // Stray load losses factor + parameter Real eSll(fixed = false); + // Stray load losses exponent + parameter Real nbPtsCM(fixed = false); + // nb of point in CM curve (currently fixed to 3) + parameter Real cmX1(fixed = false); + // First Abscissa for CM + parameter Real cmX2(fixed = false); + // Second Abscissa for CM + parameter Real cmX3(fixed = false); + // Third Abscissa for CM + parameter Real cmY1(fixed = false); + // First Ordinate for CM + parameter Real cmY2(fixed = false); + // Second Ordinate for CM + parameter Real cmY3(fixed = false); + // Third Ordinate for CM + parameter Real isLoad(fixed = false); + // 1 if type Load ; -1 if type generator + // Inputs for initialization calculation: parametres from lf + // ----------------------------------------------------------- + parameter Real ur0(fixed = false); + parameter Real ui0(fixed = false); + parameter Real omegaRef0(fixed = false); + // Outputs for initialization calculation: initial values for machine + // ---------------------------------------------------------------------------- + parameter Real psi2R0(fixed = false); + parameter Real psi2I0(fixed = false); + parameter Real psi3R0(fixed = false); + parameter Real psi3I0(fixed = false); + parameter Real cm0(fixed = false); + parameter Real omega_0(fixed = false); + // (~1. in p.u.) do not mix with omega0=2*pi*50Hz + parameter Real ir0(fixed = false); + parameter Real ii0(fixed = false); + // calculation and per unit for parameters + // ------------------------------------ + parameter Real yScale = sNRef / SN; + parameter Real yScaleI = SN / sNRef; + parameter Real r1 = rStatIn * yScale; + parameter Real l1 = lStatIn * yScale; + parameter Real lm = mQ0Pu * yScale; + parameter Real r2 = rQ1Pu * yScale; + parameter Real l2 = lQ1Pu * yScale; + parameter Real r3 = rQ2Pu * yScale; + parameter Real l3 = lQ2Pu * yScale; + parameter Real H = HIn * yScaleI; + // attention to per unit + // Machine's ve + // ---------------- + Real ur(start = ur0); + Real ui(start = ui0); + Real ir(start = ir0); + Real ii(start = ii0); + Real psi2R(start = psi2R0); + Real psi2I(start = psi2I0); + Real psi3R(start = psi3R0); + Real psi3I(start = psi3I0); + Real omega(start = omega_0); + Real cm(start = cm0); + // Internal coefficients used in machine's eqs + // ------------------------------------------------- + parameter Real A = l2 * l3 + (l2 + l3) * lm; + parameter Real B = lm * l2 * l3 / A; + parameter Real Coef11 = r1; + parameter Real Coef12 = l1 + B; + parameter Real Coef13 = lm * l3 / A; + parameter Real Coef14 = lm * l2 / A; + parameter Real Coef31 = omega0 * r2 * B / l2; + parameter Real Coef32 = omega0 * r2 * (lm + l3) / A; + parameter Real Coef33 = omega0 * r2 * B / (l2 * l3); + parameter Real Coef51 = omega0 * r3 * B / l3; + parameter Real Coef52 = omega0 * r3 * B / (l2 * l3); + parameter Real Coef53 = omega0 * r3 * (lm + l2) / A; + parameter Real Coef71 = 1.0 / (2 * H); + parameter Real Coef72 = lm * l3 / (2 * H * A); + parameter Real Coef73 = lm * l2 / (2 * H * A); + parameter Real Coef74 = kSll * yScale ^ (eSll - 1.0) / (2 * H); + parameter Real Coef75 = eSll / 2.0; + // coefficients for curve CM + parameter Real Coefcm1 = yScaleI * (cmY2 - cmY1) / (cmX2 - cmX1); + parameter Real Coefcm2 = yScaleI * (cmY3 - cmY2) / (cmX3 - cmX2); + parameter Real CoefcmY1 = yScaleI * cmY1; + parameter Real CoefcmY2 = yScaleI * cmY2; + parameter Real CoefcmY3 = yScaleI * cmY3; + // outputs + // ------- + output Real output_Q; + output Real output_P; + output Real output_u; + output Real output_cm; + output Real output_omega; + output Real output_omegaRef; +equation + // outputs + // ------- + output_u = sqrt(sortie.vr * sortie.vr + sortie.vi * sortie.vi); + output_Q = sortie.vi * sortie.ir - sortie.vr * sortie.ii; + output_P = sortie.vr * sortie.ir + sortie.vi * sortie.ii; + output_cm = cm; + output_omega = omega; + output_omegaRef = omegaRef; + // asynchronous machine + // ------------------ + // Interconnexion equations + ur = Coef11 * ir - omegaRef * (Coef12 * ii + Coef13 * psi2I + Coef14 * psi3I); + ui = Coef11 * ii + omegaRef * (Coef12 * ir + Coef13 * psi2R + Coef14 * psi3R); + // Park's equations + der(psi2R) = Coef31 * ir - Coef32 * psi2R + (omegaRef - omega) * psi2I * omega0 + Coef33 * psi3R; + der(psi2I) = Coef31 * ii - Coef32 * psi2I - (omegaRef - omega) * psi2R * omega0 + Coef33 * psi3I; + der(psi3R) = Coef51 * ir + Coef52 * psi2R + (omegaRef - omega) * psi3I * omega0 - Coef53 * psi3R; + der(psi3I) = Coef51 * ii + Coef52 * psi2I - (omegaRef - omega) * psi3R * omega0 - Coef53 * psi3I; + // equation of the rotating masses + if omega < cmX2 then + cm = isLoad * (Coefcm1 * (omega - cmX1) + CoefcmY1); + else + cm = isLoad * (Coefcm2 * (omega - cmX2) + CoefcmY2); + end if; + der(omega) = (-Coef71 * cm) + Coef72 * (psi2R * ii - psi2I * ir) + Coef73 * (psi3R * ii - psi3I * ir) - Coef74 * (ir * ir + ii * ii) ^ Coef75; + // connecteur PwPin + // ---------------- + ur = sortie.vr; + ui = sortie.vi; + ir = sortie.ir; + ii = sortie.ii; + annotation(Diagram(graphics), Icon(graphics={ Rectangle(extent = {{-40, 40}, {40, -40}}, lineColor = {0, 0, 255}), Ellipse(extent = {{-24, 22}, {24, -24}}, lineColor = {0, 0, 255}, + lineThickness = 1), Text(extent = {{-12, -7}, {12, 7}}, lineColor = {0, 0, 255}, textString = "M10")})); +end PwMachineM10; diff --git a/iPSL/Electrical/Machines/Eurostag/package.order b/iPSL/Electrical/Machines/Eurostag/package.order index 5c283b24c..bee3d2e2a 100644 --- a/iPSL/Electrical/Machines/Eurostag/package.order +++ b/iPSL/Electrical/Machines/Eurostag/package.order @@ -1,7 +1,7 @@ -PwExtIntParameters -PwGenerator -PwGeneratorM1S -PwGeneratorM2S -PwMachineM10 -DYNModelM1S_INIT -DYNModelM2S_INIT +PwExtIntParameters +PwGenerator +PwGeneratorM1S +PwGeneratorM2S +PwMachineM10 +DYNModelM1S_INIT +DYNModelM2S_INIT