Skip to content
Snippets Groups Projects
Select Git revision
  • master
  • debugged_version
2 results

Reader.cpp

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    Reader.cpp 11.42 KiB
    /** Read CIM files
     *
     * @author Georg Reinke <georg.reinke@rwth-aachen.de>
     * @copyright 2017, Institute for Automation of Complex Power Systems, EONERC
     *
     * DPsim
     *
     * This program is free software: you can redistribute it and/or modify
     * it under the terms of the GNU General Public License as published by
     * the Free Software Foundation, either version 3 of the License, or
     * any later version.
     *
     * This program 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 General Public License for more details.
     *
     * You should have received a copy of the GNU General Public License
     * along with this program.  If not, see <http://www.gnu.org/licenses/>.
     *********************************************************************************/
    
    #include <CIMModel.hpp>
    #include <IEC61970.hpp>
    
    #include "Reader.h"
    
    using namespace DPsim;
    using namespace DPsim::CIM;
    using namespace IEC61970::Base::Core;
    using namespace IEC61970::Base::Domain;
    using namespace IEC61970::Base::Equivalents;
    using namespace IEC61970::Base::Topology;
    using namespace IEC61970::Base::Wires;
    
    Reader::Reader(Real systemFrequency, Logger::Level logLevel, Logger::Level componentLogLevel)
    	: mLog("Logs/CIMpp.log", logLevel) {
    	mModel.setDependencyCheckOff();
    	mFrequency = systemFrequency;
    	mOmega = 2 * PI*mFrequency;
    	mComponentLogLevel = componentLogLevel;
    }
    
    Reader::~Reader() { }
    
    Real Reader::unitValue(Real value, UnitMultiplier mult) {
    	switch (mult) {
    	case UnitMultiplier::p:
    		value *= 1e-12;
    		break;
    	case UnitMultiplier::n:
    		value *= 1e-9;
    		break;
    	case UnitMultiplier::micro:
    		value *= 1e-6;
    		break;
    	case UnitMultiplier::m:
    		value *= 1e-3;
    		break;
    	case UnitMultiplier::c:
    		value *= 1e-2;
    		break;
    	case UnitMultiplier::d:
    		value *= 1e-1;
    		break;
    	case UnitMultiplier::k:
    		value *= 1e3;
    		break;
    	case UnitMultiplier::M:
    		value *= 1e6;
    		break;