Advertisement
Guest User

Untitled

a guest
Apr 25th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 18.90 KB | None | 0 0
  1. --- assets/lua/application.lua
  2. +++ assets/lua/application.lua
  3. @@ -35,6 +35,8 @@ function Application.getNameTranslated(application)
  4.          return ltr("Application","Electric and Magnetic Fields")
  5.      elseif application == Application.PLSCADDTools then
  6.          return ltr("Application","PLS-CADD Tools")
  7. +    elseif application == Application.WindPressure then
  8. +        return ltr("Application","Wind Pressure")
  9.      elseif application == Application.Last then
  10.          return ltr("Application","Transmission Line")
  11.      else
  12. --- assets/lua/const.lua
  13. +++ assets/lua/const.lua
  14. @@ -24,6 +24,7 @@ Application.Test = "Test"
  15.  Application.ThermalRating = "ThermalRating"
  16.  Application.DP_ElectricMagneticFields = "ElectricMagneticFields"
  17.  Application.PLSCADDTools = "PLSCADDTools"
  18. +Application.WindPressure = "WindPressure"
  19.  Application.Last = "TransmissionLines"
  20.  
  21.  PipelineType = {}
  22. --- assets/reports/project.lhtml
  23. +++ assets/reports/project.lhtml
  24. @@ -64,3 +64,7 @@
  25.  <? if config.applicationName == Application.SagTensionSubstation then ?>
  26.      <?= include('substations/sagtensionsubstation', { margin = margin }) ?>
  27.  <? end ?>
  28. +
  29. +<? if config.applicationName == Application.WindPressure then ?>
  30. +    <?= include('transmissionlines/windpressure', { margin = margin }) ?>
  31. +<? end ?>
  32. --- src/core/applications/windpressure.cpp
  33. +++ src/core/applications/windpressure.cpp
  34. @@ -1,4 +1,16 @@
  35.  #include "windpressure.h"
  36. +#include "project.h"
  37. +#include "transmissionline.h"
  38. +#include "util/tmath.h"
  39. +#include "cablesag.h"
  40. +#include "sagtension.h"
  41. +#include "core/database.h"
  42. +#include <QDebug>
  43. +
  44. +// References
  45. +// [1] Coletânia de normas de linhas de transmissão
  46. +
  47. +// [2] Norma IEC60826
  48.  
  49.  WindPressure::WindPressure(Project *project) :
  50.      Application(project)
  51. @@ -19,3 +31,230 @@ WindPressure::WindPressure(Project *project) :
  52.      m_modules[Module_TransmissionLineStructureDistances] = true;
  53.      m_modules[Module_TransmissionLineFinalSags] = true;
  54.  }
  55. +
  56. +bool WindPressure::calculate(QString &error)
  57. +{
  58. +    for(TransmissionLinePtr tl : m_project->getTransmissionLines()) {
  59. +        if(tl->isIgnored())
  60. +            continue;
  61. +
  62. +
  63. +        double windTemperature = tl->getWindTemperature();
  64. +        double minimumAltitude = tl->getMinimumAltitude();
  65. +        double airDensity = 1.293/(1+0.00367 * windTemperature)*(16000+64 * windTemperature - minimumAltitude)/(16000+64 * windTemperature + minimumAltitude);
  66. +        tl->setAirDensity(airDensity);
  67. +
  68. +        // Uses reference [1].
  69. +        // Page 11
  70. +        // 8.2.1 Pressão dinâmica de referência
  71. +
  72. +        // Uses reference [2]
  73. +        // Page 28
  74. +        // 6.2.8 Unit action of the wind speed on any line component or element
  75. +        double Kr = tl->getKr();
  76. +        double extremeWindSpeed = tl->getExtremeWindSpeed();
  77. +        double windPressure = 0.5 * airDensity * std::pow((Kr * extremeWindSpeed/3.6), 2)/math::g;
  78. +        tl->setWindPressure(windPressure);
  79. +
  80. +        if(true/*tl->getFinalSagAtAverageTemperatureText().isEmpty()*/) {
  81. +
  82. +            //            SagTension sagTension(m_project);
  83. +            SagTension *sagTension = new SagTension(m_project);
  84. +
  85. +            double finalSagAT = tl->getClearance() * 1.5; // AT = averageTemperature; chute inicial
  86. +            double finalSagOT = tl->getClearance() * 1.5; // OT = operatingTemperature
  87. +
  88. +            QString minimumTemperature = tl->getMinimumTemperatureText();
  89. +            QString windTemperature = tl->getWindTemperatureText();
  90. +            QString averageTemperature = tl->getAverageTemperatureText();
  91. +            QString towerWindSpan = tl->getTowerWindSpanText();
  92. +            //QString operatingTemperature =... checkHere!!            QString tl->getOper operating temperature???/
  93. +
  94. +            for(int i = 0; i < 1; i++) {// fazer condição de parada
  95. +                double Pv = calculatePv(tl, 22.77, 24.42, (0.85 * 22.77), windPressure, Conductor);
  96. +//                qDebug() << Pv;
  97. +                CableSag *cableSag = new CableSag(tl);
  98. +                QVector<CableCondition*>& governigConditions = cableSag->getGovernmentConditions();
  99. +
  100. +                CableCondition* tempMin = new CableCondition();
  101. +                tempMin->setTemperature(minimumTemperature);
  102. +                tempMin->setWindPressure("0");
  103. +                tempMin->setUltimateLoading("33");
  104. +                tempMin->setLoadingCondition(CableCondition::Initial);
  105. +                governigConditions.append(tempMin);
  106. +
  107. +                CableCondition* extremeWind = new CableCondition();
  108. +                extremeWind->setTemperature(windTemperature);
  109. +                extremeWind->setWindPressure(QString::number(Pv));
  110. +                extremeWind->setUltimateLoading("70");
  111. +                extremeWind->setLoadingCondition(CableCondition::Final);
  112. +                governigConditions.append(extremeWind);
  113. +
  114. +                CableCondition* eds = new CableCondition();
  115. +                eds->setTemperature(averageTemperature);
  116. +                eds->setWindPressure("0");
  117. +                eds->setUltimateLoading("20");
  118. +                eds->setLoadingCondition(CableCondition::Final);
  119. +                governigConditions.append(eds);
  120. +
  121. +                CableCondition* creep = new CableCondition();
  122. +                creep->setTemperature(averageTemperature);
  123. +                creep->setWindPressure("0");
  124. +                creep->setUltimateLoading("0");
  125. +                creep->setLoadingCondition(CableCondition::Final);
  126. +                governigConditions.append(creep);
  127. +
  128. +
  129. +                QVector<CableCondition*>& loadingConditions = cableSag->getLoadings();
  130. +
  131. +                CableCondition* loading = new CableCondition();
  132. +                loading->setTemperature("60");//checkHere!!!!!! esse valor é uma variavel de entrada operating temperature
  133. +                loading->setWindPressure("0");
  134. +                loadingConditions.append(loading);
  135. +
  136. +                QVector<QString>& spans = cableSag->getSpans();
  137. +                spans.append(towerWindSpan);
  138. +
  139. +                cableSag->setCableType(g_database->getCableByCode(CableCategory_Conductor, "CAL 1120 - 1055 kCM"));
  140. +                sagTension->fleteiCalculate(cableSag, error);
  141. +                qDebug() << cableSag->getGovernmentConditions().at(cableSag->getGovernmentConditions().size() - 1)->getTemperature();
  142. +                qDebug() << cableSag->getGovernmentConditions().at(cableSag->getGovernmentConditions().size() - 1)->getConditionSag()[towerWindSpan].finalSag;
  143. +
  144. +                qDebug() << cableSag->getLoadings().at(cableSag->getLoadings().size() - 1)->getTemperature();
  145. +                qDebug() << cableSag->getLoadings().at(cableSag->getLoadings().size() - 1)->getConditionSag()[towerWindSpan].finalSag;
  146. +            }
  147. +
  148. +
  149. +        }
  150. +
  151. +        double finalSagSW = tl->getFinalSagAtAverageTemperature() * 0.85;//0.85 variável ou constante?
  152. +        tl->setFinalSagSW(finalSagSW);
  153. +    }
  154. +    return true;
  155. +}
  156. +
  157. +double WindPressure::calculatePv(TransmissionLinePtr tl, double finalSagAT, double finalSagOT, double finalSagSW, double windPressure, StructurePart part)
  158. +{
  159. +    //BASEADO NA PLANILHA DO EXCEL
  160. +    TerrainCategory terrainCategory = tl->getTerrainCategory();
  161. +    double averageSpan = tl->getAverageSpan();
  162. +    double averageHeight = calculateAverageHeight(tl, finalSagAT, finalSagOT, finalSagSW, part);
  163. +    double Pv, Cxc, Cxi, Gc, Gl, Gt;
  164. +    switch(part){
  165. +    case Conductor:
  166. +        Cxc = 1;
  167. +        Gc = calculateGc(averageHeight, terrainCategory);
  168. +        Gl = calculateGl(averageSpan);
  169. +        Pv = Cxc * Gc * Gl * windPressure;
  170. +        break;
  171. +    case ShieldWire:
  172. +        Cxc = 1;
  173. +        Gc = calculateGc(averageHeight, terrainCategory);
  174. +        Gl = calculateGl(averageSpan);
  175. +        Pv = Cxc * Gc * Gl * windPressure;
  176. +        break;
  177. +    case InsulatorString:
  178. +        Cxi = 1.2;
  179. +        Gt = calculateGt(averageHeight, terrainCategory);
  180. +        Pv = Cxi * Gt * windPressure;
  181. +        break;
  182. +    }
  183. +    return Pv;
  184. +}
  185. +
  186. +double WindPressure::calculateAverageHeight(TransmissionLinePtr tl, double finalSagAT, double finalSagOT, double finalSagSW, StructurePart part)
  187. +{
  188. +    double averageHeight;
  189. +    double clearance = tl->getClearance();
  190. +    double distanceConductorInfSup = tl->getDistanceConductorInfSup();
  191. +    double distanceConductorSW = tl->getDistanceConductorSW();
  192. +    double insulatorStringLength = tl->getInsulatorStringLength();
  193. +    switch(part){
  194. +    case Conductor:
  195. +        averageHeight = clearance+finalSagOT-2*finalSagAT/3+distanceConductorInfSup;
  196. +        break;
  197. +    case ShieldWire:
  198. +        averageHeight = finalSagOT+distanceConductorSW+clearance-2./3.*finalSagSW+distanceConductorInfSup;
  199. +        break;
  200. +    case InsulatorString:
  201. +        averageHeight = clearance+finalSagOT+insulatorStringLength/2+distanceConductorInfSup;
  202. +        break;
  203. +    }
  204. +
  205. +    return averageHeight;
  206. +}
  207. +
  208. +double WindPressure::calculateGc(double averageHeight, TerrainCategory terrainCategory)
  209. +{
  210. +    double Gc;
  211. +    switch(terrainCategory) {
  212. +    case TerrainCategory_A:
  213. +        if(averageHeight <= 16)
  214. +            Gc = 1.72+0.0267*(averageHeight-10);
  215. +        else
  216. +            Gc = 1.88+0.60624*std::log10(averageHeight/16);
  217. +        break;
  218. +    case TerrainCategory_B:
  219. +        if(averageHeight <= 16)
  220. +            Gc = 1.85+0.0267*(averageHeight-10);
  221. +        else
  222. +            Gc = 2.01+0.85361*std::log10(averageHeight/16);
  223. +        break;
  224. +    case TerrainCategory_C:
  225. +        if(averageHeight <= 16)
  226. +            Gc = 2.06+0.0367*(averageHeight-10);
  227. +        else
  228. +            Gc = 2.28+1.14105*std::log10(averageHeight/16);
  229. +        break;
  230. +    case TerrainCategory_D:
  231. +        if(averageHeight <= 16)
  232. +            Gc = 2.24+0.05*(averageHeight-10);
  233. +        else
  234. +            Gc = 2.54+1.36752*std::log10(averageHeight/16);
  235. +        break;
  236. +    }
  237. +    return Gc;
  238. +}
  239. +
  240. +double WindPressure::calculateGt(double averageHeight, TerrainCategory terrainCategory)
  241. +{
  242. +    double Gt;
  243. +    switch(terrainCategory) {
  244. +    case TerrainCategory_A:
  245. +        if(averageHeight <= 35)
  246. +            Gt = 1.7+0.68006*std::log10(averageHeight/10);
  247. +        else
  248. +            Gt = 2.07+0.0072*(averageHeight-35);
  249. +        break;
  250. +    case TerrainCategory_B:
  251. +        if(averageHeight <= 35)
  252. +            Gt = 1.9+0.88224*std::log10(averageHeight/10);
  253. +        else
  254. +            Gt = 2.38+0.0088*(averageHeight-35);
  255. +        break;
  256. +    case TerrainCategory_C:
  257. +        if(averageHeight <= 30)
  258. +            Gt = 2.55+0.94316*std::log10(averageHeight/10);
  259. +        else
  260. +            Gt = 3+0.01*(averageHeight-30);
  261. +        break;
  262. +    case TerrainCategory_D:
  263. +        if(averageHeight <= 40)
  264. +            Gt = 3.3+0.02833*(averageHeight-10);
  265. +        else
  266. +            Gt = 4.15+0.0175*(averageHeight-40);
  267. +        break;
  268. +    }
  269. +
  270. +    return Gt;
  271. +}
  272. +
  273. +double WindPressure::calculateGl(double averageSpan)
  274. +{
  275. +    double Gl;
  276. +    if(averageSpan <= 560)
  277. +        Gl = -0.1/(560-200)*averageSpan+1.0556;
  278. +    else
  279. +        Gl = 0.9-((averageSpan-560)*0.000175);
  280. +    return Gl;
  281. +}
  282. --- src/core/applications/windpressure.h
  283. +++ src/core/applications/windpressure.h
  284. @@ -2,6 +2,7 @@
  285.  #define WINDPRESSURE_H
  286.  
  287.  #include "application.h"
  288. +#include "cablesag.h"
  289.  
  290.  class WindPressure : public Application
  291.  {
  292. @@ -9,6 +10,21 @@ public:
  293.      WindPressure(Project *project);
  294.  
  295.      ApplicationName getName() { return App_WindPressure; }
  296. +
  297. +    bool calculate(QString &error);
  298. +
  299. +private:
  300. +    enum StructurePart {
  301. +        Conductor = 0,
  302. +        ShieldWire,
  303. +        InsulatorString,
  304. +    };
  305. +
  306. +    double calculatePv(TransmissionLinePtr tl, double finalSagAT, double finalSagOT, double finalSagSW, double windPressure, StructurePart part);
  307. +    double calculateAverageHeight(TransmissionLinePtr tl, double finalSagAT, double finalSagOT, double finalSagSW, StructurePart part);
  308. +    double calculateGc(double averageHeight, TerrainCategory terrainCategory);
  309. +    double calculateGt(double averageHeight, TerrainCategory terrainCategory);
  310. +    double calculateGl(double averageSpan);
  311.  };
  312.  
  313.  #endif // WINDPRESSURE_H
  314. --- src/core/cablesag.cpp
  315. +++ src/core/cablesag.cpp
  316. @@ -75,7 +75,7 @@ void CableCondition::save(QSettings *settings, bool saveTemporary)
  317.      }
  318.  }
  319.  
  320. -CableSag::CableSag(TransmissionLine *transmissionLine)
  321. +CableSag::CableSag(TransmissionLineWeakPtr transmissionLine)
  322.  {
  323.      m_transmissionLine = transmissionLine;
  324.  }
  325. @@ -215,6 +215,6 @@ bool CableSag::moveSpans(int fromIndex, int toIndex)
  326.  QString CableSag::getErrorLocation()
  327.  {
  328.      if(CableTypePtr cable = getCableType())
  329. -        return "\n" + QObject::tr("Cable: ") + cable->getCode() + "\n" + QObject::tr("Transmission Line: ") + m_transmissionLine->getName();
  330. -    return "\n" + QObject::tr("Transmission Line: ") + m_transmissionLine->getName();
  331. +        return "\n" + QObject::tr("Cable: ") + cable->getCode() + "\n" + QObject::tr("Transmission Line: ") + m_transmissionLine.lock()->getName();
  332. +    return "\n" + QObject::tr("Transmission Line: ") + m_transmissionLine.lock()->getName();
  333.  }
  334. --- src/core/cablesag.h
  335. +++ src/core/cablesag.h
  336. @@ -62,6 +62,7 @@ public:
  337.      QString getWindPressure() { return m_windPressure; }
  338.      QString getUltimateLoading() { return m_ultimateLoading; }
  339.      QMap<QString, CableConditionResult> getSagResults() { return m_sagResults; }
  340. +    QMap<QString, CableConditionSag> getConditionSag() { return m_sags; }
  341.      LoadingCondition getLoadingCondition() { return m_loadingCondition; }
  342.  
  343.  private:
  344. @@ -84,7 +85,7 @@ private:
  345.  class CableSag
  346.  {
  347.  public:
  348. -    explicit CableSag(TransmissionLine *transmissionLine);
  349. +    explicit CableSag(TransmissionLineWeakPtr transmissionLine);
  350.  
  351.      void load(QSettings *settings);
  352.      void save(QSettings *settings, bool saveTemporary);
  353. @@ -104,7 +105,7 @@ public:
  354.      QString getSpan(int index);
  355.      QVector<QString>& getSpans() { return m_spans; }
  356.      bool moveSpans(int fromIndex, int toIndex);
  357. -    TransmissionLine *getTransmissionLine() { return m_transmissionLine; }
  358. +    TransmissionLineWeakPtr getTransmissionLine() { return m_transmissionLine; }
  359.  
  360.  private:
  361.      QString getErrorLocation();
  362. @@ -113,7 +114,7 @@ private:
  363.      QVector<CableCondition*> m_governingConditions;
  364.      QVector<CableCondition*> m_loadings;
  365.      QVector<QString> m_spans;
  366. -    TransmissionLine *m_transmissionLine;
  367. +    TransmissionLineWeakPtr m_transmissionLine;
  368.  
  369.      // Cache
  370.      QMap<QString, bool> m_hasFinalWithCreep;
  371. --- src/core/transmissionline.cpp
  372. +++ src/core/transmissionline.cpp
  373. @@ -161,7 +161,7 @@ void TransmissionLine::load(QSettings *settings)
  374.      removeCableSags();
  375.      for(const QString& group : settings->childGroups()) {
  376.          settings->beginGroup(group);
  377. -        CableSag *c = new CableSag(this);
  378. +        CableSag *c = new CableSag(shared_from_this());
  379.          c->load(settings);
  380.          m_cableSags.push_back(c);
  381.          settings->endGroup();
  382. @@ -320,6 +320,9 @@ void TransmissionLine::save(QSettings *settings, bool saveTemporary)
  383.          settings->setValue("dischargeRiskFailure", m_dischargeRiskFailure);
  384.          settings->setValue("spanFlashShutdownsPerYear", m_spanFlashShutdownsPerYear);
  385.          settings->setValue("structureFlashShutdownsPerYear", m_structureFlashShutdownsPerYear);
  386. +        settings->setValue("finalSagSW", m_finalSagSW);
  387. +        settings->setValue("airDensity", m_airDensity);
  388. +        settings->setValue("windPressure", m_windPressure);
  389.          settings->setValue("circuitsValid", m_circuitsValid);
  390.          settings->setValue("shieldWiresValid", m_shieldWiresValid);
  391.          Settings::saveMatrix(settings, "longitudinalPhaseMatrixWithShieldWires", m_longitudinalPhaseMatrixWithShieldWires);
  392. @@ -549,6 +552,8 @@ bool TransmissionLine::validate(QString& error)
  393.          }
  394.      }
  395.  
  396. +//     checkHere fazer as validações
  397. +
  398.      return true;
  399.  }
  400.  
  401. @@ -1046,7 +1051,7 @@ CableSag *TransmissionLine::addCableSag(int index, bool clone)
  402.      if(index >= 0 && index < m_cableSags.size() && clone)
  403.          cableSag = m_cableSags[index]->clone();
  404.      else
  405. -        cableSag = new CableSag(this);
  406. +        cableSag = new CableSag(shared_from_this());
  407.  
  408.      if(index >= 0 && index < m_cableSags.size())
  409.          m_cableSags.insert(index, cableSag);
  410. @@ -1205,6 +1210,20 @@ double TransmissionLine::getAverageSoilResistivity()
  411.      return soilResistivity / count;
  412.  }
  413.  
  414. +double TransmissionLine::getKr() //based on page 26
  415. +{
  416. +    switch(m_terrainCategory){
  417. +    case TerrainCategory_A:
  418. +        return 1.08;
  419. +    case TerrainCategory_B:
  420. +        return 1;
  421. +    case TerrainCategory_C:
  422. +        return 0.85;
  423. +    case TerrainCategory_D:
  424. +        return 0.67;
  425. +    }
  426. +}
  427. +
  428.  void TransmissionLine::removeFaultLocations()
  429.  {
  430.      for(TransmissionLineFaultLocation *faultLocation : m_faultLocations)
  431. --- src/core/transmissionline.h
  432. +++ src/core/transmissionline.h
  433. @@ -131,6 +131,9 @@ public:
  434.      void setDistanceConductorSW(const QString& distanceConductorSW) { m_distanceConductorSW = distanceConductorSW; }
  435.      void setFinalSagAtOperationTemperature(const QString& finalSagAtOperatingTemperature) { m_finalSagAtOperatingTemperature = finalSagAtOperatingTemperature; }
  436.      void setFinalSagAtAverageTemperature(const QString& finalSagAtAverageTemperature) { m_finalSagAtAverageTemperature = finalSagAtAverageTemperature; }
  437. +    void setFinalSagSW(double finalSagSW) { m_finalSagSW = finalSagSW; }
  438. +    void setAirDensity(double airDensity) { m_airDensity = airDensity; }
  439. +    void setWindPressure(double windPressure) { m_windPressure = windPressure; }
  440.  
  441.      void setAverageElevation(const QString& elevation);
  442.      void setAverageGroundResistance(const QString& groundResistance);
  443. @@ -203,6 +206,7 @@ public:
  444.      QString getFinalSagAtOperatingTemperatureText() const { return m_finalSagAtOperatingTemperature; }
  445.      double getFinalSagAtAverageTemperature() const { return m_finalSagAtAverageTemperature.toDouble(); }
  446.      QString getFinalSagAtAverageTemperatureText() const { return m_finalSagAtAverageTemperature; }
  447. +    double getKr(); //coeficiente de rugosidade Kr. Descreve a ação do vento de acordo com o terreno.
  448.  
  449.      double getAverageElevation();
  450.      double getAverageGroundResistance();
  451. @@ -307,6 +311,10 @@ private:
  452.      double m_dischargesPerYear;
  453.      double m_dischargeRiskFailure;
  454.  
  455. +    double m_finalSagSW;
  456. +    double m_airDensity;
  457. +    double m_windPressure;
  458. +
  459.      friend class AtmosphericDischarges;
  460.      friend class CurrentDistribuition;
  461.      friend class ElectricParameters;
  462. --- src/util/tmath.h
  463. +++ src/util/tmath.h
  464. @@ -25,6 +25,7 @@ const double feet_to_meter = 0.3048;
  465.  const double c = 299792458; // speed of light
  466.  const double u0 = 4 * math::pi * 1E-07; // vaccum permeability
  467.  const double e0 = 8.854187817E-12; // vaccum permittivity
  468. +const double g = 9.80665; // gravitational acceleration
  469.  
  470.  const double speedOfSound = 343.2; // m/s at 20C dry air
  471.  const double airDensity = 1.225; // kg/m^3 at 15C, 1atm
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement