Skip to content
Snippets Groups Projects
Select Git revision
  • master
  • gitkeep
  • dev protected
  • Issue/2309-docs
  • Fix/xxxx-migrateLogin
  • Issue/2215-releaseNewsBeGone
  • Hotfix/2087-efNet6
  • Issue/1910-MigrationtoNET6.0
  • Issue/1756-maintenanceBannerDeployment
  • Sprint/2022-01
  • Sprint/2021-14
  • Hotfix/1488-maintenanceBanner
  • Sprint/2021-13
  • Sprint/2021-08
  • Sprint/2021-06
  • Product/917-maintenanceFunctionality
  • Sprint/2021-05
  • Hotfix/1370-swaggerDescription
  • Topic/1296-maintenanceFunctionality
  • Hotfix/1357-ymlFile
  • v2.4.1
  • v2.4.0
  • v2.3.2
  • v2.3.1
  • v2.3.0
  • v2.2.0
  • v2.1.2
  • v2.1.1
  • v2.1.0
  • v2.0.2
  • v2.0.1
  • v2.0.0
  • v1.1.2
  • v1.1.1
  • v1.1.0
35 results

nunit3-junit.xslt

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    PiLine.cpp 4.41 KiB
    #include "PiLine.h"
    
    using namespace DPsim;
    
    PiLine::PiLine(std::string name, int node1, int node2, int node3, Real resistance, Real inductance, Real capacitance) : BaseComponent(name, node1, node2, node3) {
    	mResistance = resistance;
    	mConductance = 1.0 / resistance;
    	mInductance = inductance;
    	mCapacitance = capacitance / 2;
    }
    
    void PiLine::applySystemMatrixStamp(SystemModel& system) {
    
    	Real a = system.getTimeStep() / (2. * mInductance);
    	Real b = system.getTimeStep() * system.getOmega() / 2.;
    	mGlr = a / (1 + b*b);
    	mGli = -a*b / (1 + b*b);
    	mPrevCurFacRe = (1 - b*b) / (1 + b*b);
    	mPrevCurFacIm = -2. * b / (1 + b*b);
    
    	// Resistive part
    	// Set diagonal entries
    	if (mNode1 >= 0) {
    		system.addCompToSystemMatrix(mNode1, mNode1, mConductance, 0);
    	}
    	if (mNode3 >= 0) {
    		system.addCompToSystemMatrix(mNode3, mNode3, mConductance, 0);
    	}
    	// Set off diagonal entries
    	if (mNode1 >= 0 && mNode3 >= 0) {
    		system.addCompToSystemMatrix(mNode1, mNode3, -mConductance, 0);
    		system.addCompToSystemMatrix(mNode3, mNode1, -mConductance, 0);
    	}
    
    	// Inductance part
    	// Set diagonal entries
    	if (mNode3 >= 0) {
    		system.addCompToSystemMatrix(mNode3, mNode3, mGlr, mGli);
    	}
    	if (mNode2 >= 0) {
    		system.addCompToSystemMatrix(mNode2, mNode2, mGlr, mGli);
    	}
    
    	if (mNode3 >= 0 && mNode2 >= 0) {
    		system.addCompToSystemMatrix(mNode3, mNode2, -mGlr, -mGli);
    		system.addCompToSystemMatrix(mNode2, mNode3, -mGlr, -mGli);
    	}
    
    	//capacitive part
    	mGcr = 2.0 * mCapacitance / system.getTimeStep();
    	mGci = system.getOmega() * mCapacitance;
    
    	if (mNode1 >= 0) {
    		system.addCompToSystemMatrix(mNode1, mNode1, mGcr, mGci);
    	}
    	if (mNode2 >= 0) {
    		system.addCompToSystemMatrix(mNode2, mNode2, mGcr, mGci);
    	}
    
    }
    
    void PiLine::init(Real om, Real dt) {
    	// Initialize internal state
    	mCurrIndRe = 0;
    	mCurrIndIm = 0;
    
    	mCurrCapRe1 = 0;
    	mCurrCapIm1 = 0;
    
    	mCurrCapRe2 = 0;