From eeeeddb12df8db67714b65b6d23d68eb632793ca Mon Sep 17 00:00:00 2001 From: Jonas Schroeder Date: Mon, 10 Jul 2023 11:54:07 +0000 Subject: [PATCH 01/31] log all components to the same file Signed-off-by: Jonas Schroeder --- dpsim-models/include/dpsim-models/Logger.h | 29 ++++--- .../dpsim-models/TopologicalPowerComp.h | 8 +- .../dpsim-models/TopologicalSignalComp.h | 2 +- dpsim-models/src/CIM/Reader.cpp | 2 +- dpsim-models/src/CSVReader.cpp | 4 +- dpsim-models/src/Logger.cpp | 78 +++++++++++++------ dpsim/include/dpsim/MNASolverFactory.h | 2 +- dpsim/include/dpsim/Scheduler.h | 2 +- dpsim/include/dpsim/Simulation.h | 2 +- dpsim/include/dpsim/Solver.h | 2 +- dpsim/src/MNASolverPlugin.cpp | 2 +- dpsim/src/Simulation.cpp | 4 +- 12 files changed, 86 insertions(+), 51 deletions(-) diff --git a/dpsim-models/include/dpsim-models/Logger.h b/dpsim-models/include/dpsim-models/Logger.h index 8df7e8db3a..396cf14185 100644 --- a/dpsim-models/include/dpsim-models/Logger.h +++ b/dpsim-models/include/dpsim-models/Logger.h @@ -1,10 +1,4 @@ -/* Copyright 2017-2021 Institute for Automation of Complex Power Systems, - * EONERC, RWTH Aachen University - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. - *********************************************************************************/ +// SPDX-License-Identifier: Apache-2.0 #pragma once @@ -30,12 +24,23 @@ namespace CPS { using Level = spdlog::level::level_enum; using Log = std::shared_ptr; + enum class LoggerType { + SIMULATION, + COMPONENT, + DEBUG + }; + + /// Holds the CLI sink shared by all loggers + static spdlog::sink_ptr mCliSink; + /// Holds the file sink shared by all component loggers + static spdlog::sink_ptr mComponentFileSink; + private: - static Log create(const std::string &name, Level filelevel = Level::info, Level clilevel = Level::off); + static Log create(Logger::LoggerType type, const std::string &name, const std::string &fileName, Level filelevel, Level clilevel); public: - Logger(); - ~Logger(); + Logger() = default; + ~Logger() = default; static String prefix(); static String logDir(); @@ -43,7 +48,7 @@ namespace CPS { // #### SPD log wrapper #### /// - static Log get(const std::string &name, Level filelevel = Level::info, Level clilevel = Level::off); + static Log get(LoggerType type, const std::string &name, Level filelevel = Level::info, Level clilevel = Level::off); /// static void setLogLevel(std::shared_ptr logger, Logger::Level level); /// @@ -58,7 +63,7 @@ namespace CPS { static String phasorToString(const Complex& num); static String complexToString(const Complex& num); static String realToString(const Real& num); - + static String getCSVColumnNames(std::vector names); static String getCSVLineFromData(Real time, Real data); static String getCSVLineFromData(Real time, const Matrix& data); diff --git a/dpsim-models/include/dpsim-models/TopologicalPowerComp.h b/dpsim-models/include/dpsim-models/TopologicalPowerComp.h index 71bf1c0d43..cc2eecb563 100644 --- a/dpsim-models/include/dpsim-models/TopologicalPowerComp.h +++ b/dpsim-models/include/dpsim-models/TopologicalPowerComp.h @@ -49,7 +49,7 @@ namespace CPS { /* We also want to set the CLI loglevel according to the logLevel * std::max(Logger::Level::info, logLevel). But because of excessive * logging to Level::info that is currently infeasible. */ - mSLog(Logger::get(name, logLevel, Logger::Level::warn)), + mSLog(Logger::get(Logger::LoggerType::COMPONENT, name, logLevel, Logger::Level::warn)), mLogLevel(logLevel) { } /// Basic constructor that takes name and log level and sets the UID to name as well @@ -63,15 +63,15 @@ namespace CPS { /// Returns terminal that are part of the component virtual TopologicalTerminal::List topologicalTerminals() = 0; /// Set behavior of component, e.g. initialization - void setBehaviour(Behaviour behaviour) { - mBehaviour = behaviour; + void setBehaviour(Behaviour behaviour) { + mBehaviour = behaviour; if (mBehaviour == Behaviour::Initialization) SPDLOG_LOGGER_INFO(mSLog, "Set component behaviour to Initialization"); else if (mBehaviour == Behaviour::PFSimulation) SPDLOG_LOGGER_INFO(mSLog, "Set component behaviour to PFSimulation"); else if (mBehaviour == Behaviour::MNASimulation) SPDLOG_LOGGER_INFO(mSLog, "Set component behaviour to MNASimulation"); - else + else SPDLOG_LOGGER_WARN(mSLog, "Set component behaviour not fully supported yet"); } }; diff --git a/dpsim-models/include/dpsim-models/TopologicalSignalComp.h b/dpsim-models/include/dpsim-models/TopologicalSignalComp.h index 70b357f38d..ef4c4ed0c7 100644 --- a/dpsim-models/include/dpsim-models/TopologicalSignalComp.h +++ b/dpsim-models/include/dpsim-models/TopologicalSignalComp.h @@ -31,7 +31,7 @@ namespace CPS { /* We also want to set the CLI loglevel according to the logLevel * std::max(Logger::Level::info, logLevel). But because of excessive * logging to Level::info that is currently infeasible. */ - mSLog(Logger::get(name, logLevel, Logger::Level::warn)), + mSLog(Logger::get(Logger::LoggerType::COMPONENT, name, logLevel, Logger::Level::warn)), mLogLevel(logLevel) { } /// Basic constructor that takes name and log level and sets the UID to name as well diff --git a/dpsim-models/src/CIM/Reader.cpp b/dpsim-models/src/CIM/Reader.cpp index 9686736b34..33ad0f2b78 100644 --- a/dpsim-models/src/CIM/Reader.cpp +++ b/dpsim-models/src/CIM/Reader.cpp @@ -19,7 +19,7 @@ using namespace CPS::CIM; using CIMPP::UnitMultiplier; Reader::Reader(String name, Logger::Level logLevel, Logger::Level componentLogLevel) { - mSLog = Logger::get(name + "_CIM", logLevel); + mSLog = Logger::get(Logger::LoggerType::DEBUG, name + "_CIM", logLevel); mModel = new CIMModel(); mModel->setDependencyCheckOff(); diff --git a/dpsim-models/src/CSVReader.cpp b/dpsim-models/src/CSVReader.cpp index 03d9b2340d..133e437811 100644 --- a/dpsim-models/src/CSVReader.cpp +++ b/dpsim-models/src/CSVReader.cpp @@ -89,7 +89,7 @@ CSVReaderIterator::CSVReaderIterator(std::istream& str) CSVReaderIterator::CSVReaderIterator():m_str(NULL) { } CSVReader::CSVReader(CPS::String name, std::list paths, CPS::Logger::Level logLevel) { - mSLog = Logger::get(name + "_csvReader", logLevel); + mSLog = Logger::get(Logger::LoggerType::DEBUG, name + "_csvReader", logLevel); //mFileList = paths; for(auto file : paths){ if(file.string().find(".csv")!=std::string::npos){ @@ -101,7 +101,7 @@ CSVReader::CSVReader(CPS::String name, std::list paths, CPS::Logger::L } CSVReader::CSVReader(CPS::String name, CPS::String path, CPS::Logger::Level logLevel) { - mSLog = Logger::get(name + "_csvReader", logLevel); + mSLog = Logger::get(Logger::LoggerType::DEBUG, name + "_csvReader", logLevel); mPath = path; for (const auto & entry : fs::directory_iterator(path)) { diff --git a/dpsim-models/src/Logger.cpp b/dpsim-models/src/Logger.cpp index 876877efaa..12e35e0d4e 100644 --- a/dpsim-models/src/Logger.cpp +++ b/dpsim-models/src/Logger.cpp @@ -17,6 +17,8 @@ using namespace CPS; +spdlog::sink_ptr Logger::mCliSink; +spdlog::sink_ptr Logger::mComponentFileSink; void Logger::setLogLevel(std::shared_ptr logger, Logger::Level level) { logger->set_level(level); @@ -72,13 +74,13 @@ String Logger::realToString(const Real& num) { } String Logger::prefix() { - char *p = getenv("CPS_LOG_PREFIX"); + char const *p = getenv("CPS_LOG_PREFIX"); return p ? p : ""; } String Logger::logDir() { - char *p = getenv("CPS_LOG_DIR"); + char const *p = getenv("CPS_LOG_DIR"); return p ? p : "logs"; } @@ -96,7 +98,7 @@ void Logger::setLogDir(String path) { String Logger::getCSVColumnNames(std::vector names) { std::stringstream ss; ss << std::right << std::setw(14) << "time"; - for (auto name : names) { + for (auto const& name : names) { ss << ", " << std::right << std::setw(13) << name; } ss << '\n'; @@ -135,38 +137,65 @@ String Logger::getCSVLineFromData(Real time, const MatrixComp& data) { return ss.str(); } -Logger::Log Logger::get(const std::string &name, Level filelevel, Level clilevel) { - Logger::Log logger = spdlog::get(name); - - if (!logger) { - logger = create(name, filelevel, clilevel); +Logger::Log Logger::get(LoggerType type, const std::string &name, Level filelevel, Level clilevel) { + switch (type) { + case LoggerType::SIMULATION: { + if (Logger::Log logger = spdlog::get("simulation")) { + return logger; + } else return create(LoggerType::SIMULATION, "simulation", name, filelevel, clilevel); + } + case LoggerType::COMPONENT: { + if (Logger::Log logger = spdlog::get(name)) { + return logger; + } else return create(LoggerType::COMPONENT, name, "components", filelevel, clilevel); + } + case LoggerType::DEBUG: { + if (Logger::Log logger = spdlog::get(name)) { + return logger; + } else return create(LoggerType::DEBUG, name, name, filelevel, clilevel); + } + default: { + // UNREACHABLE! + return nullptr; + } } - - return logger; } -Logger::Log Logger::create(const std::string &name, Level filelevel, Level clilevel) { +Logger::Log Logger::create(Logger::LoggerType type, const std::string &name, const std::string &fileName, Level filelevel, Level clilevel) { String logDir = Logger::logDir(); - String filename = logDir + "/" + name + ".log"; + String filepath = logDir + "/" + fileName + ".log"; std::vector sinks; Logger::Log ret; - // Create log folder if it does not exist - fs::path p = filename; - if (p.has_parent_path() && !fs::exists(p.parent_path())) - fs::create_directories(p.parent_path()); - if (clilevel != Logger::Level::off) { - auto console_sink = std::make_shared(); - console_sink->set_level(clilevel); - console_sink->set_pattern(fmt::format("{}[%T.%f %n %^%l%$] %v", CPS::Logger::prefix())); - sinks.push_back(console_sink); + // Why do we log into stderr instead of stdout? + if (!Logger::mCliSink) { + Logger::mCliSink = std::make_shared(); + Logger::mCliSink->set_level(clilevel); + Logger::mCliSink->set_pattern(fmt::format("{}[%T.%f %n %^%l%$] %v", CPS::Logger::prefix())); + } + sinks.push_back(Logger::mCliSink); } if (filelevel != Logger::Level::off) { - auto file_sink = std::make_shared(filename, true); - file_sink->set_level(filelevel); - file_sink->set_pattern(prefix() + "[%L] %v"); + spdlog::sink_ptr file_sink; + + if (type == LoggerType::COMPONENT) { + // Use common file sink + if (!Logger::mComponentFileSink) { + Logger::mComponentFileSink = std::make_shared(filepath, true); + Logger::mComponentFileSink->set_level(filelevel); + // TODO: Use better prefix + Logger::mComponentFileSink->set_pattern(prefix() + "[%l][%n] %v"); + } + file_sink = Logger::mComponentFileSink; + } else { + // Create new file sink + file_sink = std::make_shared(filepath, true); + file_sink->set_level(filelevel); + // TODO: Use better prefix + file_sink->set_pattern(prefix() + "[%L] %v"); + } sinks.push_back(file_sink); } @@ -174,6 +203,7 @@ Logger::Log Logger::create(const std::string &name, Level filelevel, Level clile ret = spdlog::create(name); } else { ret = std::make_shared(name, begin(sinks), end(sinks)); + spdlog::register_logger(ret); } return ret; diff --git a/dpsim/include/dpsim/MNASolverFactory.h b/dpsim/include/dpsim/MNASolverFactory.h index 3c381eebd5..7785738996 100644 --- a/dpsim/include/dpsim/MNASolverFactory.h +++ b/dpsim/include/dpsim/MNASolverFactory.h @@ -71,7 +71,7 @@ class MnaSolverFactory { if (implementation == DirectLinearSolverImpl::Undef) { implementation = DirectLinearSolverImpl::SparseLU; } - CPS::Logger::Log log = CPS::Logger::get("MnaSolverFactory", CPS::Logger::Level::info, CPS::Logger::Level::info); + CPS::Logger::Log log = CPS::Logger::get(CPS::Logger::LoggerType::DEBUG, "MnaSolverFactory", CPS::Logger::Level::info, CPS::Logger::Level::info); switch(implementation) { /* TODO: have only one "solver" object of type MnaSolverDirect and only use setDirectLinearSolverImplementation in the switch-case. diff --git a/dpsim/include/dpsim/Scheduler.h b/dpsim/include/dpsim/Scheduler.h index ff4981847d..964aa01113 100644 --- a/dpsim/include/dpsim/Scheduler.h +++ b/dpsim/include/dpsim/Scheduler.h @@ -37,7 +37,7 @@ namespace DPsim { mRoot(std::make_shared()), // Logging mLogLevel(logLevel), - mSLog(CPS::Logger::get("scheduler", logLevel)) { + mSLog(CPS::Logger::get(CPS::Logger::LoggerType::DEBUG, "scheduler", logLevel)) { mSLog->set_pattern("[%L] %v"); } /// diff --git a/dpsim/include/dpsim/Simulation.h b/dpsim/include/dpsim/Simulation.h index 9e50411f64..8ce2df6803 100644 --- a/dpsim/include/dpsim/Simulation.h +++ b/dpsim/include/dpsim/Simulation.h @@ -160,7 +160,7 @@ namespace DPsim { Simulation(String name, CPS::Logger::Level logLevel = CPS::Logger::Level::info); /// Desctructor - virtual ~Simulation() { } + virtual ~Simulation() = default; // #### Simulation Settings #### /// diff --git a/dpsim/include/dpsim/Solver.h b/dpsim/include/dpsim/Solver.h index 61af394571..4184cb80fd 100644 --- a/dpsim/include/dpsim/Solver.h +++ b/dpsim/include/dpsim/Solver.h @@ -69,7 +69,7 @@ namespace DPsim { Solver(String name, CPS::Logger::Level logLevel) : mName(name), mLogLevel(logLevel), - mSLog(CPS::Logger::get(name + "_Solver", logLevel, CPS::Logger::Level::warn)) { + mSLog(CPS::Logger::get(CPS::Logger::LoggerType::DEBUG, name + "_Solver", logLevel, CPS::Logger::Level::warn)) { } virtual ~Solver() { } diff --git a/dpsim/src/MNASolverPlugin.cpp b/dpsim/src/MNASolverPlugin.cpp index f132b195e4..7f4031a2ca 100644 --- a/dpsim/src/MNASolverPlugin.cpp +++ b/dpsim/src/MNASolverPlugin.cpp @@ -39,7 +39,7 @@ MnaSolverPlugin::~MnaSolverPlugin() { extern "C" void pluginLogger(const char * str) { - CPS::Logger::Log log = CPS::Logger::get("Plugin", CPS::Logger::Level::debug, CPS::Logger::Level::debug); + CPS::Logger::Log log = CPS::Logger::get(Logger::LoggerType::DEBUG, "Plugin", CPS::Logger::Level::debug, CPS::Logger::Level::debug); log->info(str); } diff --git a/dpsim/src/Simulation.cpp b/dpsim/src/Simulation.cpp index a1c94d00c0..941236ad19 100644 --- a/dpsim/src/Simulation.cpp +++ b/dpsim/src/Simulation.cpp @@ -54,7 +54,7 @@ Simulation::Simulation(String name, CommandLineArgs& args) : void Simulation::create() { // Logging - mLog = Logger::get(**mName, mLogLevel, std::max(Logger::Level::info, mLogLevel)); + mLog = Logger::get(Logger::LoggerType::SIMULATION, **mName, mLogLevel, std::max(Logger::Level::info, mLogLevel)); Eigen::setNbThreads(1); @@ -404,7 +404,7 @@ Real Simulation::step() { } void Simulation::logStepTimes(String logName) { - auto stepTimeLog = Logger::get(logName, Logger::Level::info); + auto stepTimeLog = Logger::get(Logger::LoggerType::SIMULATION, logName, Logger::Level::info); Logger::setLogPattern(stepTimeLog, "%v"); stepTimeLog->info("step_time"); From 9b9c9e2a18109c4319fa56529321e2544ebf1b66 Mon Sep 17 00:00:00 2001 From: Jonas Schroeder Date: Tue, 11 Jul 2023 10:41:16 +0000 Subject: [PATCH 02/31] enable debug logging Signed-off-by: Jonas Schroeder --- dpsim-models/include/dpsim-models/Logger.h | 5 ++++- dpsim-models/src/Logger.cpp | 18 ++++++++---------- dpsim-villas/src/InterfaceWorkerVillas.cpp | 2 -- dpsim/src/Simulation.cpp | 4 +--- dpsim/src/pybind/main.cpp | 2 +- 5 files changed, 14 insertions(+), 17 deletions(-) diff --git a/dpsim-models/include/dpsim-models/Logger.h b/dpsim-models/include/dpsim-models/Logger.h index 396cf14185..440bf9d4bf 100644 --- a/dpsim-models/include/dpsim-models/Logger.h +++ b/dpsim-models/include/dpsim-models/Logger.h @@ -2,7 +2,8 @@ #pragma once -#define SPDLOG_ACTIVE_LEVEL SPDLOG_LEVEL_INFO +#define SPDLOG_ACTIVE_LEVEL SPDLOG_LEVEL_DEBUG + #include #if defined(SPDLOG_VER_MAJOR) && SPDLOG_VER_MAJOR >= 1 @@ -12,6 +13,8 @@ #endif #include +#include +#include #include #include diff --git a/dpsim-models/src/Logger.cpp b/dpsim-models/src/Logger.cpp index 12e35e0d4e..b24f76da74 100644 --- a/dpsim-models/src/Logger.cpp +++ b/dpsim-models/src/Logger.cpp @@ -9,11 +9,8 @@ #include #include -#include -#include - -#include #include +#include using namespace CPS; @@ -165,7 +162,7 @@ Logger::Log Logger::create(Logger::LoggerType type, const std::string &name, con String logDir = Logger::logDir(); String filepath = logDir + "/" + fileName + ".log"; std::vector sinks; - Logger::Log ret; + Logger::Log logger; if (clilevel != Logger::Level::off) { // Why do we log into stderr instead of stdout? @@ -194,17 +191,18 @@ Logger::Log Logger::create(Logger::LoggerType type, const std::string &name, con file_sink = std::make_shared(filepath, true); file_sink->set_level(filelevel); // TODO: Use better prefix - file_sink->set_pattern(prefix() + "[%L] %v"); + file_sink->set_pattern(prefix() + "[%l] %v"); } sinks.push_back(file_sink); } if (filelevel == Logger::Level::off && clilevel == Logger::Level::off) { - ret = spdlog::create(name); + logger = spdlog::create(name); } else { - ret = std::make_shared(name, begin(sinks), end(sinks)); - spdlog::register_logger(ret); + logger = std::make_shared(name, begin(sinks), end(sinks)); + spdlog::register_logger(logger); } + logger->set_level(spdlog::level::trace); - return ret; + return logger; } diff --git a/dpsim-villas/src/InterfaceWorkerVillas.cpp b/dpsim-villas/src/InterfaceWorkerVillas.cpp index a1eef5c6f8..eb9a721e71 100644 --- a/dpsim-villas/src/InterfaceWorkerVillas.cpp +++ b/dpsim-villas/src/InterfaceWorkerVillas.cpp @@ -9,8 +9,6 @@ #include #include -#include - #include #include #include diff --git a/dpsim/src/Simulation.cpp b/dpsim/src/Simulation.cpp index 941236ad19..b9fdd58ff0 100644 --- a/dpsim/src/Simulation.cpp +++ b/dpsim/src/Simulation.cpp @@ -13,8 +13,6 @@ #include #include -#include - #ifdef WITH_CIM #include #endif @@ -404,7 +402,7 @@ Real Simulation::step() { } void Simulation::logStepTimes(String logName) { - auto stepTimeLog = Logger::get(Logger::LoggerType::SIMULATION, logName, Logger::Level::info); + auto stepTimeLog = Logger::get(Logger::LoggerType::DEBUG, logName, Logger::Level::info); Logger::setLogPattern(stepTimeLog, "%v"); stepTimeLog->info("step_time"); diff --git a/dpsim/src/pybind/main.cpp b/dpsim/src/pybind/main.cpp index 03de1e88d9..ed20fcfbe8 100644 --- a/dpsim/src/pybind/main.cpp +++ b/dpsim/src/pybind/main.cpp @@ -77,7 +77,7 @@ PYBIND11_MODULE(dpsimpy, m) { .def("get_btf", &DPsim::DirectLinearSolverConfiguration::getBTF); py::class_(m, "Simulation") - .def(py::init(), "name"_a, "loglevel"_a = CPS::Logger::Level::off) + .def(py::init(), "name"_a, "loglevel"_a = CPS::Logger::Level::info) .def("name", &DPsim::Simulation::name) .def("set_time_step", &DPsim::Simulation::setTimeStep) .def("set_final_time", &DPsim::Simulation::setFinalTime) From 653f90c4ceb63ecc567c48a7f2c11a1e935840c0 Mon Sep 17 00:00:00 2001 From: Jonas Schroeder Date: Wed, 12 Jul 2023 10:00:23 +0000 Subject: [PATCH 03/31] set max log level according to build type Signed-off-by: Jonas Schroeder --- CMakeLists.txt | 4 ++++ dpsim-models/include/dpsim-models/Config.h.in | 1 + dpsim-models/include/dpsim-models/Logger.h | 9 ++++++++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ed1bcafe9c..bc9e78416a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -80,6 +80,10 @@ check_symbol_exists(getopt_long getopt.h HAVE_GETOPT) include(GetVersion) GetVersion(${PROJECT_SOURCE_DIR} "DPSIM") +if (CMAKE_BUILD_TYPE MATCHES Debug) + set(DEBUG_BUILD ON) +endif() + # Deprecated build options # TODO: Remove deprecated options in future release option(WITH_EIGEN_MODULE "Fetch Eigen3 as module (deprecated option)" OFF) diff --git a/dpsim-models/include/dpsim-models/Config.h.in b/dpsim-models/include/dpsim-models/Config.h.in index 548b680826..b27ff9c0fc 100644 --- a/dpsim-models/include/dpsim-models/Config.h.in +++ b/dpsim-models/include/dpsim-models/Config.h.in @@ -16,3 +16,4 @@ #cmakedefine WITH_NUMPY #cmakedefine WITH_KLU #cmakedefine CGMES_BUILD +#cmakedefine DEBUG_BUILD diff --git a/dpsim-models/include/dpsim-models/Logger.h b/dpsim-models/include/dpsim-models/Logger.h index 440bf9d4bf..c9156f7fb0 100644 --- a/dpsim-models/include/dpsim-models/Logger.h +++ b/dpsim-models/include/dpsim-models/Logger.h @@ -2,7 +2,14 @@ #pragma once -#define SPDLOG_ACTIVE_LEVEL SPDLOG_LEVEL_DEBUG +#include + +#if defined(DEBUG_BUILD) + #define SPDLOG_ACTIVE_LEVEL SPDLOG_LEVEL_TRACE +#else + #define SPDLOG_ACTIVE_LEVEL SPDLOG_LEVEL_INFO +#endif + #include From 115a2665bd1010ed6e2cd4a94a867e4dc416944b Mon Sep 17 00:00:00 2001 From: Jonas Schroeder Date: Fri, 14 Jul 2023 08:50:28 +0000 Subject: [PATCH 04/31] introduce custom sink type Signed-off-by: Jonas Schroeder --- dpsim-models/include/dpsim-models/Logger.h | 55 +++++++++++++- dpsim-models/src/Logger.cpp | 84 +++++++++++++++------- 2 files changed, 110 insertions(+), 29 deletions(-) diff --git a/dpsim-models/include/dpsim-models/Logger.h b/dpsim-models/include/dpsim-models/Logger.h index c9156f7fb0..3f74c44e3c 100644 --- a/dpsim-models/include/dpsim-models/Logger.h +++ b/dpsim-models/include/dpsim-models/Logger.h @@ -9,7 +9,7 @@ #else #define SPDLOG_ACTIVE_LEVEL SPDLOG_LEVEL_INFO #endif - +#define SPDLOG_DISABLE_DEFAULT_LOGGER #include @@ -22,6 +22,7 @@ #include #include #include +#include "spdlog/sinks/base_sink.h" #include #include @@ -40,10 +41,14 @@ namespace CPS { DEBUG }; - /// Holds the CLI sink shared by all loggers - static spdlog::sink_ptr mCliSink; + /// Holds the file sink shared by all simulation loggers + static spdlog::sink_ptr mSimulationFileSink; /// Holds the file sink shared by all component loggers static spdlog::sink_ptr mComponentFileSink; + /// Holds the stdout cli sink shared by all loggers + static spdlog::sink_ptr mStdoutSink; + /// Holds the stderr cli sink shared by all loggers + static spdlog::sink_ptr mStderrSink; private: static Log create(Logger::LoggerType type, const std::string &name, const std::string &fileName, Level filelevel, Level clilevel); @@ -78,5 +83,49 @@ namespace CPS { static String getCSVLineFromData(Real time, Real data); static String getCSVLineFromData(Real time, const Matrix& data); static String getCSVLineFromData(Real time, const MatrixComp& data); + + class dpsim_sink : public spdlog::sinks::base_sink + { + private: + spdlog::sink_ptr mFileSink; + spdlog::sink_ptr mStdoutSink; + spdlog::sink_ptr mStderrSink; + Level mFileLevel; + Level mCliLevel; + public: + dpsim_sink(spdlog::sink_ptr fileSink, spdlog::sink_ptr stdoutSink, spdlog::sink_ptr stderrSink, Level fileLevel, Level cliLevel) : + spdlog::sinks::base_sink(), + mFileSink(fileSink), + mStdoutSink(stdoutSink), + mStderrSink(stderrSink), + mFileLevel(fileLevel), + mCliLevel(cliLevel) { }; + protected: + void sink_it_(const spdlog::details::log_msg& msg) override + { + if (mFileSink && msg.level >= mFileLevel) { + mFileSink->log(msg); + } + if (mStdoutSink && msg.level >= mCliLevel && msg.level < Level::warn) { + mStdoutSink->log(msg); + } + if (mStderrSink && msg.level >= mCliLevel && msg.level >= Level::warn) { + mStderrSink->log(msg); + } + } + + void flush_() override + { + if (mFileSink) { + mFileSink->flush(); + } + if (mStdoutSink) { + mStdoutSink->flush(); + } + if (mStderrSink) { + mStderrSink->flush(); + } + } + }; }; } diff --git a/dpsim-models/src/Logger.cpp b/dpsim-models/src/Logger.cpp index b24f76da74..a0242775b1 100644 --- a/dpsim-models/src/Logger.cpp +++ b/dpsim-models/src/Logger.cpp @@ -14,8 +14,10 @@ using namespace CPS; -spdlog::sink_ptr Logger::mCliSink; +spdlog::sink_ptr Logger::mSimulationFileSink; spdlog::sink_ptr Logger::mComponentFileSink; +spdlog::sink_ptr Logger::mStdoutSink; +spdlog::sink_ptr Logger::mStderrSink; void Logger::setLogLevel(std::shared_ptr logger, Logger::Level level) { logger->set_level(level); @@ -161,48 +163,78 @@ Logger::Log Logger::get(LoggerType type, const std::string &name, Level fileleve Logger::Log Logger::create(Logger::LoggerType type, const std::string &name, const std::string &fileName, Level filelevel, Level clilevel) { String logDir = Logger::logDir(); String filepath = logDir + "/" + fileName + ".log"; - std::vector sinks; Logger::Log logger; + spdlog::sink_ptr file_sink; if (clilevel != Logger::Level::off) { - // Why do we log into stderr instead of stdout? - if (!Logger::mCliSink) { - Logger::mCliSink = std::make_shared(); - Logger::mCliSink->set_level(clilevel); - Logger::mCliSink->set_pattern(fmt::format("{}[%T.%f %n %^%l%$] %v", CPS::Logger::prefix())); + + if (!Logger::mStderrSink) { + Logger::mStderrSink = std::make_shared(); + Logger::mStderrSink->set_level(Level::warn); + Logger::mStderrSink->set_pattern(fmt::format("{}[%T.%f %n %^%l%$] %v", CPS::Logger::prefix())); + } + + if (clilevel < Level::warn && !Logger::mStdoutSink) { + Logger::mStdoutSink = std::make_shared(); + Logger::mStdoutSink->set_level(Level::trace); + Logger::mStdoutSink->set_pattern(fmt::format("{}[%T.%f %n %^%l%$] %v", CPS::Logger::prefix())); } - sinks.push_back(Logger::mCliSink); } if (filelevel != Logger::Level::off) { - spdlog::sink_ptr file_sink; - - if (type == LoggerType::COMPONENT) { - // Use common file sink - if (!Logger::mComponentFileSink) { - Logger::mComponentFileSink = std::make_shared(filepath, true); - Logger::mComponentFileSink->set_level(filelevel); + switch (type) { + case LoggerType::COMPONENT: { + if (!Logger::mComponentFileSink) { + Logger::mComponentFileSink = std::make_shared(filepath, true); + Logger::mComponentFileSink->set_level(Level::trace); + // TODO: Use better prefix + Logger::mComponentFileSink->set_pattern(prefix() + "[%l][%n] %v"); + } + file_sink = Logger::mComponentFileSink; + break; + } + case LoggerType::SIMULATION: { + if (!Logger::mSimulationFileSink) { + Logger::mSimulationFileSink = std::make_shared(filepath, true); + Logger::mSimulationFileSink->set_level(Level::trace); + // TODO: Use better prefix + Logger::mSimulationFileSink->set_pattern(prefix() + "[%l][%n] %v"); + } + file_sink = Logger::mSimulationFileSink; + break; + } + case LoggerType::DEBUG: { + // Create new file sink + file_sink = std::make_shared(filepath, true); + file_sink->set_level(filelevel); // TODO: Use better prefix - Logger::mComponentFileSink->set_pattern(prefix() + "[%l][%n] %v"); + file_sink->set_pattern(prefix() + "[%l] %v"); + break; + } + default: { + // UNREACHABLE! } - file_sink = Logger::mComponentFileSink; - } else { - // Create new file sink - file_sink = std::make_shared(filepath, true); - file_sink->set_level(filelevel); - // TODO: Use better prefix - file_sink->set_pattern(prefix() + "[%l] %v"); } - sinks.push_back(file_sink); } if (filelevel == Logger::Level::off && clilevel == Logger::Level::off) { logger = spdlog::create(name); } else { - logger = std::make_shared(name, begin(sinks), end(sinks)); + spdlog::sink_ptr dpsimSink = std::make_shared(file_sink, Logger::mStdoutSink, Logger::mStderrSink, filelevel, clilevel); + logger = std::make_shared(name, dpsimSink); spdlog::register_logger(logger); } - logger->set_level(spdlog::level::trace); + logger->set_level(std::min(filelevel, clilevel)); + + #ifndef DEBUG_BUILD + if (filelevel < Level::info || clilevel < Level::info) { + SPDLOG_LOGGER_WARN(logger, + "This logger has been configured to log at level {} (file) and {} (cli)." + "However, because this is a release build, debug logging has been disabled." + "Please build in debug mode for extended log output.", + filelevel, clilevel); + } + #endif return logger; } From 0e530dac865e881eafd5728cabd8393cf953fbf3 Mon Sep 17 00:00:00 2001 From: Jonas Schroeder Date: Sun, 16 Jul 2023 08:53:08 +0000 Subject: [PATCH 05/31] remove name argument for csvreader log Signed-off-by: Jonas Schroeder --- dpsim-models/include/dpsim-models/CSVReader.h | 8 ++++---- dpsim-models/src/CSVReader.cpp | 19 +++++++++---------- ...em_CIGRE_MV_PowerFlowTest_LoadProfiles.cpp | 2 +- .../CIGRE_MV_PowerFlowTest_LoadProfiles.cpp | 2 +- dpsim/examples/cxx/CIM/DP_CIGRE_MV_withDG.cpp | 1 - .../CIM/DP_CIGRE_MV_withDG_withLoadStep.cpp | 1 - .../cxx/CIM/DP_CIGRE_MV_withoutDG.cpp | 1 - .../examples/cxx/CIM/EMT_CIGRE_MV_withDG.cpp | 1 - .../CIM/EMT_CIGRE_MV_withDG_withLoadStep.cpp | 1 - .../cxx/CIM/EMT_CIGRE_MV_withoutDG.cpp | 1 - dpsim/examples/cxx/CIM/PF_CIGRE_MV_withDG.cpp | 1 - dpsim/src/pybind/Attributes.cpp | 1 - dpsim/src/pybind/BaseComponents.cpp | 1 - dpsim/src/pybind/DPComponents.cpp | 1 - dpsim/src/pybind/EMTComponents.cpp | 1 - dpsim/src/pybind/SPComponents.cpp | 1 - dpsim/src/pybind/SignalComponents.cpp | 1 - dpsim/src/pybind/main.cpp | 2 +- .../CIGRE_MV_powerflow_profiles-dpsimpy.ipynb | 4 +++- .../cigre-mv-pf-profiles-shmem.ipynb | 4 +++- .../test_shmem_cigre_mv_pf_profiles.py | 2 +- .../villas/dpsim-mqtt-cigre-mv-pf-profiles.py | 2 +- 22 files changed, 24 insertions(+), 34 deletions(-) diff --git a/dpsim-models/include/dpsim-models/CSVReader.h b/dpsim-models/include/dpsim-models/CSVReader.h index 92815447be..ae3f6d9be8 100644 --- a/dpsim-models/include/dpsim-models/CSVReader.h +++ b/dpsim-models/include/dpsim-models/CSVReader.h @@ -52,13 +52,13 @@ namespace CPS { enum class DataFormat { HHMMSS, SECONDS, HOURS, MINUTES }; /// - CSVReader(String name, std::list path, Logger::Level logLevel); + CSVReader(std::list path, Logger::Level logLevel, Logger::Level cliLevel = Logger::Level::off); /// - CSVReader(String name, String path, Logger::Level logLevel); + CSVReader(String path, Logger::Level logLevel, Logger::Level cliLevel = Logger::Level::off); /// - CSVReader(String name, std::list path, std::map& assignList, Logger::Level logLevel); + CSVReader(std::list path, std::map& assignList, Logger::Level logLevel, Logger::Level cliLevel = Logger::Level::off); /// - CSVReader(String name, String path, std::map& assignList, Logger::Level logLevel); + CSVReader(String path, std::map& assignList, Logger::Level logLevel, Logger::Level cliLevel = Logger::Level::off); /// convert HH:MM:SS format timestamp into total seconds. /// e.g.: 00 : 01 : 00 -- > 60. diff --git a/dpsim-models/src/CSVReader.cpp b/dpsim-models/src/CSVReader.cpp index 133e437811..b2d9c0b816 100644 --- a/dpsim-models/src/CSVReader.cpp +++ b/dpsim-models/src/CSVReader.cpp @@ -88,8 +88,8 @@ CSVReaderIterator::CSVReaderIterator(std::istream& str) CSVReaderIterator::CSVReaderIterator():m_str(NULL) { } -CSVReader::CSVReader(CPS::String name, std::list paths, CPS::Logger::Level logLevel) { - mSLog = Logger::get(Logger::LoggerType::DEBUG, name + "_csvReader", logLevel); +CSVReader::CSVReader(std::list paths, CPS::Logger::Level logLevel, CPS::Logger::Level cliLevel) { + mSLog = Logger::get(Logger::LoggerType::DEBUG, "CSVReader", logLevel, cliLevel); //mFileList = paths; for(auto file : paths){ if(file.string().find(".csv")!=std::string::npos){ @@ -100,24 +100,23 @@ CSVReader::CSVReader(CPS::String name, std::list paths, CPS::Logger::L } -CSVReader::CSVReader(CPS::String name, CPS::String path, CPS::Logger::Level logLevel) { - mSLog = Logger::get(Logger::LoggerType::DEBUG, name + "_csvReader", logLevel); +CSVReader::CSVReader(CPS::String path, CPS::Logger::Level logLevel, CPS::Logger::Level cliLevel) { + mSLog = Logger::get(Logger::LoggerType::DEBUG, "CSVReader", logLevel, cliLevel); mPath = path; for (const auto & entry : fs::directory_iterator(path)) { - mFileList.push_back(entry.path()); - + mFileList.push_back(entry.path()); } } -CSVReader::CSVReader(CPS::String name, CPS::String path, std::map& assignList, CPS::Logger::Level logLevel) - : CSVReader(name, path, logLevel) { +CSVReader::CSVReader(CPS::String path, std::map& assignList, CPS::Logger::Level logLevel, CPS::Logger::Level cliLevel) + : CSVReader(path, logLevel, cliLevel) { mAssignPattern = assignList; } -CSVReader::CSVReader(CPS::String name, std::list paths, std::map& assignList, -CPS::Logger::Level logLevel): CSVReader(name, paths, logLevel){ +CSVReader::CSVReader(std::list paths, std::map& assignList, +CPS::Logger::Level logLevel, CPS::Logger::Level cliLevel): CSVReader(paths, logLevel, cliLevel){ mAssignPattern = assignList; } diff --git a/dpsim-villas/examples/cxx/Shmem_CIGRE_MV_PowerFlowTest_LoadProfiles.cpp b/dpsim-villas/examples/cxx/Shmem_CIGRE_MV_PowerFlowTest_LoadProfiles.cpp index accfb9fbb8..2dec369156 100644 --- a/dpsim-villas/examples/cxx/Shmem_CIGRE_MV_PowerFlowTest_LoadProfiles.cpp +++ b/dpsim-villas/examples/cxx/Shmem_CIGRE_MV_PowerFlowTest_LoadProfiles.cpp @@ -61,7 +61,7 @@ int main(int argc, char** argv){ CIM::Reader reader(simName, CPS::Logger::Level::debug, CPS::Logger::Level::off); SystemTopology sys = reader.loadCIM(system_freq, filenames, CPS::Domain::SP); - CSVReader csvreader(simName, loadProfilePath, assignList, CPS::Logger::Level::info); + CSVReader csvreader(loadProfilePath, assignList, CPS::Logger::Level::info); csvreader.assignLoadProfile(sys, 0, args.timeStep, args.duration, CSVReader::Mode::MANUAL); RealTimeSimulation sim(simName, args.logLevel); diff --git a/dpsim/examples/cxx/CIM/CIGRE_MV_PowerFlowTest_LoadProfiles.cpp b/dpsim/examples/cxx/CIM/CIGRE_MV_PowerFlowTest_LoadProfiles.cpp index 5b1a4f3244..436429c400 100644 --- a/dpsim/examples/cxx/CIM/CIGRE_MV_PowerFlowTest_LoadProfiles.cpp +++ b/dpsim/examples/cxx/CIM/CIGRE_MV_PowerFlowTest_LoadProfiles.cpp @@ -73,7 +73,7 @@ int main(int argc, char** argv){ CIM::Reader reader(simName, Logger::Level::info, Logger::Level::off); SystemTopology system = reader.loadCIM(system_freq, filenames, CPS::Domain::SP); - CSVReader csvreader(simName, loadProfilePath, assignList, Logger::Level::info); + CSVReader csvreader(loadProfilePath, assignList, Logger::Level::info); csvreader.assignLoadProfile(system, time_begin, time_step, time_end, CSVReader::Mode::MANUAL); auto logger = DPsim::DataLogger::make(simName); diff --git a/dpsim/examples/cxx/CIM/DP_CIGRE_MV_withDG.cpp b/dpsim/examples/cxx/CIM/DP_CIGRE_MV_withDG.cpp index e14036d037..f90ffad321 100644 --- a/dpsim/examples/cxx/CIM/DP_CIGRE_MV_withDG.cpp +++ b/dpsim/examples/cxx/CIM/DP_CIGRE_MV_withDG.cpp @@ -8,7 +8,6 @@ #include "dpsim-models/CIM/Reader.h" #include -#include #include "../Examples.h" using namespace std; diff --git a/dpsim/examples/cxx/CIM/DP_CIGRE_MV_withDG_withLoadStep.cpp b/dpsim/examples/cxx/CIM/DP_CIGRE_MV_withDG_withLoadStep.cpp index a692cb6516..8c9734473e 100644 --- a/dpsim/examples/cxx/CIM/DP_CIGRE_MV_withDG_withLoadStep.cpp +++ b/dpsim/examples/cxx/CIM/DP_CIGRE_MV_withDG_withLoadStep.cpp @@ -7,7 +7,6 @@ *********************************************************************************/ #include -#include #include "../Examples.h" using namespace std; diff --git a/dpsim/examples/cxx/CIM/DP_CIGRE_MV_withoutDG.cpp b/dpsim/examples/cxx/CIM/DP_CIGRE_MV_withoutDG.cpp index e234a579b9..cc77b17c5f 100644 --- a/dpsim/examples/cxx/CIM/DP_CIGRE_MV_withoutDG.cpp +++ b/dpsim/examples/cxx/CIM/DP_CIGRE_MV_withoutDG.cpp @@ -8,7 +8,6 @@ #include "dpsim-models/CIM/Reader.h" #include -#include using namespace std; using namespace DPsim; diff --git a/dpsim/examples/cxx/CIM/EMT_CIGRE_MV_withDG.cpp b/dpsim/examples/cxx/CIM/EMT_CIGRE_MV_withDG.cpp index c5827d1278..24edae579e 100644 --- a/dpsim/examples/cxx/CIM/EMT_CIGRE_MV_withDG.cpp +++ b/dpsim/examples/cxx/CIM/EMT_CIGRE_MV_withDG.cpp @@ -8,7 +8,6 @@ #include "dpsim-models/CIM/Reader.h" #include -#include #include "../Examples.h" using namespace std; diff --git a/dpsim/examples/cxx/CIM/EMT_CIGRE_MV_withDG_withLoadStep.cpp b/dpsim/examples/cxx/CIM/EMT_CIGRE_MV_withDG_withLoadStep.cpp index d9555a00bf..f1292bab47 100644 --- a/dpsim/examples/cxx/CIM/EMT_CIGRE_MV_withDG_withLoadStep.cpp +++ b/dpsim/examples/cxx/CIM/EMT_CIGRE_MV_withDG_withLoadStep.cpp @@ -8,7 +8,6 @@ #include "dpsim-models/CIM/Reader.h" #include -#include #include "../Examples.h" using namespace std; diff --git a/dpsim/examples/cxx/CIM/EMT_CIGRE_MV_withoutDG.cpp b/dpsim/examples/cxx/CIM/EMT_CIGRE_MV_withoutDG.cpp index 09ae1173bd..042a62291c 100644 --- a/dpsim/examples/cxx/CIM/EMT_CIGRE_MV_withoutDG.cpp +++ b/dpsim/examples/cxx/CIM/EMT_CIGRE_MV_withoutDG.cpp @@ -8,7 +8,6 @@ #include "dpsim-models/CIM/Reader.h" #include -#include using namespace std; using namespace DPsim; diff --git a/dpsim/examples/cxx/CIM/PF_CIGRE_MV_withDG.cpp b/dpsim/examples/cxx/CIM/PF_CIGRE_MV_withDG.cpp index c4dbbd73af..2a285d38f1 100644 --- a/dpsim/examples/cxx/CIM/PF_CIGRE_MV_withDG.cpp +++ b/dpsim/examples/cxx/CIM/PF_CIGRE_MV_withDG.cpp @@ -8,7 +8,6 @@ #include "dpsim-models/CIM/Reader.h" #include -#include #include "../Examples.h" using namespace std; diff --git a/dpsim/src/pybind/Attributes.cpp b/dpsim/src/pybind/Attributes.cpp index 22c7f9cccc..df0f3e7430 100644 --- a/dpsim/src/pybind/Attributes.cpp +++ b/dpsim/src/pybind/Attributes.cpp @@ -11,7 +11,6 @@ #include #include #include -#include #include PYBIND11_DECLARE_HOLDER_TYPE(T, CPS::AttributePointer); diff --git a/dpsim/src/pybind/BaseComponents.cpp b/dpsim/src/pybind/BaseComponents.cpp index ab4c81550c..76922c7823 100644 --- a/dpsim/src/pybind/BaseComponents.cpp +++ b/dpsim/src/pybind/BaseComponents.cpp @@ -11,7 +11,6 @@ #include #include #include -#include #include namespace py = pybind11; diff --git a/dpsim/src/pybind/DPComponents.cpp b/dpsim/src/pybind/DPComponents.cpp index 7a087edb98..85b8d44019 100644 --- a/dpsim/src/pybind/DPComponents.cpp +++ b/dpsim/src/pybind/DPComponents.cpp @@ -11,7 +11,6 @@ #include #include #include -#include #include namespace py = pybind11; diff --git a/dpsim/src/pybind/EMTComponents.cpp b/dpsim/src/pybind/EMTComponents.cpp index 6c524f0f4e..77c38bb72c 100644 --- a/dpsim/src/pybind/EMTComponents.cpp +++ b/dpsim/src/pybind/EMTComponents.cpp @@ -11,7 +11,6 @@ #include #include #include -#include #include namespace py = pybind11; diff --git a/dpsim/src/pybind/SPComponents.cpp b/dpsim/src/pybind/SPComponents.cpp index c0084eea31..0ccaacaff4 100644 --- a/dpsim/src/pybind/SPComponents.cpp +++ b/dpsim/src/pybind/SPComponents.cpp @@ -11,7 +11,6 @@ #include #include #include -#include #include namespace py = pybind11; diff --git a/dpsim/src/pybind/SignalComponents.cpp b/dpsim/src/pybind/SignalComponents.cpp index 64e82fb36a..b009f6de48 100644 --- a/dpsim/src/pybind/SignalComponents.cpp +++ b/dpsim/src/pybind/SignalComponents.cpp @@ -11,7 +11,6 @@ #include #include #include -#include #include namespace py = pybind11; diff --git a/dpsim/src/pybind/main.cpp b/dpsim/src/pybind/main.cpp index ed20fcfbe8..20df706bf7 100644 --- a/dpsim/src/pybind/main.cpp +++ b/dpsim/src/pybind/main.cpp @@ -251,7 +251,7 @@ PYBIND11_MODULE(dpsimpy, m) { #endif py::class_(m, "CSVReader") - .def(py::init &, CPS::Logger::Level>()) + .def(py::init &, CPS::Logger::Level, CPS::Logger::Level>(), "path"_a, "assignlist"_a, "loglevel"_a, "clilevel"_a = CPS::Logger::Level::off) .def("assignLoadProfile", &CPS::CSVReader::assignLoadProfile); //Base Classes diff --git a/examples/Notebooks/Grids/CIGRE_MV_powerflow_profiles-dpsimpy.ipynb b/examples/Notebooks/Grids/CIGRE_MV_powerflow_profiles-dpsimpy.ipynb index 12f8040b25..c802d591d1 100644 --- a/examples/Notebooks/Grids/CIGRE_MV_powerflow_profiles-dpsimpy.ipynb +++ b/examples/Notebooks/Grids/CIGRE_MV_powerflow_profiles-dpsimpy.ipynb @@ -1,6 +1,7 @@ { "cells": [ { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -8,6 +9,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -124,7 +126,7 @@ "metadata": {}, "outputs": [], "source": [ - "csvreader = dpsimpy.CSVReader(name, profile_path, assignList, dpsimpy.LogLevel.info)\n", + "csvreader = dpsimpy.CSVReader(profile_path, assignList, dpsimpy.LogLevel.info)\n", "csvreader.assignLoadProfile(system, 0, 1, 300, dpsimpy.CSVReaderMode.MANUAL, dpsimpy.CSVReaderFormat.SECONDS)" ] }, diff --git a/examples/villas-deprecated/cigre-mv-pf-profiles-shmem.ipynb b/examples/villas-deprecated/cigre-mv-pf-profiles-shmem.ipynb index 715a70e7a4..a0f1530f59 100644 --- a/examples/villas-deprecated/cigre-mv-pf-profiles-shmem.ipynb +++ b/examples/villas-deprecated/cigre-mv-pf-profiles-shmem.ipynb @@ -1,6 +1,7 @@ { "cells": [ { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -8,6 +9,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -121,7 +123,7 @@ "metadata": {}, "outputs": [], "source": [ - "csvreader = dpsimpy.CSVReader(name, profile_path, assignList, dpsimpy.LogLevel.info)\n", + "csvreader = dpsimpy.CSVReader(profile_path, assignList, dpsimpy.LogLevel.info)\n", "csvreader.assignLoadProfile(system, 0, 1, 300, dpsimpy.CSVReaderMode.MANUAL, dpsimpy.CSVReaderFormat.SECONDS)" ] }, diff --git a/examples/villas-deprecated/test_shmem_cigre_mv_pf_profiles.py b/examples/villas-deprecated/test_shmem_cigre_mv_pf_profiles.py index 78f95728e9..bcbb092dc3 100644 --- a/examples/villas-deprecated/test_shmem_cigre_mv_pf_profiles.py +++ b/examples/villas-deprecated/test_shmem_cigre_mv_pf_profiles.py @@ -107,7 +107,7 @@ def dpsim(): 'LOAD-I-14': 'Load_I_14' } - csvreader = dpsimpy.CSVReader(name, csv_files, assignList, dpsimpy.LogLevel.info) + csvreader = dpsimpy.CSVReader(csv_files, assignList, dpsimpy.LogLevel.info) csvreader.assignLoadProfile(system, 0, 1, 300, dpsimpy.CSVReaderMode.MANUAL, dpsimpy.CSVReaderFormat.SECONDS) sim = dpsimpy.RealTimeSimulation(name) diff --git a/examples/villas/dpsim-mqtt-cigre-mv-pf-profiles.py b/examples/villas/dpsim-mqtt-cigre-mv-pf-profiles.py index 8b5ef2c850..2ded3aa256 100644 --- a/examples/villas/dpsim-mqtt-cigre-mv-pf-profiles.py +++ b/examples/villas/dpsim-mqtt-cigre-mv-pf-profiles.py @@ -48,7 +48,7 @@ # read profiles from CSV csv_files = 'build/_deps/profile-data-src/CIGRE_MV_NoTap/load_profiles/' log.info('CSV files: %s', csv_files) -csvreader = dpsimpy.CSVReader(name, csv_files, assignList, dpsimpy.LogLevel.info) +csvreader = dpsimpy.CSVReader(csv_files, assignList, dpsimpy.LogLevel.info) csvreader.assignLoadProfile(system, 0, 1, 300, dpsimpy.CSVReaderMode.MANUAL, dpsimpy.CSVReaderFormat.SECONDS) # instantiate logger From 85a5ab640571f67b98da7d0578948ef9c80d9e55 Mon Sep 17 00:00:00 2001 From: Jonas Schroeder Date: Sun, 16 Jul 2023 09:14:18 +0000 Subject: [PATCH 06/31] remove solver name variable Signed-off-by: Jonas Schroeder --- dpsim-models/src/Logger.cpp | 2 +- dpsim/include/dpsim/DiakopticsSolver.h | 10 +++++----- dpsim/include/dpsim/MNASolverDirect.h | 8 ++++---- dpsim/include/dpsim/MNASolverFactory.h | 2 +- dpsim/include/dpsim/MNASolverPlugin.h | 4 ++-- dpsim/include/dpsim/ODESolver.h | 2 +- dpsim/include/dpsim/PFSolver.h | 2 +- dpsim/include/dpsim/Solver.h | 10 ++-------- dpsim/src/DAESolver.cpp | 2 +- dpsim/src/DiakopticsSolver.cpp | 2 +- dpsim/src/MNASolver.cpp | 14 ++++++++------ dpsim/src/ODESolver.cpp | 2 +- dpsim/src/PFSolver.cpp | 2 +- 13 files changed, 29 insertions(+), 33 deletions(-) diff --git a/dpsim-models/src/Logger.cpp b/dpsim-models/src/Logger.cpp index a0242775b1..a1632699e2 100644 --- a/dpsim-models/src/Logger.cpp +++ b/dpsim-models/src/Logger.cpp @@ -141,7 +141,7 @@ Logger::Log Logger::get(LoggerType type, const std::string &name, Level fileleve case LoggerType::SIMULATION: { if (Logger::Log logger = spdlog::get("simulation")) { return logger; - } else return create(LoggerType::SIMULATION, "simulation", name, filelevel, clilevel); + } else return create(LoggerType::SIMULATION, name, "simulation", filelevel, clilevel); } case LoggerType::COMPONENT: { if (Logger::Log logger = spdlog::get(name)) { diff --git a/dpsim/include/dpsim/DiakopticsSolver.h b/dpsim/include/dpsim/DiakopticsSolver.h index 47122ccc82..6b5fc15d20 100644 --- a/dpsim/include/dpsim/DiakopticsSolver.h +++ b/dpsim/include/dpsim/DiakopticsSolver.h @@ -110,7 +110,7 @@ namespace DPsim { class SubnetSolveTask : public CPS::Task { public: SubnetSolveTask(DiakopticsSolver& solver, UInt net) : - Task(solver.mName + ".SubnetSolve_" + std::to_string(net)), mSolver(solver), mSubnet(solver.mSubnets[net]) { + Task("DiakopticsSolver.SubnetSolve_" + std::to_string(net)), mSolver(solver), mSubnet(solver.mSubnets[net]) { for (auto it : mSubnet.components) { if (it->getRightVector()->get().size() != 0) { mAttributeDependencies.push_back(it->getRightVector()); @@ -130,7 +130,7 @@ namespace DPsim { class PreSolveTask : public CPS::Task { public: PreSolveTask(DiakopticsSolver& solver) : - Task(solver.mName + ".PreSolve"), mSolver(solver) { + Task("DiakopticsSolver.PreSolve"), mSolver(solver) { mAttributeDependencies.push_back(solver.mOrigLeftSideVector); mModifiedAttributes.push_back(solver.mMappedTearCurrents); } @@ -144,7 +144,7 @@ namespace DPsim { class SolveTask : public CPS::Task { public: SolveTask(DiakopticsSolver& solver, UInt net) : - Task(solver.mName + ".Solve_" + std::to_string(net)), mSolver(solver), mSubnet(solver.mSubnets[net]) { + Task("DiakopticsSolver.Solve_" + std::to_string(net)), mSolver(solver), mSubnet(solver.mSubnets[net]) { mAttributeDependencies.push_back(solver.mMappedTearCurrents); mModifiedAttributes.push_back(mSubnet.leftVector); } @@ -159,7 +159,7 @@ namespace DPsim { class PostSolveTask : public CPS::Task { public: PostSolveTask(DiakopticsSolver& solver) : - Task(solver.mName + ".PostSolve"), mSolver(solver) { + Task("DiakopticsSolver.PostSolve"), mSolver(solver) { for (auto& net : solver.mSubnets) { mAttributeDependencies.push_back(net.leftVector); } @@ -175,7 +175,7 @@ namespace DPsim { class LogTask : public CPS::Task { public: LogTask(DiakopticsSolver& solver) : - Task(solver.mName + ".Log"), mSolver(solver) { + Task("DiakopticsSolver.Log"), mSolver(solver) { for (auto& net : solver.mSubnets) { mAttributeDependencies.push_back(net.leftVector); } diff --git a/dpsim/include/dpsim/MNASolverDirect.h b/dpsim/include/dpsim/MNASolverDirect.h index 1df04ac95a..52812cb703 100644 --- a/dpsim/include/dpsim/MNASolverDirect.h +++ b/dpsim/include/dpsim/MNASolverDirect.h @@ -176,7 +176,7 @@ namespace DPsim { class SolveTask : public CPS::Task { public: SolveTask(MnaSolverDirect& solver) : - Task(solver.mName + ".Solve"), mSolver(solver) { + Task("MNASolverDirect.Solve"), mSolver(solver) { for (auto it : solver.mMNAComponents) { if (it->getRightVector()->get().size() != 0) @@ -200,7 +200,7 @@ namespace DPsim { class SolveTaskHarm : public CPS::Task { public: SolveTaskHarm(MnaSolverDirect& solver, UInt freqIdx) : - Task(solver.mName + ".Solve"), mSolver(solver), mFreqIdx(freqIdx) { + Task("MNASolverDirect.Solve"), mSolver(solver), mFreqIdx(freqIdx) { for (auto it : solver.mMNAComponents) { if (it->getRightVector()->get().size() != 0) @@ -227,7 +227,7 @@ namespace DPsim { class SolveTaskRecomp : public CPS::Task { public: SolveTaskRecomp(MnaSolverDirect& solver) : - Task(solver.mName + ".Solve"), mSolver(solver) { + Task("MNASolverDirect.Solve"), mSolver(solver) { for (auto it : solver.mMNAComponents) { if (it->getRightVector()->get().size() != 0) @@ -256,7 +256,7 @@ namespace DPsim { class LogTask : public CPS::Task { public: LogTask(MnaSolverDirect& solver) : - Task(solver.mName + ".Log"), mSolver(solver) { + Task("MNASolverDirect.Log"), mSolver(solver) { mAttributeDependencies.push_back(solver.mLeftSideVector); mModifiedAttributes.push_back(Scheduler::external); } diff --git a/dpsim/include/dpsim/MNASolverFactory.h b/dpsim/include/dpsim/MNASolverFactory.h index 7785738996..14a8db763b 100644 --- a/dpsim/include/dpsim/MNASolverFactory.h +++ b/dpsim/include/dpsim/MNASolverFactory.h @@ -71,7 +71,7 @@ class MnaSolverFactory { if (implementation == DirectLinearSolverImpl::Undef) { implementation = DirectLinearSolverImpl::SparseLU; } - CPS::Logger::Log log = CPS::Logger::get(CPS::Logger::LoggerType::DEBUG, "MnaSolverFactory", CPS::Logger::Level::info, CPS::Logger::Level::info); + CPS::Logger::Log log = CPS::Logger::get(CPS::Logger::LoggerType::SIMULATION, "MnaSolverFactory", logLevel, logLevel); switch(implementation) { /* TODO: have only one "solver" object of type MnaSolverDirect and only use setDirectLinearSolverImplementation in the switch-case. diff --git a/dpsim/include/dpsim/MNASolverPlugin.h b/dpsim/include/dpsim/MNASolverPlugin.h index c3e47fea10..96800ea7fe 100644 --- a/dpsim/include/dpsim/MNASolverPlugin.h +++ b/dpsim/include/dpsim/MNASolverPlugin.h @@ -39,7 +39,7 @@ namespace DPsim { class SolveTask : public CPS::Task { public: SolveTask(MnaSolverPlugin& solver) : - Task(solver.mName + ".Solve"), mSolver(solver) { + Task("MNASolverPlugin.Solve"), mSolver(solver) { for (auto it : solver.mMNAComponents) { if (it->getRightVector()->get().size() != 0) @@ -60,7 +60,7 @@ namespace DPsim { class LogTask : public CPS::Task { public: LogTask(MnaSolverPlugin& solver) : - Task(solver.mName + ".Log"), mSolver(solver) { + Task("MNASolverPlugin.Log"), mSolver(solver) { mAttributeDependencies.push_back(solver.mLeftSideVector); mModifiedAttributes.push_back(Scheduler::external); } diff --git a/dpsim/include/dpsim/ODESolver.h b/dpsim/include/dpsim/ODESolver.h index 60dfe823cc..caa343e7d8 100644 --- a/dpsim/include/dpsim/ODESolver.h +++ b/dpsim/include/dpsim/ODESolver.h @@ -86,7 +86,7 @@ namespace DPsim { class SolveTask : public CPS::Task { public: SolveTask(ODESolver& solver) - : Task(solver.mName + ".Solve"), mSolver(solver) { + : Task("ODESolver.Solve"), mSolver(solver) { mAttributeDependencies.push_back(solver.mComponent->mOdePreState); mModifiedAttributes.push_back(solver.mComponent->mOdePostState); } diff --git a/dpsim/include/dpsim/PFSolver.h b/dpsim/include/dpsim/PFSolver.h index bfd00048a9..cc80784b1a 100644 --- a/dpsim/include/dpsim/PFSolver.h +++ b/dpsim/include/dpsim/PFSolver.h @@ -151,7 +151,7 @@ namespace DPsim { class SolveTask : public CPS::Task { public: SolveTask(PFSolver& solver) : - Task(solver.mName + ".Solve"), mSolver(solver) { + Task("PFSolver.Solve"), mSolver(solver) { mModifiedAttributes.push_back(Scheduler::external); } diff --git a/dpsim/include/dpsim/Solver.h b/dpsim/include/dpsim/Solver.h index 4184cb80fd..6e559b9469 100644 --- a/dpsim/include/dpsim/Solver.h +++ b/dpsim/include/dpsim/Solver.h @@ -35,10 +35,6 @@ namespace DPsim { enum Behaviour { Initialization, Simulation }; protected: - /// Name for logging - String mName; - /// Logging level - CPS::Logger::Level mLogLevel; /// Logger CPS::Logger::Log mSLog; /// Time step for fixed step solvers @@ -66,10 +62,8 @@ namespace DPsim { public: - Solver(String name, CPS::Logger::Level logLevel) : - mName(name), - mLogLevel(logLevel), - mSLog(CPS::Logger::get(CPS::Logger::LoggerType::DEBUG, name + "_Solver", logLevel, CPS::Logger::Level::warn)) { + Solver(CPS::Logger::Level logLevel, CPS::Logger::Level cliLevel = CPS::Logger::Level::warn) : + mSLog(CPS::Logger::get(CPS::Logger::LoggerType::SIMULATION, "Solver", logLevel, cliLevel)) { } virtual ~Solver() { } diff --git a/dpsim/src/DAESolver.cpp b/dpsim/src/DAESolver.cpp index d3390fcbd1..586c00a0cb 100644 --- a/dpsim/src/DAESolver.cpp +++ b/dpsim/src/DAESolver.cpp @@ -16,7 +16,7 @@ using namespace CPS; //#define NVECTOR_DATA(vec) NV_DATA_S (vec) // Returns pointer to the first element of array vec DAESolver::DAESolver(String name, const CPS::SystemTopology &system, Real dt, Real t0) : - Solver(name, CPS::Logger::Level::info), + Solver(CPS::Logger::Level::info), mSystem(system), mTimestep(dt) { diff --git a/dpsim/src/DiakopticsSolver.cpp b/dpsim/src/DiakopticsSolver.cpp index bed9e6e2cc..db6d9e1237 100644 --- a/dpsim/src/DiakopticsSolver.cpp +++ b/dpsim/src/DiakopticsSolver.cpp @@ -23,7 +23,7 @@ template DiakopticsSolver::DiakopticsSolver(String name, SystemTopology system, IdentifiedObject::List tearComponents, Real timeStep, Logger::Level logLevel) : - Solver(name, logLevel), + Solver(logLevel), mMappedTearCurrents(AttributeStatic::make()), mOrigLeftSideVector(AttributeStatic::make()) { mTimeStep = timeStep; diff --git a/dpsim/src/MNASolver.cpp b/dpsim/src/MNASolver.cpp index 22f4ff6f1d..9cb9d690d5 100644 --- a/dpsim/src/MNASolver.cpp +++ b/dpsim/src/MNASolver.cpp @@ -19,7 +19,7 @@ namespace DPsim { template MnaSolver::MnaSolver(String name, CPS::Domain domain, CPS::Logger::Level logLevel) : - Solver(name, logLevel), mDomain(domain) { + Solver(logLevel), mDomain(domain) { // Raw source and solution vector logging mLeftVectorLog = std::make_shared(name + "_LeftVector", logLevel == CPS::Logger::Level::trace); @@ -315,7 +315,7 @@ void MnaSolver::identifyTopologyObjects() { if (genComp) { mSyncGen.push_back(genComp); } - + auto swComp = std::dynamic_pointer_cast(comp); if (swComp) { mSwitches.push_back(swComp); @@ -447,8 +447,9 @@ template void MnaSolver::steadyStateInitialization() { SPDLOG_LOGGER_INFO(mSLog, "--- Run steady-state initialization ---"); - DataLogger initLeftVectorLog(mName + "_InitLeftVector", mLogLevel != CPS::Logger::Level::off); - DataLogger initRightVectorLog(mName + "_InitRightVector", mLogLevel != CPS::Logger::Level::off); + //TODO: Update condition for enabled, see below + DataLogger initLeftVectorLog("InitLeftVector", true); + DataLogger initRightVectorLog("InitRightVector", true); TopologicalPowerComp::Behaviour initBehaviourPowerComps = TopologicalPowerComp::Behaviour::Initialization; SimSignalComp::Behaviour initBehaviourSignalComps = SimSignalComp::Behaviour::Initialization; @@ -581,8 +582,9 @@ Task::List MnaSolver::getTasks() { template void MnaSolver::log(Real time, Int timeStepCount) { - if (mLogLevel == Logger::Level::off) - return; + //TODO: Allow for activating / deactivating data logger functions + //if (mLogLevel == Logger::Level::off) + // return; if (mDomain == CPS::Domain::EMT) { mLeftVectorLog->logEMTNodeValues(time, leftSideVector()); diff --git a/dpsim/src/ODESolver.cpp b/dpsim/src/ODESolver.cpp index f01e58d328..a512f91499 100644 --- a/dpsim/src/ODESolver.cpp +++ b/dpsim/src/ODESolver.cpp @@ -12,7 +12,7 @@ using namespace DPsim; ODESolver::ODESolver(String name, const CPS::ODEInterface::Ptr &comp, bool implicit_integration, Real timestep) : - Solver(name, CPS::Logger::Level::info), + Solver(CPS::Logger::Level::info), mComponent(comp), mImplicitIntegration(implicit_integration), mTimestep(timestep) { diff --git a/dpsim/src/PFSolver.cpp b/dpsim/src/PFSolver.cpp index aeea54d6b2..590b2c9a10 100644 --- a/dpsim/src/PFSolver.cpp +++ b/dpsim/src/PFSolver.cpp @@ -14,7 +14,7 @@ using namespace DPsim; using namespace CPS; PFSolver::PFSolver(CPS::String name, CPS::SystemTopology system, CPS::Real timeStep, CPS::Logger::Level logLevel) : - Solver(name + "_PF", logLevel) { + Solver(logLevel) { mSystem = system; mTimeStep = timeStep; } From 8efb2bf997ba54292b3fc4b7588a76023ad35f6e Mon Sep 17 00:00:00 2001 From: Jonas Schroeder Date: Sun, 16 Jul 2023 09:22:14 +0000 Subject: [PATCH 07/31] clean up scheduler and MNASolverPlugin loggers Signed-off-by: Jonas Schroeder --- dpsim/include/dpsim/Scheduler.h | 3 +-- dpsim/src/MNASolverPlugin.cpp | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dpsim/include/dpsim/Scheduler.h b/dpsim/include/dpsim/Scheduler.h index 964aa01113..dad4ceacb4 100644 --- a/dpsim/include/dpsim/Scheduler.h +++ b/dpsim/include/dpsim/Scheduler.h @@ -37,8 +37,7 @@ namespace DPsim { mRoot(std::make_shared()), // Logging mLogLevel(logLevel), - mSLog(CPS::Logger::get(CPS::Logger::LoggerType::DEBUG, "scheduler", logLevel)) { - mSLog->set_pattern("[%L] %v"); + mSLog(CPS::Logger::get(CPS::Logger::LoggerType::SIMULATION, "Scheduler", logLevel, logLevel)) { } /// virtual ~Scheduler() { } diff --git a/dpsim/src/MNASolverPlugin.cpp b/dpsim/src/MNASolverPlugin.cpp index 7f4031a2ca..4347e1c9cb 100644 --- a/dpsim/src/MNASolverPlugin.cpp +++ b/dpsim/src/MNASolverPlugin.cpp @@ -39,7 +39,8 @@ MnaSolverPlugin::~MnaSolverPlugin() { extern "C" void pluginLogger(const char * str) { - CPS::Logger::Log log = CPS::Logger::get(Logger::LoggerType::DEBUG, "Plugin", CPS::Logger::Level::debug, CPS::Logger::Level::debug); + ///CHECK: Is it possible to use the normal Solver logger for this? + CPS::Logger::Log log = CPS::Logger::get(Logger::LoggerType::SIMULATION, "MNASolverPlugin", CPS::Logger::Level::debug, CPS::Logger::Level::debug); log->info(str); } From 8af1b598a9285eb3478fda3acb37d9def8a21e00 Mon Sep 17 00:00:00 2001 From: Jonas Schroeder Date: Sun, 16 Jul 2023 10:07:16 +0000 Subject: [PATCH 08/31] remove CIMReader name and add cli log level Signed-off-by: Jonas Schroeder --- .../include/dpsim-models/CIM/Reader.h | 4 +-- dpsim-models/src/CIM/Reader.cpp | 4 +-- .../cxx/Shmem_CIGRE_MV_PowerFlowTest.cpp | 4 +-- ...em_CIGRE_MV_PowerFlowTest_LoadProfiles.cpp | 2 +- dpsim-villas/examples/cxx/Shmem_WSCC-9bus.cpp | 2 +- .../examples/cxx/Shmem_WSCC-9bus_Ctrl.cpp | 2 +- .../examples/cxx/Shmem_WSCC-9bus_CtrlDist.cpp | 2 +- .../cxx/CIM/CIGRE_MV_PowerFlowTest.cpp | 2 +- .../CIGRE_MV_PowerFlowTest_LoadProfiles.cpp | 2 +- dpsim/examples/cxx/CIM/DP_CIGRE_MV_withDG.cpp | 4 +-- .../CIM/DP_CIGRE_MV_withDG_withLoadStep.cpp | 4 +-- .../cxx/CIM/DP_CIGRE_MV_withoutDG.cpp | 4 +-- .../examples/cxx/CIM/DP_WSCC-9bus_IdealVS.cpp | 6 ++-- .../CIM/DP_WSCC9bus_SGReducedOrderIter.cpp | 4 +-- .../cxx/CIM/DP_WSCC9bus_SGReducedOrderVBR.cpp | 4 +-- .../examples/cxx/CIM/EMT_CIGRE_MV_withDG.cpp | 4 +-- .../CIM/EMT_CIGRE_MV_withDG_withLoadStep.cpp | 4 +-- .../cxx/CIM/EMT_CIGRE_MV_withoutDG.cpp | 4 +-- .../cxx/CIM/EMT_WSCC-9bus_FullOrderSG.cpp | 4 +-- .../cxx/CIM/EMT_WSCC-9bus_IdealCS.cpp | 4 +-- .../cxx/CIM/EMT_WSCC-9bus_IdealVS.cpp | 4 +-- dpsim/examples/cxx/CIM/EMT_WSCC-9bus_VBR.cpp | 4 +-- .../CIM/EMT_WSCC9bus_SGReducedOrderVBR.cpp | 4 +-- .../cxx/CIM/IEEE_LV_PowerFlowTest.cpp | 2 +- dpsim/examples/cxx/CIM/PF_CIGRE_MV_withDG.cpp | 2 +- .../cxx/CIM/SP_WSCC-9bus_CIM_Dyn_Switch.cpp | 2 +- .../cxx/CIM/SP_WSCC9bus_SGReducedOrderVBR.cpp | 4 +-- .../cxx/CIM/Slack_TrafoTapChanger_Load.cpp | 2 +- dpsim/examples/cxx/CIM/Slack_Trafo_Load.cpp | 2 +- dpsim/examples/cxx/CIM/WSCC-9bus_CIM.cpp | 4 +-- dpsim/examples/cxx/CIM/WSCC-9bus_CIM_Dyn.cpp | 2 +- .../cxx/CIM/WSCC-9bus_CIM_Dyn_Switch.cpp | 2 +- .../cxx/CIM/WSCC_9bus_mult_coupled.cpp | 4 +-- .../cxx/CIM/WSCC_9bus_mult_decoupled.cpp | 2 +- .../cxx/CIM/WSCC_9bus_mult_diakoptics.cpp | 2 +- .../RealTime/RT_CIGRE_MV_PowerFlowTest.cpp | 2 +- dpsim/examples/cxx/cim_graphviz/cimviz.cpp | 2 +- dpsim/src/pybind/main.cpp | 2 +- .../CIGRE_MV_pf-interactive-dpsimpy.ipynb | 2 +- .../Grids/CIGRE_MV_powerflow-dpsimpy.ipynb | 2 +- .../CIGRE_MV_powerflow_profiles-dpsimpy.ipynb | 2 +- .../Notebooks/Grids/DP_CIGRE_MV_withDG.ipynb | 31 ++++++++++++++-- .../DP_CIGRE_MV_withDG_withLoadStep.ipynb | 32 +++++++++++++++-- .../Grids/DP_CIGRE_MV_withoutDG.ipynb | 24 +++++++++++-- .../Grids/DP_WSCC9bus_SGTrStab.ipynb | 14 ++++++-- .../Grids/DP_WSCC9bus_SGTrStab_Switch.ipynb | 9 ++++- .../Grids/DP_WSCC9bus_SGVoltageSource.ipynb | 14 +++++++- .../Notebooks/Grids/EMT_CIGRE_MV_withDG.ipynb | 35 +++++++++++++++++-- .../EMT_CIGRE_MV_withDG_withLoadStep.ipynb | 15 ++++++-- .../Grids/EMT_CIGRE_MV_withoutDG.ipynb | 25 +++++++++++-- .../Notebooks/Grids/IEEE_LV_powerflow.ipynb | 8 ++++- .../Notebooks/Grids/PF_CIGRE_MV_withDG.ipynb | 8 ++++- ...9bus_SGTrStab_Switch_PSAT_Validation.ipynb | 15 +++++++- examples/Notebooks/Grids/case14.ipynb | 2 +- examples/Notebooks/Grids/case145.ipynb | 2 +- examples/Notebooks/Grids/case300.ipynb | 2 +- examples/Notebooks/Grids/case9.ipynb | 5 ++- ...alidate_KLU_using_different_settings.ipynb | 6 ++-- ...LU_KLU_using_partial_refactorization.ipynb | 4 +-- .../cigre-mv-pf-profiles-shmem.ipynb | 2 +- .../test_shmem_cigre_mv_pf_profiles.py | 2 +- .../villas/dpsim-mqtt-cigre-mv-pf-profiles.py | 2 +- 62 files changed, 287 insertions(+), 94 deletions(-) diff --git a/dpsim-models/include/dpsim-models/CIM/Reader.h b/dpsim-models/include/dpsim-models/CIM/Reader.h index 4872764cd9..64a7b51290 100644 --- a/dpsim-models/include/dpsim-models/CIM/Reader.h +++ b/dpsim-models/include/dpsim-models/CIM/Reader.h @@ -154,8 +154,8 @@ namespace CIM { public: /// Creates new reader with a name for logging. /// The first log level is for the reader and the second for the generated components. - Reader(String name, - Logger::Level logLevel = Logger::Level::info, + Reader(Logger::Level logLevel = Logger::Level::info, + Logger::Level cliLevel = Logger::Level::off, Logger::Level componentLogLevel = Logger::Level::off); /// virtual ~Reader(); diff --git a/dpsim-models/src/CIM/Reader.cpp b/dpsim-models/src/CIM/Reader.cpp index 33ad0f2b78..48e4a0fc90 100644 --- a/dpsim-models/src/CIM/Reader.cpp +++ b/dpsim-models/src/CIM/Reader.cpp @@ -18,8 +18,8 @@ using namespace CPS; using namespace CPS::CIM; using CIMPP::UnitMultiplier; -Reader::Reader(String name, Logger::Level logLevel, Logger::Level componentLogLevel) { - mSLog = Logger::get(Logger::LoggerType::DEBUG, name + "_CIM", logLevel); +Reader::Reader(Logger::Level logLevel, Logger::Level cliLevel, Logger::Level componentLogLevel) { + mSLog = Logger::get(Logger::LoggerType::DEBUG, "CIMReader", logLevel, cliLevel); mModel = new CIMModel(); mModel->setDependencyCheckOff(); diff --git a/dpsim-villas/examples/cxx/Shmem_CIGRE_MV_PowerFlowTest.cpp b/dpsim-villas/examples/cxx/Shmem_CIGRE_MV_PowerFlowTest.cpp index bfab04d775..832a1d4124 100644 --- a/dpsim-villas/examples/cxx/Shmem_CIGRE_MV_PowerFlowTest.cpp +++ b/dpsim-villas/examples/cxx/Shmem_CIGRE_MV_PowerFlowTest.cpp @@ -23,11 +23,11 @@ int main(int argc, char** argv) { "Rootnet_FULL_NE_06J16h_SV.xml", "Rootnet_FULL_NE_06J16h_TP.xml" }, "build/_deps/cim-data-src/CIGRE_MV/NEPLAN/CIGRE_MV_no_tapchanger_With_LoadFlow_Results", "CIMPATH"); - + String simName = "Shmem_CIGRE_MV_PowerFlowTest"; CPS::Real system_freq = 50; - CIM::Reader reader(simName, CPS::Logger::Level::debug, CPS::Logger::Level::off); + CIM::Reader reader(CPS::Logger::Level::debug, CPS::Logger::Level::off, CPS::Logger::Level::off); SystemTopology sys = reader.loadCIM(system_freq, filenames, CPS::Domain::SP); RealTimeSimulation sim(simName, args.logLevel); diff --git a/dpsim-villas/examples/cxx/Shmem_CIGRE_MV_PowerFlowTest_LoadProfiles.cpp b/dpsim-villas/examples/cxx/Shmem_CIGRE_MV_PowerFlowTest_LoadProfiles.cpp index 2dec369156..aeacb45af3 100644 --- a/dpsim-villas/examples/cxx/Shmem_CIGRE_MV_PowerFlowTest_LoadProfiles.cpp +++ b/dpsim-villas/examples/cxx/Shmem_CIGRE_MV_PowerFlowTest_LoadProfiles.cpp @@ -58,7 +58,7 @@ int main(int argc, char** argv){ String simName = "Shmem_CIGRE-MV-NoTap"; CPS::Real system_freq = 50; - CIM::Reader reader(simName, CPS::Logger::Level::debug, CPS::Logger::Level::off); + CIM::Reader reader(CPS::Logger::Level::debug, CPS::Logger::Level::off, CPS::Logger::Level::off); SystemTopology sys = reader.loadCIM(system_freq, filenames, CPS::Domain::SP); CSVReader csvreader(loadProfilePath, assignList, CPS::Logger::Level::info); diff --git a/dpsim-villas/examples/cxx/Shmem_WSCC-9bus.cpp b/dpsim-villas/examples/cxx/Shmem_WSCC-9bus.cpp index d1b3c097e3..a24d4dccac 100644 --- a/dpsim-villas/examples/cxx/Shmem_WSCC-9bus.cpp +++ b/dpsim-villas/examples/cxx/Shmem_WSCC-9bus.cpp @@ -21,7 +21,7 @@ int main(int argc, char *argv[]) { String simName = "Shmem_WSCC-9bus"; - CIMReader reader(simName, CPS::Logger::Level::info, CPS::Logger::Level::info); + CIMReader reader(CPS::Logger::Level::info, CPS::Logger::Level::off, CPS::Logger::Level::info); SystemTopology sys = reader.loadCIM(60, filenames); RealTimeSimulation sim(simName, CPS::Logger::Level::debug); diff --git a/dpsim-villas/examples/cxx/Shmem_WSCC-9bus_Ctrl.cpp b/dpsim-villas/examples/cxx/Shmem_WSCC-9bus_Ctrl.cpp index 0965a99033..ff961e7ecf 100644 --- a/dpsim-villas/examples/cxx/Shmem_WSCC-9bus_Ctrl.cpp +++ b/dpsim-villas/examples/cxx/Shmem_WSCC-9bus_Ctrl.cpp @@ -31,7 +31,7 @@ int main(int argc, char *argv[]) { String simName = "Shmem_WSCC-9bus_Ctrl"; CPS::Logger::setLogDir("logs/"+simName); - CPS::CIM::Reader reader(simName, CPS::Logger::Level::info, CPS::Logger::Level::off); + CPS::CIM::Reader reader(CPS::Logger::Level::info, CPS::Logger::Level::off, CPS::Logger::Level::off); SystemTopology sys = reader.loadCIM(60, filenames); // Extend system with controllable load (Profile) diff --git a/dpsim-villas/examples/cxx/Shmem_WSCC-9bus_CtrlDist.cpp b/dpsim-villas/examples/cxx/Shmem_WSCC-9bus_CtrlDist.cpp index ae60d00673..31529f75da 100644 --- a/dpsim-villas/examples/cxx/Shmem_WSCC-9bus_CtrlDist.cpp +++ b/dpsim-villas/examples/cxx/Shmem_WSCC-9bus_CtrlDist.cpp @@ -31,7 +31,7 @@ int main(int argc, char *argv[]) { filenames = args.positionalPaths(); } - CIM::Reader reader(args.name, CPS::Logger::Level::info, CPS::Logger::Level::info); + CIM::Reader reader(CPS::Logger::Level::info, CPS::Logger::Level::off, CPS::Logger::Level::info); SystemTopology sys = reader.loadCIM(args.sysFreq, filenames); // Extend system with controllable load (Profile) diff --git a/dpsim/examples/cxx/CIM/CIGRE_MV_PowerFlowTest.cpp b/dpsim/examples/cxx/CIM/CIGRE_MV_PowerFlowTest.cpp index 7e16a07f67..93f77d7609 100644 --- a/dpsim/examples/cxx/CIM/CIGRE_MV_PowerFlowTest.cpp +++ b/dpsim/examples/cxx/CIM/CIGRE_MV_PowerFlowTest.cpp @@ -37,7 +37,7 @@ int main(int argc, char** argv){ String simName = "CIGRE-MV-NoTap"; CPS::Real system_freq = 50; - CIM::Reader reader(simName, Logger::Level::info, Logger::Level::info); + CIM::Reader reader(Logger::Level::info, Logger::Level::off, Logger::Level::info); SystemTopology system = reader.loadCIM(system_freq, filenames, CPS::Domain::SP); auto logger = DPsim::DataLogger::make(simName); diff --git a/dpsim/examples/cxx/CIM/CIGRE_MV_PowerFlowTest_LoadProfiles.cpp b/dpsim/examples/cxx/CIM/CIGRE_MV_PowerFlowTest_LoadProfiles.cpp index 436429c400..9e1f395bc3 100644 --- a/dpsim/examples/cxx/CIM/CIGRE_MV_PowerFlowTest_LoadProfiles.cpp +++ b/dpsim/examples/cxx/CIM/CIGRE_MV_PowerFlowTest_LoadProfiles.cpp @@ -70,7 +70,7 @@ int main(int argc, char** argv){ time_end = args.duration; } - CIM::Reader reader(simName, Logger::Level::info, Logger::Level::off); + CIM::Reader reader(Logger::Level::info, Logger::Level::off, Logger::Level::off); SystemTopology system = reader.loadCIM(system_freq, filenames, CPS::Domain::SP); CSVReader csvreader(loadProfilePath, assignList, Logger::Level::info); diff --git a/dpsim/examples/cxx/CIM/DP_CIGRE_MV_withDG.cpp b/dpsim/examples/cxx/CIM/DP_CIGRE_MV_withDG.cpp index f90ffad321..d67b426781 100644 --- a/dpsim/examples/cxx/CIM/DP_CIGRE_MV_withDG.cpp +++ b/dpsim/examples/cxx/CIM/DP_CIGRE_MV_withDG.cpp @@ -49,7 +49,7 @@ int main(int argc, char** argv){ // read original network topology String simNamePF = simName + "_Powerflow"; Logger::setLogDir("logs/" + simNamePF); - CIM::Reader reader(simNamePF, Logger::Level::debug, Logger::Level::debug); + CIM::Reader reader(Logger::Level::debug, Logger::Level::off, Logger::Level::debug); SystemTopology systemPF = reader.loadCIM(scenario.systemFrequency, filenames, Domain::SP); Examples::Grids::CIGREMV::addInvertersToCIGREMV(systemPF, scenario, Domain::SP); @@ -75,7 +75,7 @@ int main(int argc, char** argv){ // ----- DYNAMIC SIMULATION ----- Logger::setLogDir("logs/" + simName); - CIM::Reader reader2(simName, Logger::Level::debug, Logger::Level::debug); + CIM::Reader reader2(Logger::Level::debug, Logger::Level::off, Logger::Level::debug); SystemTopology systemDP = reader2.loadCIM(scenario.systemFrequency, filenames, CPS::Domain::DP); Examples::Grids::CIGREMV::addInvertersToCIGREMV(systemDP, scenario, Domain::DP); systemDP.initWithPowerflow(systemPF); diff --git a/dpsim/examples/cxx/CIM/DP_CIGRE_MV_withDG_withLoadStep.cpp b/dpsim/examples/cxx/CIM/DP_CIGRE_MV_withDG_withLoadStep.cpp index 8c9734473e..1d330f1c6c 100644 --- a/dpsim/examples/cxx/CIM/DP_CIGRE_MV_withDG_withLoadStep.cpp +++ b/dpsim/examples/cxx/CIM/DP_CIGRE_MV_withDG_withLoadStep.cpp @@ -46,7 +46,7 @@ int main(int argc, char** argv){ String simName = "DP_CIGRE_MV_withDG_withLoadStep"; String simNamePF = simName + "_Powerflow"; Logger::setLogDir("logs/" + simNamePF); - CIM::Reader reader(simNamePF, Logger::Level::debug, Logger::Level::debug); + CIM::Reader reader(Logger::Level::debug, Logger::Level::off, Logger::Level::debug); SystemTopology systemPF = reader.loadCIM(scenario.systemFrequency, filenames, Domain::SP); Examples::Grids::CIGREMV::addInvertersToCIGREMV(systemPF, scenario, Domain::SP); @@ -71,7 +71,7 @@ int main(int argc, char** argv){ // ----- DYNAMIC SIMULATION ----- Logger::setLogDir("logs/" + simName); - CIM::Reader reader2(simName, Logger::Level::info, Logger::Level::debug); + CIM::Reader reader2(Logger::Level::info, Logger::Level::off, Logger::Level::debug); SystemTopology systemDP = reader2.loadCIM(scenario.systemFrequency, filenames, CPS::Domain::DP); Examples::Grids::CIGREMV::addInvertersToCIGREMV(systemDP, scenario, Domain::DP); systemDP.initWithPowerflow(systemPF); diff --git a/dpsim/examples/cxx/CIM/DP_CIGRE_MV_withoutDG.cpp b/dpsim/examples/cxx/CIM/DP_CIGRE_MV_withoutDG.cpp index cc77b17c5f..21b8a948fd 100644 --- a/dpsim/examples/cxx/CIM/DP_CIGRE_MV_withoutDG.cpp +++ b/dpsim/examples/cxx/CIM/DP_CIGRE_MV_withoutDG.cpp @@ -47,7 +47,7 @@ int main(int argc, char** argv){ // ----- POWERFLOW FOR INITIALIZATION ----- String simNamePF = simName + "_Powerflow"; Logger::setLogDir("logs/" + simNamePF); - CIM::Reader reader(simNamePF, Logger::Level::debug, Logger::Level::debug); + CIM::Reader reader(Logger::Level::debug, Logger::Level::off, Logger::Level::debug); SystemTopology systemPF = reader.loadCIM(systemFrequency, filenames, CPS::Domain::SP); auto loggerPF = DPsim::DataLogger::make(simNamePF); @@ -68,7 +68,7 @@ int main(int argc, char** argv){ // ----- DYNAMIC SIMULATION ----- Logger::setLogDir("logs/" + simName); - CIM::Reader reader2(simName, Logger::Level::debug, Logger::Level::debug); + CIM::Reader reader2(Logger::Level::debug, Logger::Level::off, Logger::Level::debug); SystemTopology systemDP = reader2.loadCIM(systemFrequency, filenames, CPS::Domain::DP); systemDP.initWithPowerflow(systemPF); diff --git a/dpsim/examples/cxx/CIM/DP_WSCC-9bus_IdealVS.cpp b/dpsim/examples/cxx/CIM/DP_WSCC-9bus_IdealVS.cpp index 2c09f11ab1..1e4ad5e525 100644 --- a/dpsim/examples/cxx/CIM/DP_WSCC-9bus_IdealVS.cpp +++ b/dpsim/examples/cxx/CIM/DP_WSCC-9bus_IdealVS.cpp @@ -44,10 +44,10 @@ int main(int argc, char *argv[]) { // read original network topology String simNamePF = simName + "_PF"; Logger::setLogDir("logs/" + simNamePF); - CPS::CIM::Reader reader(simNamePF, Logger::Level::debug, Logger::Level::debug); + CPS::CIM::Reader reader(Logger::Level::debug, Logger::Level::off, Logger::Level::debug); SystemTopology systemPF = reader.loadCIM(60, filenames, Domain::SP, PhaseType::Single, CPS::GeneratorType::PVNode); systemPF.component("GEN1")->modifyPowerFlowBusType(CPS::PowerflowBusType::VD); - + // define logging auto loggerPF = DPsim::DataLogger::make(simNamePF); for (auto node : systemPF.mNodes) @@ -70,7 +70,7 @@ int main(int argc, char *argv[]) { // ----- DYNAMIC SIMULATION ----- Logger::setLogDir("logs/"+simName); - CPS::CIM::Reader reader2(simName, Logger::Level::debug, Logger::Level::debug); + CPS::CIM::Reader reader2(Logger::Level::debug, Logger::Level::off, Logger::Level::debug); SystemTopology sys = reader2.loadCIM(60, filenames, Domain::DP, PhaseType::Single, CPS::GeneratorType::IdealVoltageSource); sys.initWithPowerflow(systemPF); diff --git a/dpsim/examples/cxx/CIM/DP_WSCC9bus_SGReducedOrderIter.cpp b/dpsim/examples/cxx/CIM/DP_WSCC9bus_SGReducedOrderIter.cpp index d7e049571b..25326c661b 100644 --- a/dpsim/examples/cxx/CIM/DP_WSCC9bus_SGReducedOrderIter.cpp +++ b/dpsim/examples/cxx/CIM/DP_WSCC9bus_SGReducedOrderIter.cpp @@ -88,7 +88,7 @@ int main(int argc, char *argv[]) { // read original network topology String simNamePF = simName + "_PF"; Logger::setLogDir(logDirectory + "/" + simNamePF); - CPS::CIM::Reader reader(simNamePF, logLevel, logLevel); + CPS::CIM::Reader reader(logLevel, Logger::Level::off, logLevel); SystemTopology systemPF = reader.loadCIM(60, filenames, Domain::SP, PhaseType::Single, CPS::GeneratorType::PVNode); systemPF.component("GEN1")->modifyPowerFlowBusType(CPS::PowerflowBusType::VD); @@ -112,7 +112,7 @@ int main(int argc, char *argv[]) { // ----- DYNAMIC SIMULATION ----- Logger::setLogDir(logDirectory + "/" + simName); - CPS::CIM::Reader reader2(simName, logLevel, logLevel); + CPS::CIM::Reader reader2(logLevel, Logger::Level::off, logLevel); SystemTopology sys; if (SGModel=="4PCM") sys = reader2.loadCIM(60, filenames, Domain::DP, PhaseType::Single, CPS::GeneratorType::SG4OrderPCM); diff --git a/dpsim/examples/cxx/CIM/DP_WSCC9bus_SGReducedOrderVBR.cpp b/dpsim/examples/cxx/CIM/DP_WSCC9bus_SGReducedOrderVBR.cpp index 84ff3df067..34fdc24be4 100644 --- a/dpsim/examples/cxx/CIM/DP_WSCC9bus_SGReducedOrderVBR.cpp +++ b/dpsim/examples/cxx/CIM/DP_WSCC9bus_SGReducedOrderVBR.cpp @@ -89,7 +89,7 @@ int main(int argc, char *argv[]) { // read original network topology String simNamePF = simName + "_PF"; Logger::setLogDir(logDirectory + "/" + simNamePF); - CPS::CIM::Reader reader(simNamePF, logLevel, logLevel); + CPS::CIM::Reader reader(logLevel, Logger::Level::off, logLevel); SystemTopology systemPF = reader.loadCIM(60, filenames, Domain::SP, PhaseType::Single, CPS::GeneratorType::PVNode); @@ -115,7 +115,7 @@ int main(int argc, char *argv[]) { // ----- DYNAMIC SIMULATION ----- Logger::setLogDir(logDirectory + "/" + simName); - CPS::CIM::Reader reader2(simName, logLevel, logLevel); + CPS::CIM::Reader reader2(logLevel, Logger::Level::off, logLevel); SystemTopology sys; if (sgType=="3") sys = reader2.loadCIM(60, filenames, Domain::DP, PhaseType::Single, CPS::GeneratorType::SG3OrderVBR); diff --git a/dpsim/examples/cxx/CIM/EMT_CIGRE_MV_withDG.cpp b/dpsim/examples/cxx/CIM/EMT_CIGRE_MV_withDG.cpp index 24edae579e..d1cd584b5d 100644 --- a/dpsim/examples/cxx/CIM/EMT_CIGRE_MV_withDG.cpp +++ b/dpsim/examples/cxx/CIM/EMT_CIGRE_MV_withDG.cpp @@ -46,7 +46,7 @@ int main(int argc, char** argv){ // read original network topology String simNamePF = simName + "_Powerflow"; Logger::setLogDir("logs/" + simNamePF); - CIM::Reader reader(simNamePF, Logger::Level::debug, Logger::Level::debug); + CIM::Reader reader(Logger::Level::debug, Logger::Level::off, Logger::Level::debug); SystemTopology systemPF = reader.loadCIM(scenario.systemFrequency, filenames, Domain::SP); Examples::Grids::CIGREMV::addInvertersToCIGREMV(systemPF, scenario, Domain::SP); @@ -72,7 +72,7 @@ int main(int argc, char** argv){ // ----- DYNAMIC SIMULATION ----- Logger::setLogDir("logs/" + simName); - CIM::Reader reader2(simName, Logger::Level::debug, Logger::Level::debug); + CIM::Reader reader2(Logger::Level::debug, Logger::Level::off, Logger::Level::debug); SystemTopology systemEMT = reader2.loadCIM(scenario.systemFrequency, filenames, CPS::Domain::EMT, PhaseType::ABC); Examples::Grids::CIGREMV::addInvertersToCIGREMV(systemEMT, scenario, Domain::EMT); systemEMT.initWithPowerflow(systemPF); diff --git a/dpsim/examples/cxx/CIM/EMT_CIGRE_MV_withDG_withLoadStep.cpp b/dpsim/examples/cxx/CIM/EMT_CIGRE_MV_withDG_withLoadStep.cpp index f1292bab47..971856ec10 100644 --- a/dpsim/examples/cxx/CIM/EMT_CIGRE_MV_withDG_withLoadStep.cpp +++ b/dpsim/examples/cxx/CIM/EMT_CIGRE_MV_withDG_withLoadStep.cpp @@ -46,7 +46,7 @@ int main(int argc, char** argv){ String simName = "EMT_CIGRE_MV_withDG_withLoadStep"; String simNamePF = simName + "_Powerflow"; Logger::setLogDir("logs/" + simNamePF); - CIM::Reader reader(simNamePF, Logger::Level::debug, Logger::Level::debug); + CIM::Reader reader(Logger::Level::debug, Logger::Level::off, Logger::Level::debug); SystemTopology systemPF = reader.loadCIM(scenario.systemFrequency, filenames, Domain::SP); Examples::Grids::CIGREMV::addInvertersToCIGREMV(systemPF, scenario, Domain::SP); @@ -72,7 +72,7 @@ int main(int argc, char** argv){ // ----- DYNAMIC SIMULATION ----- Logger::setLogDir("logs/" + simName); - CIM::Reader reader2(simName, Logger::Level::debug, Logger::Level::debug); + CIM::Reader reader2(Logger::Level::debug, Logger::Level::off, Logger::Level::debug); SystemTopology systemEMT = reader2.loadCIM(scenario.systemFrequency, filenames, CPS::Domain::EMT, PhaseType::ABC); Examples::Grids::CIGREMV::addInvertersToCIGREMV(systemEMT, scenario, Domain::EMT); systemEMT.initWithPowerflow(systemPF); diff --git a/dpsim/examples/cxx/CIM/EMT_CIGRE_MV_withoutDG.cpp b/dpsim/examples/cxx/CIM/EMT_CIGRE_MV_withoutDG.cpp index 042a62291c..8d1e3d5cb0 100644 --- a/dpsim/examples/cxx/CIM/EMT_CIGRE_MV_withoutDG.cpp +++ b/dpsim/examples/cxx/CIM/EMT_CIGRE_MV_withoutDG.cpp @@ -44,7 +44,7 @@ int main(int argc, char** argv){ // ----- POWERFLOW FOR INITIALIZATION ----- String simNamePF = simName + "_Powerflow"; Logger::setLogDir("logs/" + simNamePF); - CIM::Reader reader(simNamePF, Logger::Level::debug, Logger::Level::debug); + CIM::Reader reader(Logger::Level::debug, Logger::Level::off, Logger::Level::debug); SystemTopology systemPF = reader.loadCIM(systemFrequency, filenames, CPS::Domain::SP); auto loggerPF = DPsim::DataLogger::make(simNamePF); @@ -66,7 +66,7 @@ int main(int argc, char** argv){ // ----- DYNAMIC SIMULATION ----- Logger::setLogDir("logs/" + simName); - CIM::Reader reader2(simName, Logger::Level::debug, Logger::Level::debug); + CIM::Reader reader2(Logger::Level::debug, Logger::Level::off, Logger::Level::debug); SystemTopology systemEMT = reader2.loadCIM(systemFrequency, filenames, CPS::Domain::EMT, PhaseType::ABC); systemEMT.initWithPowerflow(systemPF); diff --git a/dpsim/examples/cxx/CIM/EMT_WSCC-9bus_FullOrderSG.cpp b/dpsim/examples/cxx/CIM/EMT_WSCC-9bus_FullOrderSG.cpp index 72424e32e3..45b12f3543 100644 --- a/dpsim/examples/cxx/CIM/EMT_WSCC-9bus_FullOrderSG.cpp +++ b/dpsim/examples/cxx/CIM/EMT_WSCC-9bus_FullOrderSG.cpp @@ -44,7 +44,7 @@ int main(int argc, char *argv[]) { // read original network topology String simNamePF = simName + "_PF"; Logger::setLogDir("logs/" + simNamePF); - CPS::CIM::Reader reader(simNamePF, Logger::Level::debug, Logger::Level::debug); + CPS::CIM::Reader reader(Logger::Level::debug, Logger::Level::off, Logger::Level::debug); SystemTopology systemPF = reader.loadCIM(60, filenames, Domain::SP, PhaseType::Single, CPS::GeneratorType::PVNode); systemPF.component("GEN1")->modifyPowerFlowBusType(CPS::PowerflowBusType::VD); @@ -70,7 +70,7 @@ int main(int argc, char *argv[]) { // ----- DYNAMIC SIMULATION ----- Logger::setLogDir("logs/"+simName); - CPS::CIM::Reader reader2(simName, Logger::Level::debug, Logger::Level::debug); + CPS::CIM::Reader reader2(Logger::Level::debug, Logger::Level::off, Logger::Level::debug); SystemTopology sys = reader2.loadCIM(60, filenames, Domain::EMT, PhaseType::ABC, CPS::GeneratorType::FullOrder); sys.initWithPowerflow(systemPF); diff --git a/dpsim/examples/cxx/CIM/EMT_WSCC-9bus_IdealCS.cpp b/dpsim/examples/cxx/CIM/EMT_WSCC-9bus_IdealCS.cpp index 4784ee3b42..91ec37dd4f 100644 --- a/dpsim/examples/cxx/CIM/EMT_WSCC-9bus_IdealCS.cpp +++ b/dpsim/examples/cxx/CIM/EMT_WSCC-9bus_IdealCS.cpp @@ -44,7 +44,7 @@ int main(int argc, char *argv[]) { // read original network topology String simNamePF = simName + "_PF"; Logger::setLogDir("logs/" + simNamePF); - CPS::CIM::Reader reader(simNamePF, Logger::Level::debug, Logger::Level::debug); + CPS::CIM::Reader reader(Logger::Level::debug, Logger::Level::off, Logger::Level::debug); SystemTopology systemPF = reader.loadCIM(60, filenames, Domain::SP, PhaseType::Single, CPS::GeneratorType::PVNode); systemPF.component("GEN1")->modifyPowerFlowBusType(CPS::PowerflowBusType::VD); @@ -70,7 +70,7 @@ int main(int argc, char *argv[]) { // ----- DYNAMIC SIMULATION ----- Logger::setLogDir("logs/"+simName); - CPS::CIM::Reader reader2(simName, Logger::Level::debug, Logger::Level::debug); + CPS::CIM::Reader reader2(Logger::Level::debug, Logger::Level::off, Logger::Level::debug); SystemTopology sys = reader2.loadCIM(60, filenames, Domain::EMT, PhaseType::ABC, CPS::GeneratorType::IdealCurrentSource); sys.initWithPowerflow(systemPF); diff --git a/dpsim/examples/cxx/CIM/EMT_WSCC-9bus_IdealVS.cpp b/dpsim/examples/cxx/CIM/EMT_WSCC-9bus_IdealVS.cpp index 91d036b73f..e508657ec8 100644 --- a/dpsim/examples/cxx/CIM/EMT_WSCC-9bus_IdealVS.cpp +++ b/dpsim/examples/cxx/CIM/EMT_WSCC-9bus_IdealVS.cpp @@ -44,7 +44,7 @@ int main(int argc, char *argv[]) { // read original network topology String simNamePF = simName + "_PF"; Logger::setLogDir("logs/" + simNamePF); - CPS::CIM::Reader reader(simNamePF, Logger::Level::debug, Logger::Level::debug); + CPS::CIM::Reader reader(Logger::Level::debug, Logger::Level::off, Logger::Level::debug); SystemTopology systemPF = reader.loadCIM(60, filenames, Domain::SP, PhaseType::Single, CPS::GeneratorType::PVNode); systemPF.component("GEN1")->modifyPowerFlowBusType(CPS::PowerflowBusType::VD); @@ -70,7 +70,7 @@ int main(int argc, char *argv[]) { // ----- DYNAMIC SIMULATION ----- Logger::setLogDir("logs/"+simName); - CPS::CIM::Reader reader2(simName, Logger::Level::debug, Logger::Level::debug); + CPS::CIM::Reader reader2(Logger::Level::debug, Logger::Level::off, Logger::Level::debug); SystemTopology sys = reader2.loadCIM(60, filenames, Domain::EMT, PhaseType::ABC, CPS::GeneratorType::IdealVoltageSource); sys.initWithPowerflow(systemPF); diff --git a/dpsim/examples/cxx/CIM/EMT_WSCC-9bus_VBR.cpp b/dpsim/examples/cxx/CIM/EMT_WSCC-9bus_VBR.cpp index c686614adf..90e1a5a1ed 100644 --- a/dpsim/examples/cxx/CIM/EMT_WSCC-9bus_VBR.cpp +++ b/dpsim/examples/cxx/CIM/EMT_WSCC-9bus_VBR.cpp @@ -47,7 +47,7 @@ int main(int argc, char *argv[]) { // read original network topology String simNamePF = simName + "_PF"; Logger::setLogDir("logs/" + simNamePF); - CPS::CIM::Reader reader(simNamePF, Logger::Level::debug, Logger::Level::debug); + CPS::CIM::Reader reader(Logger::Level::debug, Logger::Level::off, Logger::Level::debug); SystemTopology systemPF = reader.loadCIM(60, filenames, Domain::SP, PhaseType::Single, CPS::GeneratorType::PVNode); systemPF.component("GEN1")->modifyPowerFlowBusType(CPS::PowerflowBusType::VD); @@ -73,7 +73,7 @@ int main(int argc, char *argv[]) { // ----- DYNAMIC SIMULATION ----- Logger::setLogDir("logs/"+simName); - CPS::CIM::Reader reader2(simName, Logger::Level::debug, Logger::Level::debug); + CPS::CIM::Reader reader2(Logger::Level::debug, Logger::Level::off, Logger::Level::debug); SystemTopology sys = reader2.loadCIM(60, filenames, Domain::EMT, PhaseType::ABC, CPS::GeneratorType::FullOrderVBR); sys.initWithPowerflow(systemPF); diff --git a/dpsim/examples/cxx/CIM/EMT_WSCC9bus_SGReducedOrderVBR.cpp b/dpsim/examples/cxx/CIM/EMT_WSCC9bus_SGReducedOrderVBR.cpp index 95ceb78115..490ea50bcf 100644 --- a/dpsim/examples/cxx/CIM/EMT_WSCC9bus_SGReducedOrderVBR.cpp +++ b/dpsim/examples/cxx/CIM/EMT_WSCC9bus_SGReducedOrderVBR.cpp @@ -88,7 +88,7 @@ int main(int argc, char *argv[]) { // read original network topology String simNamePF = simName + "_PF"; Logger::setLogDir(logDirectory + "/" + simNamePF); - CPS::CIM::Reader reader(simNamePF, logLevel, logLevel); + CPS::CIM::Reader reader(logLevel, Logger::Level::off, logLevel); SystemTopology systemPF = reader.loadCIM(60, filenames, Domain::SP, PhaseType::Single, CPS::GeneratorType::PVNode); systemPF.component("GEN1")->modifyPowerFlowBusType(CPS::PowerflowBusType::VD); @@ -112,7 +112,7 @@ int main(int argc, char *argv[]) { // ----- DYNAMIC SIMULATION ----- Logger::setLogDir(logDirectory + "/" + simName); - CPS::CIM::Reader reader2(simName, logLevel, logLevel); + CPS::CIM::Reader reader2(logLevel, Logger::Level::off, logLevel); SystemTopology sys; if (sgType=="3") sys = reader2.loadCIM(60, filenames, Domain::EMT, PhaseType::ABC, CPS::GeneratorType::SG3OrderVBR); diff --git a/dpsim/examples/cxx/CIM/IEEE_LV_PowerFlowTest.cpp b/dpsim/examples/cxx/CIM/IEEE_LV_PowerFlowTest.cpp index d5ffef0dbe..922ca05d23 100644 --- a/dpsim/examples/cxx/CIM/IEEE_LV_PowerFlowTest.cpp +++ b/dpsim/examples/cxx/CIM/IEEE_LV_PowerFlowTest.cpp @@ -37,7 +37,7 @@ int main(int argc, char** argv){ String simName = "IEEE_EU_LV_reduced"; CPS::Real system_freq = 50; - CIM::Reader reader(simName, Logger::Level::info, Logger::Level::off); + CIM::Reader reader(Logger::Level::info, Logger::Level::off, Logger::Level::off); SystemTopology system = reader.loadCIM(system_freq, filenames, CPS::Domain::SP); auto logger = DPsim::DataLogger::make(simName); diff --git a/dpsim/examples/cxx/CIM/PF_CIGRE_MV_withDG.cpp b/dpsim/examples/cxx/CIM/PF_CIGRE_MV_withDG.cpp index 2a285d38f1..a9071a7a6c 100644 --- a/dpsim/examples/cxx/CIM/PF_CIGRE_MV_withDG.cpp +++ b/dpsim/examples/cxx/CIM/PF_CIGRE_MV_withDG.cpp @@ -39,7 +39,7 @@ int main(int argc, char** argv){ Logger::setLogDir("logs/" + simName); // read original network topology - CIM::Reader reader(simName, Logger::Level::debug, Logger::Level::debug); + CIM::Reader reader(Logger::Level::debug, Logger::Level::off, Logger::Level::debug); SystemTopology system = reader.loadCIM(scenario.systemFrequency, filenames, Domain::SP); Examples::Grids::CIGREMV::addInvertersToCIGREMV(system, scenario, Domain::SP); diff --git a/dpsim/examples/cxx/CIM/SP_WSCC-9bus_CIM_Dyn_Switch.cpp b/dpsim/examples/cxx/CIM/SP_WSCC-9bus_CIM_Dyn_Switch.cpp index 62b8759953..78565c2e0c 100644 --- a/dpsim/examples/cxx/CIM/SP_WSCC-9bus_CIM_Dyn_Switch.cpp +++ b/dpsim/examples/cxx/CIM/SP_WSCC-9bus_CIM_Dyn_Switch.cpp @@ -33,7 +33,7 @@ int main(int argc, char *argv[]) { String simName = "SP_WSCC-9bus_dyn_switch"; Logger::setLogDir("logs/"+simName); - CPS::CIM::Reader reader(simName, Logger::Level::debug, Logger::Level::info); + CPS::CIM::Reader reader(Logger::Level::debug, Logger::Level::off, Logger::Level::info); SystemTopology sys = reader.loadCIM(60, filenames, Domain::SP, PhaseType::Single, CPS::GeneratorType::TransientStability); // Extend topology with switch diff --git a/dpsim/examples/cxx/CIM/SP_WSCC9bus_SGReducedOrderVBR.cpp b/dpsim/examples/cxx/CIM/SP_WSCC9bus_SGReducedOrderVBR.cpp index 655749b08a..25ab577cff 100644 --- a/dpsim/examples/cxx/CIM/SP_WSCC9bus_SGReducedOrderVBR.cpp +++ b/dpsim/examples/cxx/CIM/SP_WSCC9bus_SGReducedOrderVBR.cpp @@ -85,7 +85,7 @@ int main(int argc, char *argv[]) { // read original network topology String simNamePF = simName + "_PF"; Logger::setLogDir(logDirectory + "/" + simNamePF); - CPS::CIM::Reader reader(simNamePF, logLevel, logLevel); + CPS::CIM::Reader reader(logLevel, Logger::Level::off, logLevel); SystemTopology systemPF = reader.loadCIM(60, filenames, Domain::SP, PhaseType::Single, CPS::GeneratorType::PVNode); systemPF.component("GEN1")->modifyPowerFlowBusType(CPS::PowerflowBusType::VD); @@ -109,7 +109,7 @@ int main(int argc, char *argv[]) { // ----- DYNAMIC SIMULATION ----- Logger::setLogDir(logDirectory + "/" + simName); - CPS::CIM::Reader reader2(simName, logLevel, logLevel); + CPS::CIM::Reader reader2(logLevel, Logger::Level::off, logLevel); SystemTopology sys; if (sgType=="3") sys = reader2.loadCIM(60, filenames, Domain::SP, PhaseType::Single, CPS::GeneratorType::SG3OrderVBR); diff --git a/dpsim/examples/cxx/CIM/Slack_TrafoTapChanger_Load.cpp b/dpsim/examples/cxx/CIM/Slack_TrafoTapChanger_Load.cpp index bc22228600..4a818f2e3f 100644 --- a/dpsim/examples/cxx/CIM/Slack_TrafoTapChanger_Load.cpp +++ b/dpsim/examples/cxx/CIM/Slack_TrafoTapChanger_Load.cpp @@ -37,7 +37,7 @@ int main(int argc, char** argv){ String simName = "Slack_TrafoTapChanger_Load"; CPS::Real system_freq = 50; - CIM::Reader reader(simName, Logger::Level::info, Logger::Level::debug); + CIM::Reader reader(Logger::Level::info, Logger::Level::off, Logger::Level::debug); SystemTopology system = reader.loadCIM(system_freq, filenames, CPS::Domain::SP); auto logger = DPsim::DataLogger::make(simName); diff --git a/dpsim/examples/cxx/CIM/Slack_Trafo_Load.cpp b/dpsim/examples/cxx/CIM/Slack_Trafo_Load.cpp index 865c1df0fb..e1fb67fc93 100644 --- a/dpsim/examples/cxx/CIM/Slack_Trafo_Load.cpp +++ b/dpsim/examples/cxx/CIM/Slack_Trafo_Load.cpp @@ -37,7 +37,7 @@ int main(int argc, char** argv){ String simName = "Slack_Trafo_Load"; CPS::Real system_freq = 50; - CIM::Reader reader(simName, Logger::Level::info, Logger::Level::debug); + CIM::Reader reader(Logger::Level::info, Logger::Level::off, Logger::Level::debug); SystemTopology system = reader.loadCIM(system_freq, filenames, CPS::Domain::SP); auto logger = DPsim::DataLogger::make(simName); diff --git a/dpsim/examples/cxx/CIM/WSCC-9bus_CIM.cpp b/dpsim/examples/cxx/CIM/WSCC-9bus_CIM.cpp index 386e159442..cf988d3f73 100644 --- a/dpsim/examples/cxx/CIM/WSCC-9bus_CIM.cpp +++ b/dpsim/examples/cxx/CIM/WSCC-9bus_CIM.cpp @@ -44,7 +44,7 @@ int main(int argc, char *argv[]) { // read original network topology String simNamePF = simName + "_PF"; Logger::setLogDir("logs/" + simNamePF); - CPS::CIM::Reader reader(simNamePF, Logger::Level::debug, Logger::Level::debug); + CPS::CIM::Reader reader(Logger::Level::debug, Logger::Level::off, Logger::Level::debug); SystemTopology systemPF = reader.loadCIM(60, filenames, Domain::SP, PhaseType::Single, CPS::GeneratorType::PVNode); systemPF.component("GEN1")->modifyPowerFlowBusType(CPS::PowerflowBusType::VD); @@ -70,7 +70,7 @@ int main(int argc, char *argv[]) { // ----- DYNAMIC SIMULATION ----- Logger::setLogDir("logs/"+simName); - CPS::CIM::Reader reader2(simName, Logger::Level::debug, Logger::Level::off); + CPS::CIM::Reader reader2(Logger::Level::debug, Logger::Level::off, Logger::Level::off); SystemTopology sys = reader2.loadCIM(60, filenames, Domain::DP, PhaseType::Single, CPS::GeneratorType::IdealVoltageSource); sys.initWithPowerflow(systemPF); diff --git a/dpsim/examples/cxx/CIM/WSCC-9bus_CIM_Dyn.cpp b/dpsim/examples/cxx/CIM/WSCC-9bus_CIM_Dyn.cpp index 692781d74e..e9792441c1 100644 --- a/dpsim/examples/cxx/CIM/WSCC-9bus_CIM_Dyn.cpp +++ b/dpsim/examples/cxx/CIM/WSCC-9bus_CIM_Dyn.cpp @@ -33,7 +33,7 @@ int main(int argc, char *argv[]) { String simName = "WSCC-9bus_dyn"; Logger::setLogDir("logs/"+simName); - CPS::CIM::Reader reader(simName, Logger::Level::debug, Logger::Level::debug); + CPS::CIM::Reader reader(Logger::Level::debug, Logger::Level::off, Logger::Level::debug); SystemTopology sys = reader.loadCIM(60, filenames, Domain::DP, PhaseType::Single, CPS::GeneratorType::TransientStability); // Logging diff --git a/dpsim/examples/cxx/CIM/WSCC-9bus_CIM_Dyn_Switch.cpp b/dpsim/examples/cxx/CIM/WSCC-9bus_CIM_Dyn_Switch.cpp index dda9618cea..e544c804e0 100644 --- a/dpsim/examples/cxx/CIM/WSCC-9bus_CIM_Dyn_Switch.cpp +++ b/dpsim/examples/cxx/CIM/WSCC-9bus_CIM_Dyn_Switch.cpp @@ -33,7 +33,7 @@ int main(int argc, char *argv[]) { String simName = "WSCC-9bus_dyn_switch"; Logger::setLogDir("logs/"+simName); - CPS::CIM::Reader reader(simName, Logger::Level::debug, Logger::Level::info); + CPS::CIM::Reader reader(Logger::Level::debug, Logger::Level::off, Logger::Level::info); SystemTopology sys = reader.loadCIM(60, filenames, Domain::DP, PhaseType::Single, CPS::GeneratorType::TransientStability); // Extend topology with switch diff --git a/dpsim/examples/cxx/CIM/WSCC_9bus_mult_coupled.cpp b/dpsim/examples/cxx/CIM/WSCC_9bus_mult_coupled.cpp index 1d63a2fb87..8697cc118b 100644 --- a/dpsim/examples/cxx/CIM/WSCC_9bus_mult_coupled.cpp +++ b/dpsim/examples/cxx/CIM/WSCC_9bus_mult_coupled.cpp @@ -70,7 +70,7 @@ void simulateCoupled(std::list filenames, CommandLineArgs& args, Int c + "_" + std::to_string(threads) + "_" + std::to_string(seq); Logger::setLogDir("logs/"+simName); - CIM::Reader reader(simName, args.logLevel, args.logLevel); + CIM::Reader reader(args.logLevel, Logger::Level::off, args.logLevel); SystemTopology sys = reader.loadCIM(60, filenames, Domain::DP, PhaseType::Single, CPS::GeneratorType::IdealVoltageSource); if (copies > 0) @@ -134,6 +134,6 @@ int main(int argc, char *argv[]) { std::cout << "Simulate with " << numCopies << " copies, " << numThreads << " threads, sequence number " << numSeq << std::endl; - + simulateCoupled(filenames, args, numCopies, numThreads, numSeq); } diff --git a/dpsim/examples/cxx/CIM/WSCC_9bus_mult_decoupled.cpp b/dpsim/examples/cxx/CIM/WSCC_9bus_mult_decoupled.cpp index 617f3eb540..c1a4053852 100644 --- a/dpsim/examples/cxx/CIM/WSCC_9bus_mult_decoupled.cpp +++ b/dpsim/examples/cxx/CIM/WSCC_9bus_mult_decoupled.cpp @@ -51,7 +51,7 @@ void simulateDecoupled(std::list filenames, Int copies, Int threads, I + "_" + std::to_string(threads) + "_" + std::to_string(seq); Logger::setLogDir("logs/"+simName); - CIM::Reader reader(simName, Logger::Level::off, Logger::Level::info); + CIM::Reader reader(Logger::Level::off, Logger::Level::off, Logger::Level::info); SystemTopology sys = reader.loadCIM(60, filenames, Domain::DP, PhaseType::Single, CPS::GeneratorType::IdealVoltageSource); if (copies > 0) diff --git a/dpsim/examples/cxx/CIM/WSCC_9bus_mult_diakoptics.cpp b/dpsim/examples/cxx/CIM/WSCC_9bus_mult_diakoptics.cpp index 71ad8b9f6e..af6da12d0b 100644 --- a/dpsim/examples/cxx/CIM/WSCC_9bus_mult_diakoptics.cpp +++ b/dpsim/examples/cxx/CIM/WSCC_9bus_mult_diakoptics.cpp @@ -67,7 +67,7 @@ void simulateDiakoptics(std::list filenames, + "_" + std::to_string(seq); Logger::setLogDir("logs/"+simName); - CIM::Reader reader(simName, Logger::Level::off, Logger::Level::off); + CIM::Reader reader(Logger::Level::off, Logger::Level::off, Logger::Level::off); SystemTopology sys = reader.loadCIM(60, filenames, Domain::DP, PhaseType::Single, CPS::GeneratorType::IdealVoltageSource); if (copies > 0) diff --git a/dpsim/examples/cxx/RealTime/RT_CIGRE_MV_PowerFlowTest.cpp b/dpsim/examples/cxx/RealTime/RT_CIGRE_MV_PowerFlowTest.cpp index 4757fdd36b..07f4a1c8d3 100644 --- a/dpsim/examples/cxx/RealTime/RT_CIGRE_MV_PowerFlowTest.cpp +++ b/dpsim/examples/cxx/RealTime/RT_CIGRE_MV_PowerFlowTest.cpp @@ -37,7 +37,7 @@ int main(int argc, char** argv){ String simName = "RT_CIGRE-MV-NoTap"; CPS::Real system_freq = 50; - CIM::Reader reader(simName, Logger::Level::debug, Logger::Level::off); + CIM::Reader reader(Logger::Level::debug, Logger::Level::off, Logger::Level::off); SystemTopology system = reader.loadCIM(system_freq, filenames, CPS::Domain::SP); auto logger = DPsim::DataLogger::make(simName); diff --git a/dpsim/examples/cxx/cim_graphviz/cimviz.cpp b/dpsim/examples/cxx/cim_graphviz/cimviz.cpp index c181159bbb..0c34b53035 100644 --- a/dpsim/examples/cxx/cim_graphviz/cimviz.cpp +++ b/dpsim/examples/cxx/cim_graphviz/cimviz.cpp @@ -54,7 +54,7 @@ int main(int argc, char *argv[]) { signal(SIGINT, intr); #endif - Reader reader("cimviz", Logger::Level::info); + Reader reader(Logger::Level::info); std::list filenames; for (i = 0; gvc->input_filenames[i]; i++) { diff --git a/dpsim/src/pybind/main.cpp b/dpsim/src/pybind/main.cpp index 20df706bf7..c5e7262888 100644 --- a/dpsim/src/pybind/main.cpp +++ b/dpsim/src/pybind/main.cpp @@ -246,7 +246,7 @@ PYBIND11_MODULE(dpsimpy, m) { #ifdef WITH_CIM py::class_(m, "CIMReader") - .def(py::init(), "name"_a, "loglevel"_a = CPS::Logger::Level::info, "comploglevel"_a = CPS::Logger::Level::off) + .def(py::init(), "loglevel"_a = CPS::Logger::Level::info, "cliLevel"_a = CPS::Logger::Level::off, "comploglevel"_a = CPS::Logger::Level::off) .def("loadCIM", (CPS::SystemTopology (CPS::CIM::Reader::*)(CPS::Real, const std::list &, CPS::Domain, CPS::PhaseType, CPS::GeneratorType)) &CPS::CIM::Reader::loadCIM); #endif diff --git a/examples/Notebooks/Grids/CIGRE_MV_pf-interactive-dpsimpy.ipynb b/examples/Notebooks/Grids/CIGRE_MV_pf-interactive-dpsimpy.ipynb index d57879f5d2..b8394811f0 100644 --- a/examples/Notebooks/Grids/CIGRE_MV_pf-interactive-dpsimpy.ipynb +++ b/examples/Notebooks/Grids/CIGRE_MV_pf-interactive-dpsimpy.ipynb @@ -54,7 +54,7 @@ "outputs": [], "source": [ "name = 'CIGRE_MV'\n", - "reader = dpsimpy.CIMReader(name)\n", + "reader = dpsimpy.CIMReader()\n", "system = reader.loadCIM(50, files, dpsimpy.Domain.SP, dpsimpy.PhaseType.Single, dpsimpy.GeneratorType.PVNode)" ] }, diff --git a/examples/Notebooks/Grids/CIGRE_MV_powerflow-dpsimpy.ipynb b/examples/Notebooks/Grids/CIGRE_MV_powerflow-dpsimpy.ipynb index 8f24793c3f..9acfc41577 100644 --- a/examples/Notebooks/Grids/CIGRE_MV_powerflow-dpsimpy.ipynb +++ b/examples/Notebooks/Grids/CIGRE_MV_powerflow-dpsimpy.ipynb @@ -57,7 +57,7 @@ "outputs": [], "source": [ "name = 'CIGRE_MV'\n", - "reader = dpsimpy.CIMReader(name)\n", + "reader = dpsimpy.CIMReader()\n", "system = reader.loadCIM(50, files, dpsimpy.Domain.SP, dpsimpy.PhaseType.Single, dpsimpy.GeneratorType.PVNode)\n", "system" ] diff --git a/examples/Notebooks/Grids/CIGRE_MV_powerflow_profiles-dpsimpy.ipynb b/examples/Notebooks/Grids/CIGRE_MV_powerflow_profiles-dpsimpy.ipynb index c802d591d1..6ad63d1bef 100644 --- a/examples/Notebooks/Grids/CIGRE_MV_powerflow_profiles-dpsimpy.ipynb +++ b/examples/Notebooks/Grids/CIGRE_MV_powerflow_profiles-dpsimpy.ipynb @@ -89,7 +89,7 @@ "outputs": [], "source": [ "name = 'CIGRE-MV-Profiles'\n", - "reader = dpsimpy.CIMReader(name)\n", + "reader = dpsimpy.CIMReader()\n", "system = reader.loadCIM(50, files, dpsimpy.Domain.SP, dpsimpy.PhaseType.Single, dpsimpy.GeneratorType.PVNode)" ] }, diff --git a/examples/Notebooks/Grids/DP_CIGRE_MV_withDG.ipynb b/examples/Notebooks/Grids/DP_CIGRE_MV_withDG.ipynb index 2357f2c5ea..6aa2381fa0 100644 --- a/examples/Notebooks/Grids/DP_CIGRE_MV_withDG.ipynb +++ b/examples/Notebooks/Grids/DP_CIGRE_MV_withDG.ipynb @@ -1,6 +1,7 @@ { "cells": [ { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -8,6 +9,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -64,6 +66,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -77,7 +80,7 @@ "outputs": [], "source": [ "dpsimpy.Logger.set_log_dir('logs/' + sim_name_pf)\n", - "reader = dpsimpy.CIMReader(sim_name_pf, dpsimpy.LogLevel.debug, dpsimpy.LogLevel.debug)\n", + "reader = dpsimpy.CIMReader(dpsimpy.LogLevel.debug, dpsimpy.LogLevel.off, dpsimpy.LogLevel.debug)\n", "system_pf = reader.loadCIM(50, files, dpsimpy.Domain.SP, dpsimpy.PhaseType.Single, dpsimpy.GeneratorType.PVNode)\n", "pv_active_power = 50e3 * int(int(4319.1e3 / 50e3) / 9)\n", "pv_reactive_power = np.sqrt(np.power(pv_active_power / 1, 2) - np.power(pv_active_power, 2))\n", @@ -115,6 +118,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -128,7 +132,7 @@ "outputs": [], "source": [ "dpsimpy.Logger.set_log_dir('logs/' + sim_name)\n", - "reader2 = dpsimpy.CIMReader(sim_name, dpsimpy.LogLevel.info, dpsimpy.LogLevel.debug)\n", + "reader2 = dpsimpy.CIMReader(dpsimpy.LogLevel.info, dpsimpy.LogLevel.off, dpsimpy.LogLevel.debug)\n", "system_dp = reader2.loadCIM(50, files, dpsimpy.Domain.DP, dpsimpy.PhaseType.Single, dpsimpy.GeneratorType.PVNode)\n", "\n", "pv_active_power = 50e3 * int(int(4319.1e3 * 1 / 50e3) / 9)\n", @@ -203,6 +207,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -210,6 +215,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -231,6 +237,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -252,6 +259,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -269,6 +277,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -289,6 +298,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -310,6 +320,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -328,6 +339,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -346,6 +358,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -353,6 +366,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -374,6 +388,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -395,6 +410,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -413,6 +429,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -431,6 +448,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -452,6 +470,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -470,6 +489,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -488,6 +508,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -509,6 +530,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -527,6 +549,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -545,6 +568,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -566,6 +590,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -587,6 +612,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -606,6 +632,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ diff --git a/examples/Notebooks/Grids/DP_CIGRE_MV_withDG_withLoadStep.ipynb b/examples/Notebooks/Grids/DP_CIGRE_MV_withDG_withLoadStep.ipynb index 62b19dcb06..41b0ef2dbf 100644 --- a/examples/Notebooks/Grids/DP_CIGRE_MV_withDG_withLoadStep.ipynb +++ b/examples/Notebooks/Grids/DP_CIGRE_MV_withDG_withLoadStep.ipynb @@ -1,6 +1,7 @@ { "cells": [ { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -56,6 +57,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -69,7 +71,7 @@ "outputs": [], "source": [ "dpsimpy.Logger.set_log_dir('logs/' + sim_name_pf)\n", - "reader = dpsimpy.CIMReader(sim_name_pf, dpsimpy.LogLevel.debug, dpsimpy.LogLevel.debug)\n", + "reader = dpsimpy.CIMReader(dpsimpy.LogLevel.debug, dpsimpy.LogLevel.off, dpsimpy.LogLevel.debug)\n", "system_pf = reader.loadCIM(50, files, dpsimpy.Domain.SP, dpsimpy.PhaseType.Single, dpsimpy.GeneratorType.PVNode)\n", "pv_active_power = 50e3 * int(int(4319.1e3 / 50e3) / 9)\n", "pv_reactive_power = np.sqrt(np.power(pv_active_power / 1, 2) - np.power(pv_active_power, 2))\n", @@ -107,6 +109,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -120,7 +123,7 @@ "outputs": [], "source": [ "dpsimpy.Logger.set_log_dir('logs/' + sim_name)\n", - "reader2 = dpsimpy.CIMReader(sim_name, dpsimpy.LogLevel.info, dpsimpy.LogLevel.debug)\n", + "reader2 = dpsimpy.CIMReader(dpsimpy.LogLevel.info, dpsimpy.LogLevel.off, dpsimpy.LogLevel.debug)\n", "system_dp = reader2.loadCIM(50, files, dpsimpy.Domain.DP, dpsimpy.PhaseType.Single, dpsimpy.GeneratorType.PVNode)\n", "\n", "pv_active_power = 50e3 * int(int(4319.1e3 / 50e3) / 9)\n", @@ -208,6 +211,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -215,6 +219,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -235,6 +240,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -256,6 +262,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -276,6 +283,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -297,6 +305,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -315,6 +324,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -338,6 +348,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -364,6 +375,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -386,6 +398,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -411,6 +424,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -418,6 +432,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -439,6 +454,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -460,6 +476,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -478,6 +495,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -496,6 +514,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -517,6 +536,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -535,6 +555,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -553,6 +574,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -574,6 +596,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -592,6 +615,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -610,6 +634,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -631,6 +656,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -652,6 +678,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -671,6 +698,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ diff --git a/examples/Notebooks/Grids/DP_CIGRE_MV_withoutDG.ipynb b/examples/Notebooks/Grids/DP_CIGRE_MV_withoutDG.ipynb index d550c3f390..c0f90eaca6 100644 --- a/examples/Notebooks/Grids/DP_CIGRE_MV_withoutDG.ipynb +++ b/examples/Notebooks/Grids/DP_CIGRE_MV_withoutDG.ipynb @@ -1,6 +1,7 @@ { "cells": [ { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -8,6 +9,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -72,6 +74,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -85,7 +88,7 @@ "outputs": [], "source": [ "dpsimpy.Logger.set_log_dir('logs/' + sim_name_pf)\n", - "reader = dpsimpy.CIMReader(sim_name_pf, dpsimpy.LogLevel.debug, dpsimpy.LogLevel.debug)\n", + "reader = dpsimpy.CIMReader(dpsimpy.LogLevel.debug, dpsimpy.LogLevel.off, dpsimpy.LogLevel.debug)\n", "system_pf = reader.loadCIM(50, files, dpsimpy.Domain.SP, dpsimpy.PhaseType.Single, dpsimpy.GeneratorType.PVNode)\n", "\n", "logger_pf = dpsimpy.Logger(sim_name_pf)\n", @@ -106,6 +109,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -119,7 +123,7 @@ "outputs": [], "source": [ "dpsimpy.Logger.set_log_dir('logs/' + sim_name)\n", - "reader2 = dpsimpy.CIMReader(sim_name, dpsimpy.LogLevel.info, dpsimpy.LogLevel.debug)\n", + "reader2 = dpsimpy.CIMReader(dpsimpy.LogLevel.info, dpsimpy.LogLevel.off, dpsimpy.LogLevel.debug)\n", "system_dp = reader2.loadCIM(50, files, dpsimpy.Domain.DP, dpsimpy.PhaseType.Single, dpsimpy.GeneratorType.PVNode)\n", "system_dp.init_with_powerflow(system_pf)\n", "\n", @@ -149,6 +153,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -156,6 +161,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -176,6 +182,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -197,6 +204,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -214,6 +222,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -221,6 +230,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -241,6 +251,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -248,6 +259,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -269,6 +281,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -287,6 +300,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -305,6 +319,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -327,6 +342,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -345,6 +361,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -363,6 +380,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -380,6 +398,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -397,6 +416,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ diff --git a/examples/Notebooks/Grids/DP_WSCC9bus_SGTrStab.ipynb b/examples/Notebooks/Grids/DP_WSCC9bus_SGTrStab.ipynb index 22df4fdce6..703a7de9bc 100644 --- a/examples/Notebooks/Grids/DP_WSCC9bus_SGTrStab.ipynb +++ b/examples/Notebooks/Grids/DP_WSCC9bus_SGTrStab.ipynb @@ -1,6 +1,7 @@ { "cells": [ { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -55,6 +56,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -68,7 +70,7 @@ "outputs": [], "source": [ "dpsimpy.Logger.set_log_dir('logs/' + sim_name)\n", - "reader = dpsimpy.CIMReader(sim_name, dpsimpy.LogLevel.debug, dpsimpy.LogLevel.debug)\n", + "reader = dpsimpy.CIMReader(dpsimpy.LogLevel.debug, dpsimpy.LogLevel.off, dpsimpy.LogLevel.debug)\n", "system = reader.loadCIM(60, files, dpsimpy.Domain.DP, dpsimpy.PhaseType.Single, dpsimpy.GeneratorType.TransientStability)\n", "\n", "logger = dpsimpy.Logger(sim_name)\n", @@ -91,6 +93,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -112,6 +115,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -131,6 +135,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -148,6 +153,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -165,6 +171,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -187,6 +194,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -207,6 +215,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -224,6 +233,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -306,7 +316,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.13" + "version": "3.10.11" } }, "nbformat": 4, diff --git a/examples/Notebooks/Grids/DP_WSCC9bus_SGTrStab_Switch.ipynb b/examples/Notebooks/Grids/DP_WSCC9bus_SGTrStab_Switch.ipynb index 9fc74088e8..085ee0f08c 100644 --- a/examples/Notebooks/Grids/DP_WSCC9bus_SGTrStab_Switch.ipynb +++ b/examples/Notebooks/Grids/DP_WSCC9bus_SGTrStab_Switch.ipynb @@ -1,6 +1,7 @@ { "cells": [ { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -55,6 +56,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -68,7 +70,7 @@ "outputs": [], "source": [ "dpsimpy.Logger.set_log_dir('logs/' + sim_name)\n", - "reader = dpsimpy.CIMReader(sim_name, dpsimpy.LogLevel.debug, dpsimpy.LogLevel.debug)\n", + "reader = dpsimpy.CIMReader(dpsimpy.LogLevel.debug, dpsimpy.LogLevel.off, dpsimpy.LogLevel.debug)\n", "system = reader.loadCIM(60, files, dpsimpy.Domain.DP, dpsimpy.PhaseType.Single, dpsimpy.GeneratorType.TransientStability)\n", "\n", "# Extend topology with switch\n", @@ -111,6 +113,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -133,6 +136,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -153,6 +157,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -184,6 +189,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -206,6 +212,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ diff --git a/examples/Notebooks/Grids/DP_WSCC9bus_SGVoltageSource.ipynb b/examples/Notebooks/Grids/DP_WSCC9bus_SGVoltageSource.ipynb index 6747701970..3341dc4f89 100644 --- a/examples/Notebooks/Grids/DP_WSCC9bus_SGVoltageSource.ipynb +++ b/examples/Notebooks/Grids/DP_WSCC9bus_SGVoltageSource.ipynb @@ -1,6 +1,7 @@ { "cells": [ { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -55,6 +56,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -62,6 +64,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -75,7 +78,7 @@ "outputs": [], "source": [ "dpsimpy.Logger.set_log_dir('logs/' + sim_name)\n", - "reader = dpsimpy.CIMReader(sim_name, dpsimpy.LogLevel.debug, dpsimpy.LogLevel.debug)\n", + "reader = dpsimpy.CIMReader(dpsimpy.LogLevel.debug, dpsimpy.LogLevel.off, dpsimpy.LogLevel.debug)\n", "system = reader.loadCIM(60, files, dpsimpy.Domain.DP, dpsimpy.PhaseType.Single, dpsimpy.GeneratorType.IdealVoltageSource)\n", "\n", "logger = dpsimpy.Logger(sim_name)\n", @@ -109,6 +112,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -128,6 +132,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -145,6 +150,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -162,6 +168,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -184,6 +191,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -204,6 +212,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -223,6 +232,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -240,6 +250,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -276,6 +287,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ diff --git a/examples/Notebooks/Grids/EMT_CIGRE_MV_withDG.ipynb b/examples/Notebooks/Grids/EMT_CIGRE_MV_withDG.ipynb index aae5c82861..9cc49564db 100644 --- a/examples/Notebooks/Grids/EMT_CIGRE_MV_withDG.ipynb +++ b/examples/Notebooks/Grids/EMT_CIGRE_MV_withDG.ipynb @@ -1,6 +1,7 @@ { "cells": [ { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -8,6 +9,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -71,6 +73,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -84,7 +87,7 @@ "outputs": [], "source": [ "dpsimpy.Logger.set_log_dir('logs/' + sim_name_pf)\n", - "reader = dpsimpy.CIMReader(sim_name_pf, dpsimpy.LogLevel.debug, dpsimpy.LogLevel.debug)\n", + "reader = dpsimpy.CIMReader(dpsimpy.LogLevel.debug, dpsimpy.LogLevel.off, dpsimpy.LogLevel.debug)\n", "system_pf = reader.loadCIM(50, files, dpsimpy.Domain.SP, dpsimpy.PhaseType.Single, dpsimpy.GeneratorType.PVNode)\n", "pv_active_power = 50e3 * int(int(4319.1e3 / 50e3) / 9)\n", "pv_reactive_power = np.sqrt(np.power(pv_active_power / 1, 2) - np.power(pv_active_power, 2))\n", @@ -122,6 +125,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -135,7 +139,7 @@ "outputs": [], "source": [ "dpsimpy.Logger.set_log_dir('logs/' + sim_name)\n", - "reader2 = dpsimpy.CIMReader(sim_name, dpsimpy.LogLevel.info, dpsimpy.LogLevel.debug)\n", + "reader2 = dpsimpy.CIMReader(dpsimpy.LogLevel.info, dpsimpy.LogLevel.off, dpsimpy.LogLevel.debug)\n", "system_emt = reader2.loadCIM(50, files, dpsimpy.Domain.EMT, dpsimpy.PhaseType.ABC, dpsimpy.GeneratorType.NONE)\n", "\n", "pv_active_power = 50e3 * int(int(4319.1e3 / 50e3) / 9)\n", @@ -210,6 +214,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -217,6 +222,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -240,6 +246,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -261,6 +268,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -278,6 +286,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -285,6 +294,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -305,6 +315,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -312,6 +323,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -337,6 +349,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -355,6 +368,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -373,6 +387,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -380,6 +395,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -401,6 +417,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -422,6 +439,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -440,6 +458,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -458,6 +477,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -479,6 +499,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -497,6 +518,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -515,6 +537,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -536,6 +559,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -554,6 +578,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -572,6 +597,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -596,6 +622,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -616,6 +643,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -635,6 +663,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -673,7 +702,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.12" + "version": "3.10.11" }, "tests": { "skip": false diff --git a/examples/Notebooks/Grids/EMT_CIGRE_MV_withDG_withLoadStep.ipynb b/examples/Notebooks/Grids/EMT_CIGRE_MV_withDG_withLoadStep.ipynb index 8cbdd1874e..26846f16bb 100644 --- a/examples/Notebooks/Grids/EMT_CIGRE_MV_withDG_withLoadStep.ipynb +++ b/examples/Notebooks/Grids/EMT_CIGRE_MV_withDG_withLoadStep.ipynb @@ -1,6 +1,7 @@ { "cells": [ { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -8,6 +9,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -71,6 +73,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -84,7 +87,7 @@ "outputs": [], "source": [ "dpsimpy.Logger.set_log_dir('logs/' + sim_name_pf)\n", - "reader = dpsimpy.CIMReader(sim_name_pf, dpsimpy.LogLevel.debug, dpsimpy.LogLevel.debug)\n", + "reader = dpsimpy.CIMReader(dpsimpy.LogLevel.debug, dpsimpy.LogLevel.off, dpsimpy.LogLevel.debug)\n", "system_pf = reader.loadCIM(50, files, dpsimpy.Domain.SP, dpsimpy.PhaseType.Single, dpsimpy.GeneratorType.PVNode)\n", "pv_active_power = 50e3 * int(int(4319.1e3 / 50e3) / 9)\n", "pv_reactive_power = np.sqrt(np.power(pv_active_power / 1, 2) - np.power(pv_active_power, 2))\n", @@ -122,6 +125,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -135,7 +139,7 @@ "outputs": [], "source": [ "dpsimpy.Logger.set_log_dir('logs/' + sim_name)\n", - "reader2 = dpsimpy.CIMReader(sim_name, dpsimpy.LogLevel.info, dpsimpy.LogLevel.debug)\n", + "reader2 = dpsimpy.CIMReader(dpsimpy.LogLevel.info, dpsimpy.LogLevel.off, dpsimpy.LogLevel.debug)\n", "system_emt = reader2.loadCIM(50, files, dpsimpy.Domain.EMT, dpsimpy.PhaseType.ABC, dpsimpy.GeneratorType.NONE)\n", "\n", "pv_active_power = 50e3 * int(int(4319.1e3 / 50e3) / 9)\n", @@ -223,6 +227,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -230,6 +235,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -250,6 +256,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -271,6 +278,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -291,6 +299,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -298,6 +307,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -319,6 +329,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ diff --git a/examples/Notebooks/Grids/EMT_CIGRE_MV_withoutDG.ipynb b/examples/Notebooks/Grids/EMT_CIGRE_MV_withoutDG.ipynb index 0a415077f8..39ae46ed57 100644 --- a/examples/Notebooks/Grids/EMT_CIGRE_MV_withoutDG.ipynb +++ b/examples/Notebooks/Grids/EMT_CIGRE_MV_withoutDG.ipynb @@ -1,6 +1,7 @@ { "cells": [ { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -8,6 +9,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -71,6 +73,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -84,7 +87,7 @@ "outputs": [], "source": [ "dpsimpy.Logger.set_log_dir('logs/' + sim_name_pf)\n", - "reader = dpsimpy.CIMReader(sim_name_pf, dpsimpy.LogLevel.debug, dpsimpy.LogLevel.debug)\n", + "reader = dpsimpy.CIMReader(dpsimpy.LogLevel.debug, dpsimpy.LogLevel.off, dpsimpy.LogLevel.debug)\n", "system_pf = reader.loadCIM(50, files, dpsimpy.Domain.SP, dpsimpy.PhaseType.Single, dpsimpy.GeneratorType.PVNode)\n", "\n", "logger_pf = dpsimpy.Logger(sim_name_pf)\n", @@ -105,6 +108,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -118,7 +122,7 @@ "outputs": [], "source": [ "dpsimpy.Logger.set_log_dir('logs/' + sim_name)\n", - "reader2 = dpsimpy.CIMReader(sim_name, dpsimpy.LogLevel.info, dpsimpy.LogLevel.debug)\n", + "reader2 = dpsimpy.CIMReader(dpsimpy.LogLevel.info, dpsimpy.LogLevel.off, dpsimpy.LogLevel.debug)\n", "system_emt = reader2.loadCIM(50, files, dpsimpy.Domain.EMT, dpsimpy.PhaseType.ABC, dpsimpy.GeneratorType.NONE)\n", "\n", "system_emt.init_with_powerflow(system_pf)\n", @@ -149,6 +153,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -156,6 +161,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -176,6 +182,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -197,6 +204,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -204,6 +212,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -224,6 +233,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -247,6 +257,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -265,6 +276,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -283,6 +295,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -305,6 +318,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -323,6 +337,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -341,6 +356,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -375,6 +391,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -392,6 +409,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -409,6 +427,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -431,6 +450,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -449,6 +469,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ diff --git a/examples/Notebooks/Grids/IEEE_LV_powerflow.ipynb b/examples/Notebooks/Grids/IEEE_LV_powerflow.ipynb index 487c42067a..f24343ccf6 100644 --- a/examples/Notebooks/Grids/IEEE_LV_powerflow.ipynb +++ b/examples/Notebooks/Grids/IEEE_LV_powerflow.ipynb @@ -1,6 +1,7 @@ { "cells": [ { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -8,6 +9,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -51,6 +53,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -72,7 +75,7 @@ "metadata": {}, "outputs": [], "source": [ - "reader = dpsimpy.CIMReader(sim_name, dpsimpy.LogLevel.info, dpsimpy.LogLevel.off)\n", + "reader = dpsimpy.CIMReader(dpsimpy.LogLevel.info, dpsimpy.LogLevel.off, dpsimpy.LogLevel.off)\n", "system = reader.loadCIM(50, files, dpsimpy.Domain.SP, dpsimpy.PhaseType.Single, dpsimpy.GeneratorType.NONE)\n", "\n", "logger = dpsimpy.Logger(sim_name)\n", @@ -92,6 +95,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -116,6 +120,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -144,6 +149,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ diff --git a/examples/Notebooks/Grids/PF_CIGRE_MV_withDG.ipynb b/examples/Notebooks/Grids/PF_CIGRE_MV_withDG.ipynb index 895c85570c..319ddf28e0 100644 --- a/examples/Notebooks/Grids/PF_CIGRE_MV_withDG.ipynb +++ b/examples/Notebooks/Grids/PF_CIGRE_MV_withDG.ipynb @@ -1,6 +1,7 @@ { "cells": [ { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -8,6 +9,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -15,6 +17,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -67,6 +70,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -80,7 +84,7 @@ "outputs": [], "source": [ "dpsimpy.Logger.set_log_dir('logs/' + sim_name)\n", - "reader = dpsimpy.CIMReader(sim_name, dpsimpy.LogLevel.debug, dpsimpy.LogLevel.debug)\n", + "reader = dpsimpy.CIMReader(dpsimpy.LogLevel.debug, dpsimpy.LogLevel.off, dpsimpy.LogLevel.debug)\n", "system = reader.loadCIM(50, files, dpsimpy.Domain.SP, dpsimpy.PhaseType.Single, dpsimpy.GeneratorType.PVNode)\n", "pv_active_power = 50e3 * int(int(4319.1e3 / 50e3) / 9)\n", "pv_reactive_power = np.sqrt(np.power(pv_active_power / 1, 2) - np.power(pv_active_power, 2))\n", @@ -117,6 +121,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -137,6 +142,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ diff --git a/examples/Notebooks/Grids/SP_WSCC9bus_SGTrStab_Switch_PSAT_Validation.ipynb b/examples/Notebooks/Grids/SP_WSCC9bus_SGTrStab_Switch_PSAT_Validation.ipynb index 16099921b3..c7ec3b37bc 100644 --- a/examples/Notebooks/Grids/SP_WSCC9bus_SGTrStab_Switch_PSAT_Validation.ipynb +++ b/examples/Notebooks/Grids/SP_WSCC9bus_SGTrStab_Switch_PSAT_Validation.ipynb @@ -1,6 +1,7 @@ { "cells": [ { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -55,6 +56,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -68,7 +70,7 @@ "outputs": [], "source": [ "dpsimpy.Logger.set_log_dir('logs/' + sim_name)\n", - "reader = dpsimpy.CIMReader(sim_name, dpsimpy.LogLevel.debug, dpsimpy.LogLevel.debug)\n", + "reader = dpsimpy.CIMReader(dpsimpy.LogLevel.debug, dpsimpy.LogLevel.off, dpsimpy.LogLevel.debug)\n", "system = reader.loadCIM(60, files, dpsimpy.Domain.SP, dpsimpy.PhaseType.Single, dpsimpy.GeneratorType.TransientStability)\n", "\n", "# Extend topology with switch\n", @@ -111,6 +113,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -133,6 +136,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -153,6 +157,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -184,6 +189,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -208,6 +214,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -249,6 +256,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -274,6 +282,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -292,6 +301,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -316,6 +326,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -347,6 +358,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -371,6 +383,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ diff --git a/examples/Notebooks/Grids/case14.ipynb b/examples/Notebooks/Grids/case14.ipynb index 092d845a38..3f09383910 100644 --- a/examples/Notebooks/Grids/case14.ipynb +++ b/examples/Notebooks/Grids/case14.ipynb @@ -47,7 +47,7 @@ "outputs": [], "source": [ "name = 'case14'\n", - "reader = dpsimpy.CIMReader(name)\n", + "reader = dpsimpy.CIMReader()\n", "system = reader.loadCIM(50, files, dpsimpy.Domain.SP, dpsimpy.PhaseType.Single, dpsimpy.GeneratorType.PVNode)\n", "system" ] diff --git a/examples/Notebooks/Grids/case145.ipynb b/examples/Notebooks/Grids/case145.ipynb index 74418ce8a1..4ba622bad6 100644 --- a/examples/Notebooks/Grids/case145.ipynb +++ b/examples/Notebooks/Grids/case145.ipynb @@ -47,7 +47,7 @@ "outputs": [], "source": [ "name = 'case145'\n", - "reader = dpsimpy.CIMReader(name)\n", + "reader = dpsimpy.CIMReader()\n", "system = reader.loadCIM(50, files, dpsimpy.Domain.SP, dpsimpy.PhaseType.Single, dpsimpy.GeneratorType.PVNode)\n", "system" ] diff --git a/examples/Notebooks/Grids/case300.ipynb b/examples/Notebooks/Grids/case300.ipynb index cc804f3420..7e9f8d0b65 100644 --- a/examples/Notebooks/Grids/case300.ipynb +++ b/examples/Notebooks/Grids/case300.ipynb @@ -47,7 +47,7 @@ "outputs": [], "source": [ "name = 'case300'\n", - "reader = dpsimpy.CIMReader(name)\n", + "reader = dpsimpy.CIMReader()\n", "system = reader.loadCIM(50, files, dpsimpy.Domain.SP, dpsimpy.PhaseType.Single, dpsimpy.GeneratorType.PVNode)\n", "system" ] diff --git a/examples/Notebooks/Grids/case9.ipynb b/examples/Notebooks/Grids/case9.ipynb index 1c35295f4a..2bc8528d26 100644 --- a/examples/Notebooks/Grids/case9.ipynb +++ b/examples/Notebooks/Grids/case9.ipynb @@ -1,6 +1,7 @@ { "cells": [ { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -8,6 +9,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -47,7 +49,7 @@ "outputs": [], "source": [ "name = 'case9'\n", - "reader = dpsimpy.CIMReader(name)\n", + "reader = dpsimpy.CIMReader()\n", "system = reader.loadCIM(50, files, dpsimpy.Domain.SP, dpsimpy.PhaseType.Single, dpsimpy.GeneratorType.PVNode)\n", "system" ] @@ -79,6 +81,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ diff --git a/examples/Notebooks/Performance/DP_WSCC9bus_SGReducedOrderVBR_validate_KLU_using_different_settings.ipynb b/examples/Notebooks/Performance/DP_WSCC9bus_SGReducedOrderVBR_validate_KLU_using_different_settings.ipynb index 6e99446dd2..de1efe9036 100644 --- a/examples/Notebooks/Performance/DP_WSCC9bus_SGReducedOrderVBR_validate_KLU_using_different_settings.ipynb +++ b/examples/Notebooks/Performance/DP_WSCC9bus_SGReducedOrderVBR_validate_KLU_using_different_settings.ipynb @@ -60,7 +60,7 @@ "files = glob.glob(filename+'_*.xml')\n", "\n", "dpsimpy.Logger.set_log_dir(log_dir+\"/\"+sim_name_pf)\n", - "reader = dpsimpy.CIMReader(sim_name_pf, log_level, log_level)\n", + "reader = dpsimpy.CIMReader(log_level, dpsimpy.LogLevel.off, log_level)\n", "\n", "system_pf = reader.loadCIM(60, files, dpsimpy.Domain.SP, dpsimpy.PhaseType.Single, dpsimpy.GeneratorType.PVNode)\n", "system_pf.component('GEN1').modify_power_flow_bus_type(dpsimpy.PowerflowBusType.VD)\n", @@ -90,7 +90,7 @@ "## Dynamic Simulation\n", "def run_simulation(fillin, btf, partial):\n", " dpsimpy.Logger.set_log_dir(log_dir+\"/\"+sim_name)\n", - " reader2 = dpsimpy.CIMReader(sim_name, log_level, log_level)\n", + " reader2 = dpsimpy.CIMReader(log_level, dpsimpy.LogLevel.off, log_level)\n", " if sg_type == \"3\":\n", " sys = reader2.loadCIM(60, files, dpsimpy.Domain.DP, dpsimpy.PhaseType.Single, dpsimpy.GeneratorType.SG3OrderVBR)\n", " elif sg_type == \"4\":\n", @@ -266,7 +266,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.13" + "version": "3.10.11" }, "vscode": { "interpreter": { diff --git a/examples/Notebooks/Performance/DP_WSCC9bus_SGReducedOrderVBR_validate_SparseLU_DenseLU_KLU_using_partial_refactorization.ipynb b/examples/Notebooks/Performance/DP_WSCC9bus_SGReducedOrderVBR_validate_SparseLU_DenseLU_KLU_using_partial_refactorization.ipynb index 70e3f6ebc9..83593752b1 100644 --- a/examples/Notebooks/Performance/DP_WSCC9bus_SGReducedOrderVBR_validate_SparseLU_DenseLU_KLU_using_partial_refactorization.ipynb +++ b/examples/Notebooks/Performance/DP_WSCC9bus_SGReducedOrderVBR_validate_SparseLU_DenseLU_KLU_using_partial_refactorization.ipynb @@ -61,7 +61,7 @@ "files = glob.glob(filename+'_*.xml')\n", "\n", "dpsimpy.Logger.set_log_dir(log_dir+\"/\"+sim_name_pf)\n", - "reader = dpsimpy.CIMReader(sim_name_pf, log_level, log_level)\n", + "reader = dpsimpy.CIMReader(log_level, dpsimpy.LogLevel.off, log_level)\n", "\n", "system_pf = reader.loadCIM(60, files, dpsimpy.Domain.SP, dpsimpy.PhaseType.Single, dpsimpy.GeneratorType.PVNode)\n", "system_pf.component('GEN1').modify_power_flow_bus_type(dpsimpy.PowerflowBusType.VD)\n", @@ -91,7 +91,7 @@ "## Dynamic Simulation\n", "def run_simulation(implementation):\n", " dpsimpy.Logger.set_log_dir(log_dir+\"/\"+sim_name)\n", - " reader2 = dpsimpy.CIMReader(sim_name, log_level, log_level)\n", + " reader2 = dpsimpy.CIMReader(log_level, dpsimpy.LogLevel.off, log_level)\n", " if sg_type == \"3\":\n", " sys = reader2.loadCIM(60, files, dpsimpy.Domain.DP, dpsimpy.PhaseType.Single, dpsimpy.GeneratorType.SG3OrderVBR)\n", " elif sg_type == \"4\":\n", diff --git a/examples/villas-deprecated/cigre-mv-pf-profiles-shmem.ipynb b/examples/villas-deprecated/cigre-mv-pf-profiles-shmem.ipynb index a0f1530f59..866de306ea 100644 --- a/examples/villas-deprecated/cigre-mv-pf-profiles-shmem.ipynb +++ b/examples/villas-deprecated/cigre-mv-pf-profiles-shmem.ipynb @@ -86,7 +86,7 @@ "outputs": [], "source": [ "name = 'CIGRE-MV-Profiles'\n", - "reader = dpsimpy.CIMReader(name)\n", + "reader = dpsimpy.CIMReader()\n", "system = reader.loadCIM(50, files, dpsimpy.Domain.SP, dpsimpy.PhaseType.Single, dpsimpy.GeneratorType.PVNode)" ] }, diff --git a/examples/villas-deprecated/test_shmem_cigre_mv_pf_profiles.py b/examples/villas-deprecated/test_shmem_cigre_mv_pf_profiles.py index bcbb092dc3..7ecf89ad58 100644 --- a/examples/villas-deprecated/test_shmem_cigre_mv_pf_profiles.py +++ b/examples/villas-deprecated/test_shmem_cigre_mv_pf_profiles.py @@ -80,7 +80,7 @@ def dpsim(): files = glob.glob('build/_deps/cim-data-src/CIGRE_MV/NEPLAN/CIGRE_MV_no_tapchanger_With_LoadFlow_Results/*.xml') log.info('CIM files: %s', files) - reader = dpsimpy.CIMReader(name) + reader = dpsimpy.CIMReader() system = reader.loadCIM(50, files, dpsimpy.Domain.SP, dpsimpy.PhaseType.Single, dpsimpy.GeneratorType.PVNode) csv_files = glob.glob('build/_deps/profile-data-src/CIGRE_MV_NoTap/load_profiles/')[0] diff --git a/examples/villas/dpsim-mqtt-cigre-mv-pf-profiles.py b/examples/villas/dpsim-mqtt-cigre-mv-pf-profiles.py index 2ded3aa256..a83a076de2 100644 --- a/examples/villas/dpsim-mqtt-cigre-mv-pf-profiles.py +++ b/examples/villas/dpsim-mqtt-cigre-mv-pf-profiles.py @@ -20,7 +20,7 @@ # read topology from CIM files = glob.glob('build/_deps/cim-data-src/CIGRE_MV/NEPLAN/CIGRE_MV_no_tapchanger_With_LoadFlow_Results/*.xml') # downloaded by CMake log.info('CIM files: %s', files) -reader = dpsimpy.CIMReader(name) +reader = dpsimpy.CIMReader() system = reader.loadCIM(50, files, dpsimpy.Domain.SP, dpsimpy.PhaseType.Single, dpsimpy.GeneratorType.PVNode) # map from CSV to simulation names From a265cdb43e81ebea58333807bd4a7f063c73de2b Mon Sep 17 00:00:00 2001 From: Jonas Schroeder Date: Sun, 16 Jul 2023 10:12:27 +0000 Subject: [PATCH 09/31] do not use logger registry to allow duplicates Signed-off-by: Jonas Schroeder --- dpsim-models/src/Logger.cpp | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/dpsim-models/src/Logger.cpp b/dpsim-models/src/Logger.cpp index a1632699e2..ebf5f7bc31 100644 --- a/dpsim-models/src/Logger.cpp +++ b/dpsim-models/src/Logger.cpp @@ -139,19 +139,13 @@ String Logger::getCSVLineFromData(Real time, const MatrixComp& data) { Logger::Log Logger::get(LoggerType type, const std::string &name, Level filelevel, Level clilevel) { switch (type) { case LoggerType::SIMULATION: { - if (Logger::Log logger = spdlog::get("simulation")) { - return logger; - } else return create(LoggerType::SIMULATION, name, "simulation", filelevel, clilevel); + return create(LoggerType::SIMULATION, name, "simulation", filelevel, clilevel); } case LoggerType::COMPONENT: { - if (Logger::Log logger = spdlog::get(name)) { - return logger; - } else return create(LoggerType::COMPONENT, name, "components", filelevel, clilevel); + return create(LoggerType::COMPONENT, name, "components", filelevel, clilevel); } case LoggerType::DEBUG: { - if (Logger::Log logger = spdlog::get(name)) { - return logger; - } else return create(LoggerType::DEBUG, name, name, filelevel, clilevel); + return create(LoggerType::DEBUG, name, name, filelevel, clilevel); } default: { // UNREACHABLE! @@ -222,7 +216,6 @@ Logger::Log Logger::create(Logger::LoggerType type, const std::string &name, con } else { spdlog::sink_ptr dpsimSink = std::make_shared(file_sink, Logger::mStdoutSink, Logger::mStderrSink, filelevel, clilevel); logger = std::make_shared(name, dpsimSink); - spdlog::register_logger(logger); } logger->set_level(std::min(filelevel, clilevel)); From 3c58a45c38896a48798468e8df6102a4195b4bad Mon Sep 17 00:00:00 2001 From: Jonas Schroeder Date: Sun, 16 Jul 2023 10:30:06 +0000 Subject: [PATCH 10/31] fix log file names Signed-off-by: Jonas Schroeder --- examples/Notebooks/Grids/DP_WSCC9bus_SGTrStab.ipynb | 2 +- examples/Notebooks/Grids/DP_WSCC9bus_SGVoltageSource.ipynb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/Notebooks/Grids/DP_WSCC9bus_SGTrStab.ipynb b/examples/Notebooks/Grids/DP_WSCC9bus_SGTrStab.ipynb index 703a7de9bc..695f9a164d 100644 --- a/examples/Notebooks/Grids/DP_WSCC9bus_SGTrStab.ipynb +++ b/examples/Notebooks/Grids/DP_WSCC9bus_SGTrStab.ipynb @@ -107,7 +107,7 @@ "outputs": [], "source": [ "path = 'logs/WSCC-9bus_dyn/'\n", - "logName = 'WSCC-9bus_dyn_InitLeftVector'\n", + "logName = 'InitLeftVector'\n", "logFilename = path + logName + '.csv'\n", "print(logFilename)\n", "\n", diff --git a/examples/Notebooks/Grids/DP_WSCC9bus_SGVoltageSource.ipynb b/examples/Notebooks/Grids/DP_WSCC9bus_SGVoltageSource.ipynb index 3341dc4f89..84ae03665e 100644 --- a/examples/Notebooks/Grids/DP_WSCC9bus_SGVoltageSource.ipynb +++ b/examples/Notebooks/Grids/DP_WSCC9bus_SGVoltageSource.ipynb @@ -104,7 +104,7 @@ "outputs": [], "source": [ "path = 'logs/WSCC-9bus/'\n", - "logName = 'WSCC-9bus_InitLeftVector'\n", + "logName = 'InitLeftVector'\n", "logFilename = path + logName + '.csv'\n", "print(logFilename)\n", "\n", From 447044307217c585c78e06bccd6f3373d44adf69 Mon Sep 17 00:00:00 2001 From: Jonas Schroeder Date: Sun, 16 Jul 2023 10:30:34 +0000 Subject: [PATCH 11/31] demote all CIMReader info log to debug Signed-off-by: Jonas Schroeder --- dpsim-models/src/CIM/Reader.cpp | 116 ++++++++++++++++---------------- 1 file changed, 58 insertions(+), 58 deletions(-) diff --git a/dpsim-models/src/CIM/Reader.cpp b/dpsim-models/src/CIM/Reader.cpp index 48e4a0fc90..b9e0f31fee 100644 --- a/dpsim-models/src/CIM/Reader.cpp +++ b/dpsim-models/src/CIM/Reader.cpp @@ -127,7 +127,7 @@ void Reader::parseFiles() { return; } - SPDLOG_LOGGER_INFO(mSLog, "#### List of TopologicalNodes, associated Terminals and Equipment"); + SPDLOG_LOGGER_DEBUG(mSLog, "#### List of TopologicalNodes, associated Terminals and Equipment"); for (auto obj : mModel->Objects) { if (CIMPP::TopologicalNode* topNode = dynamic_cast(obj)) { if (mDomain == Domain::EMT) @@ -139,7 +139,7 @@ void Reader::parseFiles() { // Collect voltage state variables associated to nodes that are used // for various components. - SPDLOG_LOGGER_INFO(mSLog, "#### List of Node voltages and Terminal power flow data"); + SPDLOG_LOGGER_DEBUG(mSLog, "#### List of Node voltages and Terminal power flow data"); for (auto obj : mModel->Objects) { // Check if object is of class SvVoltage if (CIMPP::SvVoltage* volt = dynamic_cast(obj)) { @@ -151,7 +151,7 @@ void Reader::parseFiles() { } } - SPDLOG_LOGGER_INFO(mSLog, "#### Create other components"); + SPDLOG_LOGGER_DEBUG(mSLog, "#### Create other components"); for (auto obj : mModel->Objects) { // Check if object is not TopologicalNode, SvVoltage or SvPowerFlow @@ -171,7 +171,7 @@ void Reader::parseFiles() { } } - SPDLOG_LOGGER_INFO(mSLog, "#### Check topology for unconnected components"); + SPDLOG_LOGGER_DEBUG(mSLog, "#### Check topology for unconnected components"); for (auto pfe : mPowerflowEquipment) { auto c = pfe.second; @@ -228,7 +228,7 @@ void Reader::processSvVoltage(CIMPP::SvVoltage* volt) { Real voltageAbs = Reader::unitValue(volt->v.value, UnitMultiplier::k); try{ - SPDLOG_LOGGER_INFO(mSLog, " Angle={}", (float)volt->angle.value); + SPDLOG_LOGGER_DEBUG(mSLog, " Angle={}", (float)volt->angle.value); }catch(ReadingUninitializedField* e ){ volt->angle.value = 0; std::cerr<< "Uninitialized Angle for SVVoltage at " << volt->TopologicalNode->name << ".Setting default value of " << volt->angle.value << std::endl; @@ -236,7 +236,7 @@ void Reader::processSvVoltage(CIMPP::SvVoltage* volt) { Real voltagePhase = volt->angle.value * PI / 180; mPowerflowNodes[node->mRID]->setInitialVoltage(std::polar(voltageAbs, voltagePhase)); - SPDLOG_LOGGER_INFO(mSLog, "Node {} MatrixNodeIndex {}: {} V, {} deg", + SPDLOG_LOGGER_DEBUG(mSLog, "Node {} MatrixNodeIndex {}: {} V, {} deg", mPowerflowNodes[node->mRID]->uid(), mPowerflowNodes[node->mRID]->matrixNodeIndex(), std::abs(mPowerflowNodes[node->mRID]->initialSingleVoltage()), @@ -299,14 +299,14 @@ Matrix::Index Reader::mapTopologicalNode(String mrid) { } TopologicalPowerComp::Ptr Reader::mapEnergyConsumer(CIMPP::EnergyConsumer* consumer) { - SPDLOG_LOGGER_INFO(mSLog, " Found EnergyConsumer {}", consumer->name); + SPDLOG_LOGGER_DEBUG(mSLog, " Found EnergyConsumer {}", consumer->name); if (mDomain == Domain::EMT) { if (mPhase == PhaseType::ABC) { return std::make_shared(consumer->mRID, consumer->name, mComponentLogLevel); } else { - SPDLOG_LOGGER_INFO(mSLog, " RXLoad for EMT not implemented yet"); + SPDLOG_LOGGER_DEBUG(mSLog, " RXLoad for EMT not implemented yet"); return std::make_shared(consumer->mRID, consumer->name, mComponentLogLevel); } } @@ -339,7 +339,7 @@ TopologicalPowerComp::Ptr Reader::mapEnergyConsumer(CIMPP::EnergyConsumer* consu } TopologicalPowerComp::Ptr Reader::mapACLineSegment(CIMPP::ACLineSegment* line) { - SPDLOG_LOGGER_INFO(mSLog, " Found ACLineSegment {} r={} x={} bch={} gch={}", line->name, + SPDLOG_LOGGER_DEBUG(mSLog, " Found ACLineSegment {} r={} x={} bch={} gch={}", line->name, (float) line->r.value, (float) line->x.value, (float) line->bch.value, @@ -373,7 +373,7 @@ TopologicalPowerComp::Ptr Reader::mapACLineSegment(CIMPP::ACLineSegment* line) { return cpsLine; } else { - SPDLOG_LOGGER_INFO(mSLog, " PiLine for EMT not implemented yet"); + SPDLOG_LOGGER_DEBUG(mSLog, " PiLine for EMT not implemented yet"); auto cpsLine = std::make_shared(line->mRID, line->name, mComponentLogLevel); cpsLine->setParameters(resistance, inductance, capacitance, conductance); return cpsLine; @@ -398,7 +398,7 @@ TopologicalPowerComp::Ptr Reader::mapPowerTransformer(CIMPP::PowerTransformer* t SPDLOG_LOGGER_WARN(mSLog, "PowerTransformer {} does not have exactly two windings, ignoring", trans->name); return nullptr; } - SPDLOG_LOGGER_INFO(mSLog, "Found PowerTransformer {}", trans->name); + SPDLOG_LOGGER_DEBUG(mSLog, "Found PowerTransformer {}", trans->name); // assign transformer ends CIMPP::PowerTransformerEnd* end1 = nullptr, *end2 = nullptr; @@ -409,30 +409,30 @@ TopologicalPowerComp::Ptr Reader::mapPowerTransformer(CIMPP::PowerTransformer* t } // setting default values for non-set resistances and reactances - SPDLOG_LOGGER_INFO(mSLog, " PowerTransformerEnd_1 {}", end1->name); - SPDLOG_LOGGER_INFO(mSLog, " Srated={} Vrated={}", (float) end1->ratedS.value, (float) end1->ratedU.value); + SPDLOG_LOGGER_DEBUG(mSLog, " PowerTransformerEnd_1 {}", end1->name); + SPDLOG_LOGGER_DEBUG(mSLog, " Srated={} Vrated={}", (float) end1->ratedS.value, (float) end1->ratedU.value); try{ - SPDLOG_LOGGER_INFO(mSLog, " R={}", (float) end1->r.value); + SPDLOG_LOGGER_DEBUG(mSLog, " R={}", (float) end1->r.value); }catch(ReadingUninitializedField* e1){ end1->r.value = 1e-12; SPDLOG_LOGGER_WARN(mSLog, " Uninitialized value for PowerTrafoEnd1 setting default value of R={}", (float) end1->r.value); } try{ - SPDLOG_LOGGER_INFO(mSLog, " X={}", (float) end1->x.value); + SPDLOG_LOGGER_DEBUG(mSLog, " X={}", (float) end1->x.value); }catch(ReadingUninitializedField* e1){ end1->x.value = 1e-12; SPDLOG_LOGGER_WARN(mSLog, " Uninitialized value for PowerTrafoEnd1 setting default value of X={}", (float) end1->x.value); } - SPDLOG_LOGGER_INFO(mSLog, " PowerTransformerEnd_2 {}", end2->name); - SPDLOG_LOGGER_INFO(mSLog, " Srated={} Vrated={}", (float) end2->ratedS.value, (float) end2->ratedU.value); + SPDLOG_LOGGER_DEBUG(mSLog, " PowerTransformerEnd_2 {}", end2->name); + SPDLOG_LOGGER_DEBUG(mSLog, " Srated={} Vrated={}", (float) end2->ratedS.value, (float) end2->ratedU.value); try{ - SPDLOG_LOGGER_INFO(mSLog, " R={}", (float) end2->r.value); + SPDLOG_LOGGER_DEBUG(mSLog, " R={}", (float) end2->r.value); }catch(ReadingUninitializedField* e1){ end2->r.value = 1e-12; SPDLOG_LOGGER_WARN(mSLog, " Uninitialized value for PowerTrafoEnd2 setting default value of R={}", (float) end2->r.value); } try{ - SPDLOG_LOGGER_INFO(mSLog, " X={}", (float) end2->x.value); + SPDLOG_LOGGER_DEBUG(mSLog, " X={}", (float) end2->x.value); }catch(ReadingUninitializedField* e1){ end2->x.value = 1e-12; SPDLOG_LOGGER_WARN(mSLog, " Uninitialized value for PowerTrafoEnd2 setting default value of X={}", (float) end2->x.value); @@ -496,7 +496,7 @@ TopologicalPowerComp::Ptr Reader::mapPowerTransformer(CIMPP::PowerTransformer* t } else { - SPDLOG_LOGGER_INFO(mSLog, " Transformer for EMT not implemented yet"); + SPDLOG_LOGGER_DEBUG(mSLog, " Transformer for EMT not implemented yet"); return nullptr; } } @@ -516,10 +516,10 @@ TopologicalPowerComp::Ptr Reader::mapPowerTransformer(CIMPP::PowerTransformer* t } TopologicalPowerComp::Ptr Reader::mapSynchronousMachine(CIMPP::SynchronousMachine* machine) { - SPDLOG_LOGGER_INFO(mSLog, " Found Synchronous machine {}", machine->name); + SPDLOG_LOGGER_DEBUG(mSLog, " Found Synchronous machine {}", machine->name); if (mDomain == Domain::DP) { - SPDLOG_LOGGER_INFO(mSLog, " Create generator in DP domain."); + SPDLOG_LOGGER_DEBUG(mSLog, " Create generator in DP domain."); if (mGeneratorType == GeneratorType::TransientStability || mGeneratorType == GeneratorType::SG6aOrderVBR || mGeneratorType == GeneratorType::SG6bOrderVBR @@ -563,12 +563,12 @@ TopologicalPowerComp::Ptr Reader::mapSynchronousMachine(CIMPP::SynchronousMachin Real nomFieldCurr = 0; if (mGeneratorType == GeneratorType::TransientStability) { - SPDLOG_LOGGER_INFO(mSLog, " GeneratorType is TransientStability."); + SPDLOG_LOGGER_DEBUG(mSLog, " GeneratorType is TransientStability."); auto gen = DP::Ph1::SynchronGeneratorTrStab::make(machine->mRID, machine->name, mComponentLogLevel); gen->setStandardParametersPU(ratedPower, ratedVoltage, mFrequency, Ld_t, H); return gen; } else if (mGeneratorType == GeneratorType::SG6aOrderVBR) { - SPDLOG_LOGGER_INFO(mSLog, " GeneratorType is SynchronGenerator6aOrderVBR."); + SPDLOG_LOGGER_DEBUG(mSLog, " GeneratorType is SynchronGenerator6aOrderVBR."); auto gen = std::make_shared(machine->mRID, machine->name, mComponentLogLevel); gen->setOperationalParametersPerUnit( ratedPower, ratedVoltage, mFrequency, H, @@ -576,7 +576,7 @@ TopologicalPowerComp::Ptr Reader::mapSynchronousMachine(CIMPP::SynchronousMachin Ld_s, Lq_s, Td0_s, Tq0_s); return gen; } else if (mGeneratorType == GeneratorType::SG6bOrderVBR) { - SPDLOG_LOGGER_INFO(mSLog, " GeneratorType is SynchronGenerator6bOrderVBR."); + SPDLOG_LOGGER_DEBUG(mSLog, " GeneratorType is SynchronGenerator6bOrderVBR."); auto gen = std::make_shared(machine->mRID, machine->name, mComponentLogLevel); gen->setOperationalParametersPerUnit( ratedPower, ratedVoltage, mFrequency, H, @@ -584,14 +584,14 @@ TopologicalPowerComp::Ptr Reader::mapSynchronousMachine(CIMPP::SynchronousMachin Ld_s, Lq_s, Td0_s, Tq0_s); return gen; } else if (mGeneratorType == GeneratorType::SG4OrderVBR) { - SPDLOG_LOGGER_INFO(mSLog, " GeneratorType is SynchronGenerator4OrderVBR."); + SPDLOG_LOGGER_DEBUG(mSLog, " GeneratorType is SynchronGenerator4OrderVBR."); auto gen = std::make_shared( machine->mRID, machine->name, mComponentLogLevel); gen->setOperationalParametersPerUnit(ratedPower, ratedVoltage, mFrequency, H, Ld, Lq, Ll, Ld_t, Lq_t, Td0_t, Tq0_t); return gen; } else if (mGeneratorType == GeneratorType::SG3OrderVBR) { - SPDLOG_LOGGER_INFO(mSLog, " GeneratorType is SynchronGenerator3OrderVBR."); + SPDLOG_LOGGER_DEBUG(mSLog, " GeneratorType is SynchronGenerator3OrderVBR."); auto gen = std::make_shared(machine->mRID, machine->name, mComponentLogLevel); gen->setOperationalParametersPerUnit( ratedPower, ratedVoltage, mFrequency, H, @@ -620,7 +620,7 @@ TopologicalPowerComp::Ptr Reader::mapSynchronousMachine(CIMPP::SynchronousMachin } } } else if (mGeneratorType == GeneratorType::IdealVoltageSource) { - SPDLOG_LOGGER_INFO(mSLog, " GeneratorType is IdealVoltageSource."); + SPDLOG_LOGGER_DEBUG(mSLog, " GeneratorType is IdealVoltageSource."); return std::make_shared(machine->mRID, machine->name, mComponentLogLevel); } else if (mGeneratorType == GeneratorType::None) { throw SystemError("GeneratorType is None. Specify!"); @@ -628,7 +628,7 @@ TopologicalPowerComp::Ptr Reader::mapSynchronousMachine(CIMPP::SynchronousMachin throw SystemError("GeneratorType setting unfeasible."); } } else if (mDomain == Domain::SP) { - SPDLOG_LOGGER_INFO(mSLog, " Create generator in SP domain."); + SPDLOG_LOGGER_DEBUG(mSLog, " Create generator in SP domain."); if (mGeneratorType == GeneratorType::TransientStability || mGeneratorType == GeneratorType::SG6aOrderVBR || mGeneratorType == GeneratorType::SG6bOrderVBR @@ -669,12 +669,12 @@ TopologicalPowerComp::Ptr Reader::mapSynchronousMachine(CIMPP::SynchronousMachin Real nomFieldCurr = 0; if (mGeneratorType == GeneratorType::TransientStability) { - SPDLOG_LOGGER_INFO(mSLog, " GeneratorType is TransientStability."); + SPDLOG_LOGGER_DEBUG(mSLog, " GeneratorType is TransientStability."); auto gen = SP::Ph1::SynchronGeneratorTrStab::make(machine->mRID, machine->name, mComponentLogLevel); gen->setStandardParametersPU(ratedPower, ratedVoltage, mFrequency, Ld_t, H); return gen; } else if (mGeneratorType == GeneratorType::SG6aOrderVBR) { - SPDLOG_LOGGER_INFO(mSLog, " GeneratorType is SynchronGenerator6aOrderVBR."); + SPDLOG_LOGGER_DEBUG(mSLog, " GeneratorType is SynchronGenerator6aOrderVBR."); auto gen = std::make_shared(machine->mRID, machine->name, mComponentLogLevel); gen->setOperationalParametersPerUnit( ratedPower, ratedVoltage, mFrequency, H, @@ -682,7 +682,7 @@ TopologicalPowerComp::Ptr Reader::mapSynchronousMachine(CIMPP::SynchronousMachin Ld_s, Lq_s, Td0_s, Tq0_s); return gen; } else if (mGeneratorType == GeneratorType::SG6bOrderVBR) { - SPDLOG_LOGGER_INFO(mSLog, " GeneratorType is SynchronGenerator6bOrderVBR."); + SPDLOG_LOGGER_DEBUG(mSLog, " GeneratorType is SynchronGenerator6bOrderVBR."); auto gen = std::make_shared(machine->mRID, machine->name, mComponentLogLevel); gen->setOperationalParametersPerUnit( ratedPower, ratedVoltage, mFrequency, H, @@ -690,14 +690,14 @@ TopologicalPowerComp::Ptr Reader::mapSynchronousMachine(CIMPP::SynchronousMachin Ld_s, Lq_s, Td0_s, Tq0_s); return gen; } else if (mGeneratorType == GeneratorType::SG4OrderVBR) { - SPDLOG_LOGGER_INFO(mSLog, " GeneratorType is SynchronGenerator4OrderVBR."); + SPDLOG_LOGGER_DEBUG(mSLog, " GeneratorType is SynchronGenerator4OrderVBR."); auto gen = std::make_shared( machine->mRID, machine->name, mComponentLogLevel); gen->setOperationalParametersPerUnit(ratedPower, ratedVoltage, mFrequency, H, Ld, Lq, Ll, Ld_t, Lq_t, Td0_t, Tq0_t); return gen; } else if (mGeneratorType == GeneratorType::SG3OrderVBR) { - SPDLOG_LOGGER_INFO(mSLog, " GeneratorType is SynchronGenerator3OrderVBR."); + SPDLOG_LOGGER_DEBUG(mSLog, " GeneratorType is SynchronGenerator3OrderVBR."); auto gen = std::make_shared(machine->mRID, machine->name, mComponentLogLevel); gen->setOperationalParametersPerUnit( ratedPower, ratedVoltage, mFrequency, H, @@ -708,7 +708,7 @@ TopologicalPowerComp::Ptr Reader::mapSynchronousMachine(CIMPP::SynchronousMachin } } } else if (mGeneratorType == GeneratorType::PVNode) { - SPDLOG_LOGGER_INFO(mSLog, " GeneratorType is PVNode."); + SPDLOG_LOGGER_DEBUG(mSLog, " GeneratorType is PVNode."); for (auto obj : mModel->Objects) { if (CIMPP::GeneratingUnit* genUnit = dynamic_cast(obj)) { for (auto syncGen : genUnit->RotatingMachine) { @@ -719,19 +719,19 @@ TopologicalPowerComp::Ptr Reader::mapSynchronousMachine(CIMPP::SynchronousMachin Real maximumReactivePower = 1e12; try{ setPointActivePower = unitValue(genUnit->initialP.value, UnitMultiplier::M); - SPDLOG_LOGGER_INFO(mSLog, " setPointActivePower={}", setPointActivePower); + SPDLOG_LOGGER_DEBUG(mSLog, " setPointActivePower={}", setPointActivePower); }catch(ReadingUninitializedField* e){ std::cerr << "Uninitalized setPointActivePower for GeneratingUnit " << machine->name << ". Using default value of " << setPointActivePower << std::endl; } if (machine->RegulatingControl) { setPointVoltage = unitValue(machine->RegulatingControl->targetValue.value, UnitMultiplier::k); - SPDLOG_LOGGER_INFO(mSLog, " setPointVoltage={}", setPointVoltage); + SPDLOG_LOGGER_DEBUG(mSLog, " setPointVoltage={}", setPointVoltage); } else { std::cerr << "Uninitalized setPointVoltage for GeneratingUnit " << machine->name << ". Using default value of " << setPointVoltage << std::endl; } try{ maximumReactivePower = unitValue(machine->maxQ.value, UnitMultiplier::M); - SPDLOG_LOGGER_INFO(mSLog, " maximumReactivePower={}", maximumReactivePower); + SPDLOG_LOGGER_DEBUG(mSLog, " maximumReactivePower={}", maximumReactivePower); }catch(ReadingUninitializedField* e){ std::cerr << "Uninitalized maximumReactivePower for GeneratingUnit " << machine->name << ". Using default value of " << maximumReactivePower << std::endl; } @@ -748,7 +748,7 @@ TopologicalPowerComp::Ptr Reader::mapSynchronousMachine(CIMPP::SynchronousMachin } } } - SPDLOG_LOGGER_INFO(mSLog, "no corresponding initial power for {}", machine->name); + SPDLOG_LOGGER_DEBUG(mSLog, "no corresponding initial power for {}", machine->name); return std::make_shared(machine->mRID, machine->name, mComponentLogLevel); } else if (mGeneratorType == GeneratorType::None) { throw SystemError("GeneratorType is None. Specify!"); @@ -756,7 +756,7 @@ TopologicalPowerComp::Ptr Reader::mapSynchronousMachine(CIMPP::SynchronousMachin throw SystemError("GeneratorType setting unfeasible."); } } else { - SPDLOG_LOGGER_INFO(mSLog, " Create generator in EMT domain."); + SPDLOG_LOGGER_DEBUG(mSLog, " Create generator in EMT domain."); if (mGeneratorType == GeneratorType::FullOrder || mGeneratorType == GeneratorType::FullOrderVBR || mGeneratorType == GeneratorType::SG3OrderVBR @@ -799,7 +799,7 @@ TopologicalPowerComp::Ptr Reader::mapSynchronousMachine(CIMPP::SynchronousMachin Real nomFieldCurr = 0; if (mGeneratorType == GeneratorType::FullOrder) { - SPDLOG_LOGGER_INFO(mSLog, " GeneratorType is FullOrder."); + SPDLOG_LOGGER_DEBUG(mSLog, " GeneratorType is FullOrder."); auto gen = std::make_shared(machine->mRID, machine->name, mComponentLogLevel); gen->setParametersOperationalPerUnit( ratedPower, ratedVoltage, mFrequency, poleNum, nomFieldCurr, @@ -807,7 +807,7 @@ TopologicalPowerComp::Ptr Reader::mapSynchronousMachine(CIMPP::SynchronousMachin Td0_t, Tq0_t, Td0_s, Tq0_s, H); return gen; } else if (mGeneratorType == GeneratorType::FullOrderVBR) { - SPDLOG_LOGGER_INFO(mSLog, " GeneratorType is FullOrderVBR."); + SPDLOG_LOGGER_DEBUG(mSLog, " GeneratorType is FullOrderVBR."); auto gen = std::make_shared(machine->mRID, machine->name, mComponentLogLevel); gen->setBaseAndOperationalPerUnitParameters( ratedPower, ratedVoltage, mFrequency, poleNum, nomFieldCurr, @@ -815,7 +815,7 @@ TopologicalPowerComp::Ptr Reader::mapSynchronousMachine(CIMPP::SynchronousMachin Lq_s, Ll, Td0_t, Tq0_t, Td0_s, Tq0_s, H); return gen; } else if (mGeneratorType == GeneratorType::SG6aOrderVBR) { - SPDLOG_LOGGER_INFO(mSLog, " GeneratorType is SynchronGenerator6aOrderVBR."); + SPDLOG_LOGGER_DEBUG(mSLog, " GeneratorType is SynchronGenerator6aOrderVBR."); auto gen = std::make_shared(machine->mRID, machine->name, mComponentLogLevel); gen->setOperationalParametersPerUnit( ratedPower, ratedVoltage, mFrequency, H, @@ -823,7 +823,7 @@ TopologicalPowerComp::Ptr Reader::mapSynchronousMachine(CIMPP::SynchronousMachin Ld_s, Lq_s, Td0_s, Tq0_s); return gen; } else if (mGeneratorType == GeneratorType::SG6bOrderVBR) { - SPDLOG_LOGGER_INFO(mSLog, " GeneratorType is SynchronGenerator6bOrderVBR."); + SPDLOG_LOGGER_DEBUG(mSLog, " GeneratorType is SynchronGenerator6bOrderVBR."); auto gen = std::make_shared(machine->mRID, machine->name, mComponentLogLevel); gen->setOperationalParametersPerUnit( ratedPower, ratedVoltage, mFrequency, H, @@ -831,14 +831,14 @@ TopologicalPowerComp::Ptr Reader::mapSynchronousMachine(CIMPP::SynchronousMachin Ld_s, Lq_s, Td0_s, Tq0_s); return gen; } else if (mGeneratorType == GeneratorType::SG4OrderVBR) { - SPDLOG_LOGGER_INFO(mSLog, " GeneratorType is SynchronGenerator4OrderVBR."); + SPDLOG_LOGGER_DEBUG(mSLog, " GeneratorType is SynchronGenerator4OrderVBR."); auto gen = std::make_shared(machine->mRID, machine->name, mComponentLogLevel); gen->setOperationalParametersPerUnit( ratedPower, ratedVoltage, mFrequency, H, Ld, Lq, Ll, Ld_t, Lq_t, Td0_t, Tq0_t); return gen; } else if (mGeneratorType == GeneratorType::SG3OrderVBR) { - SPDLOG_LOGGER_INFO(mSLog, " GeneratorType is SynchronGenerator3OrderVBR."); + SPDLOG_LOGGER_DEBUG(mSLog, " GeneratorType is SynchronGenerator3OrderVBR."); auto gen = std::make_shared(machine->mRID, machine->name, mComponentLogLevel); gen->setOperationalParametersPerUnit( ratedPower, ratedVoltage, mFrequency, H, @@ -849,10 +849,10 @@ TopologicalPowerComp::Ptr Reader::mapSynchronousMachine(CIMPP::SynchronousMachin } } } else if (mGeneratorType == GeneratorType::IdealVoltageSource) { - SPDLOG_LOGGER_INFO(mSLog, " GeneratorType is IdealVoltageSource."); + SPDLOG_LOGGER_DEBUG(mSLog, " GeneratorType is IdealVoltageSource."); return std::make_shared(machine->mRID, machine->name, mComponentLogLevel, GeneratorType::IdealVoltageSource); } else if (mGeneratorType == GeneratorType::IdealCurrentSource) { - SPDLOG_LOGGER_INFO(mSLog, " GeneratorType is IdealCurrentSource."); + SPDLOG_LOGGER_DEBUG(mSLog, " GeneratorType is IdealCurrentSource."); return std::make_shared(machine->mRID, machine->name, mComponentLogLevel, GeneratorType::IdealCurrentSource); } else if (mGeneratorType == GeneratorType::None) { throw SystemError("GeneratorType is None. Specify!"); @@ -864,7 +864,7 @@ TopologicalPowerComp::Ptr Reader::mapSynchronousMachine(CIMPP::SynchronousMachin } TopologicalPowerComp::Ptr Reader::mapExternalNetworkInjection(CIMPP::ExternalNetworkInjection* extnet) { - SPDLOG_LOGGER_INFO(mSLog, "Found External Network Injection {}", extnet->name); + SPDLOG_LOGGER_DEBUG(mSLog, "Found External Network Injection {}", extnet->name); Real baseVoltage = determineBaseVoltageAssociatedWithEquipment(extnet); @@ -884,10 +884,10 @@ TopologicalPowerComp::Ptr Reader::mapExternalNetworkInjection(CIMPP::ExternalNet try { if(extnet->RegulatingControl){ - SPDLOG_LOGGER_INFO(mSLog, " Voltage set-point={}", (float) extnet->RegulatingControl->targetValue); + SPDLOG_LOGGER_DEBUG(mSLog, " Voltage set-point={}", (float) extnet->RegulatingControl->targetValue); cpsextnet->setParameters(extnet->RegulatingControl->targetValue*baseVoltage); // assumes that value is specified in CIM data in per unit } else { - SPDLOG_LOGGER_INFO(mSLog, " No voltage set-point defined. Using 1 per unit."); + SPDLOG_LOGGER_DEBUG(mSLog, " No voltage set-point defined. Using 1 per unit."); cpsextnet->setParameters(1.*baseVoltage); } } catch (ReadingUninitializedField* e ) { @@ -911,7 +911,7 @@ TopologicalPowerComp::Ptr Reader::mapExternalNetworkInjection(CIMPP::ExternalNet } TopologicalPowerComp::Ptr Reader::mapEquivalentShunt(CIMPP::EquivalentShunt* shunt){ - SPDLOG_LOGGER_INFO(mSLog, "Found shunt {}", shunt->name); + SPDLOG_LOGGER_DEBUG(mSLog, "Found shunt {}", shunt->name); Real baseVoltage = determineBaseVoltageAssociatedWithEquipment(shunt); @@ -959,12 +959,12 @@ void Reader::processTopologicalNode(CIMPP::TopologicalNode* topNode) { mPowerflowNodes[topNode->mRID] = SimNode::make(topNode->mRID, topNode->name, matrixNodeIndex, mPhase); if (mPhase == PhaseType::ABC) { - SPDLOG_LOGGER_INFO(mSLog, "TopologicalNode {} phase A as simulation node {} ", topNode->mRID, mPowerflowNodes[topNode->mRID]->matrixNodeIndex(PhaseType::A)); - SPDLOG_LOGGER_INFO(mSLog, "TopologicalNode {} phase B as simulation node {}", topNode->mRID, mPowerflowNodes[topNode->mRID]->matrixNodeIndex(PhaseType::B)); - SPDLOG_LOGGER_INFO(mSLog, "TopologicalNode {} phase C as simulation node {}", topNode->mRID, mPowerflowNodes[topNode->mRID]->matrixNodeIndex(PhaseType::C)); + SPDLOG_LOGGER_DEBUG(mSLog, "TopologicalNode {} phase A as simulation node {} ", topNode->mRID, mPowerflowNodes[topNode->mRID]->matrixNodeIndex(PhaseType::A)); + SPDLOG_LOGGER_DEBUG(mSLog, "TopologicalNode {} phase B as simulation node {}", topNode->mRID, mPowerflowNodes[topNode->mRID]->matrixNodeIndex(PhaseType::B)); + SPDLOG_LOGGER_DEBUG(mSLog, "TopologicalNode {} phase C as simulation node {}", topNode->mRID, mPowerflowNodes[topNode->mRID]->matrixNodeIndex(PhaseType::C)); } else - SPDLOG_LOGGER_INFO(mSLog, "TopologicalNode id: {}, name: {} as simulation node {}", topNode->mRID, topNode->name, mPowerflowNodes[topNode->mRID]->matrixNodeIndex()); + SPDLOG_LOGGER_DEBUG(mSLog, "TopologicalNode id: {}, name: {} as simulation node {}", topNode->mRID, topNode->name, mPowerflowNodes[topNode->mRID]->matrixNodeIndex()); for (auto term : topNode->Terminal) { // Insert Terminal if it does not exist in the map and add reference to node. @@ -976,7 +976,7 @@ void Reader::processTopologicalNode(CIMPP::TopologicalNode* topNode) { if (!term->sequenceNumber.initialized) term->sequenceNumber = 1; - SPDLOG_LOGGER_INFO(mSLog, " Terminal {}, sequenceNumber {}", term->mRID, (int) term->sequenceNumber); + SPDLOG_LOGGER_DEBUG(mSLog, " Terminal {}, sequenceNumber {}", term->mRID, (int) term->sequenceNumber); // Try to process Equipment connected to Terminal. CIMPP::ConductingEquipment *equipment = term->ConductingEquipment; @@ -1000,7 +1000,7 @@ void Reader::processTopologicalNode(CIMPP::TopologicalNode* topNode) { std::dynamic_pointer_cast>(pfEquipment)->setTerminalAt( std::dynamic_pointer_cast>(mPowerflowTerminals[term->mRID]), term->sequenceNumber-1); - SPDLOG_LOGGER_INFO(mSLog, " Added Terminal {} to Equipment {}", term->mRID, equipment->mRID); + SPDLOG_LOGGER_DEBUG(mSLog, " Added Terminal {} to Equipment {}", term->mRID, equipment->mRID); } } } From 891cdb8b20bef34f9560b3a3cf404aec0c78d2d4 Mon Sep 17 00:00:00 2001 From: Jonas Schroeder Date: Sun, 16 Jul 2023 10:47:38 +0000 Subject: [PATCH 12/31] demote scheduler info log to debug Signed-off-by: Jonas Schroeder --- dpsim/src/Scheduler.cpp | 2 +- dpsim/src/SequentialScheduler.cpp | 2 +- dpsim/src/Simulation.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dpsim/src/Scheduler.cpp b/dpsim/src/Scheduler.cpp index 9a00b54a31..3314d11f59 100644 --- a/dpsim/src/Scheduler.cpp +++ b/dpsim/src/Scheduler.cpp @@ -151,7 +151,7 @@ void Scheduler::topologicalSort(const Task::List& tasks, const Edges& inEdges, c if (!visited.count(t)) { // don't put unneeded tasks in the schedule, but process them as usual // so the cycle check still works - SPDLOG_LOGGER_INFO(mSLog, "Dropping {:s}", t->toString()); + SPDLOG_LOGGER_DEBUG(mSLog, "Dropping {:s}", t->toString()); } else if (t != mRoot) { sortedTasks.push_back(t); } diff --git a/dpsim/src/SequentialScheduler.cpp b/dpsim/src/SequentialScheduler.cpp index 4b475ffc22..fec5fa3682 100644 --- a/dpsim/src/SequentialScheduler.cpp +++ b/dpsim/src/SequentialScheduler.cpp @@ -25,7 +25,7 @@ void SequentialScheduler::createSchedule(const Task::List& tasks, const Edges& i Scheduler::topologicalSort(tasks, inEdges, outEdges, mSchedule); for (auto task : mSchedule) - SPDLOG_LOGGER_INFO(mSLog, "{}", task->toString()); + SPDLOG_LOGGER_DEBUG(mSLog, "{}", task->toString()); } void SequentialScheduler::step(Real time, Int timeStepCount) { diff --git a/dpsim/src/Simulation.cpp b/dpsim/src/Simulation.cpp index b9fdd58ff0..fde4d160a7 100644 --- a/dpsim/src/Simulation.cpp +++ b/dpsim/src/Simulation.cpp @@ -198,7 +198,7 @@ void Simulation::prepSchedule() { mTasks.push_back(logger->getTask()); } if (!mScheduler) { - mScheduler = std::make_shared(); + mScheduler = std::make_shared(String(), mLogLevel); } mScheduler->resolveDeps(mTasks, mTaskInEdges, mTaskOutEdges); } From d43597fe55ac8ca6b4b8f0ea7fc491b6903ccee5 Mon Sep 17 00:00:00 2001 From: Jonas Schroeder Date: Sun, 16 Jul 2023 10:57:35 +0000 Subject: [PATCH 13/31] add separate cli log level for simulation and scheduler Signed-off-by: Jonas Schroeder --- dpsim/include/dpsim/RealTimeSimulation.h | 2 +- dpsim/include/dpsim/Scheduler.h | 8 ++------ dpsim/include/dpsim/SequentialScheduler.h | 5 +++-- dpsim/include/dpsim/Simulation.h | 6 ++++-- dpsim/src/RealTimeSimulation.cpp | 4 ++-- dpsim/src/Simulation.cpp | 9 +++++---- dpsim/src/pybind/main.cpp | 4 ++-- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/dpsim/include/dpsim/RealTimeSimulation.h b/dpsim/include/dpsim/RealTimeSimulation.h index 4f5d2f4877..f7166d9c9e 100644 --- a/dpsim/include/dpsim/RealTimeSimulation.h +++ b/dpsim/include/dpsim/RealTimeSimulation.h @@ -25,7 +25,7 @@ namespace DPsim { public: /// Standard constructor - RealTimeSimulation(String name, CPS::Logger::Level logLevel = CPS::Logger::Level::info); + RealTimeSimulation(String name, CPS::Logger::Level logLevel = CPS::Logger::Level::info, CPS::Logger::Level cliLevel = CPS::Logger::Level::info); /** Perform the main simulation loop in real time. * diff --git a/dpsim/include/dpsim/Scheduler.h b/dpsim/include/dpsim/Scheduler.h index dad4ceacb4..1e140a56ab 100644 --- a/dpsim/include/dpsim/Scheduler.h +++ b/dpsim/include/dpsim/Scheduler.h @@ -33,11 +33,9 @@ namespace DPsim { typedef std::chrono::steady_clock::duration TaskTime; /// - Scheduler(CPS::Logger::Level logLevel = CPS::Logger::Level::off) : + Scheduler(CPS::Logger::Level logLevel = CPS::Logger::Level::info, CPS::Logger::Level cliLevel = CPS::Logger::Level::off) : mRoot(std::make_shared()), - // Logging - mLogLevel(logLevel), - mSLog(CPS::Logger::get(CPS::Logger::LoggerType::SIMULATION, "Scheduler", logLevel, logLevel)) { + mSLog(CPS::Logger::get(CPS::Logger::LoggerType::SIMULATION, "Scheduler", logLevel, cliLevel)) { } /// virtual ~Scheduler() { } @@ -98,8 +96,6 @@ namespace DPsim { /// CPS::Task::Ptr mRoot; - /// Log level - CPS::Logger::Level mLogLevel; /// Logger CPS::Logger::Log mSLog; private: diff --git a/dpsim/include/dpsim/SequentialScheduler.h b/dpsim/include/dpsim/SequentialScheduler.h index 0a40d46ed9..7cb31d3995 100644 --- a/dpsim/include/dpsim/SequentialScheduler.h +++ b/dpsim/include/dpsim/SequentialScheduler.h @@ -19,8 +19,9 @@ namespace DPsim { class SequentialScheduler : public Scheduler { public: SequentialScheduler(String outMeasurementFile = String(), - CPS::Logger::Level logLevel = CPS::Logger::Level::info) - : Scheduler(logLevel), + CPS::Logger::Level logLevel = CPS::Logger::Level::info, + CPS::Logger::Level cliLevel = CPS::Logger::Level::off) + : Scheduler(logLevel, cliLevel), mOutMeasurementFile(outMeasurementFile) { } void createSchedule(const CPS::Task::List& tasks, const Edges& inEdges, const Edges& outEdges); diff --git a/dpsim/include/dpsim/Simulation.h b/dpsim/include/dpsim/Simulation.h index 8ce2df6803..99fa91a6db 100644 --- a/dpsim/include/dpsim/Simulation.h +++ b/dpsim/include/dpsim/Simulation.h @@ -73,8 +73,10 @@ namespace DPsim { std::chrono::duration mSimulationCalculationTime; // #### Logging #### - /// Simulation log level + /// Simulation file log level CPS::Logger::Level mLogLevel; + /// Simulation cli log level + CPS::Logger::Level mCliLevel; /// (Real) time needed for the timesteps std::vector mStepTimes; @@ -157,7 +159,7 @@ namespace DPsim { Simulation(String name, CommandLineArgs& args); /// Creates simulation with name and log level - Simulation(String name, CPS::Logger::Level logLevel = CPS::Logger::Level::info); + Simulation(String name, CPS::Logger::Level logLevel = CPS::Logger::Level::info, CPS::Logger::Level cliLevel = CPS::Logger::Level::info); /// Desctructor virtual ~Simulation() = default; diff --git a/dpsim/src/RealTimeSimulation.cpp b/dpsim/src/RealTimeSimulation.cpp index cff792db90..b183acdfb1 100644 --- a/dpsim/src/RealTimeSimulation.cpp +++ b/dpsim/src/RealTimeSimulation.cpp @@ -14,8 +14,8 @@ using namespace CPS; using namespace DPsim; -RealTimeSimulation::RealTimeSimulation(String name, Logger::Level logLevel) - : Simulation(name, logLevel), mTimer() { +RealTimeSimulation::RealTimeSimulation(String name, Logger::Level logLevel, Logger::Level cliLevel) + : Simulation(name, logLevel, cliLevel), mTimer() { //addAttribute("overruns", nullptr, [=](){ return mTimer.overruns(); }, Flags::read); //addAttribute("overruns", nullptr, nullptr, Flags::read); diff --git a/dpsim/src/Simulation.cpp b/dpsim/src/Simulation.cpp index fde4d160a7..54dba2b3ae 100644 --- a/dpsim/src/Simulation.cpp +++ b/dpsim/src/Simulation.cpp @@ -26,13 +26,14 @@ using namespace CPS; using namespace DPsim; -Simulation::Simulation(String name, Logger::Level logLevel) : +Simulation::Simulation(String name, Logger::Level logLevel, Logger::Level cliLevel) : mName(AttributeStatic::make(name)), mFinalTime(AttributeStatic::make(0.001)), mTimeStep(AttributeStatic::make(0.001)), mSplitSubnets(AttributeStatic::make(true)), mSteadyStateInit(AttributeStatic::make(false)), - mLogLevel(logLevel) { + mLogLevel(logLevel), + mCliLevel(cliLevel) { create(); } @@ -52,7 +53,7 @@ Simulation::Simulation(String name, CommandLineArgs& args) : void Simulation::create() { // Logging - mLog = Logger::get(Logger::LoggerType::SIMULATION, **mName, mLogLevel, std::max(Logger::Level::info, mLogLevel)); + mLog = Logger::get(Logger::LoggerType::SIMULATION, **mName, mLogLevel, mCliLevel); Eigen::setNbThreads(1); @@ -198,7 +199,7 @@ void Simulation::prepSchedule() { mTasks.push_back(logger->getTask()); } if (!mScheduler) { - mScheduler = std::make_shared(String(), mLogLevel); + mScheduler = std::make_shared(String(), mLogLevel, mCliLevel); } mScheduler->resolveDeps(mTasks, mTaskInEdges, mTaskOutEdges); } diff --git a/dpsim/src/pybind/main.cpp b/dpsim/src/pybind/main.cpp index c5e7262888..ea9526057c 100644 --- a/dpsim/src/pybind/main.cpp +++ b/dpsim/src/pybind/main.cpp @@ -77,7 +77,7 @@ PYBIND11_MODULE(dpsimpy, m) { .def("get_btf", &DPsim::DirectLinearSolverConfiguration::getBTF); py::class_(m, "Simulation") - .def(py::init(), "name"_a, "loglevel"_a = CPS::Logger::Level::info) + .def(py::init(), "name"_a, "loglevel"_a = CPS::Logger::Level::info, "cliLevel"_a = CPS::Logger::Level::info) .def("name", &DPsim::Simulation::name) .def("set_time_step", &DPsim::Simulation::setTimeStep) .def("set_final_time", &DPsim::Simulation::setFinalTime) @@ -104,7 +104,7 @@ PYBIND11_MODULE(dpsimpy, m) { .def("log_lu_times", &DPsim::Simulation::logLUTimes); py::class_(m, "RealTimeSimulation") - .def(py::init(), "name"_a, "loglevel"_a = CPS::Logger::Level::info) + .def(py::init(), "name"_a, "loglevel"_a = CPS::Logger::Level::info, "cliLevel"_a = CPS::Logger::Level::info) .def("name", &DPsim::RealTimeSimulation::name) .def("set_time_step", &DPsim::RealTimeSimulation::setTimeStep) .def("set_final_time", &DPsim::RealTimeSimulation::setFinalTime) From f7703c31ecc0ffbf8f4cf6750c92daec2f1b7f79 Mon Sep 17 00:00:00 2001 From: Jonas Schroeder Date: Mon, 17 Jul 2023 08:19:44 +0000 Subject: [PATCH 14/31] change solver logs to debug level Signed-off-by: Jonas Schroeder --- dpsim/include/dpsim/MNASolver.h | 2 +- dpsim/include/dpsim/MNASolverFactory.h | 14 ++--- dpsim/src/DiakopticsSolver.cpp | 20 +++---- dpsim/src/KLUAdapter.cpp | 8 +-- dpsim/src/MNASolver.cpp | 54 +++++++++---------- dpsim/src/MNASolverDirect.cpp | 28 +++++----- dpsim/src/PFSolver.cpp | 46 ++++++++-------- dpsim/src/PFSolverPowerPolar.cpp | 16 +++--- ...oupled_validate_SparseLU_DenseLU_KLU.ipynb | 4 +- 9 files changed, 96 insertions(+), 96 deletions(-) diff --git a/dpsim/include/dpsim/MNASolver.h b/dpsim/include/dpsim/MNASolver.h index 8c748732fc..4196a7b3db 100644 --- a/dpsim/include/dpsim/MNASolver.h +++ b/dpsim/include/dpsim/MNASolver.h @@ -196,7 +196,7 @@ namespace DPsim { /// Destructor virtual ~MnaSolver() { if (mSystemMatrixRecomputation) - SPDLOG_LOGGER_INFO(mSLog, "Number of system matrix recomputations: {:}", mNumRecomputations); + SPDLOG_LOGGER_DEBUG(mSLog, "Number of system matrix recomputations: {:}", mNumRecomputations); }; /// Calls subroutines to set up everything that is required before simulation diff --git a/dpsim/include/dpsim/MNASolverFactory.h b/dpsim/include/dpsim/MNASolverFactory.h index 14a8db763b..94217425ea 100644 --- a/dpsim/include/dpsim/MNASolverFactory.h +++ b/dpsim/include/dpsim/MNASolverFactory.h @@ -79,14 +79,14 @@ class MnaSolverFactory { * to the project (MnaSolverIterative?). It is planned to merge MnaSolverDirect and MnaSolver anyway, so this won't happen. */ case DirectLinearSolverImpl::SparseLU: { - log->info("creating SparseLUAdapter solver implementation"); + SPDLOG_LOGGER_DEBUG(log, "creating SparseLUAdapter solver implementation"); std::shared_ptr> sparseSolver = std::make_shared>(name, domain, logLevel); sparseSolver->setDirectLinearSolverImplementation(DirectLinearSolverImpl::SparseLU); return sparseSolver; } case DirectLinearSolverImpl::DenseLU: { - log->info("creating DenseLUAdapter solver implementation"); + SPDLOG_LOGGER_DEBUG(log, "creating DenseLUAdapter solver implementation"); std::shared_ptr> denseSolver = std::make_shared>(name, domain, logLevel); denseSolver->setDirectLinearSolverImplementation(DirectLinearSolverImpl::DenseLU); return denseSolver; @@ -94,7 +94,7 @@ class MnaSolverFactory { #ifdef WITH_KLU case DirectLinearSolverImpl::KLU: { - log->info("creating KLUAdapter solver implementation"); + SPDLOG_LOGGER_DEBUG(log, "creating KLUAdapter solver implementation"); std::shared_ptr> kluSolver = std::make_shared>(name, domain, logLevel); kluSolver->setDirectLinearSolverImplementation(DirectLinearSolverImpl::KLU); return kluSolver; @@ -103,7 +103,7 @@ class MnaSolverFactory { #ifdef WITH_CUDA case DirectLinearSolverImpl::CUDADense: { - log->info("creating GpuDenseAdapter solver implementation"); + SPDLOG_LOGGER_DEBUG(log, "creating GpuDenseAdapter solver implementation"); std::shared_ptr> gpuDenseSolver = std::make_shared>(name, domain, logLevel); gpuDenseSolver->setDirectLinearSolverImplementation(DirectLinearSolverImpl::CUDADense); return gpuDenseSolver; @@ -111,7 +111,7 @@ class MnaSolverFactory { #ifdef WITH_CUDA_SPARSE case DirectLinearSolverImpl::CUDASparse: { - log->info("creating GpuSparseAdapter solver implementation"); + SPDLOG_LOGGER_DEBUG(log, "creating GpuSparseAdapter solver implementation"); std::shared_ptr> gpuSparseSolver = std::make_shared>(name, domain, logLevel); gpuSparseSolver->setDirectLinearSolverImplementation(DirectLinearSolverImpl::CUDASparse); return gpuSparseSolver; @@ -120,7 +120,7 @@ class MnaSolverFactory { #ifdef WITH_MAGMA case DirectLinearSolverImpl::CUDAMagma: { - log->info("creating GpuMagmaAdapter solver implementation"); + SPDLOG_LOGGER_DEBUG(log, "creating GpuMagmaAdapter solver implementation"); std::shared_ptr> gpuMagmaSolver = std::make_shared>(name, domain, logLevel); gpuMagmaSolver->setDirectLinearSolverImplementation(DirectLinearSolverImpl::CUDAMagma); return gpuMagmaSolver; @@ -129,7 +129,7 @@ class MnaSolverFactory { #endif #ifdef WITH_MNASOLVERPLUGIN case DirectLinearSolverImpl::Plugin: - log->info("creating Plugin solver implementation"); + SPDLOG_LOGGER_DEBUG(log, "creating Plugin solver implementation"); return std::make_shared>(pluginName, name, domain, logLevel); #endif default: diff --git a/dpsim/src/DiakopticsSolver.cpp b/dpsim/src/DiakopticsSolver.cpp index db6d9e1237..c53157c184 100644 --- a/dpsim/src/DiakopticsSolver.cpp +++ b/dpsim/src/DiakopticsSolver.cpp @@ -150,15 +150,15 @@ void DiakopticsSolver::assignMatrixNodeIndices(int net) { auto& node = mSubnets[net].nodes[idx]; node->setMatrixNodeIndex(0, matrixNodeIndexIdx); - SPDLOG_LOGGER_INFO(mSLog, "Assigned index {} to node {}", matrixNodeIndexIdx, node->name()); + SPDLOG_LOGGER_DEBUG(mSLog, "Assigned index {} to node {}", matrixNodeIndexIdx, node->name()); ++matrixNodeIndexIdx; if (node->phaseType() == CPS::PhaseType::ABC) { node->setMatrixNodeIndex(1, matrixNodeIndexIdx); - SPDLOG_LOGGER_INFO(mSLog, "Assigned index {} to node {} phase B", matrixNodeIndexIdx, node->name()); + SPDLOG_LOGGER_DEBUG(mSLog, "Assigned index {} to node {} phase B", matrixNodeIndexIdx, node->name()); ++matrixNodeIndexIdx; node->setMatrixNodeIndex(2, matrixNodeIndexIdx); - SPDLOG_LOGGER_INFO(mSLog, "Assigned index {} to node {} phase C", matrixNodeIndexIdx, node->name()); + SPDLOG_LOGGER_DEBUG(mSLog, "Assigned index {} to node {} phase C", matrixNodeIndexIdx, node->name()); ++matrixNodeIndexIdx; } } @@ -278,24 +278,24 @@ void DiakopticsSolver::initMatrices() { } auto block = mSystemMatrix.block(net.sysOff, net.sysOff, net.sysSize, net.sysSize); block = partSys; - SPDLOG_LOGGER_INFO(mSLog, "Block: \n{}", block); + SPDLOG_LOGGER_DEBUG(mSLog, "Block: \n{}", block); net.luFactorization = Eigen::PartialPivLU(partSys); - SPDLOG_LOGGER_INFO(mSLog, "Factorization: \n{}", net.luFactorization.matrixLU()); + SPDLOG_LOGGER_DEBUG(mSLog, "Factorization: \n{}", net.luFactorization.matrixLU()); } - SPDLOG_LOGGER_INFO(mSLog, "Complete system matrix: \n{}", mSystemMatrix); + SPDLOG_LOGGER_DEBUG(mSLog, "Complete system matrix: \n{}", mSystemMatrix); // initialize tear topology matrix and impedance matrix of removed network for (UInt compIdx = 0; compIdx < mTearComponents.size(); ++compIdx) { applyTearComponentStamp(compIdx); } - SPDLOG_LOGGER_INFO(mSLog, "Topology matrix: \n{}", mTearTopology); - SPDLOG_LOGGER_INFO(mSLog, "Removed impedance matrix: \n{}", mTearImpedance); + SPDLOG_LOGGER_DEBUG(mSLog, "Topology matrix: \n{}", mTearTopology); + SPDLOG_LOGGER_DEBUG(mSLog, "Removed impedance matrix: \n{}", mTearImpedance); // TODO this can be sped up as well by using the block diagonal form of Yinv for (auto& net : mSubnets) { mSystemInverse.block(net.sysOff, net.sysOff, net.sysSize, net.sysSize) = net.luFactorization.inverse(); } mTotalTearImpedance = Eigen::PartialPivLU(mTearImpedance + mTearTopology.transpose() * mSystemInverse * mTearTopology); - SPDLOG_LOGGER_INFO(mSLog, "Total removed impedance matrix LU decomposition: \n{}", mTotalTearImpedance.matrixLU()); + SPDLOG_LOGGER_DEBUG(mSLog, "Total removed impedance matrix LU decomposition: \n{}", mTotalTearImpedance.matrixLU()); // Compute subnet right side (source) vectors for debugging for (auto& net : mSubnets) { @@ -304,7 +304,7 @@ void DiakopticsSolver::initMatrices() { for (auto comp : net.components) { comp->mnaApplyRightSideVectorStamp(rInit); } - SPDLOG_LOGGER_INFO(mSLog, "Source block: \n{}", rInit); + SPDLOG_LOGGER_DEBUG(mSLog, "Source block: \n{}", rInit); } } diff --git a/dpsim/src/KLUAdapter.cpp b/dpsim/src/KLUAdapter.cpp index 98e658e3b9..66d8332dd0 100644 --- a/dpsim/src/KLUAdapter.cpp +++ b/dpsim/src/KLUAdapter.cpp @@ -218,7 +218,7 @@ void KLUAdapter::applyConfiguration() mCommon.scale = 1; } - SPDLOG_LOGGER_INFO(mSLog, "Matrix is scaled using " + mConfiguration.getScalingMethodString()); + SPDLOG_LOGGER_DEBUG(mSLog, "Matrix is scaled using " + mConfiguration.getScalingMethodString()); // TODO: implement support for COLAMD (modifiy SuiteSparse) switch(mConfiguration.getFillInReductionMethod()) @@ -236,12 +236,12 @@ void KLUAdapter::applyConfiguration() mPreordering = AMD_ORDERING; } - SPDLOG_LOGGER_INFO(mSLog, "Matrix is fill reduced with " + mConfiguration.getFillInReductionMethodString()); + SPDLOG_LOGGER_DEBUG(mSLog, "Matrix is fill reduced with " + mConfiguration.getFillInReductionMethodString()); // NOTE: in case more partial refactorization methods are defined/developed, that are not implemented in KLU, this assigment would be invalid mPartialRefactorizationMethod = mConfiguration.getPartialRefactorizationMethod(); - SPDLOG_LOGGER_INFO(mSLog, "Matrix is refactored " + mConfiguration.getPartialRefactorizationMethodString()); + SPDLOG_LOGGER_DEBUG(mSLog, "Matrix is refactored " + mConfiguration.getPartialRefactorizationMethodString()); switch(mConfiguration.getBTF()) { @@ -255,6 +255,6 @@ void KLUAdapter::applyConfiguration() mCommon.btf = 1; } - SPDLOG_LOGGER_INFO(mSLog, "Matrix is permuted " + mConfiguration.getBTFString()); + SPDLOG_LOGGER_DEBUG(mSLog, "Matrix is permuted " + mConfiguration.getBTFString()); } } // namespace DPsim diff --git a/dpsim/src/MNASolver.cpp b/dpsim/src/MNASolver.cpp index 9cb9d690d5..8fc8d161bb 100644 --- a/dpsim/src/MNASolver.cpp +++ b/dpsim/src/MNASolver.cpp @@ -34,13 +34,13 @@ void MnaSolver::setSystem(const CPS::SystemTopology &system) { template void MnaSolver::initialize() { // TODO: check that every system matrix has the same dimensions - SPDLOG_LOGGER_INFO(mSLog, "---- Start initialization ----"); + SPDLOG_LOGGER_DEBUG(mSLog, "---- Start initialization ----"); // Register attribute for solution vector ///FIXME: This is kinda ugly... At least we should somehow unify mLeftSideVector and mLeftSideVectorHarm. // Best case we have some kind of sub-attributes for attribute vectors / tensor attributes... if (mFrequencyParallel) { - SPDLOG_LOGGER_INFO(mSLog, "Computing network harmonics in parallel."); + SPDLOG_LOGGER_DEBUG(mSLog, "Computing network harmonics in parallel."); for(Int freq = 0; freq < mSystem.mFrequencies.size(); ++freq) { mLeftSideVectorHarm.push_back(AttributeStatic::make()); } @@ -49,9 +49,9 @@ void MnaSolver::initialize() { mLeftSideVector = AttributeStatic::make(); } - SPDLOG_LOGGER_INFO(mSLog, "-- Process topology"); + SPDLOG_LOGGER_DEBUG(mSLog, "-- Process topology"); for (auto comp : mSystem.mComponents) - SPDLOG_LOGGER_INFO(mSLog, "Added {:s} '{:s}' to simulation.", comp->type(), comp->name()); + SPDLOG_LOGGER_DEBUG(mSLog, "Added {:s} '{:s}' to simulation.", comp->type(), comp->name()); // Otherwise LU decomposition will fail if (mSystem.mComponents.size() == 0) @@ -64,7 +64,7 @@ void MnaSolver::initialize() { collectVirtualNodes(); assignMatrixNodeIndices(); - SPDLOG_LOGGER_INFO(mSLog, "-- Create empty MNA system matrices and vectors"); + SPDLOG_LOGGER_DEBUG(mSLog, "-- Create empty MNA system matrices and vectors"); createEmptyVectors(); createEmptySystemMatrix(); @@ -90,8 +90,8 @@ void MnaSolver::initialize() { // Initialize system matrices and source vector. initializeSystem(); - SPDLOG_LOGGER_INFO(mSLog, "--- Initialization finished ---"); - SPDLOG_LOGGER_INFO(mSLog, "--- Initial system matrices and vectors ---"); + SPDLOG_LOGGER_DEBUG(mSLog, "--- Initialization finished ---"); + SPDLOG_LOGGER_DEBUG(mSLog, "--- Initial system matrices and vectors ---"); logSystemMatrices(); mSLog->flush(); @@ -99,7 +99,7 @@ void MnaSolver::initialize() { template <> void MnaSolver::initializeComponents() { - SPDLOG_LOGGER_INFO(mSLog, "-- Initialize components from power flow"); + SPDLOG_LOGGER_DEBUG(mSLog, "-- Initialize components from power flow"); CPS::MNAInterface::List allMNAComps; allMNAComps.insert(allMNAComps.end(), mMNAComponents.begin(), mMNAComponents.end()); @@ -132,7 +132,7 @@ void MnaSolver::initializeComponents() { template <> void MnaSolver::initializeComponents() { - SPDLOG_LOGGER_INFO(mSLog, "-- Initialize components from power flow"); + SPDLOG_LOGGER_DEBUG(mSLog, "-- Initialize components from power flow"); CPS::MNAInterface::List allMNAComps; allMNAComps.insert(allMNAComps.end(), mMNAComponents.begin(), mMNAComponents.end()); @@ -151,7 +151,7 @@ void MnaSolver::initializeComponents() { for (auto comp : mSimSignalComps) comp->initialize(mSystem.mSystemOmega, mTimeStep); - SPDLOG_LOGGER_INFO(mSLog, "-- Initialize MNA properties of components"); + SPDLOG_LOGGER_DEBUG(mSLog, "-- Initialize MNA properties of components"); if (mFrequencyParallel) { // Initialize MNA specific parts of components. for (auto comp : mMNAComponents) { @@ -182,7 +182,7 @@ void MnaSolver::initializeComponents() { template void MnaSolver::initializeSystem() { - SPDLOG_LOGGER_INFO(mSLog, "-- Initialize MNA system matrices and source vector"); + SPDLOG_LOGGER_DEBUG(mSLog, "-- Initialize MNA system matrices and source vector"); mRightSideVector.setZero(); // just a sanity check in case we change the static @@ -258,9 +258,11 @@ void MnaSolver::initializeSystemWithVariableMatrix() { for (auto varElem : mVariableComps) for (auto varEntry : varElem->mVariableSystemMatrixEntries) mListVariableSystemMatrixEntries.push_back(varEntry); - SPDLOG_LOGGER_INFO(mSLog, "List of index pairs of varying matrix entries: "); - for (auto indexPair : mListVariableSystemMatrixEntries) - SPDLOG_LOGGER_INFO(mSLog, "({}, {})", indexPair.first, indexPair.second); + SPDLOG_LOGGER_DEBUG(mSLog, "List of index pairs of varying matrix entries: "); + #if defined(DEBUG_BUILD) + for (auto indexPair : mListVariableSystemMatrixEntries) + SPDLOG_LOGGER_DEBUG(mSLog, "({}, {})", indexPair.first, indexPair.second); + #endif stampVariableSystemMatrix(); @@ -305,7 +307,7 @@ void MnaSolver::identifyTopologyObjects() { if (!baseNode->isGround()) { auto node = std::dynamic_pointer_cast< CPS::SimNode >(baseNode); mNodes.push_back(node); - SPDLOG_LOGGER_INFO(mSLog, "Added node {:s}", node->name()); + SPDLOG_LOGGER_DEBUG(mSLog, "Added node {:s}", node->name()); } } @@ -345,14 +347,14 @@ void MnaSolver::assignMatrixNodeIndices() { UInt matrixNodeIndexIdx = 0; for (UInt idx = 0; idx < mNodes.size(); ++idx) { mNodes[idx]->setMatrixNodeIndex(0, matrixNodeIndexIdx); - SPDLOG_LOGGER_INFO(mSLog, "Assigned index {} to phase A of node {}", matrixNodeIndexIdx, idx); + SPDLOG_LOGGER_DEBUG(mSLog, "Assigned index {} to phase A of node {}", matrixNodeIndexIdx, idx); ++matrixNodeIndexIdx; if (mNodes[idx]->phaseType() == CPS::PhaseType::ABC) { mNodes[idx]->setMatrixNodeIndex(1, matrixNodeIndexIdx); - SPDLOG_LOGGER_INFO(mSLog, "Assigned index {} to phase B of node {}", matrixNodeIndexIdx, idx); + SPDLOG_LOGGER_DEBUG(mSLog, "Assigned index {} to phase B of node {}", matrixNodeIndexIdx, idx); ++matrixNodeIndexIdx; mNodes[idx]->setMatrixNodeIndex(2, matrixNodeIndexIdx); - SPDLOG_LOGGER_INFO(mSLog, "Assigned index {} to phase C of node {}", matrixNodeIndexIdx, idx); + SPDLOG_LOGGER_DEBUG(mSLog, "Assigned index {} to phase C of node {}", matrixNodeIndexIdx, idx); ++matrixNodeIndexIdx; } // This should be true when the final network node is reached, not considering virtual nodes @@ -394,8 +396,6 @@ template void MnaSolver::collectVirtualNodes() { // We have not added virtual nodes yet so the list has only network nodes mNumNetNodes = (UInt) mNodes.size(); - // virtual nodes are placed after network nodes - UInt virtualNode = mNumNetNodes - 1; for (auto comp : mMNAComponents) { auto pComp = std::dynamic_pointer_cast>(comp); @@ -405,7 +405,7 @@ void MnaSolver::collectVirtualNodes() { if (pComp->hasVirtualNodes()) { for (UInt node = 0; node < pComp->virtualNodesNumber(); ++node) { mNodes.push_back(pComp->virtualNode(node)); - SPDLOG_LOGGER_INFO(mSLog, "Collected virtual node {} of {}", virtualNode, node, pComp->name()); + SPDLOG_LOGGER_DEBUG(mSLog, "Collected virtual node {} of {}", mNumNetNodes - 1, node, pComp->name()); } } @@ -415,7 +415,7 @@ void MnaSolver::collectVirtualNodes() { for (auto pSubComp : pComp->subComponents()) { for (UInt node = 0; node < pSubComp->virtualNodesNumber(); ++node) { mNodes.push_back(pSubComp->virtualNode(node)); - SPDLOG_LOGGER_INFO(mSLog, "Collected virtual node {} of {}", virtualNode, node, pComp->name()); + SPDLOG_LOGGER_DEBUG(mSLog, "Collected virtual node {} of {}", mNumNetNodes - 1, node, pComp->name()); } } } @@ -430,7 +430,7 @@ void MnaSolver::collectVirtualNodes() { if (pComp->hasVirtualNodes()) { for (UInt node = 0; node < pComp->virtualNodesNumber(); ++node) { mNodes.push_back(pComp->virtualNode(node)); - SPDLOG_LOGGER_INFO(mSLog, "Collected virtual node {} of Varible Comp {}", node, pComp->name()); + SPDLOG_LOGGER_DEBUG(mSLog, "Collected virtual node {} of Varible Comp {}", node, pComp->name()); } } } @@ -445,7 +445,7 @@ void MnaSolver::collectVirtualNodes() { template void MnaSolver::steadyStateInitialization() { - SPDLOG_LOGGER_INFO(mSLog, "--- Run steady-state initialization ---"); + SPDLOG_LOGGER_DEBUG(mSLog, "--- Run steady-state initialization ---"); //TODO: Update condition for enabled, see below DataLogger initLeftVectorLog("InitLeftVector", true); @@ -464,7 +464,7 @@ void MnaSolver::steadyStateInitialization() { Matrix diff = Matrix::Zero(2 * mNumNodes, 1); Matrix prevLeftSideVector = Matrix::Zero(2 * mNumNodes, 1); - SPDLOG_LOGGER_INFO(mSLog, "Time step is {:f}s for steady-state initialization", initTimeStep); + SPDLOG_LOGGER_DEBUG(mSLog, "Time step is {:f}s for steady-state initialization", initTimeStep); for (auto comp : mSystem.mComponents) { auto powerComp = std::dynamic_pointer_cast(comp); @@ -531,12 +531,12 @@ void MnaSolver::steadyStateInitialization() { break; } - SPDLOG_LOGGER_INFO(mSLog, "Max difference: {:f} or {:f}% at time {:f}", maxDiff, maxDiff / max, time); + SPDLOG_LOGGER_DEBUG(mSLog, "Max difference: {:f} or {:f}% at time {:f}", maxDiff, maxDiff / max, time); // Reset system for actual simulation mRightSideVector.setZero(); - SPDLOG_LOGGER_INFO(mSLog, "--- Finished steady-state initialization ---"); + SPDLOG_LOGGER_DEBUG(mSLog, "--- Finished steady-state initialization ---"); } template diff --git a/dpsim/src/MNASolverDirect.cpp b/dpsim/src/MNASolverDirect.cpp index bb5e4adba5..fa27f0a6e9 100644 --- a/dpsim/src/MNASolverDirect.cpp +++ b/dpsim/src/MNASolverDirect.cpp @@ -66,23 +66,23 @@ void MnaSolverDirect::stampVariableSystemMatrix() { mBaseSystemMatrix.setZero(); for (auto statElem : mMNAComponents) statElem->mnaApplySystemMatrixStamp(mBaseSystemMatrix); - SPDLOG_LOGGER_INFO(mSLog, "Base matrix with only static elements: {}", Logger::matrixToString(mBaseSystemMatrix)); + SPDLOG_LOGGER_DEBUG(mSLog, "Base matrix with only static elements: {}", Logger::matrixToString(mBaseSystemMatrix)); mSLog->flush(); // Continue from base matrix mVariableSystemMatrix = mBaseSystemMatrix; // Now stamp switches into matrix - SPDLOG_LOGGER_INFO(mSLog, "Stamping switches"); + SPDLOG_LOGGER_DEBUG(mSLog, "Stamping switches"); for (auto sw : mMNAIntfSwitches) sw->mnaApplySystemMatrixStamp(mVariableSystemMatrix); // Now stamp initial state of variable elements into matrix - SPDLOG_LOGGER_INFO(mSLog, "Stamping variable elements"); + SPDLOG_LOGGER_DEBUG(mSLog, "Stamping variable elements"); for (auto varElem : mMNAIntfVariableComps) varElem->mnaApplySystemMatrixStamp(mVariableSystemMatrix); - SPDLOG_LOGGER_INFO(mSLog, "Initial system matrix with variable elements {}", Logger::matrixToString(mVariableSystemMatrix)); + SPDLOG_LOGGER_DEBUG(mSLog, "Initial system matrix with variable elements {}", Logger::matrixToString(mVariableSystemMatrix)); /* TODO: find replacement for flush() */ mSLog->flush(); @@ -307,32 +307,32 @@ template void MnaSolverDirect::logSystemMatrices() { if (mFrequencyParallel) { for (UInt i = 0; i < mSwitchedMatrices[std::bitset(0)].size(); ++i) { - SPDLOG_LOGGER_INFO(mSLog, "System matrix for frequency: {:d} \n{:s}", i, Logger::matrixToString(mSwitchedMatrices[std::bitset(0)][i])); + SPDLOG_LOGGER_DEBUG(mSLog, "System matrix for frequency: {:d} \n{:s}", i, Logger::matrixToString(mSwitchedMatrices[std::bitset(0)][i])); } for (UInt i = 0; i < mRightSideVectorHarm.size(); ++i) { - SPDLOG_LOGGER_INFO(mSLog, "Right side vector for frequency: {:d} \n{:s}", i, Logger::matrixToString(mRightSideVectorHarm[i])); + SPDLOG_LOGGER_DEBUG(mSLog, "Right side vector for frequency: {:d} \n{:s}", i, Logger::matrixToString(mRightSideVectorHarm[i])); } } else if (mSystemMatrixRecomputation) { - SPDLOG_LOGGER_INFO(mSLog, "Summarizing matrices: "); - SPDLOG_LOGGER_INFO(mSLog, "Base matrix with only static elements: {}", Logger::matrixToString(mBaseSystemMatrix)); - SPDLOG_LOGGER_INFO(mSLog, "Initial system matrix with variable elements {}", Logger::matrixToString(mVariableSystemMatrix)); - SPDLOG_LOGGER_INFO(mSLog, "Right side vector: {}", Logger::matrixToString(mRightSideVector)); + SPDLOG_LOGGER_DEBUG(mSLog, "Summarizing matrices: "); + SPDLOG_LOGGER_DEBUG(mSLog, "Base matrix with only static elements: {}", Logger::matrixToString(mBaseSystemMatrix)); + SPDLOG_LOGGER_DEBUG(mSLog, "Initial system matrix with variable elements {}", Logger::matrixToString(mVariableSystemMatrix)); + SPDLOG_LOGGER_DEBUG(mSLog, "Right side vector: {}", Logger::matrixToString(mRightSideVector)); } else { if (mSwitches.size() < 1) { - SPDLOG_LOGGER_INFO(mSLog, "System matrix: \n{}", mSwitchedMatrices[std::bitset(0)][0]); + SPDLOG_LOGGER_DEBUG(mSLog, "System matrix: \n{}", mSwitchedMatrices[std::bitset(0)][0]); } else { - SPDLOG_LOGGER_INFO(mSLog, "Initial switch status: {:s}", mCurrentSwitchStatus.to_string()); + SPDLOG_LOGGER_DEBUG(mSLog, "Initial switch status: {:s}", mCurrentSwitchStatus.to_string()); for (auto sys : mSwitchedMatrices) { - SPDLOG_LOGGER_INFO(mSLog, "Switching System matrix {:s} \n{:s}", + SPDLOG_LOGGER_DEBUG(mSLog, "Switching System matrix {:s} \n{:s}", sys.first.to_string(), Logger::matrixToString(sys.second[0])); } } - SPDLOG_LOGGER_INFO(mSLog, "Right side vector: \n{}", mRightSideVector); + SPDLOG_LOGGER_DEBUG(mSLog, "Right side vector: \n{}", mRightSideVector); } } diff --git a/dpsim/src/PFSolver.cpp b/dpsim/src/PFSolver.cpp index 590b2c9a10..70e315005e 100644 --- a/dpsim/src/PFSolver.cpp +++ b/dpsim/src/PFSolver.cpp @@ -20,7 +20,7 @@ PFSolver::PFSolver(CPS::String name, CPS::SystemTopology system, CPS::Real timeS } void PFSolver::initialize(){ - SPDLOG_LOGGER_INFO(mSLog, "#### INITIALIZATION OF POWERFLOW SOLVER "); + SPDLOG_LOGGER_DEBUG(mSLog, "#### INITIALIZATION OF POWERFLOW SOLVER "); for (auto comp : mSystem.mComponents) { if (std::shared_ptr gen = std::dynamic_pointer_cast(comp)) mSynchronGenerators.push_back(gen); @@ -54,11 +54,11 @@ void PFSolver::initialize(){ } void PFSolver::assignMatrixNodeIndices() { - SPDLOG_LOGGER_INFO(mSLog, "Assigning simulation nodes to topology nodes:"); + SPDLOG_LOGGER_DEBUG(mSLog, "Assigning simulation nodes to topology nodes:"); UInt matrixNodeIndexIdx = 0; for (UInt idx = 0; idx < mSystem.mNodes.size(); ++idx) { mSystem.mNodes[idx]->setMatrixNodeIndex(0, matrixNodeIndexIdx); - SPDLOG_LOGGER_INFO(mSLog, "Node {}: MatrixNodeIndex {}", mSystem.mNodes[idx]->uid(), mSystem.mNodes[idx]->matrixNodeIndex()); + SPDLOG_LOGGER_DEBUG(mSLog, "Node {}: MatrixNodeIndex {}", mSystem.mNodes[idx]->uid(), mSystem.mNodes[idx]->matrixNodeIndex()); ++matrixNodeIndexIdx; } SPDLOG_LOGGER_INFO(mSLog, "Number of simulation nodes: {:d}", matrixNodeIndexIdx); @@ -69,7 +69,7 @@ void PFSolver::initializeComponents(){ std::dynamic_pointer_cast>(comp)->updateMatrixNodeIndices(); } - SPDLOG_LOGGER_INFO(mSLog, "-- Initialize components from terminals or nodes of topology"); + SPDLOG_LOGGER_DEBUG(mSLog, "-- Initialize components from terminals or nodes of topology"); for (auto comp : mSystem.mComponents) { auto pComp = std::dynamic_pointer_cast>(comp); if (!pComp) continue; @@ -77,7 +77,7 @@ void PFSolver::initializeComponents(){ pComp->initializeFromNodesAndTerminals(mSystem.mSystemFrequency); } - SPDLOG_LOGGER_INFO(mSLog, "-- Calculate per unit parameters for all components"); + SPDLOG_LOGGER_DEBUG(mSLog, "-- Calculate per unit parameters for all components"); for (auto extnet : mExternalGrids) { extnet->calculatePerUnitParameters(mBaseApparentPower, mSystem.mSystemOmega); } @@ -121,7 +121,7 @@ void PFSolver::setBaseApparentPower() { mBaseApparentPower = 100000000; SPDLOG_LOGGER_WARN(mSLog, "No suitable quantity found for setting mBaseApparentPower. Using {} VA.", mBaseApparentPower); } - SPDLOG_LOGGER_INFO(mSLog, "Base power = {} VA", mBaseApparentPower); + SPDLOG_LOGGER_DEBUG(mSLog, "Base power = {} VA", mBaseApparentPower); } void PFSolver::determinePFBusType() { @@ -129,7 +129,7 @@ void PFSolver::determinePFBusType() { mPVBusIndices.clear(); mVDBusIndices.clear(); - SPDLOG_LOGGER_INFO(mSLog, "-- Determine powerflow bus type for each node"); + SPDLOG_LOGGER_DEBUG(mSLog, "-- Determine powerflow bus type for each node"); // Determine powerflow bus type of each node through analysis of system topology for (auto node : mSystem.mNodes) { @@ -215,15 +215,15 @@ void PFSolver::determinePFBusType() { mPQPVBusIndices.insert(mPQPVBusIndices.end(), mPQBusIndices.begin(), mPQBusIndices.end()); mPQPVBusIndices.insert(mPQPVBusIndices.end(), mPVBusIndices.begin(), mPVBusIndices.end()); - SPDLOG_LOGGER_INFO(mSLog, "#### Create index vectors for power flow solver:"); - SPDLOG_LOGGER_INFO(mSLog, "PQ Buses: {}", logVector(mPQBusIndices)); - SPDLOG_LOGGER_INFO(mSLog, "PV Buses: {}", logVector(mPVBusIndices)); - SPDLOG_LOGGER_INFO(mSLog, "VD Buses: {}", logVector(mVDBusIndices)); + SPDLOG_LOGGER_DEBUG(mSLog, "#### Create index vectors for power flow solver:"); + SPDLOG_LOGGER_DEBUG(mSLog, "PQ Buses: {}", logVector(mPQBusIndices)); + SPDLOG_LOGGER_DEBUG(mSLog, "PV Buses: {}", logVector(mPVBusIndices)); + SPDLOG_LOGGER_DEBUG(mSLog, "VD Buses: {}", logVector(mVDBusIndices)); } void PFSolver::determineNodeBaseVoltages() { - SPDLOG_LOGGER_INFO(mSLog, "-- Determine base voltages for each node according to connected components"); + SPDLOG_LOGGER_DEBUG(mSLog, "-- Determine base voltages for each node according to connected components"); mSLog->flush(); for (auto node : mSystem.mNodes) { @@ -231,34 +231,34 @@ void PFSolver::determineNodeBaseVoltages() { for (auto comp : mSystem.mComponentsAtNode[node]) { if (std::shared_ptr vsi = std::dynamic_pointer_cast(comp)) { baseVoltage_=Math::abs(vsi->attributeTyped("vnom")->get()); - SPDLOG_LOGGER_INFO(mSLog, "Choose base voltage {}V of {} to convert pu-solution of {}.", baseVoltage_, vsi->name(), node->name()); + SPDLOG_LOGGER_DEBUG(mSLog, "Choose base voltage {}V of {} to convert pu-solution of {}.", baseVoltage_, vsi->name(), node->name()); break; } else if (std::shared_ptr rxline = std::dynamic_pointer_cast(comp)) { baseVoltage_ = rxline->attributeTyped("base_Voltage")->get(); - SPDLOG_LOGGER_INFO(mSLog, "Choose base voltage {}V of {} to convert pu-solution of {}.", baseVoltage_, rxline->name(), node->name()); + SPDLOG_LOGGER_DEBUG(mSLog, "Choose base voltage {}V of {} to convert pu-solution of {}.", baseVoltage_, rxline->name(), node->name()); break; } else if (std::shared_ptr line = std::dynamic_pointer_cast(comp)) { baseVoltage_ = line->attributeTyped("base_Voltage")->get(); - SPDLOG_LOGGER_INFO(mSLog, "Choose base voltage {}V of {} to convert pu-solution of {}.", baseVoltage_, line->name(), node->name()); + SPDLOG_LOGGER_DEBUG(mSLog, "Choose base voltage {}V of {} to convert pu-solution of {}.", baseVoltage_, line->name(), node->name()); break; } else if (std::shared_ptr trans = std::dynamic_pointer_cast(comp)) { if (trans->terminal(0)->node()->name() == node->name()){ baseVoltage_ = trans->attributeTyped("nominal_voltage_end1")->get(); - SPDLOG_LOGGER_INFO(mSLog, "Choose base voltage {}V of {} to convert pu-solution of {}.", baseVoltage_, trans->name(), node->name()); + SPDLOG_LOGGER_DEBUG(mSLog, "Choose base voltage {}V of {} to convert pu-solution of {}.", baseVoltage_, trans->name(), node->name()); break; } else if (trans->terminal(1)->node()->name() == node->name()){ baseVoltage_ = trans->attributeTyped("nominal_voltage_end2")->get(); - SPDLOG_LOGGER_INFO(mSLog, "Choose base voltage {}V of {} to convert pu-solution of {}.", baseVoltage_, trans->name(), node->name()); + SPDLOG_LOGGER_DEBUG(mSLog, "Choose base voltage {}V of {} to convert pu-solution of {}.", baseVoltage_, trans->name(), node->name()); break; } } else if (std::shared_ptr gen = std::dynamic_pointer_cast(comp)) { baseVoltage_ = gen->attributeTyped("base_Voltage")->get(); - SPDLOG_LOGGER_INFO(mSLog, "Choose base voltage {}V of {} to convert pu-solution of {}.", baseVoltage_, gen->name(), node->name()); + SPDLOG_LOGGER_DEBUG(mSLog, "Choose base voltage {}V of {} to convert pu-solution of {}.", baseVoltage_, gen->name(), node->name()); break; } else { @@ -300,20 +300,20 @@ void PFSolver::modifyPowerFlowBusComponent(CPS::String name, CPS::PowerflowBusTy void PFSolver::setSolverAndComponentBehaviour(Solver::Behaviour behaviour) { mBehaviour = behaviour; if (mBehaviour == Behaviour::Initialization) { - SPDLOG_LOGGER_INFO(mSLog, "-- Set solver behaviour to Initialization"); + SPDLOG_LOGGER_DEBUG(mSLog, "-- Set solver behaviour to Initialization"); // TODO: solver setting specific to initialization (e.g. one single PF run) - SPDLOG_LOGGER_INFO(mSLog, "-- Set component behaviour to Initialization"); + SPDLOG_LOGGER_DEBUG(mSLog, "-- Set component behaviour to Initialization"); for (auto comp : mSystem.mComponents) { auto powerComp = std::dynamic_pointer_cast(comp); if (powerComp) powerComp->setBehaviour(TopologicalPowerComp::Behaviour::Initialization); } } else { - SPDLOG_LOGGER_INFO(mSLog, "-- Set solver behaviour to Simulation"); + SPDLOG_LOGGER_DEBUG(mSLog, "-- Set solver behaviour to Simulation"); // TODO: solver setting specific to simulation - SPDLOG_LOGGER_INFO(mSLog, "-- Set component behaviour to PFSimulation"); + SPDLOG_LOGGER_DEBUG(mSLog, "-- Set component behaviour to PFSimulation"); for (auto comp : mSystem.mComponents) { auto powerComp = std::dynamic_pointer_cast(comp); if (powerComp) powerComp->setBehaviour(TopologicalPowerComp::Behaviour::PFSimulation); @@ -331,7 +331,7 @@ void PFSolver::composeAdmittanceMatrix() { for(auto trans : mTransformers) { //to check if this transformer could be ignored if (**trans->mResistance == 0 && **trans->mInductance == 0) { - SPDLOG_LOGGER_INFO(mSLog, "{} {} ignored for R = 0 and L = 0",trans->type(), trans->name()); + SPDLOG_LOGGER_DEBUG(mSLog, "{} {} ignored for R = 0 and L = 0",trans->type(), trans->name()); continue; } trans->pfApplyAdmittanceMatrixStamp(mY); diff --git a/dpsim/src/PFSolverPowerPolar.cpp b/dpsim/src/PFSolverPowerPolar.cpp index 0fd371e1b2..d24054207c 100644 --- a/dpsim/src/PFSolverPowerPolar.cpp +++ b/dpsim/src/PFSolverPowerPolar.cpp @@ -114,10 +114,10 @@ void PFSolverPowerPolar::generateInitialSolution(Real time, bool keep_last_solut Pesp = sol_P; Qesp = sol_Q; - SPDLOG_LOGGER_INFO(mSLog, "#### Initial solution: "); - SPDLOG_LOGGER_INFO(mSLog, "P\t\tQ\t\tV\t\tD"); + SPDLOG_LOGGER_DEBUG(mSLog, "#### Initial solution: "); + SPDLOG_LOGGER_DEBUG(mSLog, "P\t\tQ\t\tV\t\tD"); for (UInt i = 0; i < mSystem.mNodes.size(); ++i) { - SPDLOG_LOGGER_INFO(mSLog, "{}\t{}\t{}\t{}", sol_P[i], sol_Q[i], sol_V[i], sol_D[i]); + SPDLOG_LOGGER_DEBUG(mSLog, "{}\t{}\t{}\t{}", sol_P[i], sol_Q[i], sol_V[i], sol_D[i]); } mSLog->flush(); } @@ -262,16 +262,16 @@ void PFSolverPowerPolar::updateSolution() { void PFSolverPowerPolar::setSolution() { if (! isConverged) { - SPDLOG_LOGGER_INFO(mSLog, "Not converged within {} iterations", mIterations); + SPDLOG_LOGGER_DEBUG(mSLog, "Not converged within {} iterations", mIterations); } else { calculatePAndQAtSlackBus(); calculateQAtPVBuses(); - SPDLOG_LOGGER_INFO(mSLog, "converged in {} iterations",mIterations); - SPDLOG_LOGGER_INFO(mSLog, "Solution: "); - SPDLOG_LOGGER_INFO(mSLog, "P\t\tQ\t\tV\t\tD"); + SPDLOG_LOGGER_DEBUG(mSLog, "converged in {} iterations",mIterations); + SPDLOG_LOGGER_DEBUG(mSLog, "Solution: "); + SPDLOG_LOGGER_DEBUG(mSLog, "P\t\tQ\t\tV\t\tD"); for (UInt i = 0; i < mSystem.mNodes.size(); ++i) { - SPDLOG_LOGGER_INFO(mSLog, "{}\t{}\t{}\t{}", sol_P[i], sol_Q[i], sol_V[i], sol_D[i]); + SPDLOG_LOGGER_DEBUG(mSLog, "{}\t{}\t{}\t{}", sol_P[i], sol_Q[i], sol_V[i], sol_D[i]); } } for (UInt i = 0; i < mSystem.mNodes.size(); ++i) { diff --git a/examples/Notebooks/Performance/WSCC_9bus_mult_coupled_validate_SparseLU_DenseLU_KLU.ipynb b/examples/Notebooks/Performance/WSCC_9bus_mult_coupled_validate_SparseLU_DenseLU_KLU.ipynb index 336dcc807f..acf1ede593 100644 --- a/examples/Notebooks/Performance/WSCC_9bus_mult_coupled_validate_SparseLU_DenseLU_KLU.ipynb +++ b/examples/Notebooks/Performance/WSCC_9bus_mult_coupled_validate_SparseLU_DenseLU_KLU.ipynb @@ -63,7 +63,7 @@ "\n", "def simulate_coupled(filenames, copies, threads, seq, implementation):\n", " dpsimpy.Logger.set_log_dir(log_dir+\"/\"+sim_name)\n", - " reader = dpsimpy.CIMReader(sim_name, log_level, log_level)\n", + " reader = dpsimpy.CIMReader(log_level, dpsimpy.LogLevel.off, log_level)\n", " sys = reader.loadCIM(60, filenames, dpsimpy.Domain.DP, dpsimpy.PhaseType.Single, dpsimpy.GeneratorType.IdealVoltageSource)\n", " \n", " # if copies > 0:\n", @@ -165,7 +165,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.13" + "version": "3.10.11" } }, "nbformat": 4, From 0e1dd5d2ee339472494b98cd8639e9c934eec60a Mon Sep 17 00:00:00 2001 From: Jonas Schroeder Date: Mon, 17 Jul 2023 10:16:45 +0000 Subject: [PATCH 15/31] add a new logger for interfaces Signed-off-by: Jonas Schroeder --- dpsim-models/src/Logger.cpp | 4 ++-- .../include/dpsim-villas/InterfaceVillas.h | 4 ++-- dpsim-villas/src/InterfaceVillas.cpp | 6 +++--- dpsim-villas/src/InterfaceWorkerVillas.cpp | 8 +++---- dpsim-villas/src/pybind-dpsim-villas.cpp | 10 +++++---- dpsim/include/dpsim/Interface.h | 12 ++--------- dpsim/include/dpsim/Simulation.h | 1 - dpsim/src/Interface.cpp | 21 ++++++++++++------- 8 files changed, 32 insertions(+), 34 deletions(-) diff --git a/dpsim-models/src/Logger.cpp b/dpsim-models/src/Logger.cpp index ebf5f7bc31..d594798113 100644 --- a/dpsim-models/src/Logger.cpp +++ b/dpsim-models/src/Logger.cpp @@ -223,8 +223,8 @@ Logger::Log Logger::create(Logger::LoggerType type, const std::string &name, con if (filelevel < Level::info || clilevel < Level::info) { SPDLOG_LOGGER_WARN(logger, "This logger has been configured to log at level {} (file) and {} (cli)." - "However, because this is a release build, debug logging has been disabled." - "Please build in debug mode for extended log output.", + " However, because this is a release build, debug logging has been disabled." + " Please build in debug mode for extended log output.", filelevel, clilevel); } #endif diff --git a/dpsim-villas/include/dpsim-villas/InterfaceVillas.h b/dpsim-villas/include/dpsim-villas/InterfaceVillas.h index 98b31dab74..590622cedf 100644 --- a/dpsim-villas/include/dpsim-villas/InterfaceVillas.h +++ b/dpsim-villas/include/dpsim-villas/InterfaceVillas.h @@ -29,7 +29,7 @@ namespace DPsim { /// @param sampleLength sample length configured for the node /// @param name Name of this interface. Currently only used for naming the simulation tasks /// @param downsampling Only import and export attributes on every nth timestep - InterfaceVillas(const String &nodeConfig, UInt queueLength = 512, UInt sampleLength = 64, const String& name = "", UInt downsampling = 1); + InterfaceVillas(const String &nodeConfig, CPS::Logger::Level logLevel = CPS::Logger::Level::info, CPS::Logger::Level cliLevel = CPS::Logger::Level::info, UInt queueLength = 512, UInt sampleLength = 64, const String& name = "", UInt downsampling = 1); /// @brief configure an attribute import /// @param attr the attribute that should be updated with the imported values @@ -37,7 +37,7 @@ namespace DPsim { /// @param blockOnRead Whether the simulation should block on every import until the attribute has been updated /// @param syncOnSimulationStart Whether the simulation should block before the first timestep until this attribute has been updated void importAttribute(CPS::AttributeBase::Ptr attr, UInt idx, Bool blockOnRead = false, Bool syncOnSimulationStart = true); - + /// @brief configure an attribute export /// @param attr the attribute which's value should be exported /// @param idx The id given to the attribute within VILLASnode samples diff --git a/dpsim-villas/src/InterfaceVillas.cpp b/dpsim-villas/src/InterfaceVillas.cpp index 6e1e65a52c..c0bec0ffcb 100644 --- a/dpsim-villas/src/InterfaceVillas.cpp +++ b/dpsim-villas/src/InterfaceVillas.cpp @@ -7,8 +7,8 @@ using namespace villas; namespace DPsim { - InterfaceVillas::InterfaceVillas(const String &nodeConfig, UInt queueLength, UInt sampleLength, const String& name, UInt downsampling) - : Interface(InterfaceWorkerVillas::make(nodeConfig, queueLength, sampleLength), name, downsampling) { } + InterfaceVillas::InterfaceVillas(const String &nodeConfig, CPS::Logger::Level logLevel, CPS::Logger::Level cliLevel, UInt queueLength, UInt sampleLength, const String& name, UInt downsampling) + : Interface(InterfaceWorkerVillas::make(nodeConfig, queueLength, sampleLength), logLevel, cliLevel, name, downsampling) { } void InterfaceVillas::importAttribute(CPS::AttributeBase::Ptr attr, UInt idx, Bool blockOnRead, Bool syncOnSimulationStart) { Interface::addImport(attr, blockOnRead, syncOnSimulationStart); @@ -20,4 +20,4 @@ namespace DPsim { std::dynamic_pointer_cast(mInterfaceWorker)->configureExport((UInt)mExportAttrsDpsim.size() - 1, attr->getType(), idx, waitForOnWrite, name, unit); } -} \ No newline at end of file +} diff --git a/dpsim-villas/src/InterfaceWorkerVillas.cpp b/dpsim-villas/src/InterfaceWorkerVillas.cpp index eb9a721e71..1bcaaaa6b4 100644 --- a/dpsim-villas/src/InterfaceWorkerVillas.cpp +++ b/dpsim-villas/src/InterfaceWorkerVillas.cpp @@ -30,10 +30,10 @@ InterfaceWorkerVillas::InterfaceWorkerVillas(const String &nodeConfig, UInt queu { } void InterfaceWorkerVillas::open() { - SPDLOG_LOGGER_INFO(mLog, "Opening InterfaceWorkerVillas..."); + SPDLOG_LOGGER_INFO(mLog, "Opening InterfaceVillas..."); if (!InterfaceWorkerVillas::villasInitialized) { - SPDLOG_LOGGER_INFO(mLog, "Initializing Villas..."); + SPDLOG_LOGGER_DEBUG(mLog, "Initializing Villas..."); initVillas(); InterfaceWorkerVillas::villasInitialized = true; } @@ -67,10 +67,10 @@ void InterfaceWorkerVillas::open() { std::exit(1); } - SPDLOG_LOGGER_INFO(mLog, "Preparing VILLASNode instance..."); + SPDLOG_LOGGER_DEBUG(mLog, "Preparing VILLASNode instance..."); setupNodeSignals(); prepareNode(); - SPDLOG_LOGGER_INFO(mLog, "Node is ready to send / receive data!"); + SPDLOG_LOGGER_DEBUG(mLog, "Node is ready to send / receive data!"); mOpened = true; mSequence = 0; diff --git a/dpsim-villas/src/pybind-dpsim-villas.cpp b/dpsim-villas/src/pybind-dpsim-villas.cpp index b747d90c43..ed3d6f3542 100644 --- a/dpsim-villas/src/pybind-dpsim-villas.cpp +++ b/dpsim-villas/src/pybind-dpsim-villas.cpp @@ -17,9 +17,11 @@ class PyInterfaceVillas: public DPsim::InterfaceVillas { public: using DPsim::InterfaceVillas::InterfaceVillas; - PyInterfaceVillas(py::dict config, CPS::UInt queueLength, CPS::UInt sampleLength, const CPS::String &name, CPS::UInt downsampling) : - InterfaceVillas( + PyInterfaceVillas(py::dict config, CPS::Logger::Level logLevel, CPS::Logger::Level cliLevel, CPS::UInt queueLength, CPS::UInt sampleLength, const CPS::String &name, CPS::UInt downsampling) : + InterfaceVillas( (py::str) py::module_::import("json").attr("dumps")(config, "indent"_a = py::none()), //json.dumps(config, indent=None) + logLevel, + cliLevel, queueLength, sampleLength, name, @@ -33,8 +35,8 @@ PYBIND11_MODULE(dpsimpyvillas, m) { py::object interface = (py::object) py::module_::import("dpsimpy").attr("Interface"); py::class_>(m, "InterfaceVillas", interface) - .def(py::init(), "config"_a, "queue_length"_a=512, "sample_length"_a = 64, "name"_a = "", "downsampling"_a=1) // cppcheck-suppress assignBoolToPointer - .def(py::init(), "config"_a, "queue_length"_a=512, "sample_length"_a = 64, "name"_a = "", "downsampling"_a=1) // cppcheck-suppress assignBoolToPointer + .def(py::init(), "config"_a, "log_level"_a = CPS::Logger::Level::info, "cli_level"_a = CPS::Logger::Level::info, "queue_length"_a=512, "sample_length"_a = 64, "name"_a = "", "downsampling"_a=1) // cppcheck-suppress assignBoolToPointer + .def(py::init(), "config"_a, "log_level"_a = CPS::Logger::Level::info, "cli_level"_a = CPS::Logger::Level::info, "queue_length"_a=512, "sample_length"_a = 64, "name"_a = "", "downsampling"_a=1) // cppcheck-suppress assignBoolToPointer .def("import_attribute", &PyInterfaceVillas::importAttribute, "attr"_a, "idx"_a, "block_on_read"_a = false, "sync_on_start"_a = true) // cppcheck-suppress assignBoolToPointer .def("export_attribute", &PyInterfaceVillas::exportAttribute, "attr"_a, "idx"_a, "wait_for_on_write"_a = true, "name"_a = "", "unit"_a = ""); // cppcheck-suppress assignBoolToPointer } diff --git a/dpsim/include/dpsim/Interface.h b/dpsim/include/dpsim/Interface.h index 1c59d863c9..a40f8236f4 100644 --- a/dpsim/include/dpsim/Interface.h +++ b/dpsim/include/dpsim/Interface.h @@ -36,13 +36,7 @@ namespace DPsim { PACKET_CLOSE_INTERFACE = 1, }; - Interface(std::shared_ptr intf, const String& name = "", UInt downsampling = 1) : - mInterfaceWorker(intf), - mName(name), - mDownsampling(downsampling) { - mQueueDpsimToInterface = std::make_shared>(); - mQueueInterfaceToDpsim = std::make_shared>(); - }; + Interface(std::shared_ptr intf, CPS::Logger::Level fileLevel = CPS::Logger::Level::info, CPS::Logger::Level cliLevel = CPS::Logger::Level::info, const String& name = "", UInt downsampling = 1); virtual void open(); virtual void close(); @@ -61,8 +55,6 @@ namespace DPsim { virtual CPS::Task::List getTasks(); - void setLogger(CPS::Logger::Log log); - virtual ~Interface() { if (mOpened) close(); @@ -108,7 +100,7 @@ namespace DPsim { mInterfaceWorker(intf) {}; void operator() () const; }; - + class ReaderThread { private: std::shared_ptr> mQueueInterfaceToDpsim; diff --git a/dpsim/include/dpsim/Simulation.h b/dpsim/include/dpsim/Simulation.h index 99fa91a6db..5d9dbf776a 100644 --- a/dpsim/include/dpsim/Simulation.h +++ b/dpsim/include/dpsim/Simulation.h @@ -242,7 +242,6 @@ namespace DPsim { /// void addInterface(Interface::Ptr eint) { - eint->setLogger(mLog); mInterfaces.push_back(eint); } diff --git a/dpsim/src/Interface.cpp b/dpsim/src/Interface.cpp index 471d84550f..447f1e6762 100644 --- a/dpsim/src/Interface.cpp +++ b/dpsim/src/Interface.cpp @@ -7,6 +7,19 @@ using namespace CPS; namespace DPsim { + Interface::Interface(std::shared_ptr intf, Logger::Level logLevel, Logger::Level cliLevel, const String& name, UInt downsampling) : + mInterfaceWorker(intf), + mLog(Logger::get(Logger::LoggerType::SIMULATION, "interface", logLevel, cliLevel)), + mName(name), + mDownsampling(downsampling) { + mQueueDpsimToInterface = std::make_shared>(); + mQueueInterfaceToDpsim = std::make_shared>(); + if (mInterfaceWorker) + { + mInterfaceWorker->mLog = mLog; + } + }; + void Interface::open() { mInterfaceWorker->open(); mOpened = true; @@ -77,14 +90,6 @@ namespace DPsim { mExportAttrsDpsim.emplace_back(attr, 0); } - void Interface::setLogger(CPS::Logger::Log log) { - mLog = log; - if (mInterfaceWorker != nullptr) - { - mInterfaceWorker->mLog = log; - } - } - void Interface::syncImports() { //Block on read until all attributes with syncOnSimulationStart are read this->popDpsimAttrsFromQueue(true); From b33f6b999805fa282c50fec1d682741621797947 Mon Sep 17 00:00:00 2001 From: Jonas Schroeder Date: Tue, 18 Jul 2023 10:06:50 +0000 Subject: [PATCH 16/31] change some simulation logs to debug level Signed-off-by: Jonas Schroeder --- dpsim/src/RealTimeSimulation.cpp | 12 ++++++------ dpsim/src/Simulation.cpp | 18 +++++++++--------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/dpsim/src/RealTimeSimulation.cpp b/dpsim/src/RealTimeSimulation.cpp index b183acdfb1..c1280dfdc6 100644 --- a/dpsim/src/RealTimeSimulation.cpp +++ b/dpsim/src/RealTimeSimulation.cpp @@ -29,12 +29,12 @@ void RealTimeSimulation::run(const Timer::StartClock::time_point &startAt) { if (!mInitialized) initialize(); - SPDLOG_LOGGER_INFO(mLog, "Opening interfaces."); - - for (auto intf : mInterfaces) - intf->open(); - - sync(); + if (!mInterfaces.empty()) { + SPDLOG_LOGGER_DEBUG(mLog, "Opening interfaces."); + for (auto intf : mInterfaces) + intf->open(); + sync(); + } auto now_time = std::chrono::system_clock::to_time_t(startAt); SPDLOG_LOGGER_INFO(mLog, "Starting simulation at {} (delta_T = {} seconds)", diff --git a/dpsim/src/Simulation.cpp b/dpsim/src/Simulation.cpp index 54dba2b3ae..18d2c3ff4c 100644 --- a/dpsim/src/Simulation.cpp +++ b/dpsim/src/Simulation.cpp @@ -205,10 +205,10 @@ void Simulation::prepSchedule() { } void Simulation::schedule() { - SPDLOG_LOGGER_INFO(mLog, "Scheduling tasks."); + SPDLOG_LOGGER_DEBUG(mLog, "Scheduling tasks."); prepSchedule(); mScheduler->createSchedule(mTasks, mTaskInEdges, mTaskOutEdges); - SPDLOG_LOGGER_INFO(mLog, "Scheduling done."); + SPDLOG_LOGGER_DEBUG(mLog, "Scheduling done."); } #ifdef WITH_GRAPHVIZ @@ -311,7 +311,7 @@ Graph::Graph Simulation::dependencyGraph() { if (avgTimeWorst > Scheduler::TaskTime(0)) { auto grad = (float) avgTimes[task].count() / avgTimeWorst.count(); n->set("fillcolor", CPS::Utils::Rgb::gradient(grad).hex()); - SPDLOG_LOGGER_INFO(mLog, "{} {}", task->toString(), CPS::Utils::Rgb::gradient(grad).hex()); + SPDLOG_LOGGER_DEBUG(mLog, "{} {}", task->toString(), CPS::Utils::Rgb::gradient(grad).hex()); } } else { @@ -335,12 +335,12 @@ void Simulation::start() { if (!mInitialized) initialize(); - SPDLOG_LOGGER_INFO(mLog, "Opening interfaces."); - - for (auto intf : mInterfaces) - intf->open(); - - sync(); + if (!mInterfaces.empty()) { + SPDLOG_LOGGER_DEBUG(mLog, "Opening interfaces."); + for (auto intf : mInterfaces) + intf->open(); + sync(); + } SPDLOG_LOGGER_INFO(mLog, "Start simulation: {}", **mName); SPDLOG_LOGGER_INFO(mLog, "Time step: {:e}", **mTimeStep); From 83a3b6962e59ae870a9cf4a26f898adad8c0585e Mon Sep 17 00:00:00 2001 From: Jonas Schroeder Date: Tue, 18 Jul 2023 10:54:34 +0000 Subject: [PATCH 17/31] update component log levels Signed-off-by: Jonas Schroeder --- .../dpsim-models/TopologicalPowerComp.h | 6 +-- .../Base_ReducedOrderSynchronGenerator.cpp | 10 ++--- dpsim-models/src/CSVReader.cpp | 12 +++--- .../DP/DP_Ph1_AvVoltageSourceInverterDQ.cpp | 4 +- dpsim-models/src/DP/DP_Ph1_Capacitor.cpp | 34 ++++++++-------- dpsim-models/src/DP/DP_Ph1_Inductor.cpp | 34 ++++++++-------- dpsim-models/src/DP/DP_Ph1_Inverter.cpp | 26 ++++++------ .../src/DP/DP_Ph1_NetworkInjection.cpp | 6 +-- dpsim-models/src/DP/DP_Ph1_PiLine.cpp | 2 +- dpsim-models/src/DP/DP_Ph1_RXLoadSwitch.cpp | 4 +- ...P_Ph1_ReducedOrderSynchronGeneratorVBR.cpp | 4 +- dpsim-models/src/DP/DP_Ph1_ResIndSeries.cpp | 34 ++++++++-------- dpsim-models/src/DP/DP_Ph1_Resistor.cpp | 28 ++++++------- dpsim-models/src/DP/DP_Ph1_SVC.cpp | 22 +++++----- dpsim-models/src/DP/DP_Ph1_Switch.cpp | 20 +++++----- .../DP/DP_Ph1_SynchronGenerator4OrderTPM.cpp | 6 +-- .../src/DP/DP_Ph1_SynchronGeneratorTrStab.cpp | 8 ++-- dpsim-models/src/DP/DP_Ph1_Transformer.cpp | 28 ++++++------- dpsim-models/src/DP/DP_Ph1_VoltageSource.cpp | 26 ++++++------ .../src/DP/DP_Ph1_VoltageSourceNorton.cpp | 8 ++-- dpsim-models/src/DP/DP_Ph1_varResSwitch.cpp | 10 ++--- dpsim-models/src/DP/DP_Ph3_Resistor.cpp | 4 +- dpsim-models/src/DP/DP_Ph3_SeriesResistor.cpp | 12 +++--- dpsim-models/src/DP/DP_Ph3_SeriesSwitch.cpp | 20 +++++----- .../src/DP/DP_Ph3_SynchronGeneratorDQ.cpp | 6 +-- .../src/DP/DP_Ph3_SynchronGeneratorDQODE.cpp | 2 +- ...DP_Ph3_SynchronGeneratorVBR_Deprecated.cpp | 2 +- dpsim-models/src/EMT/EMT_Ph1_Resistor.cpp | 8 ++-- .../src/EMT/EMT_Ph1_VoltageSource.cpp | 8 ++-- .../EMT/EMT_Ph3_AvVoltageSourceInverterDQ.cpp | 4 +- dpsim-models/src/EMT/EMT_Ph3_Capacitor.cpp | 6 +-- .../src/EMT/EMT_Ph3_CurrentSource.cpp | 2 +- dpsim-models/src/EMT/EMT_Ph3_Inductor.cpp | 8 ++-- .../src/EMT/EMT_Ph3_NetworkInjection.cpp | 6 +-- ...T_Ph3_ReducedOrderSynchronGeneratorVBR.cpp | 4 +- dpsim-models/src/EMT/EMT_Ph3_Resistor.cpp | 4 +- .../src/EMT/EMT_Ph3_SeriesResistor.cpp | 12 +++--- dpsim-models/src/EMT/EMT_Ph3_SeriesSwitch.cpp | 20 +++++----- .../src/EMT/EMT_Ph3_SynchronGeneratorDQ.cpp | 6 +-- .../EMT/EMT_Ph3_SynchronGeneratorDQODE.cpp | 2 +- .../EMT/EMT_Ph3_SynchronGeneratorTrStab.cpp | 4 +- .../src/EMT/EMT_Ph3_SynchronGeneratorVBR.cpp | 4 +- dpsim-models/src/EMT/EMT_Ph3_Transformer.cpp | 40 +++++++++---------- .../src/EMT/EMT_Ph3_VoltageSource.cpp | 2 +- .../SP/SP_Ph1_AvVoltageSourceInverterDQ.cpp | 4 +- dpsim-models/src/SP/SP_Ph1_Capacitor.cpp | 20 +++++----- dpsim-models/src/SP/SP_Ph1_Inductor.cpp | 10 ++--- dpsim-models/src/SP/SP_Ph1_Load.cpp | 10 ++--- .../src/SP/SP_Ph1_NetworkInjection.cpp | 2 +- dpsim-models/src/SP/SP_Ph1_PiLine.cpp | 16 ++++---- ...P_Ph1_ReducedOrderSynchronGeneratorVBR.cpp | 4 +- dpsim-models/src/SP/SP_Ph1_Resistor.cpp | 24 +++++------ dpsim-models/src/SP/SP_Ph1_Shunt.cpp | 10 ++--- .../src/SP/SP_Ph1_SynchronGenerator.cpp | 6 +-- .../src/SP/SP_Ph1_SynchronGeneratorTrStab.cpp | 8 ++-- dpsim-models/src/SP/SP_Ph1_Transformer.cpp | 36 ++++++++--------- dpsim-models/src/SP/SP_Ph1_VoltageSource.cpp | 14 +++---- dpsim-models/src/Signal/FIRFilter.cpp | 2 +- dpsim-models/src/Signal/Integrator.cpp | 8 ++-- dpsim-models/src/Signal/PLL.cpp | 10 ++--- .../src/Signal/PowerControllerVSI.cpp | 22 +++++----- dpsim-models/src/SimPowerComp.cpp | 4 +- 62 files changed, 364 insertions(+), 364 deletions(-) diff --git a/dpsim-models/include/dpsim-models/TopologicalPowerComp.h b/dpsim-models/include/dpsim-models/TopologicalPowerComp.h index cc2eecb563..9780910201 100644 --- a/dpsim-models/include/dpsim-models/TopologicalPowerComp.h +++ b/dpsim-models/include/dpsim-models/TopologicalPowerComp.h @@ -66,11 +66,11 @@ namespace CPS { void setBehaviour(Behaviour behaviour) { mBehaviour = behaviour; if (mBehaviour == Behaviour::Initialization) - SPDLOG_LOGGER_INFO(mSLog, "Set component behaviour to Initialization"); + SPDLOG_LOGGER_DEBUG(mSLog, "Set component behaviour to Initialization"); else if (mBehaviour == Behaviour::PFSimulation) - SPDLOG_LOGGER_INFO(mSLog, "Set component behaviour to PFSimulation"); + SPDLOG_LOGGER_DEBUG(mSLog, "Set component behaviour to PFSimulation"); else if (mBehaviour == Behaviour::MNASimulation) - SPDLOG_LOGGER_INFO(mSLog, "Set component behaviour to MNASimulation"); + SPDLOG_LOGGER_DEBUG(mSLog, "Set component behaviour to MNASimulation"); else SPDLOG_LOGGER_WARN(mSLog, "Set component behaviour not fully supported yet"); } diff --git a/dpsim-models/src/Base/Base_ReducedOrderSynchronGenerator.cpp b/dpsim-models/src/Base/Base_ReducedOrderSynchronGenerator.cpp index 18277ec813..07b0f09015 100644 --- a/dpsim-models/src/Base/Base_ReducedOrderSynchronGenerator.cpp +++ b/dpsim-models/src/Base/Base_ReducedOrderSynchronGenerator.cpp @@ -31,7 +31,7 @@ Base::ReducedOrderSynchronGenerator::ReducedOrderSynchronGenerator( // default model is Norton equivalent mModelAsNortonSource = true; - SPDLOG_LOGGER_INFO(this->mSLog, "SG per default modelled as Norton equivalent"); + SPDLOG_LOGGER_DEBUG(this->mSLog, "SG per default modelled as Norton equivalent"); } template <> @@ -56,7 +56,7 @@ Base::ReducedOrderSynchronGenerator::ReducedOrderSynchronGenerator( // default model is Norton equivalent mModelAsNortonSource = true; - SPDLOG_LOGGER_INFO(this->mSLog, "SG per default modelled as Norton equivalent"); + SPDLOG_LOGGER_DEBUG(this->mSLog, "SG per default modelled as Norton equivalent"); } template @@ -65,10 +65,10 @@ void Base::ReducedOrderSynchronGenerator::setModelAsNortonSource(Bool m if (mModelAsNortonSource) { this->setVirtualNodeNumber(0); - SPDLOG_LOGGER_INFO(this->mSLog, "Setting SG model to Norton equivalent"); + SPDLOG_LOGGER_DEBUG(this->mSLog, "Setting SG model to Norton equivalent"); } else { this->setVirtualNodeNumber(2); - SPDLOG_LOGGER_INFO(this->mSLog, "Setting SG model to Thevenin equivalent"); + SPDLOG_LOGGER_DEBUG(this->mSLog, "Setting SG model to Thevenin equivalent"); } } @@ -197,7 +197,7 @@ void Base::ReducedOrderSynchronGenerator::setOperationalParametersPerUn template void Base::ReducedOrderSynchronGenerator::scaleInertiaConstant(Real scalingFactor) { mH = mH * scalingFactor; - SPDLOG_LOGGER_INFO(this->mSLog, "Scaling inertia with factor {:e}:\n resulting inertia: {:e}\n", scalingFactor, mH); + SPDLOG_LOGGER_DEBUG(this->mSLog, "Scaling inertia with factor {:e}:\n resulting inertia: {:e}\n", scalingFactor, mH); } template diff --git a/dpsim-models/src/CSVReader.cpp b/dpsim-models/src/CSVReader.cpp index b2d9c0b816..cee71679b7 100644 --- a/dpsim-models/src/CSVReader.cpp +++ b/dpsim-models/src/CSVReader.cpp @@ -483,7 +483,7 @@ void CSVReader::assignLoadProfile(CPS::SystemTopology& sys, Real start_time, Rea case CSVReader::Mode::AUTO: { for (auto obj : sys.mComponents) { if (std::shared_ptr load = std::dynamic_pointer_cast(obj)) { - SPDLOG_LOGGER_INFO(mSLog, "Comparing csv file names with load mRIDs ..."); + SPDLOG_LOGGER_DEBUG(mSLog, "Comparing csv file names with load mRIDs ..."); String load_name = load->name(); for (auto file : mFileList) { String file_name = file.filename().string(); @@ -496,7 +496,7 @@ void CSVReader::assignLoadProfile(CPS::SystemTopology& sys, Real start_time, Rea if (std::string(file_name.begin(), file_name.end() - 3).compare(load_name) == 0) { load->mLoadProfile = readLoadProfile(file, start_time, time_step, end_time, format); load->use_profile = true; - SPDLOG_LOGGER_INFO(mSLog, "Assigned {} to {}", file.filename().string(), load->name()); + SPDLOG_LOGGER_DEBUG(mSLog, "Assigned {} to {}", file.filename().string(), load->name()); } } } @@ -506,24 +506,24 @@ void CSVReader::assignLoadProfile(CPS::SystemTopology& sys, Real start_time, Rea case CSVReader::Mode::MANUAL: { Int LP_assigned_counter = 0; Int LP_not_assigned_counter = 0; - SPDLOG_LOGGER_INFO(mSLog, "Assigning load profiles with user defined pattern ..."); + SPDLOG_LOGGER_DEBUG(mSLog, "Assigning load profiles with user defined pattern ..."); for (auto obj : sys.mComponents) { if (std::shared_ptr load = std::dynamic_pointer_cast(obj)) { std::map::iterator file = mAssignPattern.find(load->name()); if (file == mAssignPattern.end()) { std::cout<< load->name()<<" has no profile given."<name()); + SPDLOG_LOGGER_DEBUG(mSLog, "{} has no profile given.", load->name()); LP_not_assigned_counter++; continue; } load->mLoadProfile = readLoadProfile(fs::path(mPath + file->second + ".csv"), start_time, time_step, end_time); load->use_profile = true; std::cout<<" Assigned "<< file->second<< " to " <name()<second, load->name()); + SPDLOG_LOGGER_DEBUG(mSLog, "Assigned {}.csv to {}", file->second, load->name()); LP_assigned_counter++; } } - SPDLOG_LOGGER_INFO(mSLog, "Assigned profiles for {} loads, {} not assigned.", LP_assigned_counter, LP_not_assigned_counter); + SPDLOG_LOGGER_DEBUG(mSLog, "Assigned profiles for {} loads, {} not assigned.", LP_assigned_counter, LP_not_assigned_counter); break; } default: { diff --git a/dpsim-models/src/DP/DP_Ph1_AvVoltageSourceInverterDQ.cpp b/dpsim-models/src/DP/DP_Ph1_AvVoltageSourceInverterDQ.cpp index b780d164f6..500232efc6 100644 --- a/dpsim-models/src/DP/DP_Ph1_AvVoltageSourceInverterDQ.cpp +++ b/dpsim-models/src/DP/DP_Ph1_AvVoltageSourceInverterDQ.cpp @@ -55,9 +55,9 @@ DP::Ph1::AvVoltageSourceInverterDQ::AvVoltageSourceInverterDQ(String uid, String // Pre-step of the subcontrolled voltage source is handled explicitly in mnaParentPreStep addMNASubComponent(mSubCtrledVoltageSource, MNA_SUBCOMP_TASK_ORDER::NO_TASK, MNA_SUBCOMP_TASK_ORDER::TASK_BEFORE_PARENT, true); - SPDLOG_LOGGER_INFO(mSLog, "Electrical subcomponents: "); + SPDLOG_LOGGER_DEBUG(mSLog, "Electrical subcomponents: "); for (auto subcomp: mSubComponents) - SPDLOG_LOGGER_INFO(mSLog, "- {}", subcomp->name()); + SPDLOG_LOGGER_DEBUG(mSLog, "- {}", subcomp->name()); // Create control sub components mPLL = Signal::PLL::make(**mName + "_PLL", mLogLevel); diff --git a/dpsim-models/src/DP/DP_Ph1_Capacitor.cpp b/dpsim-models/src/DP/DP_Ph1_Capacitor.cpp index aa56bfa4a6..a1c071ea90 100644 --- a/dpsim-models/src/DP/DP_Ph1_Capacitor.cpp +++ b/dpsim-models/src/DP/DP_Ph1_Capacitor.cpp @@ -116,17 +116,17 @@ void DP::Ph1::Capacitor::mnaCompApplySystemMatrixStamp(SparseMatrixRow& systemMa Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1), matrixNodeIndex(0), -mEquivCond(freq,0), mNumFreqs, freq); } - SPDLOG_LOGGER_INFO(mSLog, "-- Stamp frequency {:d} ---", freq); + SPDLOG_LOGGER_DEBUG(mSLog, "-- Stamp frequency {:d} ---", freq); if (terminalNotGrounded(0)) - SPDLOG_LOGGER_INFO(mSLog, "Add {:e}+j{:e} to system at ({:d},{:d})", + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:e}+j{:e} to system at ({:d},{:d})", mEquivCond(freq,0).real(), mEquivCond(freq,0).imag(), matrixNodeIndex(0), matrixNodeIndex(0)); if (terminalNotGrounded(1)) - SPDLOG_LOGGER_INFO(mSLog, "Add {:e}+j{:e} to system at ({:d},{:d})", + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:e}+j{:e} to system at ({:d},{:d})", mEquivCond(freq,0).real(), mEquivCond(freq,0).imag(), matrixNodeIndex(1), matrixNodeIndex(1)); if (terminalNotGrounded(0) && terminalNotGrounded(1)) { - SPDLOG_LOGGER_INFO(mSLog, "Add {:e}+j{:e} to system at ({:d},{:d})", + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:e}+j{:e} to system at ({:d},{:d})", -mEquivCond(freq,0).real(), -mEquivCond(freq,0).imag(), matrixNodeIndex(0), matrixNodeIndex(1)); - SPDLOG_LOGGER_INFO(mSLog, "Add {:e}+j{:e} to system at ({:d},{:d})", + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:e}+j{:e} to system at ({:d},{:d})", -mEquivCond(freq,0).real(), -mEquivCond(freq,0).imag(), matrixNodeIndex(1), matrixNodeIndex(0)); } } @@ -142,17 +142,17 @@ void DP::Ph1::Capacitor::mnaCompApplySystemMatrixStampHarm(SparseMatrixRow& syst Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1), matrixNodeIndex(0), -mEquivCond(freqIdx,0)); } - SPDLOG_LOGGER_INFO(mSLog, "-- Stamp frequency {:d} ---", freqIdx); + SPDLOG_LOGGER_DEBUG(mSLog, "-- Stamp frequency {:d} ---", freqIdx); if (terminalNotGrounded(0)) - SPDLOG_LOGGER_INFO(mSLog, "Add {:e}+j{:e} to system at ({:d},{:d})", + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:e}+j{:e} to system at ({:d},{:d})", mEquivCond(freqIdx,0).real(), mEquivCond(freqIdx,0).imag(), matrixNodeIndex(0), matrixNodeIndex(0)); if (terminalNotGrounded(1)) - SPDLOG_LOGGER_INFO(mSLog, "Add {:e}+j{:e} to system at ({:d},{:d})", + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:e}+j{:e} to system at ({:d},{:d})", mEquivCond(freqIdx,0).real(), mEquivCond(freqIdx,0).imag(), matrixNodeIndex(1), matrixNodeIndex(1)); if (terminalNotGrounded(0) && terminalNotGrounded(1)) { - SPDLOG_LOGGER_INFO(mSLog, "Add {:e}+j{:e} to system at ({:d},{:d})", + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:e}+j{:e} to system at ({:d},{:d})", -mEquivCond(freqIdx,0).real(), -mEquivCond(freqIdx,0).imag(), matrixNodeIndex(0), matrixNodeIndex(1)); - SPDLOG_LOGGER_INFO(mSLog, "Add {:e}+j{:e} to system at ({:d},{:d})", + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:e}+j{:e} to system at ({:d},{:d})", -mEquivCond(freqIdx,0).real(), -mEquivCond(freqIdx,0).imag(), matrixNodeIndex(1), matrixNodeIndex(0)); } } @@ -169,13 +169,13 @@ void DP::Ph1::Capacitor::mnaCompApplyRightSideVectorStamp(Matrix& rightVector) { if (terminalNotGrounded(1)) Math::setVectorElement(rightVector, matrixNodeIndex(1), -mEquivCurrent(freq,0), mNumFreqs, freq); - SPDLOG_LOGGER_DEBUG(mSLog, "MNA EquivCurrent {:f}+j{:f}", + SPDLOG_LOGGER_TRACE(mSLog, "MNA EquivCurrent {:f}+j{:f}", mEquivCurrent(freq,0).real(), mEquivCurrent(freq,0).imag()); if (terminalNotGrounded(0)) - SPDLOG_LOGGER_DEBUG(mSLog, "Add {:f}+j{:f} to source vector at {:d}", + SPDLOG_LOGGER_TRACE(mSLog, "Add {:f}+j{:f} to source vector at {:d}", mEquivCurrent(freq,0).real(), mEquivCurrent(freq,0).imag(), matrixNodeIndex(0)); if (terminalNotGrounded(1)) - SPDLOG_LOGGER_DEBUG(mSLog, "Add {:f}+j{:f} to source vector at {:d}", + SPDLOG_LOGGER_TRACE(mSLog, "Add {:f}+j{:f} to source vector at {:d}", -mEquivCurrent(freq,0).real(), -mEquivCurrent(freq,0).imag(), matrixNodeIndex(1)); } } @@ -247,7 +247,7 @@ void DP::Ph1::Capacitor::mnaCompUpdateVoltage(const Matrix& leftVector) { if (terminalNotGrounded(0)) (**mIntfVoltage)(0,freq) = (**mIntfVoltage)(0,freq) - Math::complexFromVectorElement(leftVector, matrixNodeIndex(0), mNumFreqs, freq); - SPDLOG_LOGGER_DEBUG(mSLog, "Voltage {:e}<{:e}", std::abs((**mIntfVoltage)(0,freq)), std::arg((**mIntfVoltage)(0,freq))); + SPDLOG_LOGGER_TRACE(mSLog, "Voltage {:e}<{:e}", std::abs((**mIntfVoltage)(0,freq)), std::arg((**mIntfVoltage)(0,freq))); } } @@ -259,19 +259,19 @@ void DP::Ph1::Capacitor::mnaCompUpdateVoltageHarm(const Matrix& leftVector, Int if (terminalNotGrounded(0)) (**mIntfVoltage)(0,freqIdx) = (**mIntfVoltage)(0,freqIdx) - Math::complexFromVectorElement(leftVector, matrixNodeIndex(0)); - SPDLOG_LOGGER_DEBUG(mSLog, "Voltage {:s}", Logger::phasorToString((**mIntfVoltage)(0,freqIdx))); + SPDLOG_LOGGER_TRACE(mSLog, "Voltage {:s}", Logger::phasorToString((**mIntfVoltage)(0,freqIdx))); } void DP::Ph1::Capacitor::mnaCompUpdateCurrent(const Matrix& leftVector) { for (UInt freq = 0; freq < mNumFreqs; freq++) { (**mIntfCurrent)(0,freq) = mEquivCond(freq,0) * (**mIntfVoltage)(0,freq) + mEquivCurrent(freq,0); - SPDLOG_LOGGER_DEBUG(mSLog, "Current {:s}", Logger::phasorToString((**mIntfCurrent)(0,freq))); + SPDLOG_LOGGER_TRACE(mSLog, "Current {:s}", Logger::phasorToString((**mIntfCurrent)(0,freq))); } } void DP::Ph1::Capacitor::mnaCompUpdateCurrentHarm() { for (UInt freq = 0; freq < mNumFreqs; freq++) { (**mIntfCurrent)(0,freq) = mEquivCond(freq,0) * (**mIntfVoltage)(0,freq) + mEquivCurrent(freq,0); - SPDLOG_LOGGER_DEBUG(mSLog, "Current {:s}", Logger::phasorToString((**mIntfCurrent)(0,freq))); + SPDLOG_LOGGER_TRACE(mSLog, "Current {:s}", Logger::phasorToString((**mIntfCurrent)(0,freq))); } } diff --git a/dpsim-models/src/DP/DP_Ph1_Inductor.cpp b/dpsim-models/src/DP/DP_Ph1_Inductor.cpp index 8affd71788..f7ceb83737 100644 --- a/dpsim-models/src/DP/DP_Ph1_Inductor.cpp +++ b/dpsim-models/src/DP/DP_Ph1_Inductor.cpp @@ -112,17 +112,17 @@ void DP::Ph1::Inductor::mnaCompApplySystemMatrixStamp(SparseMatrixRow& systemMat Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1), matrixNodeIndex(0), -mEquivCond(freq,0), mNumFreqs, freq); } - SPDLOG_LOGGER_INFO(mSLog, "-- Stamp frequency {:d} ---", freq); + SPDLOG_LOGGER_DEBUG(mSLog, "-- Stamp frequency {:d} ---", freq); if (terminalNotGrounded(0)) - SPDLOG_LOGGER_INFO(mSLog, "Add {:s} to system at ({:d},{:d})", + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(mEquivCond(freq,0)), matrixNodeIndex(0), matrixNodeIndex(0)); if (terminalNotGrounded(1)) - SPDLOG_LOGGER_INFO(mSLog, "Add {:s} to system at ({:d},{:d})", + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(mEquivCond(freq,0)), matrixNodeIndex(1), matrixNodeIndex(1)); if ( terminalNotGrounded(0) && terminalNotGrounded(1) ) { - SPDLOG_LOGGER_INFO(mSLog, "Add {:s} to system at ({:d},{:d})", + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(-mEquivCond(freq,0)), matrixNodeIndex(0), matrixNodeIndex(1)); - SPDLOG_LOGGER_INFO(mSLog, "Add {:s} to system at ({:d},{:d})", + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(-mEquivCond(freq,0)), matrixNodeIndex(1), matrixNodeIndex(0)); } } @@ -138,17 +138,17 @@ void DP::Ph1::Inductor::mnaCompApplySystemMatrixStampHarm(SparseMatrixRow& syste Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1), matrixNodeIndex(0), -mEquivCond(freqIdx,0)); } - SPDLOG_LOGGER_INFO(mSLog, "-- Stamp frequency {:d} ---", freqIdx); + SPDLOG_LOGGER_DEBUG(mSLog, "-- Stamp frequency {:d} ---", freqIdx); if (terminalNotGrounded(0)) - SPDLOG_LOGGER_INFO(mSLog, "Add {:f}+j{:f} to system at ({:d},{:d})", + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:f}+j{:f} to system at ({:d},{:d})", mEquivCond(freqIdx,0).real(), mEquivCond(freqIdx,0).imag(), matrixNodeIndex(0), matrixNodeIndex(0)); if (terminalNotGrounded(1)) - SPDLOG_LOGGER_INFO(mSLog, "Add {:f}+j{:f} to system at ({:d},{:d})", + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:f}+j{:f} to system at ({:d},{:d})", mEquivCond(freqIdx,0).real(), mEquivCond(freqIdx,0).imag(), matrixNodeIndex(1), matrixNodeIndex(1)); if ( terminalNotGrounded(0) && terminalNotGrounded(1) ) { - SPDLOG_LOGGER_INFO(mSLog, "Add {:f}+j{:f} to system at ({:d},{:d})", + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:f}+j{:f} to system at ({:d},{:d})", -mEquivCond(freqIdx,0).real(), -mEquivCond(freqIdx,0).imag(), matrixNodeIndex(0), matrixNodeIndex(1)); - SPDLOG_LOGGER_INFO(mSLog, "Add {:f}+j{:f} to system at ({:d},{:d})", + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:f}+j{:f} to system at ({:d},{:d})", -mEquivCond(freqIdx,0).real(), -mEquivCond(freqIdx,0).imag(), matrixNodeIndex(1), matrixNodeIndex(0)); } } @@ -165,12 +165,12 @@ void DP::Ph1::Inductor::mnaCompApplyRightSideVectorStamp(Matrix& rightVector) { if (terminalNotGrounded(1)) Math::setVectorElement(rightVector, matrixNodeIndex(1), -mEquivCurrent(freq,0), mNumFreqs, freq); - SPDLOG_LOGGER_DEBUG(mSLog, "MNA EquivCurrent {:s}", Logger::complexToString(mEquivCurrent(freq,0))); + SPDLOG_LOGGER_TRACE(mSLog, "MNA EquivCurrent {:s}", Logger::complexToString(mEquivCurrent(freq,0))); if (terminalNotGrounded(0)) - SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to source vector at {:d}", + SPDLOG_LOGGER_TRACE(mSLog, "Add {:s} to source vector at {:d}", Logger::complexToString(mEquivCurrent(freq,0)), matrixNodeIndex(0)); if (terminalNotGrounded(1)) - SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to source vector at {:d}", + SPDLOG_LOGGER_TRACE(mSLog, "Add {:s} to source vector at {:d}", Logger::complexToString(-mEquivCurrent(freq,0)), matrixNodeIndex(1)); } } @@ -230,7 +230,7 @@ void DP::Ph1::Inductor::mnaCompUpdateVoltage(const Matrix& leftVector) { if (terminalNotGrounded(0)) (**mIntfVoltage)(0,freq) = (**mIntfVoltage)(0,freq) - Math::complexFromVectorElement(leftVector, matrixNodeIndex(0), mNumFreqs, freq); - SPDLOG_LOGGER_DEBUG(mSLog, "Voltage {:s}", Logger::phasorToString((**mIntfVoltage)(0,freq))); + SPDLOG_LOGGER_TRACE(mSLog, "Voltage {:s}", Logger::phasorToString((**mIntfVoltage)(0,freq))); } } @@ -242,20 +242,20 @@ void DP::Ph1::Inductor::mnaCompUpdateVoltageHarm(const Matrix& leftVector, Int f if (terminalNotGrounded(0)) (**mIntfVoltage)(0,freqIdx) = (**mIntfVoltage)(0,freqIdx) - Math::complexFromVectorElement(leftVector, matrixNodeIndex(0)); - SPDLOG_LOGGER_DEBUG(mSLog, "Voltage {:s}", Logger::phasorToString((**mIntfVoltage)(0,freqIdx))); + SPDLOG_LOGGER_TRACE(mSLog, "Voltage {:s}", Logger::phasorToString((**mIntfVoltage)(0,freqIdx))); } void DP::Ph1::Inductor::mnaCompUpdateCurrent(const Matrix& leftVector) { for (UInt freq = 0; freq < mNumFreqs; freq++) { (**mIntfCurrent)(0,freq) = mEquivCond(freq,0) * (**mIntfVoltage)(0,freq) + mEquivCurrent(freq,0); - SPDLOG_LOGGER_DEBUG(mSLog, "Current {:s}", Logger::phasorToString((**mIntfCurrent)(0,freq))); + SPDLOG_LOGGER_TRACE(mSLog, "Current {:s}", Logger::phasorToString((**mIntfCurrent)(0,freq))); } } void DP::Ph1::Inductor::mnaCompUpdateCurrentHarm() { for (UInt freq = 0; freq < mNumFreqs; freq++) { (**mIntfCurrent)(0,freq) = mEquivCond(freq,0) * (**mIntfVoltage)(0,freq) + mEquivCurrent(freq,0); - SPDLOG_LOGGER_DEBUG(mSLog, "Current {:s}", Logger::phasorToString((**mIntfCurrent)(0,freq))); + SPDLOG_LOGGER_TRACE(mSLog, "Current {:s}", Logger::phasorToString((**mIntfCurrent)(0,freq))); } } diff --git a/dpsim-models/src/DP/DP_Ph1_Inverter.cpp b/dpsim-models/src/DP/DP_Ph1_Inverter.cpp index 36c807c08b..72ef2a0ca9 100644 --- a/dpsim-models/src/DP/DP_Ph1_Inverter.cpp +++ b/dpsim-models/src/DP/DP_Ph1_Inverter.cpp @@ -37,11 +37,11 @@ void DP::Ph1::Inverter::initializeFromNodesAndTerminals(Real frequency) { } void DP::Ph1::Inverter::generateFrequencies() { for (Int m = 2; m <= mMaxCarrierHarm; m = m+2) { mCarHarms.push_back(m); - SPDLOG_LOGGER_INFO(mSLog, "Add carrier harmonic {0}", m); + SPDLOG_LOGGER_DEBUG(mSLog, "Add carrier harmonic {0}", m); } for (Int n = -mMaxModulHarm; n <= mMaxModulHarm; n = n+2) { mModHarms.push_back(n); - SPDLOG_LOGGER_INFO(mSLog, "Add modulation harmonic {0}", n); + SPDLOG_LOGGER_DEBUG(mSLog, "Add modulation harmonic {0}", n); } } @@ -124,50 +124,50 @@ void DP::Ph1::Inverter::mnaCompInitializeHarm(Real omega, Real timeStep, std::ve } void DP::Ph1::Inverter::mnaCompApplySystemMatrixStamp(SparseMatrixRow& systemMatrix) { - SPDLOG_LOGGER_INFO(mSLog, "--- Stamping into system matrix ---"); + SPDLOG_LOGGER_DEBUG(mSLog, "--- Stamping into system matrix ---"); for (UInt freq = 0; freq < mNumFreqs; freq++) { - SPDLOG_LOGGER_INFO(mSLog, "Stamp frequency {:d}", freq); + SPDLOG_LOGGER_DEBUG(mSLog, "Stamp frequency {:d}", freq); if (terminalNotGrounded(0)) { Math::setMatrixElement(systemMatrix, mVirtualNodes[0]->matrixNodeIndex(), matrixNodeIndex(0), Complex(1, 0), mNumFreqs, freq); Math::setMatrixElement(systemMatrix, matrixNodeIndex(0), mVirtualNodes[0]->matrixNodeIndex(), Complex(1, 0), mNumFreqs, freq); } if (terminalNotGrounded(0)) { - SPDLOG_LOGGER_INFO(mSLog, "Add {:f} to system at ({:d},{:d})", 1., mVirtualNodes[0]->matrixNodeIndex(), matrixNodeIndex(0)); - SPDLOG_LOGGER_INFO(mSLog, "Add {:f} to system at ({:d},{:d})", 1., matrixNodeIndex(0), mVirtualNodes[0]->matrixNodeIndex()); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:f} to system at ({:d},{:d})", 1., mVirtualNodes[0]->matrixNodeIndex(), matrixNodeIndex(0)); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:f} to system at ({:d},{:d})", 1., matrixNodeIndex(0), mVirtualNodes[0]->matrixNodeIndex()); } } - SPDLOG_LOGGER_INFO(mSLog, "--- Stamping into system matrix end ---"); + SPDLOG_LOGGER_DEBUG(mSLog, "--- Stamping into system matrix end ---"); } void DP::Ph1::Inverter::mnaCompApplySystemMatrixStampHarm(SparseMatrixRow& systemMatrix, Int freqIdx) { - SPDLOG_LOGGER_INFO(mSLog, "Stamp frequency {:d}", freqIdx); + SPDLOG_LOGGER_DEBUG(mSLog, "Stamp frequency {:d}", freqIdx); if (terminalNotGrounded(0)) { Math::setMatrixElement(systemMatrix, mVirtualNodes[0]->matrixNodeIndex(), matrixNodeIndex(0), Complex(1, 0)); Math::setMatrixElement(systemMatrix, matrixNodeIndex(0), mVirtualNodes[0]->matrixNodeIndex(), Complex(1, 0)); } if (terminalNotGrounded(0)) { - SPDLOG_LOGGER_INFO(mSLog, "Add {:f} to system at ({:d},{:d})", 1., mVirtualNodes[0]->matrixNodeIndex(), matrixNodeIndex(0)); - SPDLOG_LOGGER_INFO(mSLog, "Add {:f} to system at ({:d},{:d})", 1., matrixNodeIndex(0), mVirtualNodes[0]->matrixNodeIndex()); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:f} to system at ({:d},{:d})", 1., mVirtualNodes[0]->matrixNodeIndex(), matrixNodeIndex(0)); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:f} to system at ({:d},{:d})", 1., matrixNodeIndex(0), mVirtualNodes[0]->matrixNodeIndex()); } } void DP::Ph1::Inverter::mnaCompApplyRightSideVectorStamp(Matrix& rightVector) { - SPDLOG_LOGGER_DEBUG(mSLog, "Stamp harmonics into source vector"); + SPDLOG_LOGGER_TRACE(mSLog, "Stamp harmonics into source vector"); for (UInt freq = 0; freq < mNumFreqs; freq++) { if (terminalNotGrounded(0)) { Math::setVectorElement(rightVector, mVirtualNodes[0]->matrixNodeIndex(), (**mIntfVoltage)(0,freq), mNumFreqs, freq); - SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to source vector at {:d}, harmonic {:d}", + SPDLOG_LOGGER_TRACE(mSLog, "Add {:s} to source vector at {:d}, harmonic {:d}", Logger::complexToString((**mIntfVoltage)(0,freq)), mVirtualNodes[0]->matrixNodeIndex(), freq); } } } void DP::Ph1::Inverter::mnaCompApplyRightSideVectorStampHarm(Matrix& rightVector) { - SPDLOG_LOGGER_DEBUG(mSLog, "Stamp harmonics into source vector"); + SPDLOG_LOGGER_TRACE(mSLog, "Stamp harmonics into source vector"); for (UInt freq = 0; freq < mNumFreqs; freq++) { if (terminalNotGrounded(0)) { Math::setVectorElement(rightVector, mVirtualNodes[0]->matrixNodeIndex(), (**mIntfVoltage)(0,freq), 1, 0, freq); diff --git a/dpsim-models/src/DP/DP_Ph1_NetworkInjection.cpp b/dpsim-models/src/DP/DP_Ph1_NetworkInjection.cpp index 2d25016167..b0e3b39739 100644 --- a/dpsim-models/src/DP/DP_Ph1_NetworkInjection.cpp +++ b/dpsim-models/src/DP/DP_Ph1_NetworkInjection.cpp @@ -25,9 +25,9 @@ DP::Ph1::NetworkInjection::NetworkInjection(String uid, String name, Logger::Lev mSubVoltageSource = std::make_shared(**mName + "_vs", mLogLevel); addMNASubComponent(mSubVoltageSource, MNA_SUBCOMP_TASK_ORDER::TASK_BEFORE_PARENT, MNA_SUBCOMP_TASK_ORDER::TASK_BEFORE_PARENT, true); - SPDLOG_LOGGER_INFO(mSLog, "Electrical subcomponents: "); + SPDLOG_LOGGER_DEBUG(mSLog, "Electrical subcomponents: "); for (auto subcomp: mSubComponents) - SPDLOG_LOGGER_INFO(mSLog, "- {}", subcomp->name()); + SPDLOG_LOGGER_DEBUG(mSLog, "- {}", subcomp->name()); mSubVoltageSource->mVoltageRef->setReference(mVoltageRef); mSubVoltageSource->mSrcFreq->setReference(mSrcFreq); @@ -92,7 +92,7 @@ void DP::Ph1::NetworkInjection::initializeFromNodesAndTerminals(Real frequency) // #### MNA functions #### void DP::Ph1::NetworkInjection::mnaParentApplyRightSideVectorStamp(Matrix& rightVector) { - SPDLOG_LOGGER_DEBUG(mSLog, "Right Side Vector: {:s}", + SPDLOG_LOGGER_TRACE(mSLog, "Right Side Vector: {:s}", Logger::matrixToString(rightVector)); } diff --git a/dpsim-models/src/DP/DP_Ph1_PiLine.cpp b/dpsim-models/src/DP/DP_Ph1_PiLine.cpp index 929d8b3ff5..34e0a72302 100644 --- a/dpsim-models/src/DP/DP_Ph1_PiLine.cpp +++ b/dpsim-models/src/DP/DP_Ph1_PiLine.cpp @@ -90,7 +90,7 @@ void DP::Ph1::PiLine::initializeFromNodesAndTerminals(Real frequency) { addMNASubComponent(mSubParallelCapacitor1, MNA_SUBCOMP_TASK_ORDER::TASK_BEFORE_PARENT, MNA_SUBCOMP_TASK_ORDER::TASK_BEFORE_PARENT, true); } - SPDLOG_LOGGER_INFO(mSLog, + SPDLOG_LOGGER_INFO(mSLog, "\n--- Initialization from powerflow ---" "\nVoltage across: {:s}" "\nCurrent: {:s}" diff --git a/dpsim-models/src/DP/DP_Ph1_RXLoadSwitch.cpp b/dpsim-models/src/DP/DP_Ph1_RXLoadSwitch.cpp index b3fdc4cee2..68b9a689d4 100644 --- a/dpsim-models/src/DP/DP_Ph1_RXLoadSwitch.cpp +++ b/dpsim-models/src/DP/DP_Ph1_RXLoadSwitch.cpp @@ -52,7 +52,7 @@ void DP::Ph1::RXLoadSwitch::initializeFromNodesAndTerminals(Real frequency) { **mIntfVoltage = **mSubRXLoad->mIntfVoltage; **mIntfCurrent = **mSubRXLoad->mIntfCurrent; - SPDLOG_LOGGER_INFO(mSLog, + SPDLOG_LOGGER_INFO(mSLog, "\n--- Initialization from powerflow ---" "\nVoltage across: {:s}" "\nCurrent: {:s}" @@ -113,7 +113,7 @@ void DP::Ph1::RXLoadSwitch::updateSwitchState(Real time) { if (deltaV > 0.1) { mSubSwitch->open(); - SPDLOG_LOGGER_INFO(mSLog, "Opened Switch at {}", (float)time); + SPDLOG_LOGGER_DEBUG(mSLog, "Opened Switch at {}", (float)time); } } } diff --git a/dpsim-models/src/DP/DP_Ph1_ReducedOrderSynchronGeneratorVBR.cpp b/dpsim-models/src/DP/DP_Ph1_ReducedOrderSynchronGeneratorVBR.cpp index c9b2afe711..2efea7962c 100644 --- a/dpsim-models/src/DP/DP_Ph1_ReducedOrderSynchronGeneratorVBR.cpp +++ b/dpsim-models/src/DP/DP_Ph1_ReducedOrderSynchronGeneratorVBR.cpp @@ -80,9 +80,9 @@ void DP::Ph1::ReducedOrderSynchronGeneratorVBR::mnaCompInitialize(Real omega, mVariableSystemMatrixEntries.push_back(std::make_pair(matrixNodeIndex(0, 0) + complexOffset, mVirtualNodes[0]->matrixNodeIndex() + complexOffset)); } - SPDLOG_LOGGER_INFO(mSLog, "List of index pairs of varying matrix entries: "); + SPDLOG_LOGGER_DEBUG(mSLog, "List of index pairs of varying matrix entries: "); for (auto indexPair : mVariableSystemMatrixEntries) - SPDLOG_LOGGER_INFO(mSLog, "({}, {})", indexPair.first, indexPair.second); + SPDLOG_LOGGER_DEBUG(mSLog, "({}, {})", indexPair.first, indexPair.second); } void DP::Ph1::ReducedOrderSynchronGeneratorVBR::mnaCompApplySystemMatrixStamp(SparseMatrixRow& systemMatrix) { diff --git a/dpsim-models/src/DP/DP_Ph1_ResIndSeries.cpp b/dpsim-models/src/DP/DP_Ph1_ResIndSeries.cpp index 2c60752ed3..14a5b47a76 100644 --- a/dpsim-models/src/DP/DP_Ph1_ResIndSeries.cpp +++ b/dpsim-models/src/DP/DP_Ph1_ResIndSeries.cpp @@ -117,17 +117,17 @@ void DP::Ph1::ResIndSeries::mnaCompApplySystemMatrixStamp(SparseMatrixRow& syste Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1), matrixNodeIndex(0), -mEquivCond(freq,0), mNumFreqs, freq); } - SPDLOG_LOGGER_INFO(mSLog, "-- Stamp frequency {:d} ---", freq); + SPDLOG_LOGGER_DEBUG(mSLog, "-- Stamp frequency {:d} ---", freq); if (terminalNotGrounded(0)) - SPDLOG_LOGGER_INFO(mSLog, "Add {:s} to system at ({:d},{:d})", + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(mEquivCond(freq,0)), matrixNodeIndex(0), matrixNodeIndex(0)); if (terminalNotGrounded(1)) - SPDLOG_LOGGER_INFO(mSLog, "Add {:s} to system at ({:d},{:d})", + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(mEquivCond(freq,0)), matrixNodeIndex(1), matrixNodeIndex(1)); if ( terminalNotGrounded(0) && terminalNotGrounded(1) ) { - SPDLOG_LOGGER_INFO(mSLog, "Add {:s} to system at ({:d},{:d})", + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(-mEquivCond(freq,0)), matrixNodeIndex(0), matrixNodeIndex(1)); - SPDLOG_LOGGER_INFO(mSLog, "Add {:s} to system at ({:d},{:d})", + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(-mEquivCond(freq,0)), matrixNodeIndex(1), matrixNodeIndex(0)); } } @@ -143,17 +143,17 @@ void DP::Ph1::ResIndSeries::mnaCompApplySystemMatrixStampHarm(SparseMatrixRow& s Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1), matrixNodeIndex(0), -mEquivCond(freqIdx,0)); } - SPDLOG_LOGGER_INFO(mSLog, "-- Stamp frequency {:d} ---", freqIdx); + SPDLOG_LOGGER_DEBUG(mSLog, "-- Stamp frequency {:d} ---", freqIdx); if (terminalNotGrounded(0)) - SPDLOG_LOGGER_INFO(mSLog, "Add {:f}+j{:f} to system at ({:d},{:d})", + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:f}+j{:f} to system at ({:d},{:d})", mEquivCond(freqIdx,0).real(), mEquivCond(freqIdx,0).imag(), matrixNodeIndex(0), matrixNodeIndex(0)); if (terminalNotGrounded(1)) - SPDLOG_LOGGER_INFO(mSLog, "Add {:f}+j{:f} to system at ({:d},{:d})", + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:f}+j{:f} to system at ({:d},{:d})", mEquivCond(freqIdx,0).real(), mEquivCond(freqIdx,0).imag(), matrixNodeIndex(1), matrixNodeIndex(1)); if ( terminalNotGrounded(0) && terminalNotGrounded(1) ) { - SPDLOG_LOGGER_INFO(mSLog, "Add {:f}+j{:f} to system at ({:d},{:d})", + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:f}+j{:f} to system at ({:d},{:d})", -mEquivCond(freqIdx,0).real(), -mEquivCond(freqIdx,0).imag(), matrixNodeIndex(0), matrixNodeIndex(1)); - SPDLOG_LOGGER_INFO(mSLog, "Add {:f}+j{:f} to system at ({:d},{:d})", + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:f}+j{:f} to system at ({:d},{:d})", -mEquivCond(freqIdx,0).real(), -mEquivCond(freqIdx,0).imag(), matrixNodeIndex(1), matrixNodeIndex(0)); } } @@ -170,12 +170,12 @@ void DP::Ph1::ResIndSeries::mnaCompApplyRightSideVectorStamp(Matrix& rightVector if (terminalNotGrounded(1)) Math::setVectorElement(rightVector, matrixNodeIndex(1), -mEquivCurrent(freq,0), mNumFreqs, freq); - SPDLOG_LOGGER_DEBUG(mSLog, "MNA EquivCurrent {:s}", Logger::complexToString(mEquivCurrent(freq,0))); + SPDLOG_LOGGER_TRACE(mSLog, "MNA EquivCurrent {:s}", Logger::complexToString(mEquivCurrent(freq,0))); if (terminalNotGrounded(0)) - SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to source vector at {:d}", + SPDLOG_LOGGER_TRACE(mSLog, "Add {:s} to source vector at {:d}", Logger::complexToString(mEquivCurrent(freq,0)), matrixNodeIndex(0)); if (terminalNotGrounded(1)) - SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to source vector at {:d}", + SPDLOG_LOGGER_TRACE(mSLog, "Add {:s} to source vector at {:d}", Logger::complexToString(-mEquivCurrent(freq,0)), matrixNodeIndex(1)); } } @@ -235,7 +235,7 @@ void DP::Ph1::ResIndSeries::mnaCompUpdateVoltage(const Matrix& leftVector) { if (terminalNotGrounded(0)) (**mIntfVoltage)(0,freq) = (**mIntfVoltage)(0,freq) - Math::complexFromVectorElement(leftVector, matrixNodeIndex(0), mNumFreqs, freq); - SPDLOG_LOGGER_DEBUG(mSLog, "Voltage {:s}", Logger::phasorToString((**mIntfVoltage)(0,freq))); + SPDLOG_LOGGER_TRACE(mSLog, "Voltage {:s}", Logger::phasorToString((**mIntfVoltage)(0,freq))); } } @@ -247,20 +247,20 @@ void DP::Ph1::ResIndSeries::mnaCompUpdateVoltageHarm(const Matrix& leftVector, I if (terminalNotGrounded(0)) (**mIntfVoltage)(0,freqIdx) = (**mIntfVoltage)(0,freqIdx) - Math::complexFromVectorElement(leftVector, matrixNodeIndex(0)); - SPDLOG_LOGGER_DEBUG(mSLog, "Voltage {:s}", Logger::phasorToString((**mIntfVoltage)(0,freqIdx))); + SPDLOG_LOGGER_TRACE(mSLog, "Voltage {:s}", Logger::phasorToString((**mIntfVoltage)(0,freqIdx))); } void DP::Ph1::ResIndSeries::mnaCompUpdateCurrent(const Matrix& leftVector) { for (Int freq = 0; freq < mNumFreqs; freq++) { (**mIntfCurrent)(0,freq) = mEquivCond(freq,0) * (**mIntfVoltage)(0,freq) + mEquivCurrent(freq,0); - SPDLOG_LOGGER_DEBUG(mSLog, "Current {:s}", Logger::phasorToString((**mIntfCurrent)(0,freq))); + SPDLOG_LOGGER_TRACE(mSLog, "Current {:s}", Logger::phasorToString((**mIntfCurrent)(0,freq))); } } void DP::Ph1::ResIndSeries::mnaCompUpdateCurrentHarm() { for (Int freq = 0; freq < mNumFreqs; freq++) { (**mIntfCurrent)(0,freq) = mEquivCond(freq,0) * (**mIntfVoltage)(0,freq) + mEquivCurrent(freq,0); - SPDLOG_LOGGER_DEBUG(mSLog, "Current {:s}", Logger::phasorToString((**mIntfCurrent)(0,freq))); + SPDLOG_LOGGER_TRACE(mSLog, "Current {:s}", Logger::phasorToString((**mIntfCurrent)(0,freq))); } } diff --git a/dpsim-models/src/DP/DP_Ph1_Resistor.cpp b/dpsim-models/src/DP/DP_Ph1_Resistor.cpp index 7bc76214b4..ff90b346e1 100644 --- a/dpsim-models/src/DP/DP_Ph1_Resistor.cpp +++ b/dpsim-models/src/DP/DP_Ph1_Resistor.cpp @@ -81,14 +81,14 @@ void DP::Ph1::Resistor::mnaCompApplySystemMatrixStamp(SparseMatrixRow& systemMat Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1), matrixNodeIndex(0), -conductance, mNumFreqs, freq); } - SPDLOG_LOGGER_INFO(mSLog, "-- Stamp frequency {:d} ---", freq); + SPDLOG_LOGGER_DEBUG(mSLog, "-- Stamp frequency {:d} ---", freq); if (terminalNotGrounded(0)) - SPDLOG_LOGGER_INFO(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(conductance), matrixNodeIndex(0), matrixNodeIndex(0)); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(conductance), matrixNodeIndex(0), matrixNodeIndex(0)); if (terminalNotGrounded(1)) - SPDLOG_LOGGER_INFO(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(conductance), matrixNodeIndex(1), matrixNodeIndex(1)); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(conductance), matrixNodeIndex(1), matrixNodeIndex(1)); if (terminalNotGrounded(0) && terminalNotGrounded(1)) { - SPDLOG_LOGGER_INFO(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(-conductance), matrixNodeIndex(0), matrixNodeIndex(1)); - SPDLOG_LOGGER_INFO(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(-conductance), matrixNodeIndex(1), matrixNodeIndex(0)); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(-conductance), matrixNodeIndex(0), matrixNodeIndex(1)); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(-conductance), matrixNodeIndex(1), matrixNodeIndex(0)); } } } @@ -106,14 +106,14 @@ void DP::Ph1::Resistor::mnaCompApplySystemMatrixStampHarm(SparseMatrixRow& syste Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1), matrixNodeIndex(0), -conductance); } - SPDLOG_LOGGER_INFO(mSLog, "-- Stamp for frequency {:f} ---", mFrequencies(freqIdx,0)); + SPDLOG_LOGGER_DEBUG(mSLog, "-- Stamp for frequency {:f} ---", mFrequencies(freqIdx,0)); if (terminalNotGrounded(0)) - SPDLOG_LOGGER_INFO(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(conductance), matrixNodeIndex(0), matrixNodeIndex(0)); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(conductance), matrixNodeIndex(0), matrixNodeIndex(0)); if (terminalNotGrounded(1)) - SPDLOG_LOGGER_INFO(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(conductance), matrixNodeIndex(1), matrixNodeIndex(1)); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(conductance), matrixNodeIndex(1), matrixNodeIndex(1)); if (terminalNotGrounded(0) && terminalNotGrounded(1)) { - SPDLOG_LOGGER_INFO(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(-conductance), matrixNodeIndex(0), matrixNodeIndex(1)); - SPDLOG_LOGGER_INFO(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(-conductance), matrixNodeIndex(1), matrixNodeIndex(0)); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(-conductance), matrixNodeIndex(0), matrixNodeIndex(1)); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(-conductance), matrixNodeIndex(1), matrixNodeIndex(0)); } } @@ -143,14 +143,14 @@ void DP::Ph1::Resistor::mnaCompUpdateVoltage(const Matrix& leftVector) { if (terminalNotGrounded(0)) (**mIntfVoltage)(0,freq) = (**mIntfVoltage)(0,freq) - Math::complexFromVectorElement(leftVector, matrixNodeIndex(0), mNumFreqs, freq); - SPDLOG_LOGGER_DEBUG(mSLog, "Voltage {:s}", Logger::phasorToString((**mIntfVoltage)(0,freq))); + SPDLOG_LOGGER_TRACE(mSLog, "Voltage {:s}", Logger::phasorToString((**mIntfVoltage)(0,freq))); } } void DP::Ph1::Resistor::mnaCompUpdateCurrent(const Matrix& leftVector) { for (UInt freq = 0; freq < mNumFreqs; freq++) { (**mIntfCurrent)(0,freq) = (**mIntfVoltage)(0,freq) / **mResistance; - SPDLOG_LOGGER_DEBUG(mSLog, "Current {:s}", Logger::phasorToString((**mIntfCurrent)(0,freq))); + SPDLOG_LOGGER_TRACE(mSLog, "Current {:s}", Logger::phasorToString((**mIntfCurrent)(0,freq))); } } @@ -162,13 +162,13 @@ void DP::Ph1::Resistor::mnaCompUpdateVoltageHarm(const Matrix& leftVector, Int f if (terminalNotGrounded(0)) (**mIntfVoltage)(0,freqIdx) = (**mIntfVoltage)(0,freqIdx) - Math::complexFromVectorElement(leftVector, matrixNodeIndex(0)); - SPDLOG_LOGGER_DEBUG(mSLog, "Voltage {:s}", Logger::phasorToString((**mIntfVoltage)(0,freqIdx))); + SPDLOG_LOGGER_TRACE(mSLog, "Voltage {:s}", Logger::phasorToString((**mIntfVoltage)(0,freqIdx))); } void DP::Ph1::Resistor::mnaCompUpdateCurrentHarm() { for (UInt freq = 0; freq < mNumFreqs; freq++) { (**mIntfCurrent)(0,freq) = (**mIntfVoltage)(0,freq) / **mResistance; - SPDLOG_LOGGER_DEBUG(mSLog, "Current {:s}", Logger::phasorToString((**mIntfCurrent)(0,freq))); + SPDLOG_LOGGER_TRACE(mSLog, "Current {:s}", Logger::phasorToString((**mIntfCurrent)(0,freq))); } } diff --git a/dpsim-models/src/DP/DP_Ph1_SVC.cpp b/dpsim-models/src/DP/DP_Ph1_SVC.cpp index 55989f1db0..b91a38b581 100644 --- a/dpsim-models/src/DP/DP_Ph1_SVC.cpp +++ b/dpsim-models/src/DP/DP_Ph1_SVC.cpp @@ -51,7 +51,7 @@ void DP::Ph1::SVC::initializeFromNodesAndTerminals(Real frequency) { **mVmeasPrev = mPrevVoltage; if (mMechMode) { - SPDLOG_LOGGER_INFO(mSLog, "Using Mechanical Model"); + SPDLOG_LOGGER_DEBUG(mSLog, "Using Mechanical Model"); } SPDLOG_LOGGER_INFO(mSLog, @@ -247,7 +247,7 @@ void DP::Ph1::SVC::checkProtection(Real time) { } if (mDisconnect) { - SPDLOG_LOGGER_INFO(mSLog, "Disconnect SVC because of overvoltage at {}", time); + SPDLOG_LOGGER_DEBUG(mSLog, "Disconnect SVC because of overvoltage at {}", time); mSubCapacitorSwitch->open(); mSubInductorSwitch->open(); mValueChange = true; @@ -356,7 +356,7 @@ void DP::Ph1::SVC::mechanicalModelUpdateSusceptance(Real time) { mTapPos = mTapPos - 1; mTapPos = (mTapPos < mMinPos) ? mMinPos : mTapPos; **mViolationCounter = 0; - SPDLOG_LOGGER_INFO(mSLog, "Time: {}" + SPDLOG_LOGGER_DEBUG(mSLog, "Time: {}" "\nDecreasing Tap. Reason: Undervoltage" "\nNew Tap Position: {}", time, mTapPos); } @@ -365,7 +365,7 @@ void DP::Ph1::SVC::mechanicalModelUpdateSusceptance(Real time) { mTapPos = mTapPos + 1; mTapPos = (mTapPos > mMaxPos) ? mMaxPos : mTapPos; **mViolationCounter = 0; - SPDLOG_LOGGER_INFO(mSLog, "Time: {}" + SPDLOG_LOGGER_DEBUG(mSLog, "Time: {}" "\nIncreasing Tap. Reason: Overvoltag" "\nNew Tap Position: {}", time, mTapPos); } @@ -376,7 +376,7 @@ void DP::Ph1::SVC::mechanicalModelUpdateSusceptance(Real time) { // inductor is active mInductiveMode = true; Real inductance = 1 / ((mTapPos / mMaxPos) * mBN * omega); - SPDLOG_LOGGER_INFO(mSLog, "New inductance: {}", inductance); + SPDLOG_LOGGER_DEBUG(mSLog, "New inductance: {}", inductance); mSubInductor->updateInductance(inductance, mDeltaT); mValueChange = true; setSwitchState(); @@ -385,7 +385,7 @@ void DP::Ph1::SVC::mechanicalModelUpdateSusceptance(Real time) { // capacitor is active mInductiveMode = false; Real capacitance = ((mTapPos / mMinPos) * mBN) / omega; - SPDLOG_LOGGER_INFO(mSLog, "New capacitance: {}", capacitance); + SPDLOG_LOGGER_DEBUG(mSLog, "New capacitance: {}", capacitance); mSubCapacitor->updateCapacitance(capacitance, mDeltaT); mValueChange = true; setSwitchState(); @@ -393,7 +393,7 @@ void DP::Ph1::SVC::mechanicalModelUpdateSusceptance(Real time) { } else if (mTapPos = 0) { // open both - SPDLOG_LOGGER_INFO(mSLog, "Time: {}" + SPDLOG_LOGGER_DEBUG(mSLog, "Time: {}" "Tap Position: 0. Open both elements", time); mSubInductorSwitch->open(); mSubCapacitorSwitch->open(); @@ -419,22 +419,22 @@ void DP::Ph1::SVC::setSwitchState() { // set switches according to current mode of svc if (mInductiveMode) { if (!mSubInductorSwitch->mnaIsClosed()) { - SPDLOG_LOGGER_INFO(mSLog, "Inductive Mode: Closed Inductor Switch"); + SPDLOG_LOGGER_DEBUG(mSLog, "Inductive Mode: Closed Inductor Switch"); mSubInductorSwitch->close(); } if (mSubCapacitorSwitch->mnaIsClosed()) { mSubCapacitorSwitch->open(); - SPDLOG_LOGGER_INFO(mSLog, "Inductive Mode: Opened Capacitor Switch"); + SPDLOG_LOGGER_DEBUG(mSLog, "Inductive Mode: Opened Capacitor Switch"); } } else { if (mSubInductorSwitch->mnaIsClosed()) { mSubInductorSwitch->open(); - SPDLOG_LOGGER_INFO(mSLog, "Capacitive Mode: Openend Inductor Switch"); + SPDLOG_LOGGER_DEBUG(mSLog, "Capacitive Mode: Openend Inductor Switch"); } if (!mSubCapacitorSwitch->mnaIsClosed()) { mSubCapacitorSwitch->close(); - SPDLOG_LOGGER_INFO(mSLog, "Capacitive Mode: Closed Capcitor Switch"); + SPDLOG_LOGGER_DEBUG(mSLog, "Capacitive Mode: Closed Capcitor Switch"); } } } diff --git a/dpsim-models/src/DP/DP_Ph1_Switch.cpp b/dpsim-models/src/DP/DP_Ph1_Switch.cpp index bfb72091a9..645e6cfd72 100644 --- a/dpsim-models/src/DP/DP_Ph1_Switch.cpp +++ b/dpsim-models/src/DP/DP_Ph1_Switch.cpp @@ -62,14 +62,14 @@ void DP::Ph1::Switch::mnaCompApplySystemMatrixStamp(SparseMatrixRow& systemMatri Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1), matrixNodeIndex(0), -conductance); } - SPDLOG_LOGGER_TRACE(mSLog, "-- Stamp ---"); + SPDLOG_LOGGER_DEBUG(mSLog, "-- Stamp ---"); if (terminalNotGrounded(0)) - SPDLOG_LOGGER_TRACE(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(conductance), matrixNodeIndex(0), matrixNodeIndex(0)); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(conductance), matrixNodeIndex(0), matrixNodeIndex(0)); if (terminalNotGrounded(1)) - SPDLOG_LOGGER_TRACE(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(conductance), matrixNodeIndex(1), matrixNodeIndex(1)); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(conductance), matrixNodeIndex(1), matrixNodeIndex(1)); if (terminalNotGrounded(0) && terminalNotGrounded(1)) { - SPDLOG_LOGGER_TRACE(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(-conductance), matrixNodeIndex(0), matrixNodeIndex(1)); - SPDLOG_LOGGER_TRACE(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(-conductance), matrixNodeIndex(1), matrixNodeIndex(0)); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(-conductance), matrixNodeIndex(0), matrixNodeIndex(1)); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(-conductance), matrixNodeIndex(1), matrixNodeIndex(0)); } } @@ -90,14 +90,14 @@ void DP::Ph1::Switch::mnaCompApplySwitchSystemMatrixStamp(Bool closed, SparseMat Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1), matrixNodeIndex(0), -conductance); } - SPDLOG_LOGGER_TRACE(mSLog, "-- Stamp ---"); + SPDLOG_LOGGER_DEBUG(mSLog, "-- Stamp ---"); if (terminalNotGrounded(0)) - SPDLOG_LOGGER_TRACE(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(conductance), matrixNodeIndex(0), matrixNodeIndex(0)); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(conductance), matrixNodeIndex(0), matrixNodeIndex(0)); if (terminalNotGrounded(1)) - SPDLOG_LOGGER_TRACE(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(conductance), matrixNodeIndex(1), matrixNodeIndex(1)); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(conductance), matrixNodeIndex(1), matrixNodeIndex(1)); if (terminalNotGrounded(0) && terminalNotGrounded(1)) { - SPDLOG_LOGGER_TRACE(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(-conductance), matrixNodeIndex(0), matrixNodeIndex(1)); - SPDLOG_LOGGER_TRACE(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(-conductance), matrixNodeIndex(1), matrixNodeIndex(0)); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(-conductance), matrixNodeIndex(0), matrixNodeIndex(1)); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(-conductance), matrixNodeIndex(1), matrixNodeIndex(0)); } } diff --git a/dpsim-models/src/DP/DP_Ph1_SynchronGenerator4OrderTPM.cpp b/dpsim-models/src/DP/DP_Ph1_SynchronGenerator4OrderTPM.cpp index d3e9166eec..a5dde913b5 100644 --- a/dpsim-models/src/DP/DP_Ph1_SynchronGenerator4OrderTPM.cpp +++ b/dpsim-models/src/DP/DP_Ph1_SynchronGenerator4OrderTPM.cpp @@ -96,13 +96,13 @@ void DP::Ph1::SynchronGenerator4OrderTPM::calculateConstantConductanceMatrix() { resistanceMatrix(1,0) = - (mA - mB) / 2.0; resistanceMatrix(1,1) = 0; - SPDLOG_LOGGER_INFO(mSLog, "\nR_const [pu]: {}", Logger::matrixToString(resistanceMatrix)); + SPDLOG_LOGGER_DEBUG(mSLog, "\nR_const [pu]: {}", Logger::matrixToString(resistanceMatrix)); resistanceMatrix = resistanceMatrix * mBase_Z; - SPDLOG_LOGGER_INFO(mSLog, "\nR_const [Ohm]: {}", Logger::matrixToString(resistanceMatrix)); + SPDLOG_LOGGER_DEBUG(mSLog, "\nR_const [Ohm]: {}", Logger::matrixToString(resistanceMatrix)); mConductanceMatrixConst = resistanceMatrix.inverse(); - SPDLOG_LOGGER_INFO(mSLog, "\nG_const [S]: {}", Logger::matrixToString(mConductanceMatrixConst)); + SPDLOG_LOGGER_DEBUG(mSLog, "\nG_const [S]: {}", Logger::matrixToString(mConductanceMatrixConst)); } void DP::Ph1::SynchronGenerator4OrderTPM::mnaCompApplySystemMatrixStamp(SparseMatrixRow& systemMatrix) { diff --git a/dpsim-models/src/DP/DP_Ph1_SynchronGeneratorTrStab.cpp b/dpsim-models/src/DP/DP_Ph1_SynchronGeneratorTrStab.cpp index fa2b664ed4..2a0e742f44 100644 --- a/dpsim-models/src/DP/DP_Ph1_SynchronGeneratorTrStab.cpp +++ b/dpsim-models/src/DP/DP_Ph1_SynchronGeneratorTrStab.cpp @@ -231,7 +231,7 @@ void DP::Ph1::SynchronGeneratorTrStab::step(Real time) { mStates << Math::abs(**mEp), Math::phaseDeg(**mEp), **mElecActivePower, **mMechPower, **mDelta_p, **mOmMech, dOmMech, dDelta_p, (**mIntfVoltage)(0,0).real(), (**mIntfVoltage)(0,0).imag(); - SPDLOG_LOGGER_DEBUG(mSLog, "\nStates, time {:f}: \n{:s}", time, Logger::matrixToString(mStates)); + SPDLOG_LOGGER_TRACE(mSLog, "\nStates, time {:f}: \n{:s}", time, Logger::matrixToString(mStates)); } void DP::Ph1::SynchronGeneratorTrStab::mnaParentInitialize(Real omega, Real timeStep, Attribute::Ptr leftVector) { @@ -269,12 +269,12 @@ void DP::Ph1::SynchronGeneratorTrStab::mnaParentPostStep(Real time, Int timeStep } void DP::Ph1::SynchronGeneratorTrStab::mnaCompUpdateVoltage(const Matrix& leftVector) { - SPDLOG_LOGGER_DEBUG(mSLog, "Read voltage from {:d}", matrixNodeIndex(0)); + SPDLOG_LOGGER_TRACE(mSLog, "Read voltage from {:d}", matrixNodeIndex(0)); (**mIntfVoltage)(0,0) = Math::complexFromVectorElement(leftVector, matrixNodeIndex(0)); } void DP::Ph1::SynchronGeneratorTrStab::mnaCompUpdateCurrent(const Matrix& leftVector) { - SPDLOG_LOGGER_DEBUG(mSLog, "Read current from {:d}", matrixNodeIndex(0)); + SPDLOG_LOGGER_TRACE(mSLog, "Read current from {:d}", matrixNodeIndex(0)); //Current flowing out of component **mIntfCurrent = mSubInductor->mIntfCurrent->get(); } @@ -284,5 +284,5 @@ void DP::Ph1::SynchronGeneratorTrStab::setReferenceOmega(Attribute::Ptr re mRefDelta->setReference(refDeltaPtr); mUseOmegaRef=true; - SPDLOG_LOGGER_INFO(mSLog, "Use of reference omega."); + SPDLOG_LOGGER_DEBUG(mSLog, "Use of reference omega."); } diff --git a/dpsim-models/src/DP/DP_Ph1_Transformer.cpp b/dpsim-models/src/DP/DP_Ph1_Transformer.cpp index 1bcbe3658d..87c9a60e5d 100644 --- a/dpsim-models/src/DP/DP_Ph1_Transformer.cpp +++ b/dpsim-models/src/DP/DP_Ph1_Transformer.cpp @@ -67,9 +67,9 @@ void DP::Ph1::Transformer::initializeFromNodesAndTerminals(Real frequency) { Real tmpVolt = **mNominalVoltageEnd1; **mNominalVoltageEnd1 = **mNominalVoltageEnd2; **mNominalVoltageEnd2 = tmpVolt; - SPDLOG_LOGGER_INFO(mSLog, "Switching terminals to have first terminal at higher voltage side. Updated parameters: "); - SPDLOG_LOGGER_INFO(mSLog, "Nominal Voltage End 1 = {} [V] Nominal Voltage End 2 = {} [V]", **mNominalVoltageEnd1, **mNominalVoltageEnd2); - SPDLOG_LOGGER_INFO(mSLog, "Tap Ratio = {} [ ] Phase Shift = {} [deg]", std::abs(**mRatio), std::arg(**mRatio)); + SPDLOG_LOGGER_DEBUG(mSLog, "Switching terminals to have first terminal at higher voltage side. Updated parameters: "); + SPDLOG_LOGGER_DEBUG(mSLog, "Nominal Voltage End 1 = {} [V] Nominal Voltage End 2 = {} [V]", **mNominalVoltageEnd1, **mNominalVoltageEnd2); + SPDLOG_LOGGER_DEBUG(mSLog, "Tap Ratio = {} [ ] Phase Shift = {} [deg]", std::abs(**mRatio), std::arg(**mRatio)); } // Set initial voltage of virtual node in between @@ -78,7 +78,7 @@ void DP::Ph1::Transformer::initializeFromNodesAndTerminals(Real frequency) { // Static calculations from load flow data Real omega = 2.*PI* frequency; Complex impedance = { **mResistance, omega * **mInductance }; - SPDLOG_LOGGER_INFO(mSLog, "Reactance={} [Ohm] (referred to primary side)", omega * **mInductance ); + SPDLOG_LOGGER_DEBUG(mSLog, "Reactance={} [Ohm] (referred to primary side)", omega * **mInductance ); (**mIntfVoltage)(0,0) = mVirtualNodes[0]->initialSingleVoltage() - initialSingleVoltage(0); (**mIntfCurrent)(0,0) = (**mIntfVoltage)(0,0) / impedance; @@ -107,7 +107,7 @@ void DP::Ph1::Transformer::initializeFromNodesAndTerminals(Real frequency) { mSubSnubResistor1 = std::make_shared(**mName + "_snub_res1", mLogLevel); mSubSnubResistor1->setParameters(mSnubberResistance1); mSubSnubResistor1->connect({ node(0), DP::SimNode::GND }); - SPDLOG_LOGGER_INFO(mSLog, "Snubber Resistance 1 (connected to higher voltage side {}) = {} [Ohm]", node(0)->name(), Logger::realToString(mSnubberResistance1)); + SPDLOG_LOGGER_DEBUG(mSLog, "Snubber Resistance 1 (connected to higher voltage side {}) = {} [Ohm]", node(0)->name(), Logger::realToString(mSnubberResistance1)); addMNASubComponent(mSubSnubResistor1, MNA_SUBCOMP_TASK_ORDER::TASK_BEFORE_PARENT, MNA_SUBCOMP_TASK_ORDER::TASK_BEFORE_PARENT, true); @@ -116,7 +116,7 @@ void DP::Ph1::Transformer::initializeFromNodesAndTerminals(Real frequency) { mSubSnubResistor2 = std::make_shared(**mName + "_snub_res2", mLogLevel); mSubSnubResistor2->setParameters(mSnubberResistance2); mSubSnubResistor2->connect({ node(1), DP::SimNode::GND }); - SPDLOG_LOGGER_INFO(mSLog, "Snubber Resistance 2 (connected to lower voltage side {}) = {} [Ohm]", node(1)->name(), Logger::realToString(mSnubberResistance2)); + SPDLOG_LOGGER_DEBUG(mSLog, "Snubber Resistance 2 (connected to lower voltage side {}) = {} [Ohm]", node(1)->name(), Logger::realToString(mSnubberResistance2)); addMNASubComponent(mSubSnubResistor2, MNA_SUBCOMP_TASK_ORDER::TASK_BEFORE_PARENT, MNA_SUBCOMP_TASK_ORDER::TASK_BEFORE_PARENT, true); // // A snubber capacitance is added to higher voltage side (not used as capacitor at high voltage side made it worse) @@ -132,13 +132,13 @@ void DP::Ph1::Transformer::initializeFromNodesAndTerminals(Real frequency) { mSubSnubCapacitor2 = std::make_shared(**mName + "_snub_cap2", mLogLevel); mSubSnubCapacitor2->setParameters(mSnubberCapacitance2); mSubSnubCapacitor2->connect({ node(1), DP::SimNode::GND }); - SPDLOG_LOGGER_INFO(mSLog, "Snubber Capacitance 2 (connected to lower voltage side {}) = {} [F]", node(1)->name(), Logger::realToString(mSnubberCapacitance2)); + SPDLOG_LOGGER_DEBUG(mSLog, "Snubber Capacitance 2 (connected to lower voltage side {}) = {} [F]", node(1)->name(), Logger::realToString(mSnubberCapacitance2)); addMNASubComponent(mSubSnubCapacitor2, MNA_SUBCOMP_TASK_ORDER::TASK_BEFORE_PARENT, MNA_SUBCOMP_TASK_ORDER::TASK_BEFORE_PARENT, true); // Initialize electrical subcomponents - SPDLOG_LOGGER_INFO(mSLog, "Electrical subcomponents: "); + SPDLOG_LOGGER_DEBUG(mSLog, "Electrical subcomponents: "); for (auto subcomp: mSubComponents) { - SPDLOG_LOGGER_INFO(mSLog, "- {}", subcomp->name()); + SPDLOG_LOGGER_DEBUG(mSLog, "- {}", subcomp->name()); subcomp->initialize(mFrequencies); subcomp->initializeFromNodesAndTerminals(frequency); } @@ -183,15 +183,15 @@ void DP::Ph1::Transformer::mnaCompApplySystemMatrixStamp(SparseMatrixRow& system mnasubcomp->mnaApplySystemMatrixStamp(systemMatrix); if (terminalNotGrounded(0)) { - SPDLOG_LOGGER_INFO(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(Complex(-1.0, 0)), + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(Complex(-1.0, 0)), mVirtualNodes[0]->matrixNodeIndex(), mVirtualNodes[1]->matrixNodeIndex()); - SPDLOG_LOGGER_INFO(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(Complex(1.0, 0)), + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(Complex(1.0, 0)), mVirtualNodes[1]->matrixNodeIndex(), mVirtualNodes[0]->matrixNodeIndex()); } if (terminalNotGrounded(1)) { - SPDLOG_LOGGER_INFO(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(**mRatio), + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(**mRatio), matrixNodeIndex(1), mVirtualNodes[1]->matrixNodeIndex()); - SPDLOG_LOGGER_INFO(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(- **mRatio), + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(- **mRatio), mVirtualNodes[1]->matrixNodeIndex(), matrixNodeIndex(1)); } } @@ -226,6 +226,6 @@ void DP::Ph1::Transformer::mnaCompUpdateVoltage(const Matrix& leftVector) { (**mIntfVoltage)(0, 0) = 0; (**mIntfVoltage)(0, 0) = Math::complexFromVectorElement(leftVector, matrixNodeIndex(1)); (**mIntfVoltage)(0, 0) = (**mIntfVoltage)(0, 0) - Math::complexFromVectorElement(leftVector, mVirtualNodes[0]->matrixNodeIndex()); - SPDLOG_LOGGER_DEBUG(mSLog, "Voltage {:s}", Logger::phasorToString((**mIntfVoltage)(0, 0))); + SPDLOG_LOGGER_TRACE(mSLog, "Voltage {:s}", Logger::phasorToString((**mIntfVoltage)(0, 0))); } diff --git a/dpsim-models/src/DP/DP_Ph1_VoltageSource.cpp b/dpsim-models/src/DP/DP_Ph1_VoltageSource.cpp index 8ffce92a94..1b10489b89 100644 --- a/dpsim-models/src/DP/DP_Ph1_VoltageSource.cpp +++ b/dpsim-models/src/DP/DP_Ph1_VoltageSource.cpp @@ -129,14 +129,14 @@ void DP::Ph1::VoltageSource::mnaCompApplySystemMatrixStamp(SparseMatrixRow& syst Math::setMatrixElement(systemMatrix, matrixNodeIndex(1), mVirtualNodes[0]->matrixNodeIndex(), Complex(1, 0), mNumFreqs, freq); } - SPDLOG_LOGGER_INFO(mSLog, "-- Stamp frequency {:d} ---", freq); + SPDLOG_LOGGER_DEBUG(mSLog, "-- Stamp frequency {:d} ---", freq); if (terminalNotGrounded(0)) { - SPDLOG_LOGGER_INFO(mSLog, "Add {:f} to system at ({:d},{:d})", -1., matrixNodeIndex(0), mVirtualNodes[0]->matrixNodeIndex()); - SPDLOG_LOGGER_INFO(mSLog, "Add {:f} to system at ({:d},{:d})", -1., mVirtualNodes[0]->matrixNodeIndex(), matrixNodeIndex(0)); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:f} to system at ({:d},{:d})", -1., matrixNodeIndex(0), mVirtualNodes[0]->matrixNodeIndex()); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:f} to system at ({:d},{:d})", -1., mVirtualNodes[0]->matrixNodeIndex(), matrixNodeIndex(0)); } if (terminalNotGrounded(1)) { - SPDLOG_LOGGER_INFO(mSLog, "Add {:f} to system at ({:d},{:d})", 1., mVirtualNodes[0]->matrixNodeIndex(), matrixNodeIndex(1)); - SPDLOG_LOGGER_INFO(mSLog, "Add {:f} to system at ({:d},{:d})", 1., matrixNodeIndex(1), mVirtualNodes[0]->matrixNodeIndex()); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:f} to system at ({:d},{:d})", 1., mVirtualNodes[0]->matrixNodeIndex(), matrixNodeIndex(1)); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:f} to system at ({:d},{:d})", 1., matrixNodeIndex(1), mVirtualNodes[0]->matrixNodeIndex()); } } } @@ -151,21 +151,21 @@ void DP::Ph1::VoltageSource::mnaCompApplySystemMatrixStampHarm(SparseMatrixRow& Math::setMatrixElement(systemMatrix, matrixNodeIndex(1), mVirtualNodes[0]->matrixNodeIndex(), Complex(1, 0)); } - SPDLOG_LOGGER_INFO(mSLog, "-- Stamp frequency {:d} ---", freqIdx); + SPDLOG_LOGGER_DEBUG(mSLog, "-- Stamp frequency {:d} ---", freqIdx); if (terminalNotGrounded(0)) { - SPDLOG_LOGGER_INFO(mSLog, "Add {:f} to system at ({:d},{:d})", -1., matrixNodeIndex(0), mVirtualNodes[0]->matrixNodeIndex()); - SPDLOG_LOGGER_INFO(mSLog, "Add {:f} to system at ({:d},{:d})", -1., mVirtualNodes[0]->matrixNodeIndex(), matrixNodeIndex(0)); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:f} to system at ({:d},{:d})", -1., matrixNodeIndex(0), mVirtualNodes[0]->matrixNodeIndex()); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:f} to system at ({:d},{:d})", -1., mVirtualNodes[0]->matrixNodeIndex(), matrixNodeIndex(0)); } if (terminalNotGrounded(1)) { - SPDLOG_LOGGER_INFO(mSLog, "Add {:f} to system at ({:d},{:d})", 1., mVirtualNodes[0]->matrixNodeIndex(), matrixNodeIndex(1)); - SPDLOG_LOGGER_INFO(mSLog, "Add {:f} to system at ({:d},{:d})", 1., matrixNodeIndex(1), mVirtualNodes[0]->matrixNodeIndex()); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:f} to system at ({:d},{:d})", 1., mVirtualNodes[0]->matrixNodeIndex(), matrixNodeIndex(1)); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:f} to system at ({:d},{:d})", 1., matrixNodeIndex(1), mVirtualNodes[0]->matrixNodeIndex()); } } void DP::Ph1::VoltageSource::mnaCompApplyRightSideVectorStamp(Matrix& rightVector) { // TODO: Is this correct with two nodes not gnd? Math::setVectorElement(rightVector, mVirtualNodes[0]->matrixNodeIndex(), (**mIntfVoltage)(0,0), mNumFreqs); - SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to source vector at {:d}", + SPDLOG_LOGGER_TRACE(mSLog, "Add {:s} to source vector at {:d}", Logger::complexToString((**mIntfVoltage)(0,0)), mVirtualNodes[0]->matrixNodeIndex()); } @@ -173,7 +173,7 @@ void DP::Ph1::VoltageSource::mnaCompApplyRightSideVectorStampHarm(Matrix& rightV for (UInt freq = 0; freq < mNumFreqs; freq++) { // TODO: Is this correct with two nodes not gnd? Math::setVectorElement(rightVector, mVirtualNodes[0]->matrixNodeIndex(), (**mIntfVoltage)(0,freq), 1, 0, freq); - SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to source vector at {:d}", + SPDLOG_LOGGER_TRACE(mSLog, "Add {:s} to source vector at {:d}", Logger::complexToString((**mIntfVoltage)(0,freq)), mVirtualNodes[0]->matrixNodeIndex()); } } @@ -186,7 +186,7 @@ void DP::Ph1::VoltageSource::updateVoltage(Real time) { throw SystemError("VoltageSource::updateVoltage was called but no signal generator is configured!"); } - SPDLOG_LOGGER_DEBUG(mSLog, "Update Voltage {:s}", Logger::phasorToString((**mIntfVoltage)(0,0))); + SPDLOG_LOGGER_TRACE(mSLog, "Update Voltage {:s}", Logger::phasorToString((**mIntfVoltage)(0,0))); } void DP::Ph1::VoltageSource::mnaCompPreStep(Real time, Int timeStepCount) { diff --git a/dpsim-models/src/DP/DP_Ph1_VoltageSourceNorton.cpp b/dpsim-models/src/DP/DP_Ph1_VoltageSourceNorton.cpp index 04dbd0f059..18cb98837c 100644 --- a/dpsim-models/src/DP/DP_Ph1_VoltageSourceNorton.cpp +++ b/dpsim-models/src/DP/DP_Ph1_VoltageSourceNorton.cpp @@ -55,15 +55,15 @@ void DP::Ph1::VoltageSourceNorton::mnaCompApplySystemMatrixStamp(SparseMatrixRow } if (terminalNotGrounded(0)) - SPDLOG_LOGGER_INFO(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(Complex(mConductance, 0)), + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(Complex(mConductance, 0)), matrixNodeIndex(0), matrixNodeIndex(0)); if (terminalNotGrounded(1)) - SPDLOG_LOGGER_INFO(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(Complex(mConductance, 0)), + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(Complex(mConductance, 0)), matrixNodeIndex(1), matrixNodeIndex(1)); if (terminalNotGrounded(0) && terminalNotGrounded(1)) { - SPDLOG_LOGGER_INFO(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(Complex(-mConductance, 0)), + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(Complex(-mConductance, 0)), matrixNodeIndex(0), matrixNodeIndex(1)); - SPDLOG_LOGGER_INFO(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(Complex(-mConductance, 0)), + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(Complex(-mConductance, 0)), matrixNodeIndex(1), matrixNodeIndex(0)); } } diff --git a/dpsim-models/src/DP/DP_Ph1_varResSwitch.cpp b/dpsim-models/src/DP/DP_Ph1_varResSwitch.cpp index e0dfd3d7d6..0d0e15c435 100644 --- a/dpsim-models/src/DP/DP_Ph1_varResSwitch.cpp +++ b/dpsim-models/src/DP/DP_Ph1_varResSwitch.cpp @@ -72,14 +72,14 @@ void DP::Ph1::varResSwitch::mnaCompApplySwitchSystemMatrixStamp(Bool closed, Spa Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1), matrixNodeIndex(0), -conductance); } - SPDLOG_LOGGER_INFO(mSLog, "-- Stamp ---"); + SPDLOG_LOGGER_DEBUG(mSLog, "-- Stamp ---"); if (terminalNotGrounded(0)) - SPDLOG_LOGGER_INFO(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(conductance), matrixNodeIndex(0), matrixNodeIndex(0)); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(conductance), matrixNodeIndex(0), matrixNodeIndex(0)); if (terminalNotGrounded(1)) - SPDLOG_LOGGER_INFO(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(conductance), matrixNodeIndex(1), matrixNodeIndex(1)); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(conductance), matrixNodeIndex(1), matrixNodeIndex(1)); if (terminalNotGrounded(0) && terminalNotGrounded(1)) { - SPDLOG_LOGGER_INFO(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(-conductance), matrixNodeIndex(0), matrixNodeIndex(1)); - SPDLOG_LOGGER_INFO(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(-conductance), matrixNodeIndex(1), matrixNodeIndex(0)); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(-conductance), matrixNodeIndex(0), matrixNodeIndex(1)); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(-conductance), matrixNodeIndex(1), matrixNodeIndex(0)); } } diff --git a/dpsim-models/src/DP/DP_Ph3_Resistor.cpp b/dpsim-models/src/DP/DP_Ph3_Resistor.cpp index 20ebf45dc5..8b2cfb9faf 100644 --- a/dpsim-models/src/DP/DP_Ph3_Resistor.cpp +++ b/dpsim-models/src/DP/DP_Ph3_Resistor.cpp @@ -152,11 +152,11 @@ void DP::Ph3::Resistor::mnaCompUpdateVoltage(const Matrix& leftVector) { (**mIntfVoltage)(2,0) = (**mIntfVoltage)(2,0) - Math::complexFromVectorElement(leftVector, matrixNodeIndex(0,2)); } - SPDLOG_LOGGER_DEBUG(mSLog, "Voltage A: {} < {}", std::abs((**mIntfVoltage)(0,0)), std::arg((**mIntfVoltage)(0,0))); + SPDLOG_LOGGER_TRACE(mSLog, "Voltage A: {} < {}", std::abs((**mIntfVoltage)(0,0)), std::arg((**mIntfVoltage)(0,0))); } void DP::Ph3::Resistor::mnaCompUpdateCurrent(const Matrix& leftVector) { **mIntfCurrent = (**mResistance).inverse() * **mIntfVoltage; - SPDLOG_LOGGER_DEBUG(mSLog, "Current A: {} < {}", std::abs((**mIntfCurrent)(0,0)), std::arg((**mIntfCurrent)(0,0))); + SPDLOG_LOGGER_TRACE(mSLog, "Current A: {} < {}", std::abs((**mIntfCurrent)(0,0)), std::arg((**mIntfCurrent)(0,0))); } diff --git a/dpsim-models/src/DP/DP_Ph3_SeriesResistor.cpp b/dpsim-models/src/DP/DP_Ph3_SeriesResistor.cpp index cee4fda07d..22349c697b 100644 --- a/dpsim-models/src/DP/DP_Ph3_SeriesResistor.cpp +++ b/dpsim-models/src/DP/DP_Ph3_SeriesResistor.cpp @@ -93,12 +93,12 @@ void DP::Ph3::SeriesResistor::mnaCompApplySystemMatrixStamp(SparseMatrixRow& sys } if (terminalNotGrounded(0)) - SPDLOG_LOGGER_INFO(mSLog, "Add {} to {}, {}", conductance, matrixNodeIndex(0,0), matrixNodeIndex(0,0)); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {} to {}, {}", conductance, matrixNodeIndex(0,0), matrixNodeIndex(0,0)); if (terminalNotGrounded(1)) - SPDLOG_LOGGER_INFO(mSLog, "Add {} to {}, {}", conductance, matrixNodeIndex(1,0), matrixNodeIndex(1,0)); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {} to {}, {}", conductance, matrixNodeIndex(1,0), matrixNodeIndex(1,0)); if (terminalNotGrounded(0) && terminalNotGrounded(1)) { - SPDLOG_LOGGER_INFO(mSLog, "Add {} to {}, {}", -conductance, matrixNodeIndex(0,0), matrixNodeIndex(1,0)); - SPDLOG_LOGGER_INFO(mSLog, "Add {} to {}, {}", -conductance, matrixNodeIndex(1,0), matrixNodeIndex(0,0)); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {} to {}, {}", -conductance, matrixNodeIndex(0,0), matrixNodeIndex(1,0)); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {} to {}, {}", -conductance, matrixNodeIndex(1,0), matrixNodeIndex(0,0)); } } @@ -127,11 +127,11 @@ void DP::Ph3::SeriesResistor::mnaCompUpdateVoltage(const Matrix& leftVector) { (**mIntfVoltage)(2,0) = (**mIntfVoltage)(2,0) - Math::complexFromVectorElement(leftVector, matrixNodeIndex(0,2)); } - SPDLOG_LOGGER_DEBUG(mSLog, "Voltage A: {} < {}", std::abs((**mIntfVoltage)(0,0)), std::arg((**mIntfVoltage)(0,0))); + SPDLOG_LOGGER_TRACE(mSLog, "Voltage A: {} < {}", std::abs((**mIntfVoltage)(0,0)), std::arg((**mIntfVoltage)(0,0))); } void DP::Ph3::SeriesResistor::mnaCompUpdateCurrent(const Matrix& leftVector) { **mIntfCurrent = **mIntfVoltage / **mResistance; - SPDLOG_LOGGER_DEBUG(mSLog, "Current A: {} < {}", std::abs((**mIntfCurrent)(0,0)), std::arg((**mIntfCurrent)(0,0))); + SPDLOG_LOGGER_TRACE(mSLog, "Current A: {} < {}", std::abs((**mIntfCurrent)(0,0)), std::arg((**mIntfCurrent)(0,0))); } diff --git a/dpsim-models/src/DP/DP_Ph3_SeriesSwitch.cpp b/dpsim-models/src/DP/DP_Ph3_SeriesSwitch.cpp index 41f33d9d1e..d8d072946a 100644 --- a/dpsim-models/src/DP/DP_Ph3_SeriesSwitch.cpp +++ b/dpsim-models/src/DP/DP_Ph3_SeriesSwitch.cpp @@ -58,12 +58,12 @@ void DP::Ph3::SeriesSwitch::mnaCompApplySystemMatrixStamp(SparseMatrixRow& syste } if (terminalNotGrounded(0)) - SPDLOG_LOGGER_INFO(mSLog, "Add {} to {}, {}", conductance, matrixNodeIndices(0)[0], matrixNodeIndices(0)[0]); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {} to {}, {}", conductance, matrixNodeIndices(0)[0], matrixNodeIndices(0)[0]); if (terminalNotGrounded(1)) - SPDLOG_LOGGER_INFO(mSLog, "Add {} to {}, {}", conductance, matrixNodeIndices(1)[0], matrixNodeIndices(1)[0]); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {} to {}, {}", conductance, matrixNodeIndices(1)[0], matrixNodeIndices(1)[0]); if (terminalNotGrounded(0) && terminalNotGrounded(1)) { - SPDLOG_LOGGER_INFO(mSLog, "Add {} to {}, {}", -conductance, matrixNodeIndices(0)[0], matrixNodeIndices(1)[0]); - SPDLOG_LOGGER_INFO(mSLog, "Add {} to {}, {}", -conductance, matrixNodeIndices(1)[0], matrixNodeIndices(0)[0]); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {} to {}, {}", -conductance, matrixNodeIndices(0)[0], matrixNodeIndices(1)[0]); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {} to {}, {}", -conductance, matrixNodeIndices(1)[0], matrixNodeIndices(0)[0]); } } @@ -84,12 +84,12 @@ void DP::Ph3::SeriesSwitch::mnaCompApplySwitchSystemMatrixStamp(Bool closed, Spa } if (terminalNotGrounded(0)) - SPDLOG_LOGGER_INFO(mSLog, "Add {} to {}, {}", conductance, matrixNodeIndices(0)[0], matrixNodeIndices(0)[0]); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {} to {}, {}", conductance, matrixNodeIndices(0)[0], matrixNodeIndices(0)[0]); if (terminalNotGrounded(1)) - SPDLOG_LOGGER_INFO(mSLog, "Add {} to {}, {}", conductance, matrixNodeIndices(1)[0], matrixNodeIndices(1)[0]); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {} to {}, {}", conductance, matrixNodeIndices(1)[0], matrixNodeIndices(1)[0]); if (terminalNotGrounded(0) && terminalNotGrounded(1)) { - SPDLOG_LOGGER_INFO(mSLog, "Add {} to {}, {}", -conductance, matrixNodeIndices(0)[0], matrixNodeIndices(1)[0]); - SPDLOG_LOGGER_INFO(mSLog, "Add {} to {}, {}", -conductance, matrixNodeIndices(1)[0], matrixNodeIndices(0)[0]); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {} to {}, {}", -conductance, matrixNodeIndices(0)[0], matrixNodeIndices(1)[0]); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {} to {}, {}", -conductance, matrixNodeIndices(1)[0], matrixNodeIndices(0)[0]); } } @@ -118,12 +118,12 @@ void DP::Ph3::SeriesSwitch::mnaCompUpdateVoltage(const Matrix& leftVector) { (**mIntfVoltage)(2,0) = (**mIntfVoltage)(2,0) - Math::complexFromVectorElement(leftVector, matrixNodeIndex(0,2)); } - SPDLOG_LOGGER_DEBUG(mSLog, "Voltage A: {} < {}", std::abs((**mIntfVoltage)(0,0)), std::arg((**mIntfVoltage)(0,0))); + SPDLOG_LOGGER_TRACE(mSLog, "Voltage A: {} < {}", std::abs((**mIntfVoltage)(0,0)), std::arg((**mIntfVoltage)(0,0))); } void DP::Ph3::SeriesSwitch::mnaCompUpdateCurrent(const Matrix& leftVector) { Real impedance = (**mIsClosed) ? **mClosedResistance : **mOpenResistance; **mIntfCurrent = **mIntfVoltage / impedance; - SPDLOG_LOGGER_DEBUG(mSLog, "Current A: {} < {}", std::abs((**mIntfCurrent)(0,0)), std::arg((**mIntfCurrent)(0,0))); + SPDLOG_LOGGER_TRACE(mSLog, "Current A: {} < {}", std::abs((**mIntfCurrent)(0,0)), std::arg((**mIntfCurrent)(0,0))); } diff --git a/dpsim-models/src/DP/DP_Ph3_SynchronGeneratorDQ.cpp b/dpsim-models/src/DP/DP_Ph3_SynchronGeneratorDQ.cpp index 90c4ef6adf..8c7d6acd6c 100644 --- a/dpsim-models/src/DP/DP_Ph3_SynchronGeneratorDQ.cpp +++ b/dpsim-models/src/DP/DP_Ph3_SynchronGeneratorDQ.cpp @@ -85,9 +85,9 @@ void DP::Ph3::SynchronGeneratorDQ::mnaCompApplySystemMatrixStamp(SparseMatrixRow Math::addToMatrixElement(systemMatrix, matrixNodeIndices(0)[0], matrixNodeIndices(0)[0], Complex(conductance, 0)); Math::addToMatrixElement(systemMatrix, matrixNodeIndices(0)[1], matrixNodeIndices(0)[1], Complex(conductance, 0)); Math::addToMatrixElement(systemMatrix, matrixNodeIndices(0)[2], matrixNodeIndices(0)[2], Complex(conductance, 0)); - SPDLOG_LOGGER_INFO(mSLog, "Add {} to {}, {}", conductance, matrixNodeIndices(0)[0], matrixNodeIndices(0)[0]); - SPDLOG_LOGGER_INFO(mSLog, "Add {} to {}, {}", conductance, matrixNodeIndices(0)[1], matrixNodeIndices(0)[1]); - SPDLOG_LOGGER_INFO(mSLog, "Add {} to {}, {}", conductance, matrixNodeIndices(0)[2], matrixNodeIndices(0)[2]); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {} to {}, {}", conductance, matrixNodeIndices(0)[0], matrixNodeIndices(0)[0]); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {} to {}, {}", conductance, matrixNodeIndices(0)[1], matrixNodeIndices(0)[1]); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {} to {}, {}", conductance, matrixNodeIndices(0)[2], matrixNodeIndices(0)[2]); } } diff --git a/dpsim-models/src/DP/DP_Ph3_SynchronGeneratorDQODE.cpp b/dpsim-models/src/DP/DP_Ph3_SynchronGeneratorDQODE.cpp index 7cf5a9125f..43cbe12b84 100644 --- a/dpsim-models/src/DP/DP_Ph3_SynchronGeneratorDQODE.cpp +++ b/dpsim-models/src/DP/DP_Ph3_SynchronGeneratorDQODE.cpp @@ -71,7 +71,7 @@ void DP::Ph3::SynchronGeneratorDQODE::odePostStep() { mIdq0(2, 0) = mIsr(6, 0); **mIntfCurrent = mBase_I * dq0ToAbcTransform(mThetaMech, mIdq0); - SPDLOG_LOGGER_DEBUG(mSLog, "\nCurrent: \n{:s}", + SPDLOG_LOGGER_TRACE(mSLog, "\nCurrent: \n{:s}", Logger::matrixCompToString(**mIntfCurrent)); } diff --git a/dpsim-models/src/DP/DP_Ph3_SynchronGeneratorVBR_Deprecated.cpp b/dpsim-models/src/DP/DP_Ph3_SynchronGeneratorVBR_Deprecated.cpp index f345c7d289..0afe6a4b10 100644 --- a/dpsim-models/src/DP/DP_Ph3_SynchronGeneratorVBR_Deprecated.cpp +++ b/dpsim-models/src/DP/DP_Ph3_SynchronGeneratorVBR_Deprecated.cpp @@ -187,7 +187,7 @@ void DP::Ph3::SynchronGeneratorVBR::mnaStep(Matrix& systemMatrix, Matrix& rightV if (mLogLevel != Logger::Level::off) { Matrix logValues(statorCurrents().rows() + dqStatorCurrents().rows() + 3, 1); logValues << statorCurrents()*mBase_I, dqStatorCurrents(), electricalTorque(), rotationalSpeed(), rotorPosition(); - SPDLOG_LOGGER_DEBUG(mLog, time, logValues); + SPDLOG_LOGGER_TRACE(mLog, time, logValues); } } diff --git a/dpsim-models/src/EMT/EMT_Ph1_Resistor.cpp b/dpsim-models/src/EMT/EMT_Ph1_Resistor.cpp index b7b2456201..799a3813ab 100644 --- a/dpsim-models/src/EMT/EMT_Ph1_Resistor.cpp +++ b/dpsim-models/src/EMT/EMT_Ph1_Resistor.cpp @@ -60,12 +60,12 @@ void EMT::Ph1::Resistor::mnaCompApplySystemMatrixStamp(SparseMatrixRow& systemMa } if (terminalNotGrounded(0)) - SPDLOG_LOGGER_INFO(mSLog, "Add {:f} to system at ({:d},{:d})", conductance, matrixNodeIndex(0), matrixNodeIndex(0)); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:f} to system at ({:d},{:d})", conductance, matrixNodeIndex(0), matrixNodeIndex(0)); if (terminalNotGrounded(1)) - SPDLOG_LOGGER_INFO(mSLog, "Add {:f} to system at ({:d},{:d})", conductance, matrixNodeIndex(1), matrixNodeIndex(1)); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:f} to system at ({:d},{:d})", conductance, matrixNodeIndex(1), matrixNodeIndex(1)); if ( terminalNotGrounded(0) && terminalNotGrounded(1) ) { - SPDLOG_LOGGER_INFO(mSLog, "Add {:f} to system at ({:d},{:d})", -conductance, matrixNodeIndex(0), matrixNodeIndex(1)); - SPDLOG_LOGGER_INFO(mSLog, "Add {:f} to system at ({:d},{:d})", -conductance, matrixNodeIndex(1), matrixNodeIndex(0)); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:f} to system at ({:d},{:d})", -conductance, matrixNodeIndex(0), matrixNodeIndex(1)); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:f} to system at ({:d},{:d})", -conductance, matrixNodeIndex(1), matrixNodeIndex(0)); } } diff --git a/dpsim-models/src/EMT/EMT_Ph1_VoltageSource.cpp b/dpsim-models/src/EMT/EMT_Ph1_VoltageSource.cpp index 617e3cf7a6..b6e24bec79 100644 --- a/dpsim-models/src/EMT/EMT_Ph1_VoltageSource.cpp +++ b/dpsim-models/src/EMT/EMT_Ph1_VoltageSource.cpp @@ -49,12 +49,12 @@ void EMT::Ph1::VoltageSource::mnaCompApplySystemMatrixStamp(SparseMatrixRow& sys } if (terminalNotGrounded(0)) { - SPDLOG_LOGGER_INFO(mSLog, "Add {:f} to system at ({:d},{:d})", -1., matrixNodeIndex(0), mVirtualNodes[0]->matrixNodeIndex()); - SPDLOG_LOGGER_INFO(mSLog, "Add {:f} to system at ({:d},{:d})", -1., mVirtualNodes[0]->matrixNodeIndex(), matrixNodeIndex(0)); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:f} to system at ({:d},{:d})", -1., matrixNodeIndex(0), mVirtualNodes[0]->matrixNodeIndex()); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:f} to system at ({:d},{:d})", -1., mVirtualNodes[0]->matrixNodeIndex(), matrixNodeIndex(0)); } if (terminalNotGrounded(1)) { - SPDLOG_LOGGER_INFO(mSLog, "Add {:f} to system at ({:d},{:d})", 1., matrixNodeIndex(1), mVirtualNodes[0]->matrixNodeIndex()); - SPDLOG_LOGGER_INFO(mSLog, "Add {:f} to system at ({:d},{:d})", 1., mVirtualNodes[0]->matrixNodeIndex(), matrixNodeIndex(1)); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:f} to system at ({:d},{:d})", 1., matrixNodeIndex(1), mVirtualNodes[0]->matrixNodeIndex()); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:f} to system at ({:d},{:d})", 1., mVirtualNodes[0]->matrixNodeIndex(), matrixNodeIndex(1)); } } diff --git a/dpsim-models/src/EMT/EMT_Ph3_AvVoltageSourceInverterDQ.cpp b/dpsim-models/src/EMT/EMT_Ph3_AvVoltageSourceInverterDQ.cpp index 4a964d75ba..d643f37794 100644 --- a/dpsim-models/src/EMT/EMT_Ph3_AvVoltageSourceInverterDQ.cpp +++ b/dpsim-models/src/EMT/EMT_Ph3_AvVoltageSourceInverterDQ.cpp @@ -55,9 +55,9 @@ EMT::Ph3::AvVoltageSourceInverterDQ::AvVoltageSourceInverterDQ(String uid, Strin // Pre-step of the subcontrolled voltage source is handled explicitly in mnaParentPreStep addMNASubComponent(mSubCtrledVoltageSource, MNA_SUBCOMP_TASK_ORDER::NO_TASK, MNA_SUBCOMP_TASK_ORDER::TASK_BEFORE_PARENT, true); - SPDLOG_LOGGER_INFO(mSLog, "Electrical subcomponents: "); + SPDLOG_LOGGER_DEBUG(mSLog, "Electrical subcomponents: "); for (auto subcomp: mSubComponents) - SPDLOG_LOGGER_INFO(mSLog, "- {}", subcomp->name()); + SPDLOG_LOGGER_DEBUG(mSLog, "- {}", subcomp->name()); // Create control sub components mPLL = Signal::PLL::make(**mName + "_PLL", mLogLevel); diff --git a/dpsim-models/src/EMT/EMT_Ph3_Capacitor.cpp b/dpsim-models/src/EMT/EMT_Ph3_Capacitor.cpp index aaa19c3af8..14506a6e55 100644 --- a/dpsim-models/src/EMT/EMT_Ph3_Capacitor.cpp +++ b/dpsim-models/src/EMT/EMT_Ph3_Capacitor.cpp @@ -114,7 +114,7 @@ void EMT::Ph3::Capacitor::mnaCompApplySystemMatrixStamp(SparseMatrixRow& systemM Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 2), matrixNodeIndex(0, 2), -mEquivCond(2, 2)); } - SPDLOG_LOGGER_INFO(mSLog, + SPDLOG_LOGGER_DEBUG(mSLog, "\nEquivalent Conductance: {:s}", Logger::matrixToString(mEquivCond)); } @@ -131,7 +131,7 @@ void EMT::Ph3::Capacitor::mnaCompApplyRightSideVectorStamp(Matrix& rightVector) Math::setVectorElement(rightVector, matrixNodeIndex(1, 1), -mEquivCurrent(1, 0)); Math::setVectorElement(rightVector, matrixNodeIndex(1, 2), -mEquivCurrent(2, 0)); } - SPDLOG_LOGGER_DEBUG(mSLog, + SPDLOG_LOGGER_TRACE(mSLog, "\nEquivalent Current: {:s}", Logger::matrixToString(mEquivCurrent)); } @@ -175,7 +175,7 @@ void EMT::Ph3::Capacitor::mnaCompUpdateVoltage(const Matrix& leftVector) { void EMT::Ph3::Capacitor::mnaCompUpdateCurrent(const Matrix& leftVector) { **mIntfCurrent = mEquivCond * **mIntfVoltage + mEquivCurrent; - SPDLOG_LOGGER_DEBUG(mSLog, + SPDLOG_LOGGER_TRACE(mSLog, "\nCurrent: {:s}", Logger::matrixToString(**mIntfCurrent) ); diff --git a/dpsim-models/src/EMT/EMT_Ph3_CurrentSource.cpp b/dpsim-models/src/EMT/EMT_Ph3_CurrentSource.cpp index 0a9381f7be..c4902b2609 100644 --- a/dpsim-models/src/EMT/EMT_Ph3_CurrentSource.cpp +++ b/dpsim-models/src/EMT/EMT_Ph3_CurrentSource.cpp @@ -99,7 +99,7 @@ void EMT::Ph3::CurrentSource::updateCurrent(Real time) { } else { **mIntfCurrent = RMS_TO_PEAK * (**mCurrentRef).real(); } - SPDLOG_LOGGER_DEBUG(mSLog, + SPDLOG_LOGGER_TRACE(mSLog, "\nUpdate current: {:s}", Logger::matrixToString(**mIntfCurrent) ); diff --git a/dpsim-models/src/EMT/EMT_Ph3_Inductor.cpp b/dpsim-models/src/EMT/EMT_Ph3_Inductor.cpp index 19d48f1074..35645812ae 100644 --- a/dpsim-models/src/EMT/EMT_Ph3_Inductor.cpp +++ b/dpsim-models/src/EMT/EMT_Ph3_Inductor.cpp @@ -127,7 +127,7 @@ void EMT::Ph3::Inductor::mnaCompApplySystemMatrixStamp(SparseMatrixRow& systemMa Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 2), matrixNodeIndex(0, 2), -mEquivCond(2, 2)); } - SPDLOG_LOGGER_INFO(mSLog, + SPDLOG_LOGGER_TRACE(mSLog, "\nEquivalent Conductance: {:s}", Logger::matrixToString(mEquivCond)); } @@ -145,7 +145,7 @@ void EMT::Ph3::Inductor::mnaCompApplyRightSideVectorStamp(Matrix& rightVector) { Math::setVectorElement(rightVector, matrixNodeIndex(1, 1), -mEquivCurrent(1, 0)); Math::setVectorElement(rightVector, matrixNodeIndex(1, 2), -mEquivCurrent(2, 0)); } - SPDLOG_LOGGER_DEBUG(mSLog, + SPDLOG_LOGGER_TRACE(mSLog, "\nEquivalent Current (mnaCompApplyRightSideVectorStamp): {:s}", Logger::matrixToString(mEquivCurrent)); mSLog->flush(); @@ -186,7 +186,7 @@ void EMT::Ph3::Inductor::mnaCompUpdateVoltage(const Matrix& leftVector) { (**mIntfVoltage)(1, 0) = (**mIntfVoltage)(1, 0) - Math::realFromVectorElement(leftVector, matrixNodeIndex(0, 1)); (**mIntfVoltage)(2, 0) = (**mIntfVoltage)(2, 0) - Math::realFromVectorElement(leftVector, matrixNodeIndex(0, 2)); } - SPDLOG_LOGGER_DEBUG(mSLog, + SPDLOG_LOGGER_TRACE(mSLog, "\nUpdate Voltage: {:s}", Logger::matrixToString(**mIntfVoltage) ); @@ -194,7 +194,7 @@ void EMT::Ph3::Inductor::mnaCompUpdateVoltage(const Matrix& leftVector) { void EMT::Ph3::Inductor::mnaCompUpdateCurrent(const Matrix& leftVector) { **mIntfCurrent = mEquivCond * **mIntfVoltage + mEquivCurrent; - SPDLOG_LOGGER_DEBUG(mSLog, + SPDLOG_LOGGER_TRACE(mSLog, "\nUpdate Current: {:s}", Logger::matrixToString(**mIntfCurrent) ); diff --git a/dpsim-models/src/EMT/EMT_Ph3_NetworkInjection.cpp b/dpsim-models/src/EMT/EMT_Ph3_NetworkInjection.cpp index c7770b0e07..ced9496780 100644 --- a/dpsim-models/src/EMT/EMT_Ph3_NetworkInjection.cpp +++ b/dpsim-models/src/EMT/EMT_Ph3_NetworkInjection.cpp @@ -25,9 +25,9 @@ EMT::Ph3::NetworkInjection::NetworkInjection(String uid, String name, Logger::Le // Create electrical sub components mSubVoltageSource = std::make_shared(**mName + "_vs", mLogLevel); addMNASubComponent(mSubVoltageSource, MNA_SUBCOMP_TASK_ORDER::TASK_BEFORE_PARENT, MNA_SUBCOMP_TASK_ORDER::TASK_BEFORE_PARENT, true); - SPDLOG_LOGGER_INFO(mSLog, "Electrical subcomponents: "); + SPDLOG_LOGGER_DEBUG(mSLog, "Electrical subcomponents: "); for (auto subcomp: mSubComponents) - SPDLOG_LOGGER_INFO(mSLog, "- {}", subcomp->name()); + SPDLOG_LOGGER_DEBUG(mSLog, "- {}", subcomp->name()); mSubVoltageSource->mVoltageRef->setReference(mVoltageRef); mSubVoltageSource->mSrcFreq->setReference(mSrcFreq); @@ -91,7 +91,7 @@ void EMT::Ph3::NetworkInjection::initializeFromNodesAndTerminals(Real frequency) // #### MNA functions #### void EMT::Ph3::NetworkInjection::mnaParentApplyRightSideVectorStamp(Matrix& rightVector) { - SPDLOG_LOGGER_DEBUG(mSLog, "Right Side Vector: {:s}", + SPDLOG_LOGGER_TRACE(mSLog, "Right Side Vector: {:s}", Logger::matrixToString(rightVector)); } diff --git a/dpsim-models/src/EMT/EMT_Ph3_ReducedOrderSynchronGeneratorVBR.cpp b/dpsim-models/src/EMT/EMT_Ph3_ReducedOrderSynchronGeneratorVBR.cpp index 5b392189c9..1d0d46ef31 100644 --- a/dpsim-models/src/EMT/EMT_Ph3_ReducedOrderSynchronGeneratorVBR.cpp +++ b/dpsim-models/src/EMT/EMT_Ph3_ReducedOrderSynchronGeneratorVBR.cpp @@ -104,9 +104,9 @@ void EMT::Ph3::ReducedOrderSynchronGeneratorVBR::mnaCompInitialize(Real omega, mVariableSystemMatrixEntries.push_back(std::make_pair(matrixNodeIndex(0, 2), mVirtualNodes[0]->matrixNodeIndex(PhaseType::C))); } - SPDLOG_LOGGER_INFO(mSLog, "List of index pairs of varying matrix entries: "); + SPDLOG_LOGGER_DEBUG(mSLog, "List of index pairs of varying matrix entries: "); for (auto indexPair : mVariableSystemMatrixEntries) - SPDLOG_LOGGER_INFO(mSLog, "({}, {})", indexPair.first, indexPair.second); + SPDLOG_LOGGER_DEBUG(mSLog, "({}, {})", indexPair.first, indexPair.second); } void EMT::Ph3::ReducedOrderSynchronGeneratorVBR::mnaCompApplySystemMatrixStamp(SparseMatrixRow& systemMatrix) { diff --git a/dpsim-models/src/EMT/EMT_Ph3_Resistor.cpp b/dpsim-models/src/EMT/EMT_Ph3_Resistor.cpp index aaebef7979..8756885a6b 100644 --- a/dpsim-models/src/EMT/EMT_Ph3_Resistor.cpp +++ b/dpsim-models/src/EMT/EMT_Ph3_Resistor.cpp @@ -146,7 +146,7 @@ void EMT::Ph3::Resistor::mnaCompUpdateVoltage(const Matrix& leftVector) { (**mIntfVoltage)(1, 0) = (**mIntfVoltage)(1, 0) - Math::realFromVectorElement(leftVector, matrixNodeIndex(0, 1)); (**mIntfVoltage)(2, 0) = (**mIntfVoltage)(2, 0) - Math::realFromVectorElement(leftVector, matrixNodeIndex(0, 2)); } - SPDLOG_LOGGER_DEBUG(mSLog, + SPDLOG_LOGGER_TRACE(mSLog, "\nVoltage: {:s}", Logger::matrixToString(**mIntfVoltage) ); @@ -157,6 +157,6 @@ void EMT::Ph3::Resistor::mnaCompUpdateCurrent(const Matrix& leftVector) { Matrix resistanceInv = Matrix::Zero(3, 3); Math::invertMatrix(**mResistance, resistanceInv); **mIntfCurrent = resistanceInv * **mIntfVoltage; - SPDLOG_LOGGER_DEBUG(mSLog, "\nCurrent: {:s}", Logger::matrixToString(**mIntfCurrent)); + SPDLOG_LOGGER_TRACE(mSLog, "\nCurrent: {:s}", Logger::matrixToString(**mIntfCurrent)); mSLog->flush(); } diff --git a/dpsim-models/src/EMT/EMT_Ph3_SeriesResistor.cpp b/dpsim-models/src/EMT/EMT_Ph3_SeriesResistor.cpp index f9e0cbbcab..c1a850ecaa 100644 --- a/dpsim-models/src/EMT/EMT_Ph3_SeriesResistor.cpp +++ b/dpsim-models/src/EMT/EMT_Ph3_SeriesResistor.cpp @@ -69,12 +69,12 @@ void EMT::Ph3::SeriesResistor::mnaCompApplySystemMatrixStamp(SparseMatrixRow& sy } if (terminalNotGrounded(0)) - SPDLOG_LOGGER_INFO(mSLog, "Add {} to {}, {}", conductance, matrixNodeIndex(0,0), matrixNodeIndex(0,0)); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {} to {}, {}", conductance, matrixNodeIndex(0,0), matrixNodeIndex(0,0)); if (terminalNotGrounded(1)) - SPDLOG_LOGGER_INFO(mSLog, "Add {} to {}, {}", conductance, matrixNodeIndex(1,0), matrixNodeIndex(1,0)); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {} to {}, {}", conductance, matrixNodeIndex(1,0), matrixNodeIndex(1,0)); if (terminalNotGrounded(0) && terminalNotGrounded(1)) { - SPDLOG_LOGGER_INFO(mSLog, "Add {} to {}, {}", -conductance, matrixNodeIndex(0,0), matrixNodeIndex(1,0)); - SPDLOG_LOGGER_INFO(mSLog, "Add {} to {}, {}", -conductance, matrixNodeIndex(1,0), matrixNodeIndex(0,0)); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {} to {}, {}", -conductance, matrixNodeIndex(0,0), matrixNodeIndex(1,0)); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {} to {}, {}", -conductance, matrixNodeIndex(1,0), matrixNodeIndex(0,0)); } } @@ -104,11 +104,11 @@ void EMT::Ph3::SeriesResistor::mnaCompUpdateVoltage(const Matrix& leftVector) { (**mIntfVoltage)(2,0) = (**mIntfVoltage)(2,0) - Math::realFromVectorElement(leftVector, matrixNodeIndex(0,2)); } - SPDLOG_LOGGER_DEBUG(mSLog, "Voltage A: {}", (**mIntfVoltage)(0,0)); + SPDLOG_LOGGER_TRACE(mSLog, "Voltage A: {}", (**mIntfVoltage)(0,0)); } void EMT::Ph3::SeriesResistor::mnaCompUpdateCurrent(const Matrix& leftVector) { **mIntfCurrent = **mIntfVoltage / **mResistance; - SPDLOG_LOGGER_DEBUG(mSLog, "Current A: {} < {}", (**mIntfCurrent)(0,0)); + SPDLOG_LOGGER_TRACE(mSLog, "Current A: {} < {}", (**mIntfCurrent)(0,0)); } diff --git a/dpsim-models/src/EMT/EMT_Ph3_SeriesSwitch.cpp b/dpsim-models/src/EMT/EMT_Ph3_SeriesSwitch.cpp index 16de6c4090..1a8380fd5f 100644 --- a/dpsim-models/src/EMT/EMT_Ph3_SeriesSwitch.cpp +++ b/dpsim-models/src/EMT/EMT_Ph3_SeriesSwitch.cpp @@ -73,12 +73,12 @@ void EMT::Ph3::SeriesSwitch::mnaCompApplySystemMatrixStamp(SparseMatrixRow& syst } if (terminalNotGrounded(0)) - SPDLOG_LOGGER_INFO(mSLog, "Add {} to {}, {}", conductance, matrixNodeIndices(0)[0], matrixNodeIndices(0)[0]); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {} to {}, {}", conductance, matrixNodeIndices(0)[0], matrixNodeIndices(0)[0]); if (terminalNotGrounded(1)) - SPDLOG_LOGGER_INFO(mSLog, "Add {} to {}, {}", conductance, matrixNodeIndices(1)[0], matrixNodeIndices(1)[0]); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {} to {}, {}", conductance, matrixNodeIndices(1)[0], matrixNodeIndices(1)[0]); if (terminalNotGrounded(0) && terminalNotGrounded(1)) { - SPDLOG_LOGGER_INFO(mSLog, "Add {} to {}, {}", -conductance, matrixNodeIndices(0)[0], matrixNodeIndices(1)[0]); - SPDLOG_LOGGER_INFO(mSLog, "Add {} to {}, {}", -conductance, matrixNodeIndices(1)[0], matrixNodeIndices(0)[0]); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {} to {}, {}", -conductance, matrixNodeIndices(0)[0], matrixNodeIndices(1)[0]); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {} to {}, {}", -conductance, matrixNodeIndices(1)[0], matrixNodeIndices(0)[0]); } } @@ -99,12 +99,12 @@ void EMT::Ph3::SeriesSwitch::mnaCompApplySwitchSystemMatrixStamp(Bool closed, Sp } if (terminalNotGrounded(0)) - SPDLOG_LOGGER_INFO(mSLog, "Add {} to {}, {}", conductance, matrixNodeIndices(0)[0], matrixNodeIndices(0)[0]); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {} to {}, {}", conductance, matrixNodeIndices(0)[0], matrixNodeIndices(0)[0]); if (terminalNotGrounded(1)) - SPDLOG_LOGGER_INFO(mSLog, "Add {} to {}, {}", conductance, matrixNodeIndices(1)[0], matrixNodeIndices(1)[0]); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {} to {}, {}", conductance, matrixNodeIndices(1)[0], matrixNodeIndices(1)[0]); if (terminalNotGrounded(0) && terminalNotGrounded(1)) { - SPDLOG_LOGGER_INFO(mSLog, "Add {} to {}, {}", -conductance, matrixNodeIndices(0)[0], matrixNodeIndices(1)[0]); - SPDLOG_LOGGER_INFO(mSLog, "Add {} to {}, {}", -conductance, matrixNodeIndices(1)[0], matrixNodeIndices(0)[0]); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {} to {}, {}", -conductance, matrixNodeIndices(0)[0], matrixNodeIndices(1)[0]); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {} to {}, {}", -conductance, matrixNodeIndices(1)[0], matrixNodeIndices(0)[0]); } } @@ -133,12 +133,12 @@ void EMT::Ph3::SeriesSwitch::mnaCompUpdateVoltage(const Matrix& leftVector) { (**mIntfVoltage)(2,0) = (**mIntfVoltage)(2,0) - Math::realFromVectorElement(leftVector, matrixNodeIndex(0,2)); } - SPDLOG_LOGGER_DEBUG(mSLog, "Voltage A: {}", (**mIntfVoltage)(0,0)); + SPDLOG_LOGGER_TRACE(mSLog, "Voltage A: {}", (**mIntfVoltage)(0,0)); } void EMT::Ph3::SeriesSwitch::mnaCompUpdateCurrent(const Matrix& leftVector) { Real impedance = (**mIsClosed)? **mClosedResistance : **mOpenResistance; **mIntfCurrent = **mIntfVoltage / impedance; - SPDLOG_LOGGER_DEBUG(mSLog, "Current A: {}", (**mIntfCurrent)(0,0)); + SPDLOG_LOGGER_TRACE(mSLog, "Current A: {}", (**mIntfCurrent)(0,0)); } diff --git a/dpsim-models/src/EMT/EMT_Ph3_SynchronGeneratorDQ.cpp b/dpsim-models/src/EMT/EMT_Ph3_SynchronGeneratorDQ.cpp index 43e93bb09a..1e4b3be970 100644 --- a/dpsim-models/src/EMT/EMT_Ph3_SynchronGeneratorDQ.cpp +++ b/dpsim-models/src/EMT/EMT_Ph3_SynchronGeneratorDQ.cpp @@ -197,9 +197,9 @@ void EMT::Ph3::SynchronGeneratorDQ::mnaCompApplySystemMatrixStamp(SparseMatrixRo Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0,0), matrixNodeIndex(0,0), conductance); Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0,1), matrixNodeIndex(0,1), conductance); Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0,2), matrixNodeIndex(0,2), conductance); - SPDLOG_LOGGER_INFO(mSLog, "Add {} to {}, {}", conductance, matrixNodeIndex(0,0), matrixNodeIndex(0,0)); - SPDLOG_LOGGER_INFO(mSLog, "Add {} to {}, {}", conductance, matrixNodeIndex(0,1), matrixNodeIndex(0,1)); - SPDLOG_LOGGER_INFO(mSLog, "Add {} to {}, {}", conductance, matrixNodeIndex(0,2), matrixNodeIndex(0,2)); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {} to {}, {}", conductance, matrixNodeIndex(0,0), matrixNodeIndex(0,0)); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {} to {}, {}", conductance, matrixNodeIndex(0,1), matrixNodeIndex(0,1)); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {} to {}, {}", conductance, matrixNodeIndex(0,2), matrixNodeIndex(0,2)); } } diff --git a/dpsim-models/src/EMT/EMT_Ph3_SynchronGeneratorDQODE.cpp b/dpsim-models/src/EMT/EMT_Ph3_SynchronGeneratorDQODE.cpp index 19e7b0b276..0dfffff053 100644 --- a/dpsim-models/src/EMT/EMT_Ph3_SynchronGeneratorDQODE.cpp +++ b/dpsim-models/src/EMT/EMT_Ph3_SynchronGeneratorDQODE.cpp @@ -75,7 +75,7 @@ void EMT::Ph3::SynchronGeneratorDQODE::odePostStep() { mIdq0(2, 0) = mIsr(6, 0); **mIntfCurrent = mBase_I * dq0ToAbcTransform(mThetaMech, mIdq0); - SPDLOG_LOGGER_DEBUG(mSLog, "\nCurrent: \n{:s}", + SPDLOG_LOGGER_TRACE(mSLog, "\nCurrent: \n{:s}", Logger::matrixCompToString(**mIntfCurrent)); } diff --git a/dpsim-models/src/EMT/EMT_Ph3_SynchronGeneratorTrStab.cpp b/dpsim-models/src/EMT/EMT_Ph3_SynchronGeneratorTrStab.cpp index d32cd5435c..f708ff54f2 100644 --- a/dpsim-models/src/EMT/EMT_Ph3_SynchronGeneratorTrStab.cpp +++ b/dpsim-models/src/EMT/EMT_Ph3_SynchronGeneratorTrStab.cpp @@ -275,14 +275,14 @@ void EMT::Ph3::SynchronGeneratorTrStab::mnaParentPostStep(Real time, Int timeSte } void EMT::Ph3::SynchronGeneratorTrStab::mnaCompUpdateVoltage(const Matrix& leftVector) { - SPDLOG_LOGGER_DEBUG(mSLog, "Read voltage from {:d}", matrixNodeIndex(0)); + SPDLOG_LOGGER_TRACE(mSLog, "Read voltage from {:d}", matrixNodeIndex(0)); (**mIntfVoltage)(0, 0) = Math::realFromVectorElement(leftVector, matrixNodeIndex(0, 0)); (**mIntfVoltage)(1, 0) = Math::realFromVectorElement(leftVector, matrixNodeIndex(0, 1)); (**mIntfVoltage)(2, 0) = Math::realFromVectorElement(leftVector, matrixNodeIndex(0, 2)); } void EMT::Ph3::SynchronGeneratorTrStab::mnaCompUpdateCurrent(const Matrix& leftVector) { - SPDLOG_LOGGER_DEBUG(mSLog, "Read current from {:d}", matrixNodeIndex(0)); + SPDLOG_LOGGER_TRACE(mSLog, "Read current from {:d}", matrixNodeIndex(0)); **mIntfCurrent = **mSubInductor->mIntfCurrent; } diff --git a/dpsim-models/src/EMT/EMT_Ph3_SynchronGeneratorVBR.cpp b/dpsim-models/src/EMT/EMT_Ph3_SynchronGeneratorVBR.cpp index bcd1b11466..a6c9428c5d 100644 --- a/dpsim-models/src/EMT/EMT_Ph3_SynchronGeneratorVBR.cpp +++ b/dpsim-models/src/EMT/EMT_Ph3_SynchronGeneratorVBR.cpp @@ -132,9 +132,9 @@ void EMT::Ph3::SynchronGeneratorVBR::mnaCompInitialize(Real omega, Real timeStep for (UInt phase2Idx = 0; phase2Idx < 3; ++phase2Idx) mVariableSystemMatrixEntries.push_back(std::make_pair(matrixNodeIndex(0, phase1Idx),matrixNodeIndex(0, phase2Idx))); - SPDLOG_LOGGER_INFO(mSLog, "List of index pairs of varying matrix entries: "); + SPDLOG_LOGGER_DEBUG(mSLog, "List of index pairs of varying matrix entries: "); for (auto indexPair : mVariableSystemMatrixEntries) - SPDLOG_LOGGER_INFO(mSLog, "({}, {})", indexPair.first, indexPair.second); + SPDLOG_LOGGER_DEBUG(mSLog, "({}, {})", indexPair.first, indexPair.second); mSystemOmega = omega; diff --git a/dpsim-models/src/EMT/EMT_Ph3_Transformer.cpp b/dpsim-models/src/EMT/EMT_Ph3_Transformer.cpp index 6aa249bd01..8d1733442f 100644 --- a/dpsim-models/src/EMT/EMT_Ph3_Transformer.cpp +++ b/dpsim-models/src/EMT/EMT_Ph3_Transformer.cpp @@ -74,9 +74,9 @@ void EMT::Ph3::Transformer::initializeFromNodesAndTerminals(Real frequency) { Complex(mResistance(1, 0), omega * mInductance(1, 0)), Complex(mResistance(1, 1), omega * mInductance(1, 1)), Complex(mResistance(1, 2), omega * mInductance(1, 2)), Complex(mResistance(2, 0), omega * mInductance(2, 0)), Complex(mResistance(2, 1), omega * mInductance(2, 1)), Complex(mResistance(2, 2), omega * mInductance(2, 2)); - SPDLOG_LOGGER_INFO(mSLog, "Resistance (referred to higher voltage side) = {} [Ohm]", Logger::matrixToString(mResistance)); - SPDLOG_LOGGER_INFO(mSLog, "Inductance (referred to higher voltage side) = {} [H]", Logger::matrixToString(mInductance)); - SPDLOG_LOGGER_INFO(mSLog, "Reactance (referred to higher voltage side) = {} [Ohm]", Logger::matrixToString(omega * mInductance)); + SPDLOG_LOGGER_DEBUG(mSLog, "Resistance (referred to higher voltage side) = {} [Ohm]", Logger::matrixToString(mResistance)); + SPDLOG_LOGGER_DEBUG(mSLog, "Inductance (referred to higher voltage side) = {} [H]", Logger::matrixToString(mInductance)); + SPDLOG_LOGGER_DEBUG(mSLog, "Reactance (referred to higher voltage side) = {} [Ohm]", Logger::matrixToString(omega * mInductance)); MatrixComp vInitABC = MatrixComp::Zero(3, 1); vInitABC(0, 0) = mVirtualNodes[0]->initialSingleVoltage() - RMS3PH_TO_PEAK1PH * initialSingleVoltage(0); @@ -114,7 +114,7 @@ void EMT::Ph3::Transformer::initializeFromNodesAndTerminals(Real frequency) { mSubSnubResistor1 = std::make_shared(**mName + "_snub_res1", mLogLevel); mSubSnubResistor1->setParameters(mSnubberResistance1); mSubSnubResistor1->connect({ node(0), EMT::SimNode::GND }); - SPDLOG_LOGGER_INFO(mSLog, "Snubber Resistance 1 (connected to higher voltage side {}) = {} [Ohm]", node(0)->name(), Logger::matrixToString(mSnubberResistance1)); + SPDLOG_LOGGER_DEBUG(mSLog, "Snubber Resistance 1 (connected to higher voltage side {}) = {} [Ohm]", node(0)->name(), Logger::matrixToString(mSnubberResistance1)); addMNASubComponent(mSubSnubResistor1, MNA_SUBCOMP_TASK_ORDER::TASK_BEFORE_PARENT, MNA_SUBCOMP_TASK_ORDER::TASK_BEFORE_PARENT, true); // A snubber conductance is added on the lower voltage side @@ -123,7 +123,7 @@ void EMT::Ph3::Transformer::initializeFromNodesAndTerminals(Real frequency) { mSubSnubResistor2 = std::make_shared(**mName + "_snub_res2", mLogLevel); mSubSnubResistor2->setParameters(mSnubberResistance2); mSubSnubResistor2->connect({ node(1), EMT::SimNode::GND }); - SPDLOG_LOGGER_INFO(mSLog, "Snubber Resistance 2 (connected to lower voltage side {}) = {} [Ohm]", node(1)->name(), Logger::matrixToString(mSnubberResistance2)); + SPDLOG_LOGGER_DEBUG(mSLog, "Snubber Resistance 2 (connected to lower voltage side {}) = {} [Ohm]", node(1)->name(), Logger::matrixToString(mSnubberResistance2)); addMNASubComponent(mSubSnubResistor2, MNA_SUBCOMP_TASK_ORDER::TASK_BEFORE_PARENT, MNA_SUBCOMP_TASK_ORDER::TASK_BEFORE_PARENT, true); // // A snubber capacitance is added to higher voltage side (not used as capacitor at high voltage side made it worse) @@ -141,13 +141,13 @@ void EMT::Ph3::Transformer::initializeFromNodesAndTerminals(Real frequency) { mSubSnubCapacitor2 = std::make_shared(**mName + "_snub_cap2", mLogLevel); mSubSnubCapacitor2->setParameters(mSnubberCapacitance2); mSubSnubCapacitor2->connect({ node(1), EMT::SimNode::GND }); - SPDLOG_LOGGER_INFO(mSLog, "Snubber Capacitance 2 (connected to lower voltage side {}) = {} [F]", node(1)->name(), Logger::matrixToString(mSnubberCapacitance2)); + SPDLOG_LOGGER_DEBUG(mSLog, "Snubber Capacitance 2 (connected to lower voltage side {}) = {} [F]", node(1)->name(), Logger::matrixToString(mSnubberCapacitance2)); addMNASubComponent(mSubSnubCapacitor2, MNA_SUBCOMP_TASK_ORDER::TASK_BEFORE_PARENT, MNA_SUBCOMP_TASK_ORDER::TASK_BEFORE_PARENT, true); // Initialize electrical subcomponents - SPDLOG_LOGGER_INFO(mSLog, "Electrical subcomponents: "); + SPDLOG_LOGGER_DEBUG(mSLog, "Electrical subcomponents: "); for (auto subcomp: mSubComponents) { - SPDLOG_LOGGER_INFO(mSLog, "- {}", subcomp->name()); + SPDLOG_LOGGER_DEBUG(mSLog, "- {}", subcomp->name()); subcomp->initialize(mFrequencies); subcomp->initializeFromNodesAndTerminals(frequency); } @@ -202,33 +202,33 @@ void EMT::Ph3::Transformer::mnaCompApplySystemMatrixStamp(SparseMatrixRow& syste mnasubcomp->mnaApplySystemMatrixStamp(systemMatrix); if (terminalNotGrounded(0)) { - SPDLOG_LOGGER_INFO(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(Complex(-1.0, 0)), + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(Complex(-1.0, 0)), mVirtualNodes[0]->matrixNodeIndex(PhaseType::A), mVirtualNodes[1]->matrixNodeIndex(PhaseType::A)); - SPDLOG_LOGGER_INFO(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(Complex(-1.0, 0)), + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(Complex(-1.0, 0)), mVirtualNodes[0]->matrixNodeIndex(PhaseType::B), mVirtualNodes[1]->matrixNodeIndex(PhaseType::B)); - SPDLOG_LOGGER_INFO(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(Complex(-1.0, 0)), + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(Complex(-1.0, 0)), mVirtualNodes[0]->matrixNodeIndex(PhaseType::C), mVirtualNodes[1]->matrixNodeIndex(PhaseType::C)); - SPDLOG_LOGGER_INFO(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(Complex(1.0, 0)), + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(Complex(1.0, 0)), mVirtualNodes[1]->matrixNodeIndex(PhaseType::A), mVirtualNodes[0]->matrixNodeIndex(PhaseType::A)); - SPDLOG_LOGGER_INFO(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(Complex(1.0, 0)), + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(Complex(1.0, 0)), mVirtualNodes[1]->matrixNodeIndex(PhaseType::B), mVirtualNodes[0]->matrixNodeIndex(PhaseType::B)); - SPDLOG_LOGGER_INFO(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(Complex(1.0, 0)), + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(Complex(1.0, 0)), mVirtualNodes[1]->matrixNodeIndex(PhaseType::C), mVirtualNodes[0]->matrixNodeIndex(PhaseType::C)); } if (terminalNotGrounded(1)) { - SPDLOG_LOGGER_INFO(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(**mRatio), + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(**mRatio), matrixNodeIndex(1, 0), mVirtualNodes[1]->matrixNodeIndex(PhaseType::A)); - SPDLOG_LOGGER_INFO(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(**mRatio), + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(**mRatio), matrixNodeIndex(1, 1), mVirtualNodes[1]->matrixNodeIndex(PhaseType::B)); - SPDLOG_LOGGER_INFO(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(**mRatio), + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(**mRatio), matrixNodeIndex(1, 2), mVirtualNodes[1]->matrixNodeIndex(PhaseType::C)); - SPDLOG_LOGGER_INFO(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(- **mRatio), + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(- **mRatio), mVirtualNodes[1]->matrixNodeIndex(PhaseType::A), matrixNodeIndex(1, 0)); - SPDLOG_LOGGER_INFO(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(- **mRatio), + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(- **mRatio), mVirtualNodes[1]->matrixNodeIndex(PhaseType::B), matrixNodeIndex(1, 1)); - SPDLOG_LOGGER_INFO(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(- **mRatio), + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(- **mRatio), mVirtualNodes[1]->matrixNodeIndex(PhaseType::C), matrixNodeIndex(1, 2)); } } diff --git a/dpsim-models/src/EMT/EMT_Ph3_VoltageSource.cpp b/dpsim-models/src/EMT/EMT_Ph3_VoltageSource.cpp index a860e418aa..34b2a02073 100644 --- a/dpsim-models/src/EMT/EMT_Ph3_VoltageSource.cpp +++ b/dpsim-models/src/EMT/EMT_Ph3_VoltageSource.cpp @@ -150,7 +150,7 @@ void EMT::Ph3::VoltageSource::updateVoltage(Real time) { } else { **mIntfVoltage = RMS3PH_TO_PEAK1PH * (**mVoltageRef).real(); } - SPDLOG_LOGGER_DEBUG(mSLog, + SPDLOG_LOGGER_TRACE(mSLog, "\nUpdate Voltage: {:s}", Logger::matrixToString(**mIntfVoltage) ); diff --git a/dpsim-models/src/SP/SP_Ph1_AvVoltageSourceInverterDQ.cpp b/dpsim-models/src/SP/SP_Ph1_AvVoltageSourceInverterDQ.cpp index 7515d1d037..931278ff78 100644 --- a/dpsim-models/src/SP/SP_Ph1_AvVoltageSourceInverterDQ.cpp +++ b/dpsim-models/src/SP/SP_Ph1_AvVoltageSourceInverterDQ.cpp @@ -54,9 +54,9 @@ SP::Ph1::AvVoltageSourceInverterDQ::AvVoltageSourceInverterDQ(String uid, String // Pre-step of the subcontrolled voltage source is handled explicitly in mnaParentPreStep addMNASubComponent(mSubCtrledVoltageSource, MNA_SUBCOMP_TASK_ORDER::NO_TASK, MNA_SUBCOMP_TASK_ORDER::TASK_BEFORE_PARENT, true); - SPDLOG_LOGGER_INFO(mSLog, "Electrical subcomponents: "); + SPDLOG_LOGGER_DEBUG(mSLog, "Electrical subcomponents: "); for (auto subcomp: mSubComponents) - SPDLOG_LOGGER_INFO(mSLog, "- {}", subcomp->name()); + SPDLOG_LOGGER_DEBUG(mSLog, "- {}", subcomp->name()); // Create control sub components mPLL = Signal::PLL::make(**mName + "_PLL", mLogLevel); diff --git a/dpsim-models/src/SP/SP_Ph1_Capacitor.cpp b/dpsim-models/src/SP/SP_Ph1_Capacitor.cpp index 877a7fc2fe..21ca8362db 100644 --- a/dpsim-models/src/SP/SP_Ph1_Capacitor.cpp +++ b/dpsim-models/src/SP/SP_Ph1_Capacitor.cpp @@ -77,17 +77,17 @@ void SP::Ph1::Capacitor::mnaCompApplySystemMatrixStamp(SparseMatrixRow& systemMa Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1), matrixNodeIndex(0), -mSusceptance); } - SPDLOG_LOGGER_INFO(mSLog, "-- Matrix Stamp ---"); + SPDLOG_LOGGER_DEBUG(mSLog, "-- Matrix Stamp ---"); if (terminalNotGrounded(0)) - SPDLOG_LOGGER_INFO(mSLog, "Add {:e}+j{:e} to system at ({:d},{:d})", + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:e}+j{:e} to system at ({:d},{:d})", mSusceptance.real(), mSusceptance.imag(), matrixNodeIndex(0), matrixNodeIndex(0)); if (terminalNotGrounded(1)) - SPDLOG_LOGGER_INFO(mSLog, "Add {:e}+j{:e} to system at ({:d},{:d})", + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:e}+j{:e} to system at ({:d},{:d})", mSusceptance.real(), mSusceptance.imag(), matrixNodeIndex(1), matrixNodeIndex(1)); if (terminalNotGrounded(0) && terminalNotGrounded(1)) { - SPDLOG_LOGGER_INFO(mSLog, "Add {:e}+j{:e} to system at ({:d},{:d})", + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:e}+j{:e} to system at ({:d},{:d})", -mSusceptance.real(), -mSusceptance.imag(), matrixNodeIndex(0), matrixNodeIndex(1)); - SPDLOG_LOGGER_INFO(mSLog, "Add {:e}+j{:e} to system at ({:d},{:d})", + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:e}+j{:e} to system at ({:d},{:d})", -mSusceptance.real(), -mSusceptance.imag(), matrixNodeIndex(1), matrixNodeIndex(0)); } } @@ -125,18 +125,18 @@ void SP::Ph1::Capacitor::setBaseVoltage(Real baseVoltage){ } void SP::Ph1::Capacitor::calculatePerUnitParameters(Real baseApparentPower){ - SPDLOG_LOGGER_INFO(mSLog, "#### Calculate Per Unit Parameters for {}", **mName); + SPDLOG_LOGGER_DEBUG(mSLog, "#### Calculate Per Unit Parameters for {}", **mName); mBaseApparentPower = baseApparentPower; - SPDLOG_LOGGER_INFO(mSLog, "Base Power={} [VA]", baseApparentPower); + SPDLOG_LOGGER_DEBUG(mSLog, "Base Power={} [VA]", baseApparentPower); mBaseImpedance = mBaseVoltage * mBaseVoltage / mBaseApparentPower; mBaseAdmittance = 1.0 / mBaseImpedance; mBaseCurrent = baseApparentPower / (mBaseVoltage*sqrt(3)); // I_base=(S_threephase/3)/(V_line_to_line/sqrt(3)) - SPDLOG_LOGGER_INFO(mSLog, "Base Voltage={} [V] Base Impedance={} [Ohm]", mBaseVoltage, mBaseImpedance); + SPDLOG_LOGGER_DEBUG(mSLog, "Base Voltage={} [V] Base Impedance={} [Ohm]", mBaseVoltage, mBaseImpedance); mImpedancePerUnit = mImpedance / mBaseImpedance; mAdmittancePerUnit = 1. / mImpedancePerUnit; - SPDLOG_LOGGER_INFO(mSLog, "Impedance={} [pu] Admittance={} [pu]", Logger::complexToString(mImpedancePerUnit), Logger::complexToString(mAdmittancePerUnit)); + SPDLOG_LOGGER_DEBUG(mSLog, "Impedance={} [pu] Admittance={} [pu]", Logger::complexToString(mImpedancePerUnit), Logger::complexToString(mAdmittancePerUnit)); } void SP::Ph1::Capacitor::pfApplyAdmittanceMatrixStamp(SparseMatrixCompRow & Y) { @@ -151,5 +151,5 @@ void SP::Ph1::Capacitor::pfApplyAdmittanceMatrixStamp(SparseMatrixCompRow & Y) { //set the circuit matrix values Y.coeffRef(bus1, bus1) += mAdmittancePerUnit; - SPDLOG_LOGGER_INFO(mSLog, "#### Y matrix stamping: {}", mAdmittancePerUnit); + SPDLOG_LOGGER_DEBUG(mSLog, "#### Y matrix stamping: {}", mAdmittancePerUnit); } diff --git a/dpsim-models/src/SP/SP_Ph1_Inductor.cpp b/dpsim-models/src/SP/SP_Ph1_Inductor.cpp index 3a092bf14b..349b6b683e 100644 --- a/dpsim-models/src/SP/SP_Ph1_Inductor.cpp +++ b/dpsim-models/src/SP/SP_Ph1_Inductor.cpp @@ -74,17 +74,17 @@ void SP::Ph1::Inductor::mnaCompApplySystemMatrixStamp(SparseMatrixRow& systemMat } - SPDLOG_LOGGER_INFO(mSLog, "-- Matrix Stamp ---"); + SPDLOG_LOGGER_DEBUG(mSLog, "-- Matrix Stamp ---"); if (terminalNotGrounded(0)) - SPDLOG_LOGGER_INFO(mSLog, "Add {:e}+j{:e} to system at ({:d},{:d})", + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:e}+j{:e} to system at ({:d},{:d})", mSusceptance.real(), mSusceptance.imag(), matrixNodeIndex(0), matrixNodeIndex(0)); if (terminalNotGrounded(1)) - SPDLOG_LOGGER_INFO(mSLog, "Add {:e}+j{:e} to system at ({:d},{:d})", + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:e}+j{:e} to system at ({:d},{:d})", mSusceptance.real(), mSusceptance.imag(), matrixNodeIndex(1), matrixNodeIndex(1)); if (terminalNotGrounded(0) && terminalNotGrounded(1)) { - SPDLOG_LOGGER_INFO(mSLog, "Add {:e}+j{:e} to system at ({:d},{:d})", + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:e}+j{:e} to system at ({:d},{:d})", -mSusceptance.real(), -mSusceptance.imag(), matrixNodeIndex(0), matrixNodeIndex(1)); - SPDLOG_LOGGER_INFO(mSLog, "Add {:e}+j{:e} to system at ({:d},{:d})", + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:e}+j{:e} to system at ({:d},{:d})", -mSusceptance.real(), -mSusceptance.imag(), matrixNodeIndex(1), matrixNodeIndex(0)); } } diff --git a/dpsim-models/src/SP/SP_Ph1_Load.cpp b/dpsim-models/src/SP/SP_Ph1_Load.cpp index 9a147e0ec0..c9fabf564c 100644 --- a/dpsim-models/src/SP/SP_Ph1_Load.cpp +++ b/dpsim-models/src/SP/SP_Ph1_Load.cpp @@ -49,14 +49,14 @@ SimPowerComp::Ptr SP::Ph1::Load::clone(String name) { // #### Powerflow section #### void SP::Ph1::Load::calculatePerUnitParameters(Real baseApparentPower, Real baseOmega) { - SPDLOG_LOGGER_INFO(mSLog, "#### Calculate Per Unit Parameters for {}", **mName); + SPDLOG_LOGGER_DEBUG(mSLog, "#### Calculate Per Unit Parameters for {}", **mName); mBaseApparentPower = baseApparentPower; mBaseOmega = baseOmega; - SPDLOG_LOGGER_INFO(mSLog, "Base Power={} [VA] Base Omega={} [1/s]", mBaseApparentPower, mBaseOmega); + SPDLOG_LOGGER_DEBUG(mSLog, "Base Power={} [VA] Base Omega={} [1/s]", mBaseApparentPower, mBaseOmega); **mActivePowerPerUnit = **mActivePower / mBaseApparentPower; **mReactivePowerPerUnit = **mReactivePower /mBaseApparentPower; - SPDLOG_LOGGER_INFO(mSLog, "Active Power={} [pu] Reactive Power={} [pu]", **mActivePowerPerUnit, **mReactivePowerPerUnit); + SPDLOG_LOGGER_DEBUG(mSLog, "Active Power={} [pu] Reactive Power={} [pu]", **mActivePowerPerUnit, **mReactivePowerPerUnit); mSLog->flush(); } @@ -145,7 +145,7 @@ void SP::Ph1::Load::initializeFromNodesAndTerminals(Real frequency) { (**mIntfVoltage)(0, 0) = mTerminals[0]->initialSingleVoltage(); (**mIntfCurrent)(0, 0) = std::conj(Complex(attributeTyped("P")->get(), attributeTyped("Q")->get()) / (**mIntfVoltage)(0, 0)); - SPDLOG_LOGGER_INFO(mSLog, + SPDLOG_LOGGER_INFO(mSLog, "\n--- Initialization from powerflow ---" "\nVoltage across: {:s}" "\nCurrent: {:s}" @@ -154,7 +154,7 @@ void SP::Ph1::Load::initializeFromNodesAndTerminals(Real frequency) { Logger::phasorToString((**mIntfVoltage)(0, 0)), Logger::phasorToString((**mIntfCurrent)(0, 0)), Logger::phasorToString(initialSingleVoltage(0))); - SPDLOG_LOGGER_INFO(mSLog, + SPDLOG_LOGGER_INFO(mSLog, "Updated parameters according to powerflow:\n" "Active Power={} [W] Reactive Power={} [VAr]", attributeTyped("P")->get(), attributeTyped("Q")->get()); mSLog->flush(); diff --git a/dpsim-models/src/SP/SP_Ph1_NetworkInjection.cpp b/dpsim-models/src/SP/SP_Ph1_NetworkInjection.cpp index 79e9c36c13..9c120df2b0 100644 --- a/dpsim-models/src/SP/SP_Ph1_NetworkInjection.cpp +++ b/dpsim-models/src/SP/SP_Ph1_NetworkInjection.cpp @@ -133,7 +133,7 @@ void SP::Ph1::NetworkInjection::initializeFromNodesAndTerminals(Real frequency) // #### MNA functions #### void SP::Ph1::NetworkInjection::mnaParentApplyRightSideVectorStamp(Matrix& rightVector) { - SPDLOG_LOGGER_DEBUG(mSLog, "Right Side Vector: {:s}", + SPDLOG_LOGGER_TRACE(mSLog, "Right Side Vector: {:s}", Logger::matrixToString(rightVector)); } diff --git a/dpsim-models/src/SP/SP_Ph1_PiLine.cpp b/dpsim-models/src/SP/SP_Ph1_PiLine.cpp index 4203874973..da862eccaf 100644 --- a/dpsim-models/src/SP/SP_Ph1_PiLine.cpp +++ b/dpsim-models/src/SP/SP_Ph1_PiLine.cpp @@ -71,25 +71,25 @@ void SP::Ph1::PiLine::setBaseVoltage(Real baseVoltage) { } void SP::Ph1::PiLine::calculatePerUnitParameters(Real baseApparentPower, Real baseOmega) { - SPDLOG_LOGGER_INFO(mSLog, "#### Calculate Per Unit Parameters for {}", **mName); + SPDLOG_LOGGER_DEBUG(mSLog, "#### Calculate Per Unit Parameters for {}", **mName); mBaseApparentPower = baseApparentPower; mBaseOmega = baseOmega; - SPDLOG_LOGGER_INFO(mSLog, "Base Power={} [VA] Base Omega={} [1/s]", baseApparentPower, baseOmega); + SPDLOG_LOGGER_DEBUG(mSLog, "Base Power={} [VA] Base Omega={} [1/s]", baseApparentPower, baseOmega); mBaseImpedance = (**mBaseVoltage * **mBaseVoltage) / mBaseApparentPower; mBaseAdmittance = 1.0 / mBaseImpedance; mBaseInductance = mBaseImpedance / mBaseOmega; mBaseCapacitance = 1.0 / mBaseOmega / mBaseImpedance; mBaseCurrent = baseApparentPower / (**mBaseVoltage * sqrt(3)); // I_base=(S_threephase/3)/(V_line_to_line/sqrt(3)) - SPDLOG_LOGGER_INFO(mSLog, "Base Voltage={} [V] Base Impedance={} [Ohm]", **mBaseVoltage, mBaseImpedance); + SPDLOG_LOGGER_DEBUG(mSLog, "Base Voltage={} [V] Base Impedance={} [Ohm]", **mBaseVoltage, mBaseImpedance); mSeriesResPerUnit = **mSeriesRes / mBaseImpedance; mSeriesIndPerUnit = **mSeriesInd / mBaseInductance; mParallelCapPerUnit = **mParallelCap / mBaseCapacitance; mParallelCondPerUnit = **mParallelCond / mBaseAdmittance; - SPDLOG_LOGGER_INFO(mSLog, "Resistance={} [pu] Reactance={} [pu]", mSeriesResPerUnit, 1. * mSeriesIndPerUnit); - SPDLOG_LOGGER_INFO(mSLog, "Susceptance={} [pu] Conductance={} [pu]", 1. * mParallelCapPerUnit, mParallelCondPerUnit); + SPDLOG_LOGGER_DEBUG(mSLog, "Resistance={} [pu] Reactance={} [pu]", mSeriesResPerUnit, 1. * mSeriesIndPerUnit); + SPDLOG_LOGGER_DEBUG(mSLog, "Susceptance={} [pu] Conductance={} [pu]", 1. * mParallelCapPerUnit, mParallelCondPerUnit); mSLog->flush(); } @@ -125,8 +125,8 @@ void SP::Ph1::PiLine::pfApplyAdmittanceMatrixStamp(SparseMatrixCompRow & Y) { Y.coeffRef(bus2, bus2) += mY_element.coeff(1, 1); Y.coeffRef(bus2, bus1) += mY_element.coeff(1, 0); - SPDLOG_LOGGER_INFO(mSLog, "#### PF Y matrix stamping #### "); - SPDLOG_LOGGER_INFO(mSLog, "{}", mY_element); + SPDLOG_LOGGER_DEBUG(mSLog, "#### PF Y matrix stamping #### "); + SPDLOG_LOGGER_DEBUG(mSLog, "{}", mY_element); mSLog->flush(); } @@ -208,7 +208,7 @@ void SP::Ph1::PiLine::initializeFromNodesAndTerminals(Real frequency) { addMNASubComponent(mSubParallelCapacitor1, MNA_SUBCOMP_TASK_ORDER::NO_TASK, MNA_SUBCOMP_TASK_ORDER::TASK_BEFORE_PARENT, true); } - SPDLOG_LOGGER_INFO(mSLog, + SPDLOG_LOGGER_INFO(mSLog, "\n--- Initialization from powerflow ---" "\nVoltage across: {:s}" "\nCurrent: {:s}" diff --git a/dpsim-models/src/SP/SP_Ph1_ReducedOrderSynchronGeneratorVBR.cpp b/dpsim-models/src/SP/SP_Ph1_ReducedOrderSynchronGeneratorVBR.cpp index c4cffc95e1..0cfbe1e6f8 100644 --- a/dpsim-models/src/SP/SP_Ph1_ReducedOrderSynchronGeneratorVBR.cpp +++ b/dpsim-models/src/SP/SP_Ph1_ReducedOrderSynchronGeneratorVBR.cpp @@ -62,9 +62,9 @@ void SP::Ph1::ReducedOrderSynchronGeneratorVBR::mnaCompInitialize(Real omega, mVariableSystemMatrixEntries.push_back(std::make_pair(matrixNodeIndex(0, 0), mVirtualNodes[0]->matrixNodeIndex())); } - SPDLOG_LOGGER_INFO(mSLog, "List of index pairs of varying matrix entries: "); + SPDLOG_LOGGER_DEBUG(mSLog, "List of index pairs of varying matrix entries: "); for (auto indexPair : mVariableSystemMatrixEntries) - SPDLOG_LOGGER_INFO(mSLog, "({}, {})", indexPair.first, indexPair.second); + SPDLOG_LOGGER_DEBUG(mSLog, "({}, {})", indexPair.first, indexPair.second); } void SP::Ph1::ReducedOrderSynchronGeneratorVBR::mnaCompApplySystemMatrixStamp(SparseMatrixRow& systemMatrix) { diff --git a/dpsim-models/src/SP/SP_Ph1_Resistor.cpp b/dpsim-models/src/SP/SP_Ph1_Resistor.cpp index b44f8feefa..9f970f4cb2 100644 --- a/dpsim-models/src/SP/SP_Ph1_Resistor.cpp +++ b/dpsim-models/src/SP/SP_Ph1_Resistor.cpp @@ -52,18 +52,18 @@ void SP::Ph1::Resistor::setBaseVoltage(Real baseVoltage){ } void SP::Ph1::Resistor::calculatePerUnitParameters(Real baseApparentPower){ - SPDLOG_LOGGER_INFO(mSLog, "#### Calculate Per Unit Parameters for {}", **mName); + SPDLOG_LOGGER_DEBUG(mSLog, "#### Calculate Per Unit Parameters for {}", **mName); mBaseApparentPower = baseApparentPower; - SPDLOG_LOGGER_INFO(mSLog, "Base Power={} [VA]", baseApparentPower); + SPDLOG_LOGGER_DEBUG(mSLog, "Base Power={} [VA]", baseApparentPower); mBaseImpedance = mBaseVoltage * mBaseVoltage / mBaseApparentPower; mBaseAdmittance = 1.0 / mBaseImpedance; mBaseCurrent = baseApparentPower / (mBaseVoltage*sqrt(3)); // I_base=(S_threephase/3)/(V_line_to_line/sqrt(3)) - SPDLOG_LOGGER_INFO(mSLog, "Base Voltage={} [V] Base Impedance={} [Ohm]", mBaseVoltage, mBaseImpedance); + SPDLOG_LOGGER_DEBUG(mSLog, "Base Voltage={} [V] Base Impedance={} [Ohm]", mBaseVoltage, mBaseImpedance); mResistancePerUnit = **mResistance / mBaseImpedance; mConductancePerUnit = 1. / mResistancePerUnit; - SPDLOG_LOGGER_INFO(mSLog, "Resistance={} [pu] Conductance={} [pu]", mResistancePerUnit, mConductancePerUnit); + SPDLOG_LOGGER_DEBUG(mSLog, "Resistance={} [pu] Conductance={} [pu]", mResistancePerUnit, mConductancePerUnit); } void SP::Ph1::Resistor::pfApplyAdmittanceMatrixStamp(SparseMatrixCompRow & Y) { @@ -79,7 +79,7 @@ void SP::Ph1::Resistor::pfApplyAdmittanceMatrixStamp(SparseMatrixCompRow & Y) { //set the circuit matrix values Y.coeffRef(bus1, bus1) += Y_element; - SPDLOG_LOGGER_INFO(mSLog, "#### Y matrix stamping: {}", Y_element); + SPDLOG_LOGGER_DEBUG(mSLog, "#### Y matrix stamping: {}", Y_element); } // #### MNA section #### @@ -112,14 +112,14 @@ void SP::Ph1::Resistor::mnaCompApplySystemMatrixStamp(SparseMatrixRow& systemMat Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1), matrixNodeIndex(0), -conductance, mNumFreqs, freq); } - SPDLOG_LOGGER_INFO(mSLog, "-- Stamp frequency {:d} ---", freq); + SPDLOG_LOGGER_DEBUG(mSLog, "-- Stamp frequency {:d} ---", freq); if (terminalNotGrounded(0)) - SPDLOG_LOGGER_INFO(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(conductance), matrixNodeIndex(0), matrixNodeIndex(0)); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(conductance), matrixNodeIndex(0), matrixNodeIndex(0)); if (terminalNotGrounded(1)) - SPDLOG_LOGGER_INFO(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(conductance), matrixNodeIndex(1), matrixNodeIndex(1)); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(conductance), matrixNodeIndex(1), matrixNodeIndex(1)); if (terminalNotGrounded(0) && terminalNotGrounded(1)) { - SPDLOG_LOGGER_INFO(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(-conductance), matrixNodeIndex(0), matrixNodeIndex(1)); - SPDLOG_LOGGER_INFO(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(-conductance), matrixNodeIndex(1), matrixNodeIndex(0)); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(-conductance), matrixNodeIndex(0), matrixNodeIndex(1)); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(-conductance), matrixNodeIndex(1), matrixNodeIndex(0)); } } } @@ -144,14 +144,14 @@ void SP::Ph1::Resistor::mnaCompUpdateVoltage(const Matrix& leftVector) { if (terminalNotGrounded(0)) (**mIntfVoltage)(0,freq) = (**mIntfVoltage)(0,freq) - Math::complexFromVectorElement(leftVector, matrixNodeIndex(0), mNumFreqs, freq); - SPDLOG_LOGGER_DEBUG(mSLog, "Voltage {:s}", Logger::phasorToString((**mIntfVoltage)(0,freq))); + SPDLOG_LOGGER_TRACE(mSLog, "Voltage {:s}", Logger::phasorToString((**mIntfVoltage)(0,freq))); } } void SP::Ph1::Resistor::mnaCompUpdateCurrent(const Matrix& leftVector) { for (UInt freq = 0; freq < mNumFreqs; freq++) { (**mIntfCurrent)(0,freq) = (**mIntfVoltage)(0,freq) / **mResistance; - SPDLOG_LOGGER_DEBUG(mSLog, "Current {:s}", Logger::phasorToString((**mIntfCurrent)(0,freq))); + SPDLOG_LOGGER_TRACE(mSLog, "Current {:s}", Logger::phasorToString((**mIntfCurrent)(0,freq))); } } diff --git a/dpsim-models/src/SP/SP_Ph1_Shunt.cpp b/dpsim-models/src/SP/SP_Ph1_Shunt.cpp index 8ceb42a147..a32da868ef 100644 --- a/dpsim-models/src/SP/SP_Ph1_Shunt.cpp +++ b/dpsim-models/src/SP/SP_Ph1_Shunt.cpp @@ -35,16 +35,16 @@ void SP::Ph1::Shunt::setBaseVoltage(Real baseVoltage) { void SP::Ph1::Shunt::calculatePerUnitParameters(Real baseApparentPower, Real baseOmega) { - SPDLOG_LOGGER_INFO(mSLog, "#### Calculate Per Unit Parameters for {}", **mName); - SPDLOG_LOGGER_INFO(mSLog, "Base Power={} [VA] Base Omega={} [1/s]", baseApparentPower, baseOmega); + SPDLOG_LOGGER_DEBUG(mSLog, "#### Calculate Per Unit Parameters for {}", **mName); + SPDLOG_LOGGER_DEBUG(mSLog, "Base Power={} [VA] Base Omega={} [1/s]", baseApparentPower, baseOmega); auto baseImpedance = (mBaseVoltage * mBaseVoltage) / baseApparentPower; auto baseAdmittance = 1.0 / baseImpedance; - SPDLOG_LOGGER_INFO(mSLog, "Base Voltage={} [V] Base Admittance={} [S]", mBaseVoltage, baseAdmittance); + SPDLOG_LOGGER_DEBUG(mSLog, "Base Voltage={} [V] Base Admittance={} [S]", mBaseVoltage, baseAdmittance); mConductancePerUnit = **mConductance / baseAdmittance; mSusceptancePerUnit = **mSusceptance / baseAdmittance; - SPDLOG_LOGGER_INFO(mSLog, "Susceptance={} [pu] Conductance={} [pu]", mSusceptancePerUnit, mConductancePerUnit); + SPDLOG_LOGGER_DEBUG(mSLog, "Susceptance={} [pu] Conductance={} [pu]", mSusceptancePerUnit, mConductancePerUnit); }; @@ -61,6 +61,6 @@ void SP::Ph1::Shunt::pfApplyAdmittanceMatrixStamp(SparseMatrixCompRow & Y) { //set the circuit matrix values Y.coeffRef(bus1, bus1) += Y_element; - SPDLOG_LOGGER_INFO(mSLog, "#### Y matrix stamping: {}", Y_element); + SPDLOG_LOGGER_DEBUG(mSLog, "#### Y matrix stamping: {}", Y_element); } diff --git a/dpsim-models/src/SP/SP_Ph1_SynchronGenerator.cpp b/dpsim-models/src/SP/SP_Ph1_SynchronGenerator.cpp index 81cabe049b..bde2fa6687 100644 --- a/dpsim-models/src/SP/SP_Ph1_SynchronGenerator.cpp +++ b/dpsim-models/src/SP/SP_Ph1_SynchronGenerator.cpp @@ -43,14 +43,14 @@ void SP::Ph1::SynchronGenerator::setBaseVoltage(Real baseVoltage) { } void SP::Ph1::SynchronGenerator::calculatePerUnitParameters(Real baseApparentPower, Real baseOmega) { - SPDLOG_LOGGER_INFO(mSLog, "#### Calculate Per Unit Parameters for {}", **mName); + SPDLOG_LOGGER_DEBUG(mSLog, "#### Calculate Per Unit Parameters for {}", **mName); mBaseApparentPower = baseApparentPower; - SPDLOG_LOGGER_INFO(mSLog, "Base Power={} [VA] Base Omega={} [1/s]", mBaseApparentPower, baseOmega); + SPDLOG_LOGGER_DEBUG(mSLog, "Base Power={} [VA] Base Omega={} [1/s]", mBaseApparentPower, baseOmega); **mSetPointActivePowerPerUnit = **mSetPointActivePower / mBaseApparentPower; **mSetPointReactivePowerPerUnit = **mSetPointReactivePower / mBaseApparentPower; **mSetPointVoltagePerUnit = **mSetPointVoltage / **mBaseVoltage; - SPDLOG_LOGGER_INFO(mSLog, "Active Power Set Point={} [pu] Voltage Set Point={} [pu]", **mSetPointActivePowerPerUnit, **mSetPointVoltagePerUnit); + SPDLOG_LOGGER_DEBUG(mSLog, "Active Power Set Point={} [pu] Voltage Set Point={} [pu]", **mSetPointActivePowerPerUnit, **mSetPointVoltagePerUnit); mSLog->flush(); } diff --git a/dpsim-models/src/SP/SP_Ph1_SynchronGeneratorTrStab.cpp b/dpsim-models/src/SP/SP_Ph1_SynchronGeneratorTrStab.cpp index 17d48790f3..9f5e001451 100644 --- a/dpsim-models/src/SP/SP_Ph1_SynchronGeneratorTrStab.cpp +++ b/dpsim-models/src/SP/SP_Ph1_SynchronGeneratorTrStab.cpp @@ -241,7 +241,7 @@ void SP::Ph1::SynchronGeneratorTrStab::step(Real time) { mStates << Math::abs(**mEp), Math::phaseDeg(**mEp), **mElecActivePower, **mMechPower, **mDelta_p, **mOmMech, dOmMech, dDelta_p, (**mIntfVoltage)(0,0).real(), (**mIntfVoltage)(0,0).imag(); - SPDLOG_LOGGER_DEBUG(mSLog, "\nStates, time {:f}: \n{:s}", time, Logger::matrixToString(mStates)); + SPDLOG_LOGGER_TRACE(mSLog, "\nStates, time {:f}: \n{:s}", time, Logger::matrixToString(mStates)); } void SP::Ph1::SynchronGeneratorTrStab::mnaParentInitialize(Real omega, Real timeStep, Attribute::Ptr leftVector) { @@ -280,12 +280,12 @@ void SP::Ph1::SynchronGeneratorTrStab::mnaParentPostStep(Real time, Int timeStep } void SP::Ph1::SynchronGeneratorTrStab::mnaCompUpdateVoltage(const Matrix& leftVector) { - SPDLOG_LOGGER_DEBUG(mSLog, "Read voltage from {:d}", matrixNodeIndex(0)); + SPDLOG_LOGGER_TRACE(mSLog, "Read voltage from {:d}", matrixNodeIndex(0)); (**mIntfVoltage)(0,0) = Math::complexFromVectorElement(leftVector, matrixNodeIndex(0)); } void SP::Ph1::SynchronGeneratorTrStab::mnaCompUpdateCurrent(const Matrix& leftVector) { - SPDLOG_LOGGER_DEBUG(mSLog, "Read current from {:d}", matrixNodeIndex(0)); + SPDLOG_LOGGER_TRACE(mSLog, "Read current from {:d}", matrixNodeIndex(0)); //Current flowing out of component **mIntfCurrent = mSubInductor->mIntfCurrent->get(); } @@ -295,5 +295,5 @@ void SP::Ph1::SynchronGeneratorTrStab::setReferenceOmega(Attribute::Ptr re mRefDelta->setReference(refDeltaPtr); mUseOmegaRef=true; - SPDLOG_LOGGER_INFO(mSLog, "Use of reference omega."); + SPDLOG_LOGGER_DEBUG(mSLog, "Use of reference omega."); } diff --git a/dpsim-models/src/SP/SP_Ph1_Transformer.cpp b/dpsim-models/src/SP/SP_Ph1_Transformer.cpp index ef67009d4d..5130a9b8b9 100644 --- a/dpsim-models/src/SP/SP_Ph1_Transformer.cpp +++ b/dpsim-models/src/SP/SP_Ph1_Transformer.cpp @@ -128,7 +128,7 @@ void SP::Ph1::Transformer::initializeFromNodesAndTerminals(Real frequency) { mSubSnubResistor1 = std::make_shared(**mName + "_snub_res1", mLogLevel); mSubSnubResistor1->setParameters(mSnubberResistance1); mSubSnubResistor1->connect({ node(0), SP::SimNode::GND }); - SPDLOG_LOGGER_INFO(mSLog, "Snubber Resistance 1 (connected to higher voltage side {}) = {} [Ohm]", node(0)->name(), Logger::realToString(mSnubberResistance1)); + SPDLOG_LOGGER_DEBUG(mSLog, "Snubber Resistance 1 (connected to higher voltage side {}) = {} [Ohm]", node(0)->name(), Logger::realToString(mSnubberResistance1)); mSubSnubResistor1->setBaseVoltage(**mNominalVoltageEnd1); addMNASubComponent(mSubSnubResistor1, MNA_SUBCOMP_TASK_ORDER::TASK_BEFORE_PARENT, MNA_SUBCOMP_TASK_ORDER::TASK_BEFORE_PARENT, true); @@ -137,7 +137,7 @@ void SP::Ph1::Transformer::initializeFromNodesAndTerminals(Real frequency) { mSubSnubResistor2 = std::make_shared(**mName + "_snub_res2", mLogLevel); mSubSnubResistor2->setParameters(mSnubberResistance2); mSubSnubResistor2->connect({ node(1), SP::SimNode::GND }); - SPDLOG_LOGGER_INFO(mSLog, "Snubber Resistance 2 (connected to lower voltage side {}) = {} [Ohm]", node(1)->name(), Logger::realToString(mSnubberResistance2)); + SPDLOG_LOGGER_DEBUG(mSLog, "Snubber Resistance 2 (connected to lower voltage side {}) = {} [Ohm]", node(1)->name(), Logger::realToString(mSnubberResistance2)); mSubSnubResistor2->setBaseVoltage(**mNominalVoltageEnd2); addMNASubComponent(mSubSnubResistor2, MNA_SUBCOMP_TASK_ORDER::TASK_BEFORE_PARENT, MNA_SUBCOMP_TASK_ORDER::TASK_BEFORE_PARENT, true); @@ -155,15 +155,15 @@ void SP::Ph1::Transformer::initializeFromNodesAndTerminals(Real frequency) { mSubSnubCapacitor2 = std::make_shared(**mName + "_snub_cap2", mLogLevel); mSubSnubCapacitor2->setParameters(mSnubberCapacitance2); mSubSnubCapacitor2->connect({ node(1), SP::SimNode::GND }); - SPDLOG_LOGGER_INFO(mSLog, "Snubber Capacitance 2 (connected to lower voltage side {}) = {} [F]", node(1)->name(), Logger::realToString(mSnubberCapacitance2)); + SPDLOG_LOGGER_DEBUG(mSLog, "Snubber Capacitance 2 (connected to lower voltage side {}) = {} [F]", node(1)->name(), Logger::realToString(mSnubberCapacitance2)); mSubSnubCapacitor2->setBaseVoltage(**mNominalVoltageEnd2); addMNASubComponent(mSubSnubCapacitor2, MNA_SUBCOMP_TASK_ORDER::TASK_BEFORE_PARENT, MNA_SUBCOMP_TASK_ORDER::TASK_BEFORE_PARENT, true); } // Initialize electrical subcomponents - SPDLOG_LOGGER_INFO(mSLog, "Electrical subcomponents: "); + SPDLOG_LOGGER_DEBUG(mSLog, "Electrical subcomponents: "); for (auto subcomp: mSubComponents) { - SPDLOG_LOGGER_INFO(mSLog, "- {}", subcomp->name()); + SPDLOG_LOGGER_DEBUG(mSLog, "- {}", subcomp->name()); subcomp->initialize(mFrequencies); subcomp->initializeFromNodesAndTerminals(frequency); } @@ -193,28 +193,28 @@ void SP::Ph1::Transformer::setBaseVoltage(Real baseVoltage) { } void SP::Ph1::Transformer::calculatePerUnitParameters(Real baseApparentPower, Real baseOmega) { - SPDLOG_LOGGER_INFO(mSLog, "#### Calculate Per Unit Parameters for {}", **mName); + SPDLOG_LOGGER_DEBUG(mSLog, "#### Calculate Per Unit Parameters for {}", **mName); mBaseApparentPower = baseApparentPower; mBaseOmega = baseOmega; - SPDLOG_LOGGER_INFO(mSLog, "Base Power={} [VA] Base Omega={} [1/s]", baseApparentPower, baseOmega); + SPDLOG_LOGGER_DEBUG(mSLog, "Base Power={} [VA] Base Omega={} [1/s]", baseApparentPower, baseOmega); mBaseImpedance = **mBaseVoltage * **mBaseVoltage / mBaseApparentPower; mBaseAdmittance = 1.0 / mBaseImpedance; mBaseCurrent = baseApparentPower / (**mBaseVoltage * sqrt(3)); // I_base=(S_threephase/3)/(V_line_to_line/sqrt(3)) - SPDLOG_LOGGER_INFO(mSLog, "Base Voltage={} [V] Base Impedance={} [Ohm]", **mBaseVoltage, mBaseImpedance); + SPDLOG_LOGGER_DEBUG(mSLog, "Base Voltage={} [V] Base Impedance={} [Ohm]", **mBaseVoltage, mBaseImpedance); mResistancePerUnit = **mResistance / mBaseImpedance; mReactancePerUnit = mReactance / mBaseImpedance; - SPDLOG_LOGGER_INFO(mSLog, "Resistance={} [pu] Reactance={} [pu]", mResistancePerUnit, mReactancePerUnit); + SPDLOG_LOGGER_DEBUG(mSLog, "Resistance={} [pu] Reactance={} [pu]", mResistancePerUnit, mReactancePerUnit); mBaseInductance = mBaseImpedance / mBaseOmega; mInductancePerUnit = **mInductance / mBaseInductance; // omega per unit=1, hence 1.0*mInductancePerUnit. mLeakagePerUnit = Complex(mResistancePerUnit,1.*mInductancePerUnit); - SPDLOG_LOGGER_INFO(mSLog, "Leakage Impedance={} [pu] ", mLeakagePerUnit); + SPDLOG_LOGGER_DEBUG(mSLog, "Leakage Impedance={} [pu] ", mLeakagePerUnit); mRatioAbsPerUnit = mRatioAbs / **mNominalVoltageEnd1 * **mNominalVoltageEnd2; - SPDLOG_LOGGER_INFO(mSLog, "Tap Ratio={} [pu]", mRatioAbsPerUnit); + SPDLOG_LOGGER_DEBUG(mSLog, "Tap Ratio={} [pu]", mRatioAbsPerUnit); // Calculate per unit parameters of subcomps if (mSubSnubResistor1) @@ -255,7 +255,7 @@ void SP::Ph1::Transformer::pfApplyAdmittanceMatrixStamp(SparseMatrixCompRow & Y) Y.coeffRef(this->matrixNodeIndex(1), this->matrixNodeIndex(1)) += mY_element.coeff(1, 1); Y.coeffRef(this->matrixNodeIndex(1), this->matrixNodeIndex(0)) += mY_element.coeff(1, 0); - SPDLOG_LOGGER_INFO(mSLog, "#### Y matrix stamping: {}", mY_element); + SPDLOG_LOGGER_DEBUG(mSLog, "#### Y matrix stamping: {}", mY_element); if (mSubSnubResistor1) mSubSnubResistor1->pfApplyAdmittanceMatrixStamp(Y); @@ -312,15 +312,15 @@ void SP::Ph1::Transformer::mnaCompApplySystemMatrixStamp(SparseMatrixRow& system mnasubcomp->mnaApplySystemMatrixStamp(systemMatrix); if (terminalNotGrounded(0)) { - SPDLOG_LOGGER_INFO(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(Complex(-1.0, 0)), + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(Complex(-1.0, 0)), mVirtualNodes[0]->matrixNodeIndex(), mVirtualNodes[1]->matrixNodeIndex()); - SPDLOG_LOGGER_INFO(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(Complex(1.0, 0)), + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(Complex(1.0, 0)), mVirtualNodes[1]->matrixNodeIndex(), mVirtualNodes[0]->matrixNodeIndex()); } if (terminalNotGrounded(1)) { - SPDLOG_LOGGER_INFO(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(**mRatio), + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(**mRatio), matrixNodeIndex(1), mVirtualNodes[1]->matrixNodeIndex()); - SPDLOG_LOGGER_INFO(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(- **mRatio), + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(- **mRatio), mVirtualNodes[1]->matrixNodeIndex(), matrixNodeIndex(1)); } } @@ -348,7 +348,7 @@ void SP::Ph1::Transformer::mnaParentPostStep(Real time, Int timeStepCount, Attri void SP::Ph1::Transformer::mnaCompUpdateCurrent(const Matrix& leftVector) { (**mIntfCurrent)(0, 0) = mSubInductor->intfCurrent()(0, 0); - SPDLOG_LOGGER_DEBUG(mSLog, "Current {:s}", Logger::phasorToString((**mIntfCurrent)(0, 0))); + SPDLOG_LOGGER_TRACE(mSLog, "Current {:s}", Logger::phasorToString((**mIntfCurrent)(0, 0))); } @@ -357,5 +357,5 @@ void SP::Ph1::Transformer::mnaCompUpdateVoltage(const Matrix& leftVector) { (**mIntfVoltage)(0, 0) = 0; (**mIntfVoltage)(0, 0) = Math::complexFromVectorElement(leftVector, matrixNodeIndex(1)); (**mIntfVoltage)(0, 0) = (**mIntfVoltage)(0, 0) - Math::complexFromVectorElement(leftVector, mVirtualNodes[0]->matrixNodeIndex()); - SPDLOG_LOGGER_DEBUG(mSLog, "Voltage {:s}", Logger::phasorToString((**mIntfVoltage)(0, 0))); + SPDLOG_LOGGER_TRACE(mSLog, "Voltage {:s}", Logger::phasorToString((**mIntfVoltage)(0, 0))); } diff --git a/dpsim-models/src/SP/SP_Ph1_VoltageSource.cpp b/dpsim-models/src/SP/SP_Ph1_VoltageSource.cpp index f3b1fffafd..fa1838016c 100644 --- a/dpsim-models/src/SP/SP_Ph1_VoltageSource.cpp +++ b/dpsim-models/src/SP/SP_Ph1_VoltageSource.cpp @@ -118,14 +118,14 @@ void SP::Ph1::VoltageSource::mnaCompApplySystemMatrixStamp(SparseMatrixRow& syst Math::setMatrixElement(systemMatrix, matrixNodeIndex(1), mVirtualNodes[0]->matrixNodeIndex(), Complex(1, 0), mNumFreqs, freq); } - SPDLOG_LOGGER_INFO(mSLog, "-- Stamp frequency {:d} ---", freq); + SPDLOG_LOGGER_DEBUG(mSLog, "-- Stamp frequency {:d} ---", freq); if (terminalNotGrounded(0)) { - SPDLOG_LOGGER_INFO(mSLog, "Add {:f} to system at ({:d},{:d})", -1., matrixNodeIndex(0), mVirtualNodes[0]->matrixNodeIndex()); - SPDLOG_LOGGER_INFO(mSLog, "Add {:f} to system at ({:d},{:d})", -1., mVirtualNodes[0]->matrixNodeIndex(), matrixNodeIndex(0)); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:f} to system at ({:d},{:d})", -1., matrixNodeIndex(0), mVirtualNodes[0]->matrixNodeIndex()); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:f} to system at ({:d},{:d})", -1., mVirtualNodes[0]->matrixNodeIndex(), matrixNodeIndex(0)); } if (terminalNotGrounded(1)) { - SPDLOG_LOGGER_INFO(mSLog, "Add {:f} to system at ({:d},{:d})", 1., mVirtualNodes[0]->matrixNodeIndex(), matrixNodeIndex(1)); - SPDLOG_LOGGER_INFO(mSLog, "Add {:f} to system at ({:d},{:d})", 1., matrixNodeIndex(1), mVirtualNodes[0]->matrixNodeIndex()); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:f} to system at ({:d},{:d})", 1., mVirtualNodes[0]->matrixNodeIndex(), matrixNodeIndex(1)); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:f} to system at ({:d},{:d})", 1., matrixNodeIndex(1), mVirtualNodes[0]->matrixNodeIndex()); } } } @@ -133,7 +133,7 @@ void SP::Ph1::VoltageSource::mnaCompApplySystemMatrixStamp(SparseMatrixRow& syst void SP::Ph1::VoltageSource::mnaCompApplyRightSideVectorStamp(Matrix& rightVector) { // TODO: Is this correct with two nodes not gnd? Math::setVectorElement(rightVector, mVirtualNodes[0]->matrixNodeIndex(), (**mIntfVoltage)(0,0), mNumFreqs); - SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to source vector at {:d}", + SPDLOG_LOGGER_TRACE(mSLog, "Add {:s} to source vector at {:d}", Logger::complexToString((**mIntfVoltage)(0,0)), mVirtualNodes[0]->matrixNodeIndex()); } @@ -145,7 +145,7 @@ void SP::Ph1::VoltageSource::updateVoltage(Real time) { (**mIntfVoltage)(0,0) = **mVoltageRef; } - SPDLOG_LOGGER_DEBUG(mSLog, "Update Voltage {:s}", Logger::phasorToString((**mIntfVoltage)(0,0))); + SPDLOG_LOGGER_TRACE(mSLog, "Update Voltage {:s}", Logger::phasorToString((**mIntfVoltage)(0,0))); } void SP::Ph1::VoltageSource::mnaCompPreStep(Real time, Int timeStepCount) { diff --git a/dpsim-models/src/Signal/FIRFilter.cpp b/dpsim-models/src/Signal/FIRFilter.cpp index 53b7090b50..376e6c6bcd 100644 --- a/dpsim-models/src/Signal/FIRFilter.cpp +++ b/dpsim-models/src/Signal/FIRFilter.cpp @@ -40,7 +40,7 @@ void FIRFilter::step(Real time) { incrementIndex(); **mOutput = output; - SPDLOG_LOGGER_DEBUG(mSLog, "Set output to {}", output); + SPDLOG_LOGGER_TRACE(mSLog, "Set output to {}", output); } void FIRFilter::Step::execute(Real time, Int timeStepCount) { diff --git a/dpsim-models/src/Signal/Integrator.cpp b/dpsim-models/src/Signal/Integrator.cpp index d653976a85..65b8a40121 100644 --- a/dpsim-models/src/Signal/Integrator.cpp +++ b/dpsim-models/src/Signal/Integrator.cpp @@ -59,14 +59,14 @@ void Integrator::signalAddStepDependencies(AttributeBase::List &prevStepDependen void Integrator::signalStep(Real time, Int timeStepCount) { **mInputCurr = **mInputRef; - SPDLOG_LOGGER_INFO(mSLog, "Time {}:", time); - SPDLOG_LOGGER_INFO(mSLog, "Input values: inputCurr = {}, inputPrev = {}, statePrev = {}", **mInputCurr, **mInputPrev, **mStatePrev); + SPDLOG_LOGGER_TRACE(mSLog, "Time {}:", time); + SPDLOG_LOGGER_TRACE(mSLog, "Input values: inputCurr = {}, inputPrev = {}, statePrev = {}", **mInputCurr, **mInputPrev, **mStatePrev); **mStateCurr =**mStatePrev + mTimeStep/2.0* **mInputCurr + mTimeStep/2.0* **mInputPrev; **mOutputCurr = **mStateCurr; - SPDLOG_LOGGER_INFO(mSLog, "State values: stateCurr = {}", **mStateCurr); - SPDLOG_LOGGER_INFO(mSLog, "Output values: outputCurr = {}:", **mOutputCurr); + SPDLOG_LOGGER_TRACE(mSLog, "State values: stateCurr = {}", **mStateCurr); + SPDLOG_LOGGER_TRACE(mSLog, "Output values: outputCurr = {}:", **mOutputCurr); } Task::List Integrator::getTasks() { diff --git a/dpsim-models/src/Signal/PLL.cpp b/dpsim-models/src/Signal/PLL.cpp index 5351654b22..248f4084d5 100644 --- a/dpsim-models/src/Signal/PLL.cpp +++ b/dpsim-models/src/Signal/PLL.cpp @@ -57,11 +57,11 @@ void PLL::composeStateSpaceMatrices() { mD << 0, 0, 0, 0; - SPDLOG_LOGGER_INFO(mSLog, "State space matrices:"); - SPDLOG_LOGGER_INFO(mSLog, "A = \n{}", mA); - SPDLOG_LOGGER_INFO(mSLog, "B = \n{}", mB); - SPDLOG_LOGGER_INFO(mSLog, "C = \n{}", mC); - SPDLOG_LOGGER_INFO(mSLog, "D = \n{}", mD); + SPDLOG_LOGGER_DEBUG(mSLog, "State space matrices:"); + SPDLOG_LOGGER_DEBUG(mSLog, "A = \n{}", mA); + SPDLOG_LOGGER_DEBUG(mSLog, "B = \n{}", mB); + SPDLOG_LOGGER_DEBUG(mSLog, "C = \n{}", mC); + SPDLOG_LOGGER_DEBUG(mSLog, "D = \n{}", mD); } void PLL::signalAddPreStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes) { diff --git a/dpsim-models/src/Signal/PowerControllerVSI.cpp b/dpsim-models/src/Signal/PowerControllerVSI.cpp index 28ea06b112..d7ef39c96d 100644 --- a/dpsim-models/src/Signal/PowerControllerVSI.cpp +++ b/dpsim-models/src/Signal/PowerControllerVSI.cpp @@ -83,11 +83,11 @@ void PowerControllerVSI::setControllerParameters(Real Kp_powerCtrl, Real Ki_powe mKpCurrCtrld*mKpPowerCtrld, 0, 0, 0, -mKpCurrCtrld, 0, 0, -mKpCurrCtrlq * mKpPowerCtrlq, 0, 0, 0, -mKpCurrCtrlq; - SPDLOG_LOGGER_INFO(mSLog, "State space matrices:"); - SPDLOG_LOGGER_INFO(mSLog, "A = \n{}", mA); - SPDLOG_LOGGER_INFO(mSLog, "B = \n{}", mB); - SPDLOG_LOGGER_INFO(mSLog, "C = \n{}", mC); - SPDLOG_LOGGER_INFO(mSLog, "D = \n{}", mD); + SPDLOG_LOGGER_DEBUG(mSLog, "State space matrices:"); + SPDLOG_LOGGER_DEBUG(mSLog, "A = \n{}", mA); + SPDLOG_LOGGER_DEBUG(mSLog, "B = \n{}", mB); + SPDLOG_LOGGER_DEBUG(mSLog, "C = \n{}", mC); + SPDLOG_LOGGER_DEBUG(mSLog, "D = \n{}", mD); } void PowerControllerVSI::setInitialStateValues(Real pInit, Real qInit, @@ -115,15 +115,15 @@ void PowerControllerVSI::initializeStateSpaceModel(Real omega, Real timeStep, At // initialization of input **mInputCurr << mPref, mQref, **mVc_d, **mVc_q, **mIrc_d, **mIrc_q; - SPDLOG_LOGGER_INFO(mSLog, "Initialization of input: \n" + Logger::matrixToString(**mInputCurr)); + SPDLOG_LOGGER_DEBUG(mSLog, "Initialization of input: \n" + Logger::matrixToString(**mInputCurr)); // initialization of states **mStateCurr << mPInit, mQInit, mPhi_dInit, mPhi_qInit, mGamma_dInit, mGamma_qInit; - SPDLOG_LOGGER_INFO(mSLog, "Initialization of states: \n" + Logger::matrixToString(**mStateCurr)); + SPDLOG_LOGGER_DEBUG(mSLog, "Initialization of states: \n" + Logger::matrixToString(**mStateCurr)); // initialization of output **mOutputCurr = mC * **mStateCurr + mD * **mInputCurr; - SPDLOG_LOGGER_INFO(mSLog, "Initialization of output: \n" + Logger::matrixToString(**mOutputCurr)); + SPDLOG_LOGGER_DEBUG(mSLog, "Initialization of output: \n" + Logger::matrixToString(**mOutputCurr)); } void PowerControllerVSI::signalAddPreStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes) { @@ -154,15 +154,15 @@ void PowerControllerVSI::signalStep(Real time, Int timeStepCount) { // get current inputs **mInputCurr << mPref, mQref, **mVc_d, **mVc_q, **mIrc_d, **mIrc_q; - SPDLOG_LOGGER_DEBUG(mSLog, "Time {}\n: inputCurr = \n{}\n , inputPrev = \n{}\n , statePrev = \n{}", time, **mInputCurr, **mInputPrev, **mStatePrev); + SPDLOG_LOGGER_TRACE(mSLog, "Time {}\n: inputCurr = \n{}\n , inputPrev = \n{}\n , statePrev = \n{}", time, **mInputCurr, **mInputPrev, **mStatePrev); // calculate new states **mStateCurr = Math::StateSpaceTrapezoidal(**mStatePrev, mA, mB, mTimeStep, **mInputCurr, **mInputPrev); - SPDLOG_LOGGER_DEBUG(mSLog, "stateCurr = \n {}", **mStateCurr); + SPDLOG_LOGGER_TRACE(mSLog, "stateCurr = \n {}", **mStateCurr); // calculate new outputs **mOutputCurr = mC * **mStateCurr + mD * **mInputCurr; - SPDLOG_LOGGER_DEBUG(mSLog, "Output values: outputCurr = \n{}", **mOutputCurr); + SPDLOG_LOGGER_TRACE(mSLog, "Output values: outputCurr = \n{}", **mOutputCurr); } void PowerControllerVSI::updateBMatrixStateSpaceModel() { diff --git a/dpsim-models/src/SimPowerComp.cpp b/dpsim-models/src/SimPowerComp.cpp index b5f06c5202..2df4292fc4 100644 --- a/dpsim-models/src/SimPowerComp.cpp +++ b/dpsim-models/src/SimPowerComp.cpp @@ -149,7 +149,7 @@ void SimPowerComp::setTerminalAt(typename SimTerminal::Ptr ter return; } mTerminals[terminalPosition] = terminal; - SPDLOG_LOGGER_INFO(mSLog, "Set Terminal at position {} to Node {}, simulation node {}", terminalPosition, mTerminals[terminalPosition]->node()->name(), mTerminals[terminalPosition]->matrixNodeIndex()); + SPDLOG_LOGGER_DEBUG(mSLog, "Set Terminal at position {} to Node {}, simulation node {}", terminalPosition, mTerminals[terminalPosition]->node()->name(), mTerminals[terminalPosition]->matrixNodeIndex()); } template @@ -195,7 +195,7 @@ void SimPowerComp::setVirtualNodeAt(typename SimNode::Ptr virt SPDLOG_LOGGER_ERROR(mSLog, "Virtual Node position number too large for Component {} - Ignoring", **mName); } mVirtualNodes[nodeNum] = virtualNode; - SPDLOG_LOGGER_INFO(mSLog, "Set virtual Node at position {} to Node {}, simulation node {}", + SPDLOG_LOGGER_DEBUG(mSLog, "Set virtual Node at position {} to Node {}, simulation node {}", nodeNum, mVirtualNodes[nodeNum]->name(), mVirtualNodes[nodeNum]->matrixNodeIndex()); } From d60a9b624af848cf344aead09231613056a3d17e Mon Sep 17 00:00:00 2001 From: Jonas Schroeder Date: Wed, 19 Jul 2023 11:02:56 +0000 Subject: [PATCH 18/31] allow multiple simulation loggers for different filepaths Signed-off-by: Jonas Schroeder --- dpsim-models/include/dpsim-models/Logger.h | 6 ++--- dpsim-models/src/Logger.cpp | 31 +++++++++------------- 2 files changed, 14 insertions(+), 23 deletions(-) diff --git a/dpsim-models/include/dpsim-models/Logger.h b/dpsim-models/include/dpsim-models/Logger.h index 3f74c44e3c..74c9d2de7d 100644 --- a/dpsim-models/include/dpsim-models/Logger.h +++ b/dpsim-models/include/dpsim-models/Logger.h @@ -41,10 +41,8 @@ namespace CPS { DEBUG }; - /// Holds the file sink shared by all simulation loggers - static spdlog::sink_ptr mSimulationFileSink; - /// Holds the file sink shared by all component loggers - static spdlog::sink_ptr mComponentFileSink; + /// Holds the file sinks shared by all simulation loggers + static std::map> mFileSinkRegistry; /// Holds the stdout cli sink shared by all loggers static spdlog::sink_ptr mStdoutSink; /// Holds the stderr cli sink shared by all loggers diff --git a/dpsim-models/src/Logger.cpp b/dpsim-models/src/Logger.cpp index d594798113..167c668e10 100644 --- a/dpsim-models/src/Logger.cpp +++ b/dpsim-models/src/Logger.cpp @@ -14,8 +14,7 @@ using namespace CPS; -spdlog::sink_ptr Logger::mSimulationFileSink; -spdlog::sink_ptr Logger::mComponentFileSink; +std::map> Logger::mFileSinkRegistry; spdlog::sink_ptr Logger::mStdoutSink; spdlog::sink_ptr Logger::mStderrSink; @@ -177,24 +176,16 @@ Logger::Log Logger::create(Logger::LoggerType type, const std::string &name, con if (filelevel != Logger::Level::off) { switch (type) { - case LoggerType::COMPONENT: { - if (!Logger::mComponentFileSink) { - Logger::mComponentFileSink = std::make_shared(filepath, true); - Logger::mComponentFileSink->set_level(Level::trace); - // TODO: Use better prefix - Logger::mComponentFileSink->set_pattern(prefix() + "[%l][%n] %v"); - } - file_sink = Logger::mComponentFileSink; - break; - } + case LoggerType::COMPONENT: //fallthrough; case LoggerType::SIMULATION: { - if (!Logger::mSimulationFileSink) { - Logger::mSimulationFileSink = std::make_shared(filepath, true); - Logger::mSimulationFileSink->set_level(Level::trace); - // TODO: Use better prefix - Logger::mSimulationFileSink->set_pattern(prefix() + "[%l][%n] %v"); + file_sink = Logger::mFileSinkRegistry[filepath]; + if (!file_sink) { + file_sink = std::make_shared(filepath, true); + file_sink->set_level(Level::trace); + //TODO: Use better prefix + file_sink->set_pattern(prefix() + "[%l][%n] %v"); + Logger::mFileSinkRegistry[filepath] = file_sink; } - file_sink = Logger::mSimulationFileSink; break; } case LoggerType::DEBUG: { @@ -219,13 +210,15 @@ Logger::Log Logger::create(Logger::LoggerType type, const std::string &name, con } logger->set_level(std::min(filelevel, clilevel)); + + #ifndef DEBUG_BUILD if (filelevel < Level::info || clilevel < Level::info) { SPDLOG_LOGGER_WARN(logger, "This logger has been configured to log at level {} (file) and {} (cli)." " However, because this is a release build, debug logging has been disabled." " Please build in debug mode for extended log output.", - filelevel, clilevel); + spdlog::level::to_string_view(filelevel), spdlog::level::to_string_view(clilevel)); } #endif From 0adb4cce58f4670d94414cca26e91d4b4031a4b0 Mon Sep 17 00:00:00 2001 From: Jonas Schroeder Date: Wed, 19 Jul 2023 12:43:42 +0000 Subject: [PATCH 19/31] propagate simulation cliLevel to solvers Signed-off-by: Jonas Schroeder --- dpsim/include/dpsim/DiakopticsSolver.h | 2 +- dpsim/include/dpsim/MNASolver.h | 3 ++- dpsim/include/dpsim/MNASolverDirect.h | 3 ++- dpsim/include/dpsim/MNASolverFactory.h | 18 ++++++++++-------- dpsim/include/dpsim/MNASolverPlugin.h | 3 ++- dpsim/include/dpsim/PFSolver.h | 3 ++- dpsim/include/dpsim/PFSolverPowerPolar.h | 2 +- dpsim/src/DiakopticsSolver.cpp | 4 ++-- dpsim/src/Event.cpp | 1 + dpsim/src/MNASolver.cpp | 4 ++-- dpsim/src/MNASolverDirect.cpp | 4 ++-- dpsim/src/MNASolverPlugin.cpp | 4 ++-- dpsim/src/PFSolver.cpp | 4 ++-- dpsim/src/PFSolverPowerPolar.cpp | 4 ++-- dpsim/src/Simulation.cpp | 6 +++--- 15 files changed, 36 insertions(+), 29 deletions(-) diff --git a/dpsim/include/dpsim/DiakopticsSolver.h b/dpsim/include/dpsim/DiakopticsSolver.h index 6b5fc15d20..a976c4c002 100644 --- a/dpsim/include/dpsim/DiakopticsSolver.h +++ b/dpsim/include/dpsim/DiakopticsSolver.h @@ -103,7 +103,7 @@ namespace DPsim { /// Solutions of the split systems const CPS::Attribute::Ptr mOrigLeftSideVector; - DiakopticsSolver(String name, CPS::SystemTopology system, CPS::IdentifiedObject::List tearComponents, Real timeStep, CPS::Logger::Level logLevel); + DiakopticsSolver(String name, CPS::SystemTopology system, CPS::IdentifiedObject::List tearComponents, Real timeStep, CPS::Logger::Level logLevel, CPS::Logger::Level cliLevel); CPS::Task::List getTasks(); diff --git a/dpsim/include/dpsim/MNASolver.h b/dpsim/include/dpsim/MNASolver.h index 4196a7b3db..c50c682edc 100644 --- a/dpsim/include/dpsim/MNASolver.h +++ b/dpsim/include/dpsim/MNASolver.h @@ -123,7 +123,8 @@ namespace DPsim { /// Constructor should not be called by users but by Simulation MnaSolver(String name, CPS::Domain domain = CPS::Domain::DP, - CPS::Logger::Level logLevel = CPS::Logger::Level::info); + CPS::Logger::Level logLevel = CPS::Logger::Level::info, + CPS::Logger::Level cliLevel = CPS::Logger::Level::info); /// Initialization of individual components void initializeComponents(); diff --git a/dpsim/include/dpsim/MNASolverDirect.h b/dpsim/include/dpsim/MNASolverDirect.h index 52812cb703..be85e50799 100644 --- a/dpsim/include/dpsim/MNASolverDirect.h +++ b/dpsim/include/dpsim/MNASolverDirect.h @@ -154,7 +154,8 @@ namespace DPsim { /// sovlerImpl: choose the most advanced solver implementation available by default MnaSolverDirect(String name, CPS::Domain domain = CPS::Domain::DP, - CPS::Logger::Level logLevel = CPS::Logger::Level::info); + CPS::Logger::Level logLevel = CPS::Logger::Level::info, + CPS::Logger::Level cliLevel = CPS::Logger::Level::info); /// Destructor virtual ~MnaSolverDirect() = default; diff --git a/dpsim/include/dpsim/MNASolverFactory.h b/dpsim/include/dpsim/MNASolverFactory.h index 94217425ea..64875010ab 100644 --- a/dpsim/include/dpsim/MNASolverFactory.h +++ b/dpsim/include/dpsim/MNASolverFactory.h @@ -64,6 +64,7 @@ class MnaSolverFactory { static std::shared_ptr> factory(String name, CPS::Domain domain = CPS::Domain::DP, CPS::Logger::Level logLevel = CPS::Logger::Level::info, + CPS::Logger::Level cliLevel = CPS::Logger::Level::info, DirectLinearSolverImpl implementation = DirectLinearSolverImpl::SparseLU, String pluginName = "plugin.so") { @@ -71,7 +72,7 @@ class MnaSolverFactory { if (implementation == DirectLinearSolverImpl::Undef) { implementation = DirectLinearSolverImpl::SparseLU; } - CPS::Logger::Log log = CPS::Logger::get(CPS::Logger::LoggerType::SIMULATION, "MnaSolverFactory", logLevel, logLevel); + CPS::Logger::Log log = CPS::Logger::get(CPS::Logger::LoggerType::SIMULATION, "MnaSolverFactory", logLevel, cliLevel); switch(implementation) { /* TODO: have only one "solver" object of type MnaSolverDirect and only use setDirectLinearSolverImplementation in the switch-case. @@ -80,14 +81,14 @@ class MnaSolverFactory { case DirectLinearSolverImpl::SparseLU: { SPDLOG_LOGGER_DEBUG(log, "creating SparseLUAdapter solver implementation"); - std::shared_ptr> sparseSolver = std::make_shared>(name, domain, logLevel); + std::shared_ptr> sparseSolver = std::make_shared>(name, domain, logLevel, cliLevel); sparseSolver->setDirectLinearSolverImplementation(DirectLinearSolverImpl::SparseLU); return sparseSolver; } case DirectLinearSolverImpl::DenseLU: { SPDLOG_LOGGER_DEBUG(log, "creating DenseLUAdapter solver implementation"); - std::shared_ptr> denseSolver = std::make_shared>(name, domain, logLevel); + std::shared_ptr> denseSolver = std::make_shared>(name, domain, logLevel, cliLevel); denseSolver->setDirectLinearSolverImplementation(DirectLinearSolverImpl::DenseLU); return denseSolver; } @@ -95,7 +96,7 @@ class MnaSolverFactory { case DirectLinearSolverImpl::KLU: { SPDLOG_LOGGER_DEBUG(log, "creating KLUAdapter solver implementation"); - std::shared_ptr> kluSolver = std::make_shared>(name, domain, logLevel); + std::shared_ptr> kluSolver = std::make_shared>(name, domain, logLevel, cliLevel); kluSolver->setDirectLinearSolverImplementation(DirectLinearSolverImpl::KLU); return kluSolver; } @@ -104,7 +105,7 @@ class MnaSolverFactory { case DirectLinearSolverImpl::CUDADense: { SPDLOG_LOGGER_DEBUG(log, "creating GpuDenseAdapter solver implementation"); - std::shared_ptr> gpuDenseSolver = std::make_shared>(name, domain, logLevel); + std::shared_ptr> gpuDenseSolver = std::make_shared>(name, domain, logLevel, cliLevel); gpuDenseSolver->setDirectLinearSolverImplementation(DirectLinearSolverImpl::CUDADense); return gpuDenseSolver; } @@ -112,7 +113,7 @@ class MnaSolverFactory { case DirectLinearSolverImpl::CUDASparse: { SPDLOG_LOGGER_DEBUG(log, "creating GpuSparseAdapter solver implementation"); - std::shared_ptr> gpuSparseSolver = std::make_shared>(name, domain, logLevel); + std::shared_ptr> gpuSparseSolver = std::make_shared>(name, domain, logLevel, cliLevel); gpuSparseSolver->setDirectLinearSolverImplementation(DirectLinearSolverImpl::CUDASparse); return gpuSparseSolver; } @@ -121,7 +122,7 @@ class MnaSolverFactory { case DirectLinearSolverImpl::CUDAMagma: { SPDLOG_LOGGER_DEBUG(log, "creating GpuMagmaAdapter solver implementation"); - std::shared_ptr> gpuMagmaSolver = std::make_shared>(name, domain, logLevel); + std::shared_ptr> gpuMagmaSolver = std::make_shared>(name, domain, logLevel, cliLevel); gpuMagmaSolver->setDirectLinearSolverImplementation(DirectLinearSolverImpl::CUDAMagma); return gpuMagmaSolver; } @@ -130,7 +131,8 @@ class MnaSolverFactory { #ifdef WITH_MNASOLVERPLUGIN case DirectLinearSolverImpl::Plugin: SPDLOG_LOGGER_DEBUG(log, "creating Plugin solver implementation"); - return std::make_shared>(pluginName, name, domain, logLevel); + return std::make_shared>(pluginName, name, domain, logLevel, cliLevel + ); #endif default: throw CPS::SystemError("unsupported MNA implementation."); diff --git a/dpsim/include/dpsim/MNASolverPlugin.h b/dpsim/include/dpsim/MNASolverPlugin.h index 96800ea7fe..8316032bfd 100644 --- a/dpsim/include/dpsim/MNASolverPlugin.h +++ b/dpsim/include/dpsim/MNASolverPlugin.h @@ -30,7 +30,8 @@ namespace DPsim { MnaSolverPlugin(String pluginName, String name, CPS::Domain domain = CPS::Domain::DP, - CPS::Logger::Level logLevel = CPS::Logger::Level::info); + CPS::Logger::Level logLevel = CPS::Logger::Level::info, + CPS::Logger::Level cliLevel = CPS::Logger::Level::info); virtual ~MnaSolverPlugin(); diff --git a/dpsim/include/dpsim/PFSolver.h b/dpsim/include/dpsim/PFSolver.h index cc80784b1a..d1aa4098f6 100644 --- a/dpsim/include/dpsim/PFSolver.h +++ b/dpsim/include/dpsim/PFSolver.h @@ -137,7 +137,8 @@ namespace DPsim { PFSolver(CPS::String name, CPS::SystemTopology system, Real timeStep, - CPS::Logger::Level logLevel); + CPS::Logger::Level logLevel, + CPS::Logger::Level cliLevel); /// virtual ~PFSolver() { }; diff --git a/dpsim/include/dpsim/PFSolverPowerPolar.h b/dpsim/include/dpsim/PFSolverPowerPolar.h index 2b56c9b3d6..0e6c0630b3 100644 --- a/dpsim/include/dpsim/PFSolverPowerPolar.h +++ b/dpsim/include/dpsim/PFSolverPowerPolar.h @@ -67,7 +67,7 @@ namespace DPsim { void calculateNodalInjection(); public: /// Constructor to be used in simulation examples. - PFSolverPowerPolar(CPS::String name, const CPS::SystemTopology &system, CPS::Real timeStep, CPS::Logger::Level logLevel); + PFSolverPowerPolar(CPS::String name, const CPS::SystemTopology &system, CPS::Real timeStep, CPS::Logger::Level logLevel, CPS::Logger::Level cliLevel); /// virtual ~PFSolverPowerPolar() { }; }; diff --git a/dpsim/src/DiakopticsSolver.cpp b/dpsim/src/DiakopticsSolver.cpp index c53157c184..2a92fb12ac 100644 --- a/dpsim/src/DiakopticsSolver.cpp +++ b/dpsim/src/DiakopticsSolver.cpp @@ -22,8 +22,8 @@ namespace DPsim { template DiakopticsSolver::DiakopticsSolver(String name, SystemTopology system, IdentifiedObject::List tearComponents, - Real timeStep, Logger::Level logLevel) : - Solver(logLevel), + Real timeStep, Logger::Level logLevel, Logger::Level cliLevel) : + Solver(logLevel, cliLevel), mMappedTearCurrents(AttributeStatic::make()), mOrigLeftSideVector(AttributeStatic::make()) { mTimeStep = timeStep; diff --git a/dpsim/src/Event.cpp b/dpsim/src/Event.cpp index 2b05c2bbd2..43a9d72a82 100644 --- a/dpsim/src/Event.cpp +++ b/dpsim/src/Event.cpp @@ -23,6 +23,7 @@ void EventQueue::handleEvents(Real currentTime) { // if current time larger or equal to event time, execute event if ( currentTime > e->mTime || (e->mTime - currentTime) < 100e-9) { e->execute(); + /// FIXME: Use a logger! std::cout << std::scientific << currentTime << ": Handle event time" << std::endl; //std::cout << std::scientific << e->mTime << ": Original event time" << std::endl; //std::cout << std::scientific << (e->mTime - currentTime)*1e9 << ": Difference to specified event time in ns" << std::endl; diff --git a/dpsim/src/MNASolver.cpp b/dpsim/src/MNASolver.cpp index 8fc8d161bb..4a4df74dbf 100644 --- a/dpsim/src/MNASolver.cpp +++ b/dpsim/src/MNASolver.cpp @@ -18,8 +18,8 @@ namespace DPsim { template -MnaSolver::MnaSolver(String name, CPS::Domain domain, CPS::Logger::Level logLevel) : - Solver(logLevel), mDomain(domain) { +MnaSolver::MnaSolver(String name, CPS::Domain domain, CPS::Logger::Level logLevel, CPS::Logger::Level cliLevel) : + Solver(logLevel, cliLevel), mDomain(domain) { // Raw source and solution vector logging mLeftVectorLog = std::make_shared(name + "_LeftVector", logLevel == CPS::Logger::Level::trace); diff --git a/dpsim/src/MNASolverDirect.cpp b/dpsim/src/MNASolverDirect.cpp index fa27f0a6e9..2f1cdbe6b7 100644 --- a/dpsim/src/MNASolverDirect.cpp +++ b/dpsim/src/MNASolverDirect.cpp @@ -15,7 +15,7 @@ using namespace CPS; namespace DPsim { template -MnaSolverDirect::MnaSolverDirect(String name, CPS::Domain domain, CPS::Logger::Level logLevel) : MnaSolver(name, domain, logLevel) { +MnaSolverDirect::MnaSolverDirect(String name, CPS::Domain domain, CPS::Logger::Level logLevel, CPS::Logger::Level cliLevel) : MnaSolver(name, domain, logLevel, cliLevel) { mImplementationInUse = DirectLinearSolverImpl::SparseLU; } @@ -328,7 +328,7 @@ void MnaSolverDirect::logSystemMatrices() { SPDLOG_LOGGER_DEBUG(mSLog, "Initial switch status: {:s}", mCurrentSwitchStatus.to_string()); for (auto sys : mSwitchedMatrices) { - SPDLOG_LOGGER_DEBUG(mSLog, "Switching System matrix {:s} \n{:s}", + SPDLOG_LOGGER_TRACE(mSLog, "Switching System matrix {:s} \n{:s}", sys.first.to_string(), Logger::matrixToString(sys.second[0])); } } diff --git a/dpsim/src/MNASolverPlugin.cpp b/dpsim/src/MNASolverPlugin.cpp index 4347e1c9cb..be7cde3ae5 100644 --- a/dpsim/src/MNASolverPlugin.cpp +++ b/dpsim/src/MNASolverPlugin.cpp @@ -19,8 +19,8 @@ namespace DPsim { template MnaSolverPlugin::MnaSolverPlugin(String pluginName, String name, - CPS::Domain domain, CPS::Logger::Level logLevel) : - MnaSolverDirect(name, domain, logLevel), + CPS::Domain domain, CPS::Logger::Level logLevel, CPS::Logger::Level cliLevel) : + MnaSolverDirect(name, domain, logLevel, cliLevel), mPluginName(pluginName), mPlugin(nullptr), mDlHandle(nullptr) diff --git a/dpsim/src/PFSolver.cpp b/dpsim/src/PFSolver.cpp index 70e315005e..5826cbea7c 100644 --- a/dpsim/src/PFSolver.cpp +++ b/dpsim/src/PFSolver.cpp @@ -13,8 +13,8 @@ using namespace DPsim; using namespace CPS; -PFSolver::PFSolver(CPS::String name, CPS::SystemTopology system, CPS::Real timeStep, CPS::Logger::Level logLevel) : - Solver(logLevel) { +PFSolver::PFSolver(CPS::String name, CPS::SystemTopology system, CPS::Real timeStep, CPS::Logger::Level logLevel, CPS::Logger::Level cliLevel) : + Solver(logLevel, cliLevel) { mSystem = system; mTimeStep = timeStep; } diff --git a/dpsim/src/PFSolverPowerPolar.cpp b/dpsim/src/PFSolverPowerPolar.cpp index d24054207c..b5f91858e2 100644 --- a/dpsim/src/PFSolverPowerPolar.cpp +++ b/dpsim/src/PFSolverPowerPolar.cpp @@ -11,8 +11,8 @@ using namespace DPsim; using namespace CPS; -PFSolverPowerPolar::PFSolverPowerPolar(CPS::String name, const CPS::SystemTopology &system, CPS::Real timeStep, CPS::Logger::Level logLevel) - : PFSolver(name, system, timeStep, logLevel){ } +PFSolverPowerPolar::PFSolverPowerPolar(CPS::String name, const CPS::SystemTopology &system, CPS::Real timeStep, CPS::Logger::Level logLevel, CPS::Logger::Level cliLevel) + : PFSolver(name, system, timeStep, logLevel, cliLevel){ } void PFSolverPowerPolar::generateInitialSolution(Real time, bool keep_last_solution) { resize_sol(mSystem.mNodes.size()); diff --git a/dpsim/src/Simulation.cpp b/dpsim/src/Simulation.cpp index 18d2c3ff4c..f7eb6cc2ad 100644 --- a/dpsim/src/Simulation.cpp +++ b/dpsim/src/Simulation.cpp @@ -99,7 +99,7 @@ void Simulation::createSolvers() { break; #endif /* WITH_SUNDIALS */ case Solver::Type::NRP: - solver = std::make_shared(**mName, mSystem, **mTimeStep, mLogLevel); + solver = std::make_shared(**mName, mSystem, **mTimeStep, mLogLevel, mCliLevel); solver->doInitFromNodesAndTerminals(mInitFromNodesAndTerminals); solver->setSolverAndComponentBehaviour(mSolverBehaviour); solver->initialize(); @@ -145,11 +145,11 @@ void Simulation::createMNASolver() { if (mTearComponents.size() > 0) { // Tear components available, use diakoptics solver = std::make_shared>(**mName, - subnets[net], mTearComponents, **mTimeStep, mLogLevel); + subnets[net], mTearComponents, **mTimeStep, mLogLevel, mCliLevel); } else { // Default case with lu decomposition from mna factory solver = MnaSolverFactory::factory(**mName + copySuffix, mDomain, - mLogLevel, mDirectImpl, mSolverPluginName); + mLogLevel, mCliLevel, mDirectImpl, mSolverPluginName); solver->setTimeStep(**mTimeStep); solver->doSteadyStateInit(**mSteadyStateInit); solver->doFrequencyParallelization(mFreqParallel); From d81463a736eaafb1dbdda419b0fe53ef52324018 Mon Sep 17 00:00:00 2001 From: Jonas Schroeder Date: Wed, 19 Jul 2023 12:50:30 +0000 Subject: [PATCH 20/31] set component cliLevel according to logLevel Signed-off-by: Jonas Schroeder --- dpsim-models/include/dpsim-models/TopologicalPowerComp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dpsim-models/include/dpsim-models/TopologicalPowerComp.h b/dpsim-models/include/dpsim-models/TopologicalPowerComp.h index 9780910201..dc0de5bb4f 100644 --- a/dpsim-models/include/dpsim-models/TopologicalPowerComp.h +++ b/dpsim-models/include/dpsim-models/TopologicalPowerComp.h @@ -49,7 +49,7 @@ namespace CPS { /* We also want to set the CLI loglevel according to the logLevel * std::max(Logger::Level::info, logLevel). But because of excessive * logging to Level::info that is currently infeasible. */ - mSLog(Logger::get(Logger::LoggerType::COMPONENT, name, logLevel, Logger::Level::warn)), + mSLog(Logger::get(Logger::LoggerType::COMPONENT, name, logLevel, std::max(Logger::Level::warn, logLevel))), mLogLevel(logLevel) { } /// Basic constructor that takes name and log level and sets the UID to name as well From 4a0c9e0108c255041fdc7efd553fd1f2b42ac661 Mon Sep 17 00:00:00 2001 From: Jonas Schroeder Date: Mon, 24 Jul 2023 13:13:05 +0000 Subject: [PATCH 21/31] update log levels for component initialize methods Signed-off-by: Jonas Schroeder --- .../src/Base/Base_ReducedOrderSynchronGenerator.cpp | 4 ++-- .../src/DP/DP_Ph1_AvVoltageSourceInverterDQ.cpp | 10 +++++----- dpsim-models/src/DP/DP_Ph1_Capacitor.cpp | 6 +++--- dpsim-models/src/DP/DP_Ph1_CurrentSource.cpp | 2 +- dpsim-models/src/DP/DP_Ph1_Inductor.cpp | 6 +++--- dpsim-models/src/DP/DP_Ph1_Inverter.cpp | 4 ++-- dpsim-models/src/DP/DP_Ph1_PQLoadCS.cpp | 4 ++-- dpsim-models/src/DP/DP_Ph1_PiLine.cpp | 2 +- dpsim-models/src/DP/DP_Ph1_RXLoad.cpp | 2 +- dpsim-models/src/DP/DP_Ph1_RXLoadSwitch.cpp | 2 +- dpsim-models/src/DP/DP_Ph1_ResIndSeries.cpp | 4 ++-- dpsim-models/src/DP/DP_Ph1_Resistor.cpp | 6 +++--- dpsim-models/src/DP/DP_Ph1_RxLine.cpp | 2 +- dpsim-models/src/DP/DP_Ph1_SVC.cpp | 2 +- dpsim-models/src/DP/DP_Ph1_Switch.cpp | 2 +- .../src/DP/DP_Ph1_SynchronGenerator3OrderVBR.cpp | 2 +- .../src/DP/DP_Ph1_SynchronGenerator4OrderTPM.cpp | 2 +- .../src/DP/DP_Ph1_SynchronGenerator4OrderVBR.cpp | 2 +- .../src/DP/DP_Ph1_SynchronGenerator6aOrderVBR.cpp | 2 +- .../src/DP/DP_Ph1_SynchronGenerator6bOrderVBR.cpp | 2 +- dpsim-models/src/DP/DP_Ph1_SynchronGeneratorIdeal.cpp | 2 +- dpsim-models/src/DP/DP_Ph1_SynchronGeneratorTrStab.cpp | 2 +- dpsim-models/src/DP/DP_Ph1_Transformer.cpp | 4 ++-- dpsim-models/src/DP/DP_Ph1_VoltageSource.cpp | 4 ++-- dpsim-models/src/DP/DP_Ph3_Capacitor.cpp | 2 +- dpsim-models/src/DP/DP_Ph3_Inductor.cpp | 2 +- dpsim-models/src/DP/DP_Ph3_Resistor.cpp | 2 +- dpsim-models/src/DP/DP_Ph3_SeriesResistor.cpp | 2 +- dpsim-models/src/DP/DP_Ph3_SeriesSwitch.cpp | 2 +- .../src/DP/DP_Ph3_SynchronGeneratorDQTrapez.cpp | 2 +- dpsim-models/src/EMT/EMT_Ph1_Capacitor.cpp | 2 +- dpsim-models/src/EMT/EMT_Ph1_Inductor.cpp | 2 +- dpsim-models/src/EMT/EMT_Ph1_Resistor.cpp | 2 +- .../src/EMT/EMT_Ph3_AvVoltageSourceInverterDQ.cpp | 10 +++++----- dpsim-models/src/EMT/EMT_Ph3_Capacitor.cpp | 4 ++-- dpsim-models/src/EMT/EMT_Ph3_CurrentSource.cpp | 8 ++++---- dpsim-models/src/EMT/EMT_Ph3_Inductor.cpp | 6 +++--- dpsim-models/src/EMT/EMT_Ph3_RXLoad.cpp | 6 +++--- dpsim-models/src/EMT/EMT_Ph3_Resistor.cpp | 6 +++--- dpsim-models/src/EMT/EMT_Ph3_RxLine.cpp | 2 +- dpsim-models/src/EMT/EMT_Ph3_SeriesResistor.cpp | 2 +- dpsim-models/src/EMT/EMT_Ph3_SeriesSwitch.cpp | 2 +- dpsim-models/src/EMT/EMT_Ph3_Switch.cpp | 2 +- .../src/EMT/EMT_Ph3_SynchronGenerator3OrderVBR.cpp | 2 +- .../src/EMT/EMT_Ph3_SynchronGenerator4OrderVBR.cpp | 2 +- .../src/EMT/EMT_Ph3_SynchronGenerator6aOrderVBR.cpp | 2 +- .../src/EMT/EMT_Ph3_SynchronGenerator6bOrderVBR.cpp | 2 +- dpsim-models/src/EMT/EMT_Ph3_SynchronGeneratorDQ.cpp | 6 +++--- .../src/EMT/EMT_Ph3_SynchronGeneratorIdeal.cpp | 2 +- .../src/EMT/EMT_Ph3_SynchronGeneratorTrStab.cpp | 2 +- dpsim-models/src/EMT/EMT_Ph3_SynchronGeneratorVBR.cpp | 10 +++++----- dpsim-models/src/EMT/EMT_Ph3_Transformer.cpp | 8 ++++---- dpsim-models/src/EMT/EMT_Ph3_VoltageSource.cpp | 8 ++++---- .../src/SP/SP_Ph1_AvVoltageSourceInverterDQ.cpp | 10 +++++----- dpsim-models/src/SP/SP_Ph1_Capacitor.cpp | 6 +++--- dpsim-models/src/SP/SP_Ph1_Inductor.cpp | 6 +++--- dpsim-models/src/SP/SP_Ph1_Load.cpp | 4 ++-- dpsim-models/src/SP/SP_Ph1_NetworkInjection.cpp | 4 ++-- dpsim-models/src/SP/SP_Ph1_PiLine.cpp | 2 +- dpsim-models/src/SP/SP_Ph1_RXLine.cpp | 2 +- dpsim-models/src/SP/SP_Ph1_Resistor.cpp | 6 +++--- dpsim-models/src/SP/SP_Ph1_SolidStateTransformer.cpp | 2 +- dpsim-models/src/SP/SP_Ph1_Switch.cpp | 2 +- .../src/SP/SP_Ph1_SynchronGenerator3OrderVBR.cpp | 2 +- .../src/SP/SP_Ph1_SynchronGenerator4OrderVBR.cpp | 2 +- .../src/SP/SP_Ph1_SynchronGenerator6aOrderVBR.cpp | 2 +- .../src/SP/SP_Ph1_SynchronGenerator6bOrderVBR.cpp | 2 +- dpsim-models/src/SP/SP_Ph1_SynchronGeneratorTrStab.cpp | 2 +- dpsim-models/src/SP/SP_Ph1_Transformer.cpp | 10 +++++----- dpsim-models/src/SP/SP_Ph1_VoltageSource.cpp | 4 ++-- dpsim-models/src/SP/SP_Ph1_varResSwitch.cpp | 10 +++++----- dpsim-models/src/SP/SP_Ph3_Inductor.cpp | 2 +- dpsim-models/src/SP/SP_Ph3_Resistor.cpp | 6 +++--- 73 files changed, 138 insertions(+), 138 deletions(-) diff --git a/dpsim-models/src/Base/Base_ReducedOrderSynchronGenerator.cpp b/dpsim-models/src/Base/Base_ReducedOrderSynchronGenerator.cpp index 07b0f09015..53877383d6 100644 --- a/dpsim-models/src/Base/Base_ReducedOrderSynchronGenerator.cpp +++ b/dpsim-models/src/Base/Base_ReducedOrderSynchronGenerator.cpp @@ -322,7 +322,7 @@ void Base::ReducedOrderSynchronGenerator::initializeFromNodesAndTerminals( // initialize theta and calculate transform matrix **mThetaMech = **mDelta - PI / 2.; - SPDLOG_LOGGER_INFO(this->mSLog, + SPDLOG_LOGGER_DEBUG(this->mSLog, "\n--- Initialization from power flow ---" "\nInitial Vd (per unit): {:f}" "\nInitial Vq (per unit): {:f}" @@ -396,7 +396,7 @@ void Base::ReducedOrderSynchronGenerator::initializeFromNodesAndTermina // initialize theta and calculate transform matrix **mThetaMech = **mDelta - PI / 2.; - SPDLOG_LOGGER_INFO(this->mSLog, + SPDLOG_LOGGER_DEBUG(this->mSLog, "\n--- Initialization from power flow ---" "\nInitial Vd (per unit): {:f}" "\nInitial Vq (per unit): {:f}" diff --git a/dpsim-models/src/DP/DP_Ph1_AvVoltageSourceInverterDQ.cpp b/dpsim-models/src/DP/DP_Ph1_AvVoltageSourceInverterDQ.cpp index 500232efc6..1abe13c25c 100644 --- a/dpsim-models/src/DP/DP_Ph1_AvVoltageSourceInverterDQ.cpp +++ b/dpsim-models/src/DP/DP_Ph1_AvVoltageSourceInverterDQ.cpp @@ -219,25 +219,25 @@ void DP::Ph1::AvVoltageSourceInverterDQ::initializeFromNodesAndTerminals(Real fr matrixStateInit(0,0) = std::arg(mVirtualNodes[3]->initialSingleVoltage()); mPLL->setInitialValues(**mVcq, matrixStateInit, Matrix::Zero(2,1)); - SPDLOG_LOGGER_INFO(mSLog, + SPDLOG_LOGGER_INFO(mSLog, "Terminal 0 connected to {:s} = sim node {:d}", mTerminals[0]->node()->name(), mTerminals[0]->node()->matrixNodeIndex()); + + SPDLOG_LOGGER_DEBUG(mSLog, "\n--- Initialization from powerflow ---" "\nInterface voltage across: {:s}" "\nInterface current: {:s}" "\nTerminal 0 initial voltage: {:s}" - "\nTerminal 0 connected to {:s} = sim node {:d}" "\nVirtual node 0 initial voltage: {:s}" "\nVirtual node 1 initial voltage: {:s}" "\nVirtual node 2 initial voltage: {:s}", Logger::phasorToString((**mIntfVoltage)(0, 0)), Logger::phasorToString((**mIntfCurrent)(0, 0)), Logger::phasorToString(initialSingleVoltage(0)), - mTerminals[0]->node()->name(), mTerminals[0]->node()->matrixNodeIndex(), Logger::phasorToString(mVirtualNodes[0]->initialSingleVoltage()), Logger::phasorToString(mVirtualNodes[1]->initialSingleVoltage()), Logger::phasorToString(mVirtualNodes[2]->initialSingleVoltage())); if (mWithConnectionTransformer) - SPDLOG_LOGGER_INFO(mSLog, "\nVirtual node 3 initial voltage: {:s}", Logger::phasorToString(mVirtualNodes[3]->initialSingleVoltage())); - SPDLOG_LOGGER_INFO(mSLog, "\n--- Initialization from powerflow finished ---"); + SPDLOG_LOGGER_DEBUG(mSLog, "\nVirtual node 3 initial voltage: {:s}", Logger::phasorToString(mVirtualNodes[3]->initialSingleVoltage())); + SPDLOG_LOGGER_DEBUG(mSLog, "\n--- Initialization from powerflow finished ---"); } void DP::Ph1::AvVoltageSourceInverterDQ::mnaParentInitialize(Real omega, Real timeStep, Attribute::Ptr leftVector) { diff --git a/dpsim-models/src/DP/DP_Ph1_Capacitor.cpp b/dpsim-models/src/DP/DP_Ph1_Capacitor.cpp index a1c071ea90..3ed716a2c2 100644 --- a/dpsim-models/src/DP/DP_Ph1_Capacitor.cpp +++ b/dpsim-models/src/DP/DP_Ph1_Capacitor.cpp @@ -40,11 +40,11 @@ void DP::Ph1::Capacitor::initializeFromNodesAndTerminals(Real frequency) { (**mIntfVoltage)(0,0) = initialSingleVoltage(1) - initialSingleVoltage(0); (**mIntfCurrent)(0,0) = (**mIntfVoltage)(0,0) / impedance; - SPDLOG_LOGGER_INFO(mSLog, "\nCapacitance [F]: {:s}" + SPDLOG_LOGGER_DEBUG(mSLog, "\nCapacitance [F]: {:s}" "\nImpedance [Ohm]: {:s}", Logger::realToString(**mCapacitance), Logger::complexToString(impedance)); - SPDLOG_LOGGER_INFO(mSLog, + SPDLOG_LOGGER_DEBUG(mSLog, "\n--- Initialization from powerflow ---" "\nVoltage across: {:s}" "\nCurrent: {:s}" @@ -73,7 +73,7 @@ void DP::Ph1::Capacitor::mnaCompInitialize(Real omega, Real timeStep, Attribute< (**mIntfCurrent)(0, freq) = mEquivCond(freq,0) * (**mIntfVoltage)(0,freq) + mEquivCurrent(freq,0); } - SPDLOG_LOGGER_INFO(mSLog, + SPDLOG_LOGGER_DEBUG(mSLog, "\n--- MNA initialization ---" "\nInitial voltage {:s}" "\nInitial current {:s}" diff --git a/dpsim-models/src/DP/DP_Ph1_CurrentSource.cpp b/dpsim-models/src/DP/DP_Ph1_CurrentSource.cpp index b09402a207..4be9f9a314 100644 --- a/dpsim-models/src/DP/DP_Ph1_CurrentSource.cpp +++ b/dpsim-models/src/DP/DP_Ph1_CurrentSource.cpp @@ -39,7 +39,7 @@ void DP::Ph1::CurrentSource::initializeFromNodesAndTerminals(Real frequency) { (**mIntfVoltage)(0,0) = initialSingleVoltage(0) - initialSingleVoltage(1); (**mIntfCurrent)(0,0) = **mCurrentRef; - SPDLOG_LOGGER_INFO(mSLog, + SPDLOG_LOGGER_DEBUG(mSLog, "\n--- Initialization from powerflow ---" "\nVoltage across: {:s}" "\nCurrent: {:s}" diff --git a/dpsim-models/src/DP/DP_Ph1_Inductor.cpp b/dpsim-models/src/DP/DP_Ph1_Inductor.cpp index f7ceb83737..7b9077b63e 100644 --- a/dpsim-models/src/DP/DP_Ph1_Inductor.cpp +++ b/dpsim-models/src/DP/DP_Ph1_Inductor.cpp @@ -39,11 +39,11 @@ void DP::Ph1::Inductor::initializeFromNodesAndTerminals(Real frequency) { (**mIntfVoltage)(0,0) = initialSingleVoltage(1) - initialSingleVoltage(0); (**mIntfCurrent)(0,0) = (**mIntfVoltage)(0,0) / impedance; - SPDLOG_LOGGER_INFO(mSLog, "\nInductance [H]: {:s}" + SPDLOG_LOGGER_DEBUG(mSLog, "\nInductance [H]: {:s}" "\nImpedance [Ohm]: {:s}", Logger::realToString(**mInductance), Logger::complexToString(impedance)); - SPDLOG_LOGGER_INFO(mSLog, + SPDLOG_LOGGER_DEBUG(mSLog, "\n--- Initialization from powerflow ---" "\nVoltage across: {:s}" "\nCurrent: {:s}" @@ -80,7 +80,7 @@ void DP::Ph1::Inductor::mnaCompInitialize(Real omega, Real timeStep, Attribute::initialize(frequencies); - SPDLOG_LOGGER_INFO(mSLog, "\n--- Initialization ---"); + SPDLOG_LOGGER_DEBUG(mSLog, "\n--- Initialization ---"); // Check that both lists have the same length mCarHarNum = static_cast(mCarHarms.size()); @@ -77,7 +77,7 @@ void DP::Ph1::Inverter::initialize(Matrix frequencies) { mMultInvFactorials[f+mModHarms[h]] = multInvFactorial(f+mModHarms[h]); } - SPDLOG_LOGGER_INFO(mSLog, + SPDLOG_LOGGER_DEBUG(mSLog, "\nFrequencies: \n{}" "\nPhases: \n{}" "\n--- End of initialization ---", diff --git a/dpsim-models/src/DP/DP_Ph1_PQLoadCS.cpp b/dpsim-models/src/DP/DP_Ph1_PQLoadCS.cpp index 076dc4b4e0..cd59fb7826 100644 --- a/dpsim-models/src/DP/DP_Ph1_PQLoadCS.cpp +++ b/dpsim-models/src/DP/DP_Ph1_PQLoadCS.cpp @@ -76,7 +76,7 @@ void DP::Ph1::PQLoadCS::initializeFromNodesAndTerminals(Real frequency) { addMNASubComponent(mSubCurrentSource, MNA_SUBCOMP_TASK_ORDER::TASK_AFTER_PARENT, MNA_SUBCOMP_TASK_ORDER::TASK_BEFORE_PARENT, true); updateIntfValues(); - SPDLOG_LOGGER_INFO(mSLog, + SPDLOG_LOGGER_DEBUG(mSLog, "\n--- Initialization from powerflow ---" "\nVoltage across: {:s}" "\nCurrent: {:s}" @@ -96,7 +96,7 @@ void DP::Ph1::PQLoadCS::updateSetPoint() { //Complex current = power / (**mIntfVoltage)(0,0); **mSubCurrentSource->mCurrentRef = std::conj(current); - SPDLOG_LOGGER_DEBUG(mSLog, + SPDLOG_LOGGER_DEBUG(mSLog, "\n--- update set points ---" "\npower: {:s}" "\nCurrent: {:s}", diff --git a/dpsim-models/src/DP/DP_Ph1_PiLine.cpp b/dpsim-models/src/DP/DP_Ph1_PiLine.cpp index 34e0a72302..b0d49b2e74 100644 --- a/dpsim-models/src/DP/DP_Ph1_PiLine.cpp +++ b/dpsim-models/src/DP/DP_Ph1_PiLine.cpp @@ -90,7 +90,7 @@ void DP::Ph1::PiLine::initializeFromNodesAndTerminals(Real frequency) { addMNASubComponent(mSubParallelCapacitor1, MNA_SUBCOMP_TASK_ORDER::TASK_BEFORE_PARENT, MNA_SUBCOMP_TASK_ORDER::TASK_BEFORE_PARENT, true); } - SPDLOG_LOGGER_INFO(mSLog, + SPDLOG_LOGGER_DEBUG(mSLog, "\n--- Initialization from powerflow ---" "\nVoltage across: {:s}" "\nCurrent: {:s}" diff --git a/dpsim-models/src/DP/DP_Ph1_RXLoad.cpp b/dpsim-models/src/DP/DP_Ph1_RXLoad.cpp index 1c72c6b799..353bb5dec2 100644 --- a/dpsim-models/src/DP/DP_Ph1_RXLoad.cpp +++ b/dpsim-models/src/DP/DP_Ph1_RXLoad.cpp @@ -83,7 +83,7 @@ void DP::Ph1::RXLoad::initializeFromNodesAndTerminals(Real frequency) { (**mIntfVoltage)(0, 0) = mTerminals[0]->initialSingleVoltage(); (**mIntfCurrent)(0, 0) = std::conj(Complex(**mActivePower, **mReactivePower) / (**mIntfVoltage)(0, 0)); - SPDLOG_LOGGER_INFO(mSLog, + SPDLOG_LOGGER_DEBUG(mSLog, "\n--- Initialization from powerflow ---" "\nVoltage across: {:s}" "\nCurrent: {:s}" diff --git a/dpsim-models/src/DP/DP_Ph1_RXLoadSwitch.cpp b/dpsim-models/src/DP/DP_Ph1_RXLoadSwitch.cpp index 68b9a689d4..5c49175cfb 100644 --- a/dpsim-models/src/DP/DP_Ph1_RXLoadSwitch.cpp +++ b/dpsim-models/src/DP/DP_Ph1_RXLoadSwitch.cpp @@ -52,7 +52,7 @@ void DP::Ph1::RXLoadSwitch::initializeFromNodesAndTerminals(Real frequency) { **mIntfVoltage = **mSubRXLoad->mIntfVoltage; **mIntfCurrent = **mSubRXLoad->mIntfCurrent; - SPDLOG_LOGGER_INFO(mSLog, + SPDLOG_LOGGER_DEBUG(mSLog, "\n--- Initialization from powerflow ---" "\nVoltage across: {:s}" "\nCurrent: {:s}" diff --git a/dpsim-models/src/DP/DP_Ph1_ResIndSeries.cpp b/dpsim-models/src/DP/DP_Ph1_ResIndSeries.cpp index 14a5b47a76..011c1f5ec3 100644 --- a/dpsim-models/src/DP/DP_Ph1_ResIndSeries.cpp +++ b/dpsim-models/src/DP/DP_Ph1_ResIndSeries.cpp @@ -48,7 +48,7 @@ void DP::Ph1::ResIndSeries::initializeFromNodesAndTerminals(Real frequency) { (**mIntfVoltage)(0,0) = initialSingleVoltage(1) - initialSingleVoltage(0); (**mIntfCurrent)(0,0) = (**mIntfVoltage)(0,0) / impedance; - SPDLOG_LOGGER_INFO(mSLog, + SPDLOG_LOGGER_DEBUG(mSLog, "\n--- Initialization from powerflow ---" "\nVoltage across: {:s}" "\nCurrent: {:s}" @@ -85,7 +85,7 @@ void DP::Ph1::ResIndSeries::mnaCompInitialize(Real omega, Real timeStep, Attribu updateMatrixNodeIndices(); initVars(timeStep); - SPDLOG_LOGGER_INFO(mSLog, + SPDLOG_LOGGER_DEBUG(mSLog, "\n--- MNA initialization ---" "\nInitial voltage {:s}" "\nInitial current {:s}" diff --git a/dpsim-models/src/DP/DP_Ph1_Resistor.cpp b/dpsim-models/src/DP/DP_Ph1_Resistor.cpp index ff90b346e1..836bee2337 100644 --- a/dpsim-models/src/DP/DP_Ph1_Resistor.cpp +++ b/dpsim-models/src/DP/DP_Ph1_Resistor.cpp @@ -29,11 +29,11 @@ void DP::Ph1::Resistor::initializeFromNodesAndTerminals(Real frequency) { (**mIntfVoltage)(0,0) = initialSingleVoltage(1) - initialSingleVoltage(0); (**mIntfCurrent)(0,0) = (**mIntfVoltage)(0,0) / impedance; - SPDLOG_LOGGER_INFO(mSLog, "\nResistance [Ohm]: {:s}" + SPDLOG_LOGGER_DEBUG(mSLog, "\nResistance [Ohm]: {:s}" "\nImpedance [Ohm]: {:s}", Logger::realToString(**mResistance), Logger::complexToString(impedance)); - SPDLOG_LOGGER_INFO(mSLog, "\n--- Initialization from powerflow ---" + SPDLOG_LOGGER_DEBUG(mSLog, "\n--- Initialization from powerflow ---" "\nVoltage across: {:s}" "\nCurrent: {:s}" "\nTerminal 0 voltage: {:s}" @@ -51,7 +51,7 @@ void DP::Ph1::Resistor::mnaCompInitialize(Real omega, Real timeStep, AttributeinitializeFromNodesAndTerminals(frequency); addMNASubComponent(mInitialResistor, MNA_SUBCOMP_TASK_ORDER::TASK_BEFORE_PARENT, MNA_SUBCOMP_TASK_ORDER::TASK_BEFORE_PARENT, false); - SPDLOG_LOGGER_INFO(mSLog, + SPDLOG_LOGGER_DEBUG(mSLog, "\n--- Initialization from powerflow ---" "\nVoltage across: {:s}" "\nCurrent: {:s}" diff --git a/dpsim-models/src/DP/DP_Ph1_SVC.cpp b/dpsim-models/src/DP/DP_Ph1_SVC.cpp index b91a38b581..1d3e16c3b5 100644 --- a/dpsim-models/src/DP/DP_Ph1_SVC.cpp +++ b/dpsim-models/src/DP/DP_Ph1_SVC.cpp @@ -54,7 +54,7 @@ void DP::Ph1::SVC::initializeFromNodesAndTerminals(Real frequency) { SPDLOG_LOGGER_DEBUG(mSLog, "Using Mechanical Model"); } - SPDLOG_LOGGER_INFO(mSLog, + SPDLOG_LOGGER_DEBUG(mSLog, "\n --- Parameters ---" "\n Controller: T = {} K = {}" "\n Reference Voltage {} [kV]" diff --git a/dpsim-models/src/DP/DP_Ph1_Switch.cpp b/dpsim-models/src/DP/DP_Ph1_Switch.cpp index 645e6cfd72..e673d7f09a 100644 --- a/dpsim-models/src/DP/DP_Ph1_Switch.cpp +++ b/dpsim-models/src/DP/DP_Ph1_Switch.cpp @@ -29,7 +29,7 @@ void DP::Ph1::Switch::initializeFromNodesAndTerminals(Real frequency) { (**mIntfVoltage)(0,0) = initialSingleVoltage(1) - initialSingleVoltage(0); (**mIntfCurrent)(0,0) = (**mIntfVoltage)(0,0) / impedance; - SPDLOG_LOGGER_INFO(mSLog, + SPDLOG_LOGGER_DEBUG(mSLog, "\n--- Initialization from powerflow ---" "\nVoltage across: {:s}" "\nCurrent: {:s}" diff --git a/dpsim-models/src/DP/DP_Ph1_SynchronGenerator3OrderVBR.cpp b/dpsim-models/src/DP/DP_Ph1_SynchronGenerator3OrderVBR.cpp index 32d3a6a99f..295dd140a0 100644 --- a/dpsim-models/src/DP/DP_Ph1_SynchronGenerator3OrderVBR.cpp +++ b/dpsim-models/src/DP/DP_Ph1_SynchronGenerator3OrderVBR.cpp @@ -34,7 +34,7 @@ void DP::Ph1::SynchronGenerator3OrderVBR::specificInitialization() { (**mEdq_t)(0,0) = 0.0; (**mEdq_t)(1,0) = (**mVdq)(1,0) + (**mIdq)(0,0) * mLd_t; - SPDLOG_LOGGER_INFO(mSLog, + SPDLOG_LOGGER_DEBUG(mSLog, "\n--- Model specific initialization ---" "\nInitial Ed_t (per unit): {:f}" "\nInitial Eq_t (per unit): {:f}" diff --git a/dpsim-models/src/DP/DP_Ph1_SynchronGenerator4OrderTPM.cpp b/dpsim-models/src/DP/DP_Ph1_SynchronGenerator4OrderTPM.cpp index a5dde913b5..5729ac2afc 100644 --- a/dpsim-models/src/DP/DP_Ph1_SynchronGenerator4OrderTPM.cpp +++ b/dpsim-models/src/DP/DP_Ph1_SynchronGenerator4OrderTPM.cpp @@ -74,7 +74,7 @@ void DP::Ph1::SynchronGenerator4OrderTPM::specificInitialization() { // initial emf in the dq reference frame (**mEdq_t)(0,0) = (**mVdq)(0,0) - (**mIdq)(1,0) * mLq_t; (**mEdq_t)(1,0) = (**mVdq)(1,0) + (**mIdq)(0,0) * mLd_t; - SPDLOG_LOGGER_INFO(mSLog, + SPDLOG_LOGGER_DEBUG(mSLog, "\n--- Model specific initialization ---" "\nInitial Ed_t (per unit): {:f}" "\nInitial Eq_t (per unit): {:f}" diff --git a/dpsim-models/src/DP/DP_Ph1_SynchronGenerator4OrderVBR.cpp b/dpsim-models/src/DP/DP_Ph1_SynchronGenerator4OrderVBR.cpp index e15b8427cc..7f7676915b 100644 --- a/dpsim-models/src/DP/DP_Ph1_SynchronGenerator4OrderVBR.cpp +++ b/dpsim-models/src/DP/DP_Ph1_SynchronGenerator4OrderVBR.cpp @@ -34,7 +34,7 @@ void DP::Ph1::SynchronGenerator4OrderVBR::specificInitialization() { (**mEdq_t)(0,0) = (**mVdq)(0,0) - (**mIdq)(1,0) * mLq_t; (**mEdq_t)(1,0) = (**mVdq)(1,0) + (**mIdq)(0,0) * mLd_t; - SPDLOG_LOGGER_INFO(mSLog, + SPDLOG_LOGGER_DEBUG(mSLog, "\n--- Model specific initialization ---" "\nInitial Ed_t (per unit): {:f}" "\nInitial Eq_t (per unit): {:f}" diff --git a/dpsim-models/src/DP/DP_Ph1_SynchronGenerator6aOrderVBR.cpp b/dpsim-models/src/DP/DP_Ph1_SynchronGenerator6aOrderVBR.cpp index edc33e4978..3056041e98 100644 --- a/dpsim-models/src/DP/DP_Ph1_SynchronGenerator6aOrderVBR.cpp +++ b/dpsim-models/src/DP/DP_Ph1_SynchronGenerator6aOrderVBR.cpp @@ -41,7 +41,7 @@ void DP::Ph1::SynchronGenerator6aOrderVBR::specificInitialization() { (**mEdq_s)(0,0) = (**mVdq)(0,0) - mLq_s * (**mIdq)(1,0); (**mEdq_s)(1,0) = (**mVdq)(1,0) + mLd_s * (**mIdq)(0,0); - SPDLOG_LOGGER_INFO(mSLog, + SPDLOG_LOGGER_DEBUG(mSLog, "\n--- Model specific initialization ---" "\nInitial Ed_t (per unit): {:f}" "\nInitial Eq_t (per unit): {:f}" diff --git a/dpsim-models/src/DP/DP_Ph1_SynchronGenerator6bOrderVBR.cpp b/dpsim-models/src/DP/DP_Ph1_SynchronGenerator6bOrderVBR.cpp index d119bd8452..d03b7c3195 100644 --- a/dpsim-models/src/DP/DP_Ph1_SynchronGenerator6bOrderVBR.cpp +++ b/dpsim-models/src/DP/DP_Ph1_SynchronGenerator6bOrderVBR.cpp @@ -41,7 +41,7 @@ void DP::Ph1::SynchronGenerator6bOrderVBR::specificInitialization() { (**mEdq_s)(0,0) = (**mVdq)(0,0) - mLq_s * (**mIdq)(1,0); (**mEdq_s)(1,0) = (**mVdq)(1,0) + mLd_s * (**mIdq)(0,0); - SPDLOG_LOGGER_INFO(mSLog, + SPDLOG_LOGGER_DEBUG(mSLog, "\n--- Model specific initialization ---" "\nInitial Ed_t (per unit): {:f}" "\nInitial Eq_t (per unit): {:f}" diff --git a/dpsim-models/src/DP/DP_Ph1_SynchronGeneratorIdeal.cpp b/dpsim-models/src/DP/DP_Ph1_SynchronGeneratorIdeal.cpp index febd7c062c..cc77d13386 100644 --- a/dpsim-models/src/DP/DP_Ph1_SynchronGeneratorIdeal.cpp +++ b/dpsim-models/src/DP/DP_Ph1_SynchronGeneratorIdeal.cpp @@ -38,7 +38,7 @@ void DP::Ph1::SynchronGeneratorIdeal::initializeFromNodesAndTerminals(Real frequ mSubVoltageSource->initializeFromNodesAndTerminals(frequency); addMNASubComponent(mSubVoltageSource, MNA_SUBCOMP_TASK_ORDER::TASK_BEFORE_PARENT, MNA_SUBCOMP_TASK_ORDER::TASK_BEFORE_PARENT, true); - SPDLOG_LOGGER_INFO(mSLog, + SPDLOG_LOGGER_DEBUG(mSLog, "\n--- Initialization from powerflow ---" "\nVoltage across: {:s}" "\nCurrent: {:s}" diff --git a/dpsim-models/src/DP/DP_Ph1_SynchronGeneratorTrStab.cpp b/dpsim-models/src/DP/DP_Ph1_SynchronGeneratorTrStab.cpp index 2a0e742f44..1ff0d7c776 100644 --- a/dpsim-models/src/DP/DP_Ph1_SynchronGeneratorTrStab.cpp +++ b/dpsim-models/src/DP/DP_Ph1_SynchronGeneratorTrStab.cpp @@ -186,7 +186,7 @@ void DP::Ph1::SynchronGeneratorTrStab::initializeFromNodesAndTerminals(Real freq mSubInductor->initializeFromNodesAndTerminals(frequency); addMNASubComponent(mSubInductor, MNA_SUBCOMP_TASK_ORDER::TASK_BEFORE_PARENT, MNA_SUBCOMP_TASK_ORDER::TASK_BEFORE_PARENT, true); - SPDLOG_LOGGER_INFO(mSLog, "\n--- Initialize according to powerflow ---" + SPDLOG_LOGGER_DEBUG(mSLog, "\n--- Initialize according to powerflow ---" "\nTerminal 0 voltage: {:e}<{:e}" "\nVoltage behind reactance: {:e}<{:e}" "\ninitial electrical power: {:e}+j{:e}" diff --git a/dpsim-models/src/DP/DP_Ph1_Transformer.cpp b/dpsim-models/src/DP/DP_Ph1_Transformer.cpp index 87c9a60e5d..67e0bd7b51 100644 --- a/dpsim-models/src/DP/DP_Ph1_Transformer.cpp +++ b/dpsim-models/src/DP/DP_Ph1_Transformer.cpp @@ -143,7 +143,7 @@ void DP::Ph1::Transformer::initializeFromNodesAndTerminals(Real frequency) { subcomp->initializeFromNodesAndTerminals(frequency); } - SPDLOG_LOGGER_INFO(mSLog, + SPDLOG_LOGGER_DEBUG(mSLog, "\n--- Initialization from powerflow ---" "\nVoltage across: {:s}" "\nCurrent: {:s}" @@ -159,7 +159,7 @@ void DP::Ph1::Transformer::initializeFromNodesAndTerminals(Real frequency) { } void DP::Ph1::Transformer::mnaParentInitialize(Real omega, Real timeStep, Attribute::Ptr leftVector) { - SPDLOG_LOGGER_INFO(mSLog, + SPDLOG_LOGGER_DEBUG(mSLog, "\nTerminal 0 connected to {:s} = sim node {:d}" "\nTerminal 1 connected to {:s} = sim node {:d}", mTerminals[0]->node()->name(), mTerminals[0]->node()->matrixNodeIndex(), diff --git a/dpsim-models/src/DP/DP_Ph1_VoltageSource.cpp b/dpsim-models/src/DP/DP_Ph1_VoltageSource.cpp index 1b10489b89..00b28fde4f 100644 --- a/dpsim-models/src/DP/DP_Ph1_VoltageSource.cpp +++ b/dpsim-models/src/DP/DP_Ph1_VoltageSource.cpp @@ -70,7 +70,7 @@ void DP::Ph1::VoltageSource::initializeFromNodesAndTerminals(Real frequency) { mSrcSig = srcSigSine; } - SPDLOG_LOGGER_INFO(mSLog, + SPDLOG_LOGGER_DEBUG(mSLog, "\n--- Initialization from node voltages ---" "\nVoltage across: {:s}" "\nTerminal 0 voltage: {:s}" @@ -99,7 +99,7 @@ void DP::Ph1::VoltageSource::mnaCompInitialize(Real omega, Real timeStep, Attrib (**mIntfVoltage)(0,0) = mSrcSig->getSignal(); - SPDLOG_LOGGER_INFO(mSLog, + SPDLOG_LOGGER_DEBUG(mSLog, "\n--- MNA initialization ---" "\nInitial voltage {:s}" "\nInitial current {:s}" diff --git a/dpsim-models/src/DP/DP_Ph3_Capacitor.cpp b/dpsim-models/src/DP/DP_Ph3_Capacitor.cpp index 8be247b8f8..a70a549059 100644 --- a/dpsim-models/src/DP/DP_Ph3_Capacitor.cpp +++ b/dpsim-models/src/DP/DP_Ph3_Capacitor.cpp @@ -52,7 +52,7 @@ void DP::Ph3::Capacitor::initializeFromNodesAndTerminals(Real frequency) { **mIntfCurrent = susceptance * **mIntfVoltage; - SPDLOG_LOGGER_INFO(mSLog, "\n--- Initialize from power flow ---" ); + SPDLOG_LOGGER_DEBUG(mSLog, "\n--- Initialize from power flow ---" ); // << "Impedance: " << impedance << std::endl // << "Voltage across: " << std::abs((**mIntfVoltage)(0,0)) // << "<" << Math::phaseDeg((**mIntfVoltage)(0,0)) << std::endl diff --git a/dpsim-models/src/DP/DP_Ph3_Inductor.cpp b/dpsim-models/src/DP/DP_Ph3_Inductor.cpp index 67a9abe658..63db891c82 100644 --- a/dpsim-models/src/DP/DP_Ph3_Inductor.cpp +++ b/dpsim-models/src/DP/DP_Ph3_Inductor.cpp @@ -50,7 +50,7 @@ void DP::Ph3::Inductor::initializeFromNodesAndTerminals(Real frequency) { **mIntfCurrent = susceptance * **mIntfVoltage; //TODO - SPDLOG_LOGGER_INFO(mSLog, "--- Initialize according to power flow ---" ); + SPDLOG_LOGGER_DEBUG(mSLog, "--- Initialize according to power flow ---" ); // << "in phase A: " << std::endl // << "Voltage across: " << std::abs((**mIntfVoltage)(0,0)) // << "<" << Math::phaseDeg((**mIntfVoltage)(0,0)) << std::endl diff --git a/dpsim-models/src/DP/DP_Ph3_Resistor.cpp b/dpsim-models/src/DP/DP_Ph3_Resistor.cpp index 8b2cfb9faf..63efe37b77 100644 --- a/dpsim-models/src/DP/DP_Ph3_Resistor.cpp +++ b/dpsim-models/src/DP/DP_Ph3_Resistor.cpp @@ -37,7 +37,7 @@ void DP::Ph3::Resistor::initializeFromNodesAndTerminals(Real frequency) { voltMag * sin(voltPhase + 2. / 3. * M_PI)); **mIntfCurrent = (**mResistance).inverse() * **mIntfVoltage; - SPDLOG_LOGGER_INFO(mSLog, "\n--- Initialization from powerflow ---" + SPDLOG_LOGGER_DEBUG(mSLog, "\n--- Initialization from powerflow ---" "\nVoltage across amplitude and phase: \n{:s}" "\nCurrent amplitude and phase: \n{:s}" "\nTerminal 0 voltage amplitude and phase: \n{:s}" diff --git a/dpsim-models/src/DP/DP_Ph3_SeriesResistor.cpp b/dpsim-models/src/DP/DP_Ph3_SeriesResistor.cpp index 22349c697b..1cc6f924f0 100644 --- a/dpsim-models/src/DP/DP_Ph3_SeriesResistor.cpp +++ b/dpsim-models/src/DP/DP_Ph3_SeriesResistor.cpp @@ -47,7 +47,7 @@ void DP::Ph3::SeriesResistor::initializeFromNodesAndTerminals(Real frequency) { **mIntfCurrent = impedance.cwiseInverse().cwiseProduct(**mIntfVoltage); - SPDLOG_LOGGER_INFO(mSLog, "\n--- Initialization from powerflow ---" + SPDLOG_LOGGER_DEBUG(mSLog, "\n--- Initialization from powerflow ---" "\nVoltage across amplitude and phase: \n{:s}" "\nCurrent amplitude and phase: \n{:s}" "\nTerminal 0 voltage amplitude and phase: \n{:s}" diff --git a/dpsim-models/src/DP/DP_Ph3_SeriesSwitch.cpp b/dpsim-models/src/DP/DP_Ph3_SeriesSwitch.cpp index d8d072946a..d1aa040694 100644 --- a/dpsim-models/src/DP/DP_Ph3_SeriesSwitch.cpp +++ b/dpsim-models/src/DP/DP_Ph3_SeriesSwitch.cpp @@ -23,7 +23,7 @@ void DP::Ph3::SeriesSwitch::initializeFromNodesAndTerminals(Real frequency) { **mIntfVoltage = initialVoltage(1) - initialVoltage(0); **mIntfCurrent = **mIntfVoltage / impedance; - SPDLOG_LOGGER_INFO(mSLog, "\n--- Initialization from powerflow ---" + SPDLOG_LOGGER_DEBUG(mSLog, "\n--- Initialization from powerflow ---" "\nVoltage across phasor: \n{}" "\nCurrent phasor: \n{}" "\nTerminal 0 voltage phasor: \n{}" diff --git a/dpsim-models/src/DP/DP_Ph3_SynchronGeneratorDQTrapez.cpp b/dpsim-models/src/DP/DP_Ph3_SynchronGeneratorDQTrapez.cpp index 7f60b05df7..e4b5153e8b 100644 --- a/dpsim-models/src/DP/DP_Ph3_SynchronGeneratorDQTrapez.cpp +++ b/dpsim-models/src/DP/DP_Ph3_SynchronGeneratorDQTrapez.cpp @@ -22,7 +22,7 @@ void DP::Ph3::SynchronGeneratorDQTrapez::mnaCompInitialize(Real omega, Real time updateMatrixNodeIndices(); mTimeStep = timeStep; - SPDLOG_LOGGER_INFO(mSLog, + SPDLOG_LOGGER_DEBUG(mSLog, "\nFluxStateSpaceMat: \n{}" "\nOmegaFluxMat: \n{}" "\nResistances: {} {} {}", diff --git a/dpsim-models/src/EMT/EMT_Ph1_Capacitor.cpp b/dpsim-models/src/EMT/EMT_Ph1_Capacitor.cpp index af095071b6..5f6904fbde 100644 --- a/dpsim-models/src/EMT/EMT_Ph1_Capacitor.cpp +++ b/dpsim-models/src/EMT/EMT_Ph1_Capacitor.cpp @@ -31,7 +31,7 @@ void EMT::Ph1::Capacitor::initializeFromNodesAndTerminals(Real frequency) { (**mIntfVoltage)(0,0) = (initialSingleVoltage(1) - initialSingleVoltage(0)).real(); (**mIntfCurrent)(0,0) = ((initialSingleVoltage(1) - initialSingleVoltage(0)) / impedance).real(); - SPDLOG_LOGGER_INFO(mSLog, + SPDLOG_LOGGER_DEBUG(mSLog, "\n--- Initialization from powerflow ---" "\nVoltage across: {:f}" "\nCurrent: {:f}" diff --git a/dpsim-models/src/EMT/EMT_Ph1_Inductor.cpp b/dpsim-models/src/EMT/EMT_Ph1_Inductor.cpp index f10766a7d6..655b90b4e4 100644 --- a/dpsim-models/src/EMT/EMT_Ph1_Inductor.cpp +++ b/dpsim-models/src/EMT/EMT_Ph1_Inductor.cpp @@ -31,7 +31,7 @@ void EMT::Ph1::Inductor::initializeFromNodesAndTerminals(Real frequency) { (**mIntfVoltage)(0,0) = (initialSingleVoltage(1) - initialSingleVoltage(0)).real(); (**mIntfCurrent)(0,0) = ((initialSingleVoltage(1) - initialSingleVoltage(0)) / impedance).real(); - SPDLOG_LOGGER_INFO(mSLog, + SPDLOG_LOGGER_DEBUG(mSLog, "\n--- Initialization from powerflow ---" "\nVoltage across: {:f}" "\nCurrent: {:f}" diff --git a/dpsim-models/src/EMT/EMT_Ph1_Resistor.cpp b/dpsim-models/src/EMT/EMT_Ph1_Resistor.cpp index 799a3813ab..fdc84a2bb4 100644 --- a/dpsim-models/src/EMT/EMT_Ph1_Resistor.cpp +++ b/dpsim-models/src/EMT/EMT_Ph1_Resistor.cpp @@ -28,7 +28,7 @@ void EMT::Ph1::Resistor::initializeFromNodesAndTerminals(Real frequency) { (**mIntfVoltage)(0,0) = (initialSingleVoltage(1) - initialSingleVoltage(0)).real(); (**mIntfCurrent)(0,0) = (**mIntfVoltage)(0,0) / **mResistance; - SPDLOG_LOGGER_INFO(mSLog, + SPDLOG_LOGGER_DEBUG(mSLog, "\n--- Initialization from powerflow ---" "\nVoltage across: {:f}" "\nCurrent: {:f}" diff --git a/dpsim-models/src/EMT/EMT_Ph3_AvVoltageSourceInverterDQ.cpp b/dpsim-models/src/EMT/EMT_Ph3_AvVoltageSourceInverterDQ.cpp index d643f37794..fcd6a9103e 100644 --- a/dpsim-models/src/EMT/EMT_Ph3_AvVoltageSourceInverterDQ.cpp +++ b/dpsim-models/src/EMT/EMT_Ph3_AvVoltageSourceInverterDQ.cpp @@ -234,25 +234,25 @@ void EMT::Ph3::AvVoltageSourceInverterDQ::initializeFromNodesAndTerminals(Real f matrixOutputInit(0,0) = std::arg(mVirtualNodes[3]->initialSingleVoltage()); mPLL->setInitialValues(**mVcq, matrixStateInit, matrixOutputInit); - SPDLOG_LOGGER_INFO(mSLog, + SPDLOG_LOGGER_INFO(mSLog, "Terminal 0 connected to {:s} = sim node {:d}", mTerminals[0]->node()->name(), mTerminals[0]->node()->matrixNodeIndex()); + + SPDLOG_LOGGER_DEBUG(mSLog, "\n--- Initialization from powerflow ---" "\nInterface voltage across: {:s}" "\nInterface current: {:s}" "\nTerminal 0 initial voltage: {:s}" - "\nTerminal 0 connected to {:s} = sim node {:d}" "\nVirtual node 0 initial voltage: {:s}" "\nVirtual node 1 initial voltage: {:s}" "\nVirtual node 2 initial voltage: {:s}", Logger::phasorToString(intfVoltageComplex(0, 0)), Logger::phasorToString(intfCurrentComplex(0, 0)), Logger::phasorToString(initialSingleVoltage(0)), - mTerminals[0]->node()->name(), mTerminals[0]->node()->matrixNodeIndex(), Logger::phasorToString(mVirtualNodes[0]->initialSingleVoltage()), Logger::phasorToString(mVirtualNodes[1]->initialSingleVoltage()), Logger::phasorToString(mVirtualNodes[2]->initialSingleVoltage())); if (mWithConnectionTransformer) - SPDLOG_LOGGER_INFO(mSLog, "\nVirtual node 3 initial voltage: {:s}", Logger::phasorToString(mVirtualNodes[3]->initialSingleVoltage())); - SPDLOG_LOGGER_INFO(mSLog, "\n--- Initialization from powerflow finished ---"); + SPDLOG_LOGGER_DEBUG(mSLog, "\nVirtual node 3 initial voltage: {:s}", Logger::phasorToString(mVirtualNodes[3]->initialSingleVoltage())); + SPDLOG_LOGGER_DEBUG(mSLog, "\n--- Initialization from powerflow finished ---"); } void EMT::Ph3::AvVoltageSourceInverterDQ::mnaParentInitialize(Real omega, Real timeStep, Attribute::Ptr leftVector) { diff --git a/dpsim-models/src/EMT/EMT_Ph3_Capacitor.cpp b/dpsim-models/src/EMT/EMT_Ph3_Capacitor.cpp index 14506a6e55..54bd2e91cf 100644 --- a/dpsim-models/src/EMT/EMT_Ph3_Capacitor.cpp +++ b/dpsim-models/src/EMT/EMT_Ph3_Capacitor.cpp @@ -41,11 +41,11 @@ void EMT::Ph3::Capacitor::initializeFromNodesAndTerminals(Real frequency) { **mIntfVoltage = vInitABC.real(); **mIntfCurrent = (admittance * vInitABC).real(); - SPDLOG_LOGGER_INFO(mSLog, "\nCapacitance [F]: {:s}" + SPDLOG_LOGGER_DEBUG(mSLog, "\nCapacitance [F]: {:s}" "\nAdmittance [S]: {:s}", Logger::matrixToString(**mCapacitance), Logger::matrixCompToString(admittance)); - SPDLOG_LOGGER_INFO(mSLog, + SPDLOG_LOGGER_DEBUG(mSLog, "\n--- Initialization from powerflow ---" "\nVoltage across: {:s}" "\nCurrent: {:s}" diff --git a/dpsim-models/src/EMT/EMT_Ph3_CurrentSource.cpp b/dpsim-models/src/EMT/EMT_Ph3_CurrentSource.cpp index c4902b2609..b8e7656409 100644 --- a/dpsim-models/src/EMT/EMT_Ph3_CurrentSource.cpp +++ b/dpsim-models/src/EMT/EMT_Ph3_CurrentSource.cpp @@ -25,7 +25,7 @@ EMT::Ph3::CurrentSource::CurrentSource(String uid, String name, Logger::Level lo void EMT::Ph3::CurrentSource::initializeFromNodesAndTerminals(Real frequency) { - SPDLOG_LOGGER_INFO(mSLog, "\n--- Initialization from node voltages and terminal ---"); + SPDLOG_LOGGER_DEBUG(mSLog, "\n--- Initialization from node voltages and terminal ---"); if (!mParametersSet) { auto srcSigSine = Signal::SineWaveGenerator::make(**mName + "_sw", Logger::Level::off); // Complex(1,0) is used as initialPhasor for signal generator as only phase is used @@ -41,7 +41,7 @@ void EMT::Ph3::CurrentSource::initializeFromNodesAndTerminals(Real frequency) { **mCurrentRef = CPS::Math::singlePhaseVariableToThreePhase(i_ref); mSrcFreq->setReference(mSrcSig->attributeTyped("freq")); - SPDLOG_LOGGER_INFO(mSLog, "\nReference current: {:s}" + SPDLOG_LOGGER_DEBUG(mSLog, "\nReference current: {:s}" "\nReference voltage: {:s}" "\nReference power: {:s}" "\nTerminal 0 voltage: {:s}" @@ -56,11 +56,11 @@ void EMT::Ph3::CurrentSource::initializeFromNodesAndTerminals(Real frequency) { Logger::complexToString(terminal(0)->singlePower()), Logger::complexToString(terminal(1)->singlePower())); } else { - SPDLOG_LOGGER_INFO(mSLog, "\nInitialization from node voltages and terminal omitted (parameter already set)." + SPDLOG_LOGGER_DEBUG(mSLog, "\nInitialization from node voltages and terminal omitted (parameter already set)." "\nReference voltage: {:s}", Logger::matrixCompToString(attributeTyped("I_ref")->get())); } - SPDLOG_LOGGER_INFO(mSLog, "\n--- Initialization from node voltages and terminal ---"); + SPDLOG_LOGGER_DEBUG(mSLog, "\n--- Initialization from node voltages and terminal ---"); mSLog->flush(); } diff --git a/dpsim-models/src/EMT/EMT_Ph3_Inductor.cpp b/dpsim-models/src/EMT/EMT_Ph3_Inductor.cpp index 35645812ae..c140b64e6e 100644 --- a/dpsim-models/src/EMT/EMT_Ph3_Inductor.cpp +++ b/dpsim-models/src/EMT/EMT_Ph3_Inductor.cpp @@ -42,11 +42,11 @@ void EMT::Ph3::Inductor::initializeFromNodesAndTerminals(Real frequency) { MatrixComp admittance = impedance.inverse(); **mIntfCurrent = (admittance * vInitABC).real(); - SPDLOG_LOGGER_INFO(mSLog, "\nInductance [H]: {:s}" + SPDLOG_LOGGER_DEBUG(mSLog, "\nInductance [H]: {:s}" "\nImpedance [Ohm]: {:s}", Logger::matrixToString(**mInductance), Logger::matrixCompToString(impedance)); - SPDLOG_LOGGER_INFO(mSLog, + SPDLOG_LOGGER_DEBUG(mSLog, "\n--- Initialization from powerflow ---" "\nVoltage across: {:s}" "\nCurrent: {:s}" @@ -66,7 +66,7 @@ void EMT::Ph3::Inductor::mnaCompInitialize(Real omega, Real timeStep, Attribute< // Update internal state mEquivCurrent = mEquivCond * **mIntfVoltage + **mIntfCurrent; - SPDLOG_LOGGER_INFO(mSLog, + SPDLOG_LOGGER_DEBUG(mSLog, "\n--- MNA initialization ---" "\nInitial voltage {:s}" "\nInitial current {:s}" diff --git a/dpsim-models/src/EMT/EMT_Ph3_RXLoad.cpp b/dpsim-models/src/EMT/EMT_Ph3_RXLoad.cpp index c8d63e4901..8138096061 100644 --- a/dpsim-models/src/EMT/EMT_Ph3_RXLoad.cpp +++ b/dpsim-models/src/EMT/EMT_Ph3_RXLoad.cpp @@ -92,11 +92,11 @@ void EMT::Ph3::RXLoad::initializeFromNodesAndTerminals(Real frequency) { **mNomVoltage = std::abs(mTerminals[0]->initialSingleVoltage()); - SPDLOG_LOGGER_INFO(mSLog, "\nActive Power [W]: {}" + SPDLOG_LOGGER_DEBUG(mSLog, "\nActive Power [W]: {}" "\nReactive Power [VAr]: {}", Logger::matrixToString(**mActivePower), Logger::matrixToString(**mReactivePower)); - SPDLOG_LOGGER_INFO(mSLog, "Nominal Voltage={} [V]", **mNomVoltage); + SPDLOG_LOGGER_DEBUG(mSLog, "Nominal Voltage={} [V]", **mNomVoltage); } if ((**mActivePower)(0,0) != 0) { @@ -151,7 +151,7 @@ void EMT::Ph3::RXLoad::initializeFromNodesAndTerminals(Real frequency) { iInitABC = rhs_.conjugate().transpose(); **mIntfCurrent = iInitABC.real(); - SPDLOG_LOGGER_INFO(mSLog, + SPDLOG_LOGGER_DEBUG(mSLog, "\n--- Initialization from powerflow ---" "\nVoltage across: {:s}" "\nCurrent: {:s}" diff --git a/dpsim-models/src/EMT/EMT_Ph3_Resistor.cpp b/dpsim-models/src/EMT/EMT_Ph3_Resistor.cpp index 8756885a6b..7e89ede8e3 100644 --- a/dpsim-models/src/EMT/EMT_Ph3_Resistor.cpp +++ b/dpsim-models/src/EMT/EMT_Ph3_Resistor.cpp @@ -40,11 +40,11 @@ void EMT::Ph3::Resistor::initializeFromNodesAndTerminals(Real frequency) { Math::invertMatrix(**mResistance, mResistanceInv); **mIntfCurrent = (mResistanceInv * vInitABC).real(); - SPDLOG_LOGGER_INFO(mSLog, "\nResistance [Ohm]: {:s}" + SPDLOG_LOGGER_DEBUG(mSLog, "\nResistance [Ohm]: {:s}" "\nConductance [S]: {:s}", Logger::matrixToString(**mResistance), Logger::matrixToString(mResistanceInv)); - SPDLOG_LOGGER_INFO(mSLog, + SPDLOG_LOGGER_DEBUG(mSLog, "\n--- Initialization from powerflow ---" "\nVoltage across: {:s}" "\nCurrent: {:s}" @@ -116,7 +116,7 @@ void EMT::Ph3::Resistor::mnaCompApplySystemMatrixStamp(SparseMatrixRow& systemMa Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 2), matrixNodeIndex(0, 2), -conductance(2, 2)); } - SPDLOG_LOGGER_INFO(mSLog, + SPDLOG_LOGGER_DEBUG(mSLog, "\nConductance matrix: {:s}", Logger::matrixToString(conductance)); } diff --git a/dpsim-models/src/EMT/EMT_Ph3_RxLine.cpp b/dpsim-models/src/EMT/EMT_Ph3_RxLine.cpp index 077727e9ce..38f9a13eae 100644 --- a/dpsim-models/src/EMT/EMT_Ph3_RxLine.cpp +++ b/dpsim-models/src/EMT/EMT_Ph3_RxLine.cpp @@ -83,7 +83,7 @@ void EMT::Ph3::RxLine::initializeFromNodesAndTerminals(Real frequency) { mInitialResistor->initializeFromNodesAndTerminals(frequency); addMNASubComponent(mInitialResistor, MNA_SUBCOMP_TASK_ORDER::TASK_BEFORE_PARENT, MNA_SUBCOMP_TASK_ORDER::TASK_BEFORE_PARENT, false); - SPDLOG_LOGGER_INFO(mSLog, + SPDLOG_LOGGER_DEBUG(mSLog, "\n--- Initialization from powerflow ---" "\nVoltage across: {:s}" "\nCurrent: {:s}" diff --git a/dpsim-models/src/EMT/EMT_Ph3_SeriesResistor.cpp b/dpsim-models/src/EMT/EMT_Ph3_SeriesResistor.cpp index c1a850ecaa..369b1bae64 100644 --- a/dpsim-models/src/EMT/EMT_Ph3_SeriesResistor.cpp +++ b/dpsim-models/src/EMT/EMT_Ph3_SeriesResistor.cpp @@ -37,7 +37,7 @@ void EMT::Ph3::SeriesResistor::initializeFromNodesAndTerminals(Real frequency) { **mIntfCurrent = **mIntfVoltage / **mResistance; - SPDLOG_LOGGER_INFO(mSLog, "\n--- Initialization from powerflow ---" + SPDLOG_LOGGER_DEBUG(mSLog, "\n--- Initialization from powerflow ---" "\nVoltage across amplitude and phase: \n{}" "\nCurrent amplitude and phase: \n{}" "\nTerminal 0 voltage amplitude and phase: \n{}" diff --git a/dpsim-models/src/EMT/EMT_Ph3_SeriesSwitch.cpp b/dpsim-models/src/EMT/EMT_Ph3_SeriesSwitch.cpp index 1a8380fd5f..ecddbd84e2 100644 --- a/dpsim-models/src/EMT/EMT_Ph3_SeriesSwitch.cpp +++ b/dpsim-models/src/EMT/EMT_Ph3_SeriesSwitch.cpp @@ -37,7 +37,7 @@ void EMT::Ph3::SeriesSwitch::initializeFromNodesAndTerminals(Real frequency) { **mIntfCurrent = **mIntfVoltage / impedance; - SPDLOG_LOGGER_INFO(mSLog, "\n--- Initialization from powerflow ---" + SPDLOG_LOGGER_DEBUG(mSLog, "\n--- Initialization from powerflow ---" "\nVoltage across amplitude and phase: \n{}" "\nCurrent amplitude and phase: \n{}" "\nTerminal 0 voltage amplitude and phase: \n{}" diff --git a/dpsim-models/src/EMT/EMT_Ph3_Switch.cpp b/dpsim-models/src/EMT/EMT_Ph3_Switch.cpp index 7a2299e850..bb89785719 100644 --- a/dpsim-models/src/EMT/EMT_Ph3_Switch.cpp +++ b/dpsim-models/src/EMT/EMT_Ph3_Switch.cpp @@ -36,7 +36,7 @@ void EMT::Ph3::Switch::initializeFromNodesAndTerminals(Real frequency) { **mIntfVoltage = vInitABC.real(); **mIntfCurrent = (impedance.inverse() * vInitABC).real(); - SPDLOG_LOGGER_INFO(mSLog, + SPDLOG_LOGGER_DEBUG(mSLog, "\n--- Initialization from powerflow ---" "\nVoltage across: {:s}" "\nCurrent: {:s}" diff --git a/dpsim-models/src/EMT/EMT_Ph3_SynchronGenerator3OrderVBR.cpp b/dpsim-models/src/EMT/EMT_Ph3_SynchronGenerator3OrderVBR.cpp index 9502bd5d26..7753ebf177 100644 --- a/dpsim-models/src/EMT/EMT_Ph3_SynchronGenerator3OrderVBR.cpp +++ b/dpsim-models/src/EMT/EMT_Ph3_SynchronGenerator3OrderVBR.cpp @@ -32,7 +32,7 @@ void EMT::Ph3::SynchronGenerator3OrderVBR::specificInitialization() { // initial voltage behind the transient reactance in the dq0 reference frame (**mEdq0_t)(1,0) = (**mVdq0)(1,0) + (**mIdq0)(0,0) * mLd_t; - SPDLOG_LOGGER_INFO(mSLog, + SPDLOG_LOGGER_DEBUG(mSLog, "\n--- Model specific initialization ---" "\nInitial Eq_t (per unit): {:f}" "\n--- Model specific initialization finished ---", diff --git a/dpsim-models/src/EMT/EMT_Ph3_SynchronGenerator4OrderVBR.cpp b/dpsim-models/src/EMT/EMT_Ph3_SynchronGenerator4OrderVBR.cpp index 3df2e817f6..7d3b52c7ad 100644 --- a/dpsim-models/src/EMT/EMT_Ph3_SynchronGenerator4OrderVBR.cpp +++ b/dpsim-models/src/EMT/EMT_Ph3_SynchronGenerator4OrderVBR.cpp @@ -33,7 +33,7 @@ void EMT::Ph3::SynchronGenerator4OrderVBR::specificInitialization() { (**mEdq0_t)(0,0) = (**mVdq0)(0,0) - (**mIdq0)(1,0) * mLq_t; (**mEdq0_t)(1,0) = (**mVdq0)(1,0) + (**mIdq0)(0,0) * mLd_t; - SPDLOG_LOGGER_INFO(mSLog, + SPDLOG_LOGGER_DEBUG(mSLog, "\n--- Model specific initialization ---" "\nInitial Ed_t (per unit): {:f}" "\nInitial Eq_t (per unit): {:f}" diff --git a/dpsim-models/src/EMT/EMT_Ph3_SynchronGenerator6aOrderVBR.cpp b/dpsim-models/src/EMT/EMT_Ph3_SynchronGenerator6aOrderVBR.cpp index 73669df2f4..e15402c63b 100644 --- a/dpsim-models/src/EMT/EMT_Ph3_SynchronGenerator6aOrderVBR.cpp +++ b/dpsim-models/src/EMT/EMT_Ph3_SynchronGenerator6aOrderVBR.cpp @@ -40,7 +40,7 @@ void EMT::Ph3::SynchronGenerator6aOrderVBR::specificInitialization() { (**mEdq0_s)(0,0) = (**mVdq0)(0,0) - mLq_s * (**mIdq0)(1,0); (**mEdq0_s)(1,0) = (**mVdq0)(1,0) + mLd_s * (**mIdq0)(0,0); - SPDLOG_LOGGER_INFO(mSLog, + SPDLOG_LOGGER_DEBUG(mSLog, "\n--- Model specific initialization ---" "\nInitial Ed_t (per unit): {:f}" "\nInitial Eq_t (per unit): {:f}" diff --git a/dpsim-models/src/EMT/EMT_Ph3_SynchronGenerator6bOrderVBR.cpp b/dpsim-models/src/EMT/EMT_Ph3_SynchronGenerator6bOrderVBR.cpp index a2cd363636..417460492a 100644 --- a/dpsim-models/src/EMT/EMT_Ph3_SynchronGenerator6bOrderVBR.cpp +++ b/dpsim-models/src/EMT/EMT_Ph3_SynchronGenerator6bOrderVBR.cpp @@ -40,7 +40,7 @@ void EMT::Ph3::SynchronGenerator6bOrderVBR::specificInitialization() { (**mEdq0_s)(0,0) = (**mVdq0)(0,0) - mLq_s * (**mIdq0)(1,0); (**mEdq0_s)(1,0) = (**mVdq0)(1,0) + mLd_s * (**mIdq0)(0,0); - SPDLOG_LOGGER_INFO(mSLog, + SPDLOG_LOGGER_DEBUG(mSLog, "\n--- Model specific initialization ---" "\nInitial Ed_t (per unit): {:f}" "\nInitial Eq_t (per unit): {:f}" diff --git a/dpsim-models/src/EMT/EMT_Ph3_SynchronGeneratorDQ.cpp b/dpsim-models/src/EMT/EMT_Ph3_SynchronGeneratorDQ.cpp index 1e4b3be970..4136f2ddf8 100644 --- a/dpsim-models/src/EMT/EMT_Ph3_SynchronGeneratorDQ.cpp +++ b/dpsim-models/src/EMT/EMT_Ph3_SynchronGeneratorDQ.cpp @@ -131,7 +131,7 @@ void EMT::Ph3::SynchronGeneratorDQ::applyParametersOperationalPerUnit() { void EMT::Ph3::SynchronGeneratorDQ::initializeFromNodesAndTerminals(Real frequency) { if(!mInitialValuesSet) { - SPDLOG_LOGGER_INFO(mSLog, "--- Initialization from powerflow ---"); + SPDLOG_LOGGER_DEBUG(mSLog, "--- Initialization from powerflow ---"); // terminal powers in consumer system -> convert to generator system Real activePower = -terminal(0)->singlePower().real(); @@ -142,14 +142,14 @@ void EMT::Ph3::SynchronGeneratorDQ::initializeFromNodesAndTerminals(Real frequen this->setInitialValues(activePower, reactivePower, voltMagnitude, Math::phase(initialSingleVoltage(0)), activePower); - SPDLOG_LOGGER_INFO(mSLog, "\nTerminal 0 voltage: {:s}" + SPDLOG_LOGGER_DEBUG(mSLog, "\nTerminal 0 voltage: {:s}" "\nTerminal 0 power: {:s}" "\n--- Initialization from powerflow finished ---", Logger::phasorToString(initialSingleVoltage(0)), Logger::complexToString(terminal(0)->singlePower())); mSLog->flush(); } else { - SPDLOG_LOGGER_INFO(mSLog, "Initial values already set, skipping initializeFromNodesAndTerminals."); + SPDLOG_LOGGER_DEBUG(mSLog, "Initial values already set, skipping initializeFromNodesAndTerminals."); mSLog->flush(); } } diff --git a/dpsim-models/src/EMT/EMT_Ph3_SynchronGeneratorIdeal.cpp b/dpsim-models/src/EMT/EMT_Ph3_SynchronGeneratorIdeal.cpp index ab34087215..f6b3597d5d 100644 --- a/dpsim-models/src/EMT/EMT_Ph3_SynchronGeneratorIdeal.cpp +++ b/dpsim-models/src/EMT/EMT_Ph3_SynchronGeneratorIdeal.cpp @@ -59,7 +59,7 @@ void EMT::Ph3::SynchronGeneratorIdeal::initializeFromNodesAndTerminals(Real freq if (mSourceType == CPS::GeneratorType::IdealVoltageSource) mRefVoltage->setReference(mSubComponents[0]->attributeTyped("V_ref")); - SPDLOG_LOGGER_INFO(mSLog, + SPDLOG_LOGGER_DEBUG(mSLog, "\n--- Initialization from powerflow ---" "\nTerminal 0 voltage: {:s}" "\nTerminal 0 power: {:s}" diff --git a/dpsim-models/src/EMT/EMT_Ph3_SynchronGeneratorTrStab.cpp b/dpsim-models/src/EMT/EMT_Ph3_SynchronGeneratorTrStab.cpp index f708ff54f2..84df0c6381 100644 --- a/dpsim-models/src/EMT/EMT_Ph3_SynchronGeneratorTrStab.cpp +++ b/dpsim-models/src/EMT/EMT_Ph3_SynchronGeneratorTrStab.cpp @@ -195,7 +195,7 @@ void EMT::Ph3::SynchronGeneratorTrStab::initializeFromNodesAndTerminals(Real fre mSubInductor->initializeFromNodesAndTerminals(frequency); addMNASubComponent(mSubInductor, MNA_SUBCOMP_TASK_ORDER::TASK_AFTER_PARENT, MNA_SUBCOMP_TASK_ORDER::TASK_BEFORE_PARENT, true); - SPDLOG_LOGGER_INFO(mSLog, "\n--- Initialize according to powerflow ---" + SPDLOG_LOGGER_DEBUG(mSLog, "\n--- Initialize according to powerflow ---" "\nTerminal 0 voltage: {:e}<{:e}" "\nVoltage behind reactance: {:e}<{:e}" "\ninitial electrical power: {:e}+j{:e}" diff --git a/dpsim-models/src/EMT/EMT_Ph3_SynchronGeneratorVBR.cpp b/dpsim-models/src/EMT/EMT_Ph3_SynchronGeneratorVBR.cpp index a6c9428c5d..1ca8d78845 100644 --- a/dpsim-models/src/EMT/EMT_Ph3_SynchronGeneratorVBR.cpp +++ b/dpsim-models/src/EMT/EMT_Ph3_SynchronGeneratorVBR.cpp @@ -102,7 +102,7 @@ void EMT::Ph3::SynchronGeneratorVBR::setInitialValues(Real initActivePower, Real void EMT::Ph3::SynchronGeneratorVBR::initializeFromNodesAndTerminals(Real frequency) { if(!mInitialValuesSet) { - SPDLOG_LOGGER_INFO(mSLog, "--- Initialization from powerflow ---"); + SPDLOG_LOGGER_DEBUG(mSLog, "--- Initialization from powerflow ---"); // terminal powers in consumer system -> convert to generator system Real activePower = -terminal(0)->singlePower().real(); @@ -113,14 +113,14 @@ void EMT::Ph3::SynchronGeneratorVBR::initializeFromNodesAndTerminals(Real freque this->setInitialValues(activePower, reactivePower, voltMagnitude, Math::phase(initialSingleVoltage(0)), activePower); - SPDLOG_LOGGER_INFO(mSLog, "\nTerminal 0 voltage: {:s}" + SPDLOG_LOGGER_DEBUG(mSLog, "\nTerminal 0 voltage: {:s}" "\nTerminal 0 power: {:s}" "\n--- Initialization from powerflow finished ---", Logger::phasorToString(initialSingleVoltage(0)), Logger::complexToString(terminal(0)->singlePower())); mSLog->flush(); } else { - SPDLOG_LOGGER_INFO(mSLog, "Initial values already set, skipping initializeFromNodesAndTerminals."); + SPDLOG_LOGGER_DEBUG(mSLog, "Initial values already set, skipping initializeFromNodesAndTerminals."); mSLog->flush(); } } @@ -239,8 +239,8 @@ void EMT::Ph3::SynchronGeneratorVBR::mnaCompInitialize(Real omega, Real timeStep CalculateL(); - SPDLOG_LOGGER_INFO(mSLog, "Initialize right side vector of size {}", leftVector->get().rows()); - SPDLOG_LOGGER_INFO(mSLog, "Component affects right side vector entries {}, {} and {}", matrixNodeIndex(0,0), matrixNodeIndex(0,1), matrixNodeIndex(0,2)); + SPDLOG_LOGGER_DEBUG(mSLog, "Initialize right side vector of size {}", leftVector->get().rows()); + SPDLOG_LOGGER_DEBUG(mSLog, "Component affects right side vector entries {}, {} and {}", matrixNodeIndex(0,0), matrixNodeIndex(0,1), matrixNodeIndex(0,2)); } void EMT::Ph3::SynchronGeneratorVBR::mnaCompPreStep(Real time, Int timeStepCount) { diff --git a/dpsim-models/src/EMT/EMT_Ph3_Transformer.cpp b/dpsim-models/src/EMT/EMT_Ph3_Transformer.cpp index 8d1733442f..e6a872ba38 100644 --- a/dpsim-models/src/EMT/EMT_Ph3_Transformer.cpp +++ b/dpsim-models/src/EMT/EMT_Ph3_Transformer.cpp @@ -58,9 +58,9 @@ void EMT::Ph3::Transformer::initializeFromNodesAndTerminals(Real frequency) { Real tmpVolt = mNominalVoltageEnd1; mNominalVoltageEnd1 = mNominalVoltageEnd2; mNominalVoltageEnd2 = tmpVolt; - SPDLOG_LOGGER_INFO(mSLog, "Switching terminals to have first terminal at higher voltage side. Updated parameters: "); - SPDLOG_LOGGER_INFO(mSLog, "Nominal Voltage End 1 = {} [V] Nominal Voltage End 2 = {} [V]", mNominalVoltageEnd1, mNominalVoltageEnd2); - SPDLOG_LOGGER_INFO(mSLog, "Tap Ratio = {} [ ] Phase Shift = {} [deg]", std::abs(**mRatio), std::arg(**mRatio)); + SPDLOG_LOGGER_DEBUG(mSLog, "Switching terminals to have first terminal at higher voltage side. Updated parameters: "); + SPDLOG_LOGGER_DEBUG(mSLog, "Nominal Voltage End 1 = {} [V] Nominal Voltage End 2 = {} [V]", mNominalVoltageEnd1, mNominalVoltageEnd2); + SPDLOG_LOGGER_DEBUG(mSLog, "Tap Ratio = {} [ ] Phase Shift = {} [deg]", std::abs(**mRatio), std::arg(**mRatio)); } // Set initial voltage of virtual node in between @@ -152,7 +152,7 @@ void EMT::Ph3::Transformer::initializeFromNodesAndTerminals(Real frequency) { subcomp->initializeFromNodesAndTerminals(frequency); } - SPDLOG_LOGGER_INFO(mSLog, + SPDLOG_LOGGER_DEBUG(mSLog, "\n--- Initialization from powerflow ---" "\nVoltage across: {:s}" "\nCurrent: {:s}" diff --git a/dpsim-models/src/EMT/EMT_Ph3_VoltageSource.cpp b/dpsim-models/src/EMT/EMT_Ph3_VoltageSource.cpp index 34b2a02073..d28d4f89bc 100644 --- a/dpsim-models/src/EMT/EMT_Ph3_VoltageSource.cpp +++ b/dpsim-models/src/EMT/EMT_Ph3_VoltageSource.cpp @@ -64,7 +64,7 @@ void EMT::Ph3::VoltageSource::setParameters(MatrixComp voltageRef, Real modulati } void EMT::Ph3::VoltageSource::initializeFromNodesAndTerminals(Real frequency) { - SPDLOG_LOGGER_INFO(mSLog, "\n--- Initialization from node voltages ---"); + SPDLOG_LOGGER_DEBUG(mSLog, "\n--- Initialization from node voltages ---"); // TODO: this approach currently overwrites voltage reference set from outside, when not using setParameters if (!mParametersSet) { auto srcSigSine = Signal::SineWaveGenerator::make(**mName + "_sw"); @@ -75,18 +75,18 @@ void EMT::Ph3::VoltageSource::initializeFromNodesAndTerminals(Real frequency) { **mVoltageRef = CPS::Math::singlePhaseVariableToThreePhase(initialSingleVoltage(1) - initialSingleVoltage(0)); - SPDLOG_LOGGER_INFO(mSLog, "\nReference voltage: {:s}" + SPDLOG_LOGGER_DEBUG(mSLog, "\nReference voltage: {:s}" "\nTerminal 0 voltage: {:s}" "\nTerminal 1 voltage: {:s}", Logger::matrixCompToString(**mVoltageRef), Logger::phasorToString(initialSingleVoltage(0)), Logger::phasorToString(initialSingleVoltage(1))); } else { - SPDLOG_LOGGER_INFO(mSLog, "\nInitialization from node voltages omitted (parameter already set)." + SPDLOG_LOGGER_DEBUG(mSLog, "\nInitialization from node voltages omitted (parameter already set)." "\nReference voltage: {:s}", Logger::matrixCompToString(**mVoltageRef)); } - SPDLOG_LOGGER_INFO(mSLog, "\n--- Initialization from node voltages ---"); + SPDLOG_LOGGER_DEBUG(mSLog, "\n--- Initialization from node voltages ---"); mSLog->flush(); } diff --git a/dpsim-models/src/SP/SP_Ph1_AvVoltageSourceInverterDQ.cpp b/dpsim-models/src/SP/SP_Ph1_AvVoltageSourceInverterDQ.cpp index 931278ff78..02cbbb3a08 100644 --- a/dpsim-models/src/SP/SP_Ph1_AvVoltageSourceInverterDQ.cpp +++ b/dpsim-models/src/SP/SP_Ph1_AvVoltageSourceInverterDQ.cpp @@ -218,25 +218,25 @@ void SP::Ph1::AvVoltageSourceInverterDQ::initializeFromNodesAndTerminals(Real fr matrixStateInit(0,0) = std::arg(mVirtualNodes[3]->initialSingleVoltage()); mPLL->setInitialValues(**mVcq, matrixStateInit, Matrix::Zero(2,1)); - SPDLOG_LOGGER_INFO(mSLog, + SPDLOG_LOGGER_INFO(mSLog, "Terminal 0 connected to {:s} = sim node {:d}", mTerminals[0]->node()->name(), mTerminals[0]->node()->matrixNodeIndex()); + + SPDLOG_LOGGER_DEBUG(mSLog, "\n--- Initialization from powerflow ---" "\nInterface voltage across: {:s}" "\nInterface current: {:s}" "\nTerminal 0 initial voltage: {:s}" - "\nTerminal 0 connected to {:s} = sim node {:d}" "\nVirtual node 0 initial voltage: {:s}" "\nVirtual node 1 initial voltage: {:s}" "\nVirtual node 2 initial voltage: {:s}", Logger::phasorToString((**mIntfVoltage)(0, 0)), Logger::phasorToString((**mIntfCurrent)(0, 0)), Logger::phasorToString(initialSingleVoltage(0)), - mTerminals[0]->node()->name(), mTerminals[0]->node()->matrixNodeIndex(), Logger::phasorToString(mVirtualNodes[0]->initialSingleVoltage()), Logger::phasorToString(mVirtualNodes[1]->initialSingleVoltage()), Logger::phasorToString(mVirtualNodes[2]->initialSingleVoltage())); if (mWithConnectionTransformer) - SPDLOG_LOGGER_INFO(mSLog, "\nVirtual node 3 initial voltage: {:s}", Logger::phasorToString(mVirtualNodes[3]->initialSingleVoltage())); - SPDLOG_LOGGER_INFO(mSLog, "\n--- Initialization from powerflow finished ---"); + SPDLOG_LOGGER_DEBUG(mSLog, "\nVirtual node 3 initial voltage: {:s}", Logger::phasorToString(mVirtualNodes[3]->initialSingleVoltage())); + SPDLOG_LOGGER_DEBUG(mSLog, "\n--- Initialization from powerflow finished ---"); } void SP::Ph1::AvVoltageSourceInverterDQ::mnaParentInitialize(Real omega, Real timeStep, Attribute::Ptr leftVector) { diff --git a/dpsim-models/src/SP/SP_Ph1_Capacitor.cpp b/dpsim-models/src/SP/SP_Ph1_Capacitor.cpp index 21ca8362db..692526aa5c 100644 --- a/dpsim-models/src/SP/SP_Ph1_Capacitor.cpp +++ b/dpsim-models/src/SP/SP_Ph1_Capacitor.cpp @@ -32,13 +32,13 @@ void SP::Ph1::Capacitor::initializeFromNodesAndTerminals(Real frequency) { (**mIntfVoltage)(0, 0) = initialSingleVoltage(1) - initialSingleVoltage(0); **mIntfCurrent = mSusceptance * **mIntfVoltage; - SPDLOG_LOGGER_INFO(mSLog, "\nCapacitance [F]: {:s}" + SPDLOG_LOGGER_DEBUG(mSLog, "\nCapacitance [F]: {:s}" "\nImpedance [Ohm]: {:s}" "\nAdmittance [S]: {:s}", Logger::realToString(**mCapacitance), Logger::complexToString(mImpedance), Logger::complexToString(mAdmittance)); - SPDLOG_LOGGER_INFO(mSLog, + SPDLOG_LOGGER_DEBUG(mSLog, "\n--- Initialization from powerflow ---" "\nVoltage across: {:s}" "\nCurrent: {:s}" @@ -55,7 +55,7 @@ void SP::Ph1::Capacitor::initializeFromNodesAndTerminals(Real frequency) { void SP::Ph1::Capacitor::mnaCompInitialize(Real omega, Real timeStep, Attribute::Ptr leftVector) { updateMatrixNodeIndices(); - SPDLOG_LOGGER_INFO(mSLog, + SPDLOG_LOGGER_DEBUG(mSLog, "\n--- MNA initialization ---" "\nInitial voltage {:s}" "\nInitial current {:s}" diff --git a/dpsim-models/src/SP/SP_Ph1_Inductor.cpp b/dpsim-models/src/SP/SP_Ph1_Inductor.cpp index 349b6b683e..43ce917c35 100644 --- a/dpsim-models/src/SP/SP_Ph1_Inductor.cpp +++ b/dpsim-models/src/SP/SP_Ph1_Inductor.cpp @@ -30,11 +30,11 @@ void SP::Ph1::Inductor::initializeFromNodesAndTerminals(Real frequency) { (**mIntfVoltage)(0, 0) = initialSingleVoltage(1) - initialSingleVoltage(0); **mIntfCurrent = mSusceptance * **mIntfVoltage; - SPDLOG_LOGGER_INFO(mSLog, "\nInductance [H]: {:s}" + SPDLOG_LOGGER_DEBUG(mSLog, "\nInductance [H]: {:s}" "\nImpedance [Ohm]: {:s}", Logger::realToString(**mInductance), Logger::complexToString(1./mSusceptance)); - SPDLOG_LOGGER_INFO(mSLog, + SPDLOG_LOGGER_DEBUG(mSLog, "\n--- Initialization from powerflow ---" "\nVoltage across: {:s}" "\nCurrent: {:s}" @@ -52,7 +52,7 @@ void SP::Ph1::Inductor::initializeFromNodesAndTerminals(Real frequency) { void SP::Ph1::Inductor::mnaCompInitialize(Real omega, Real timeStep, Attribute::Ptr leftVector) { updateMatrixNodeIndices(); - SPDLOG_LOGGER_INFO(mSLog, + SPDLOG_LOGGER_DEBUG(mSLog, "\n--- MNA initialization ---" "\nInitial voltage {:s}" "\nInitial current {:s}" diff --git a/dpsim-models/src/SP/SP_Ph1_Load.cpp b/dpsim-models/src/SP/SP_Ph1_Load.cpp index c9fabf564c..28235cf8c5 100644 --- a/dpsim-models/src/SP/SP_Ph1_Load.cpp +++ b/dpsim-models/src/SP/SP_Ph1_Load.cpp @@ -145,7 +145,7 @@ void SP::Ph1::Load::initializeFromNodesAndTerminals(Real frequency) { (**mIntfVoltage)(0, 0) = mTerminals[0]->initialSingleVoltage(); (**mIntfCurrent)(0, 0) = std::conj(Complex(attributeTyped("P")->get(), attributeTyped("Q")->get()) / (**mIntfVoltage)(0, 0)); - SPDLOG_LOGGER_INFO(mSLog, + SPDLOG_LOGGER_DEBUG(mSLog, "\n--- Initialization from powerflow ---" "\nVoltage across: {:s}" "\nCurrent: {:s}" @@ -154,7 +154,7 @@ void SP::Ph1::Load::initializeFromNodesAndTerminals(Real frequency) { Logger::phasorToString((**mIntfVoltage)(0, 0)), Logger::phasorToString((**mIntfCurrent)(0, 0)), Logger::phasorToString(initialSingleVoltage(0))); - SPDLOG_LOGGER_INFO(mSLog, + SPDLOG_LOGGER_DEBUG(mSLog, "Updated parameters according to powerflow:\n" "Active Power={} [W] Reactive Power={} [VAr]", attributeTyped("P")->get(), attributeTyped("Q")->get()); mSLog->flush(); diff --git a/dpsim-models/src/SP/SP_Ph1_NetworkInjection.cpp b/dpsim-models/src/SP/SP_Ph1_NetworkInjection.cpp index 9c120df2b0..ba0542ce3c 100644 --- a/dpsim-models/src/SP/SP_Ph1_NetworkInjection.cpp +++ b/dpsim-models/src/SP/SP_Ph1_NetworkInjection.cpp @@ -30,9 +30,9 @@ SP::Ph1::NetworkInjection::NetworkInjection(String uid, String name, // Create electrical sub components mSubVoltageSource = std::make_shared(**mName + "_vs", mLogLevel); addMNASubComponent(mSubVoltageSource, MNA_SUBCOMP_TASK_ORDER::TASK_BEFORE_PARENT, MNA_SUBCOMP_TASK_ORDER::TASK_BEFORE_PARENT, true); - SPDLOG_LOGGER_INFO(mSLog, "Electrical subcomponents: "); + SPDLOG_LOGGER_DEBUG(mSLog, "Electrical subcomponents: "); for (auto subcomp: mSubComponents) - SPDLOG_LOGGER_INFO(mSLog, "- {}", subcomp->name()); + SPDLOG_LOGGER_DEBUG(mSLog, "- {}", subcomp->name()); // MNA attributes mSubVoltageSource->mVoltageRef->setReference(mVoltageRef); diff --git a/dpsim-models/src/SP/SP_Ph1_PiLine.cpp b/dpsim-models/src/SP/SP_Ph1_PiLine.cpp index da862eccaf..c6f97a585f 100644 --- a/dpsim-models/src/SP/SP_Ph1_PiLine.cpp +++ b/dpsim-models/src/SP/SP_Ph1_PiLine.cpp @@ -208,7 +208,7 @@ void SP::Ph1::PiLine::initializeFromNodesAndTerminals(Real frequency) { addMNASubComponent(mSubParallelCapacitor1, MNA_SUBCOMP_TASK_ORDER::NO_TASK, MNA_SUBCOMP_TASK_ORDER::TASK_BEFORE_PARENT, true); } - SPDLOG_LOGGER_INFO(mSLog, + SPDLOG_LOGGER_DEBUG(mSLog, "\n--- Initialization from powerflow ---" "\nVoltage across: {:s}" "\nCurrent: {:s}" diff --git a/dpsim-models/src/SP/SP_Ph1_RXLine.cpp b/dpsim-models/src/SP/SP_Ph1_RXLine.cpp index f68f05e79a..7249988bc7 100644 --- a/dpsim-models/src/SP/SP_Ph1_RXLine.cpp +++ b/dpsim-models/src/SP/SP_Ph1_RXLine.cpp @@ -174,7 +174,7 @@ void SP::Ph1::RXLine::initializeFromNodesAndTerminals(Real frequency) { mInitialResistor->initializeFromNodesAndTerminals(frequency); addMNASubComponent(mInitialResistor, MNA_SUBCOMP_TASK_ORDER::TASK_BEFORE_PARENT, MNA_SUBCOMP_TASK_ORDER::TASK_BEFORE_PARENT, true); - SPDLOG_LOGGER_INFO(mSLog, + SPDLOG_LOGGER_DEBUG(mSLog, "\n--- Initialization from powerflow ---" "\nVoltage across: {:s}" "\nCurrent: {:s}" diff --git a/dpsim-models/src/SP/SP_Ph1_Resistor.cpp b/dpsim-models/src/SP/SP_Ph1_Resistor.cpp index 9f970f4cb2..64382941e2 100644 --- a/dpsim-models/src/SP/SP_Ph1_Resistor.cpp +++ b/dpsim-models/src/SP/SP_Ph1_Resistor.cpp @@ -30,9 +30,9 @@ void SP::Ph1::Resistor::initializeFromNodesAndTerminals(Real frequency) { (**mIntfVoltage)(0, 0) = initialSingleVoltage(1) - initialSingleVoltage(0); **mIntfCurrent = (1 / **mResistance) * **mIntfVoltage; - SPDLOG_LOGGER_INFO(mSLog, "\nResistance [Ohm]: {:s}", + SPDLOG_LOGGER_DEBUG(mSLog, "\nResistance [Ohm]: {:s}", Logger::realToString(**mResistance)); - SPDLOG_LOGGER_INFO(mSLog, + SPDLOG_LOGGER_DEBUG(mSLog, "\n--- Initialization from powerflow ---" "\nVoltage across: {:s}" "\nCurrent: {:s}" @@ -88,7 +88,7 @@ void SP::Ph1::Resistor::mnaCompInitialize(Real omega, Real timeStep, AttributeinitializeFromNodesAndTerminals(frequency); addMNASubComponent(mSubInductor, MNA_SUBCOMP_TASK_ORDER::TASK_AFTER_PARENT, MNA_SUBCOMP_TASK_ORDER::TASK_BEFORE_PARENT, false); - SPDLOG_LOGGER_INFO(mSLog, "\n--- Initialize according to powerflow ---" + SPDLOG_LOGGER_DEBUG(mSLog, "\n--- Initialize according to powerflow ---" "\nTerminal 0 voltage: {:e}<{:e}" "\nVoltage behind reactance: {:e}<{:e}" "\ninitial electrical power: {:e}+j{:e}" diff --git a/dpsim-models/src/SP/SP_Ph1_Transformer.cpp b/dpsim-models/src/SP/SP_Ph1_Transformer.cpp index 5130a9b8b9..b03432209e 100644 --- a/dpsim-models/src/SP/SP_Ph1_Transformer.cpp +++ b/dpsim-models/src/SP/SP_Ph1_Transformer.cpp @@ -73,7 +73,7 @@ SimPowerComp::Ptr SP::Ph1::Transformer::clone(String name) { void SP::Ph1::Transformer::initializeFromNodesAndTerminals(Real frequency) { mNominalOmega = 2. * PI * frequency; mReactance = mNominalOmega * **mInductance; - SPDLOG_LOGGER_INFO(mSLog, "Reactance={} [Ohm] (referred to primary side)", mReactance); + SPDLOG_LOGGER_DEBUG(mSLog, "Reactance={} [Ohm] (referred to primary side)", mReactance); // Component parameters are referred to higher voltage side. // Switch terminals to have terminal 0 at higher voltage side @@ -88,9 +88,9 @@ void SP::Ph1::Transformer::initializeFromNodesAndTerminals(Real frequency) { Real tmpVolt = **mNominalVoltageEnd1; **mNominalVoltageEnd1 = **mNominalVoltageEnd2; **mNominalVoltageEnd2 = tmpVolt; - SPDLOG_LOGGER_INFO(mSLog, "Switching terminals to have first terminal at higher voltage side. Updated parameters: "); - SPDLOG_LOGGER_INFO(mSLog, "Nominal Voltage End 1 = {} [V] Nominal Voltage End 2 = {} [V]", **mNominalVoltageEnd1, **mNominalVoltageEnd2); - SPDLOG_LOGGER_INFO(mSLog, "Tap Ratio = {} [ ] Phase Shift = {} [deg]", mRatioAbs, mRatioPhase); + SPDLOG_LOGGER_DEBUG(mSLog, "Switching terminals to have first terminal at higher voltage side. Updated parameters: "); + SPDLOG_LOGGER_DEBUG(mSLog, "Nominal Voltage End 1 = {} [V] Nominal Voltage End 2 = {} [V]", **mNominalVoltageEnd1, **mNominalVoltageEnd2); + SPDLOG_LOGGER_DEBUG(mSLog, "Tap Ratio = {} [ ] Phase Shift = {} [deg]", mRatioAbs, mRatioPhase); } // Set initial voltage of virtual node in between @@ -168,7 +168,7 @@ void SP::Ph1::Transformer::initializeFromNodesAndTerminals(Real frequency) { subcomp->initializeFromNodesAndTerminals(frequency); } - SPDLOG_LOGGER_INFO(mSLog, + SPDLOG_LOGGER_DEBUG(mSLog, "\n--- Initialization from powerflow ---" "\nVoltage across: {:s}" "\nCurrent: {:s}" diff --git a/dpsim-models/src/SP/SP_Ph1_VoltageSource.cpp b/dpsim-models/src/SP/SP_Ph1_VoltageSource.cpp index fa1838016c..88b01a5e7a 100644 --- a/dpsim-models/src/SP/SP_Ph1_VoltageSource.cpp +++ b/dpsim-models/src/SP/SP_Ph1_VoltageSource.cpp @@ -69,7 +69,7 @@ void SP::Ph1::VoltageSource::initializeFromNodesAndTerminals(Real frequency) { mSrcSig = srcSigSine; } - SPDLOG_LOGGER_INFO(mSLog, + SPDLOG_LOGGER_DEBUG(mSLog, "\n--- Initialization from node voltages ---" "\nVoltage across: {:s}" "\nTerminal 0 voltage: {:s}" @@ -98,7 +98,7 @@ void SP::Ph1::VoltageSource::mnaCompInitialize(Real omega, Real timeStep, Attrib (**mIntfVoltage)(0,0) = mSrcSig->getSignal(); - SPDLOG_LOGGER_INFO(mSLog, + SPDLOG_LOGGER_DEBUG(mSLog, "\n--- MNA initialization ---" "\nInitial voltage {:s}" "\nInitial current {:s}" diff --git a/dpsim-models/src/SP/SP_Ph1_varResSwitch.cpp b/dpsim-models/src/SP/SP_Ph1_varResSwitch.cpp index 8c2a1ca9a6..169587fde9 100644 --- a/dpsim-models/src/SP/SP_Ph1_varResSwitch.cpp +++ b/dpsim-models/src/SP/SP_Ph1_varResSwitch.cpp @@ -74,14 +74,14 @@ void SP::Ph1::varResSwitch::mnaCompApplySwitchSystemMatrixStamp(Bool closed, Spa Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1), matrixNodeIndex(0), -conductance); } - SPDLOG_LOGGER_INFO(mSLog, "-- Stamp ---"); + SPDLOG_LOGGER_DEBUG(mSLog, "-- Stamp ---"); if (terminalNotGrounded(0)) - SPDLOG_LOGGER_INFO(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(conductance), matrixNodeIndex(0), matrixNodeIndex(0)); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(conductance), matrixNodeIndex(0), matrixNodeIndex(0)); if (terminalNotGrounded(1)) - SPDLOG_LOGGER_INFO(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(conductance), matrixNodeIndex(1), matrixNodeIndex(1)); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(conductance), matrixNodeIndex(1), matrixNodeIndex(1)); if (terminalNotGrounded(0) && terminalNotGrounded(1)) { - SPDLOG_LOGGER_INFO(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(-conductance), matrixNodeIndex(0), matrixNodeIndex(1)); - SPDLOG_LOGGER_INFO(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(-conductance), matrixNodeIndex(1), matrixNodeIndex(0)); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(-conductance), matrixNodeIndex(0), matrixNodeIndex(1)); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(-conductance), matrixNodeIndex(1), matrixNodeIndex(0)); } } diff --git a/dpsim-models/src/SP/SP_Ph3_Inductor.cpp b/dpsim-models/src/SP/SP_Ph3_Inductor.cpp index bb4e337547..1d8eb4173a 100644 --- a/dpsim-models/src/SP/SP_Ph3_Inductor.cpp +++ b/dpsim-models/src/SP/SP_Ph3_Inductor.cpp @@ -40,7 +40,7 @@ void SP::Ph3::Inductor::initializeFromNodesAndTerminals(Real frequency) { (**mIntfVoltage)(2, 0) = (**mIntfVoltage)(0, 0) * Complex(cos(2. / 3. * M_PI), sin(2. / 3. * M_PI)); **mIntfCurrent = mSusceptance * **mIntfVoltage; - SPDLOG_LOGGER_INFO(mSLog, "--- Initialize according to power flow ---"); + SPDLOG_LOGGER_DEBUG(mSLog, "--- Initialize according to power flow ---"); /* mLog.info() << "--- Initialize according to power flow ---" << std::endl << "in phase A: " << std::endl diff --git a/dpsim-models/src/SP/SP_Ph3_Resistor.cpp b/dpsim-models/src/SP/SP_Ph3_Resistor.cpp index 48d53289eb..ac2ffbbef4 100644 --- a/dpsim-models/src/SP/SP_Ph3_Resistor.cpp +++ b/dpsim-models/src/SP/SP_Ph3_Resistor.cpp @@ -38,9 +38,9 @@ void SP::Ph3::Resistor::initializeFromNodesAndTerminals(Real frequency) { voltMag * sin(voltPhase + 2. / 3. * M_PI)); **mIntfCurrent = (**mResistance).inverse() * **mIntfVoltage; - SPDLOG_LOGGER_INFO(mSLog, "Node 1 : {}", Logger::phasorToString(initialVoltage(0)(0, 0))); - SPDLOG_LOGGER_INFO(mSLog, "Node 2 : {}", Logger::phasorToString(initialVoltage(1)(0, 0))); - SPDLOG_LOGGER_INFO(mSLog, "initialize {} {} voltage to {} and current to {}", + SPDLOG_LOGGER_DEBUG(mSLog, "Node 1 : {}", Logger::phasorToString(initialVoltage(0)(0, 0))); + SPDLOG_LOGGER_DEBUG(mSLog, "Node 2 : {}", Logger::phasorToString(initialVoltage(1)(0, 0))); + SPDLOG_LOGGER_DEBUG(mSLog, "initialize {} {} voltage to {} and current to {}", this->type(), this->name(), Logger::phasorToString((**mIntfVoltage)(0, 0)), Logger::phasorToString((**mIntfCurrent)(0, 0))); From 83ce14fcca445071064337e4d6b156518dcf8dbd Mon Sep 17 00:00:00 2001 From: Jonas Schroeder Date: Mon, 24 Jul 2023 13:13:17 +0000 Subject: [PATCH 22/31] log domain on simulation init Signed-off-by: Jonas Schroeder --- dpsim/src/Simulation.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dpsim/src/Simulation.cpp b/dpsim/src/Simulation.cpp index f7eb6cc2ad..78f0602904 100644 --- a/dpsim/src/Simulation.cpp +++ b/dpsim/src/Simulation.cpp @@ -69,14 +69,20 @@ void Simulation::initialize() { switch (mDomain) { case Domain::SP: // Treat SP as DP + SPDLOG_LOGGER_INFO(mLog, "Created simulation in SP domain."); + createSolvers(); + break; case Domain::DP: + SPDLOG_LOGGER_INFO(mLog, "Created simulation in DP domain."); createSolvers(); break; case Domain::EMT: + SPDLOG_LOGGER_INFO(mLog, "Created simulation in EMT domain."); createSolvers(); break; } + mTime = 0; mTimeStepCount = 0; From 7d4d5f494d992056f71753d5669dfb0a514182a2 Mon Sep 17 00:00:00 2001 From: Jonas Schroeder Date: Tue, 25 Jul 2023 09:47:45 +0000 Subject: [PATCH 23/31] add an internal logger to simulation for logging iteration counts Signed-off-by: Jonas Schroeder --- dpsim-models/src/Logger.cpp | 3 ++- dpsim/include/dpsim/MNASolverDirect.h | 2 +- dpsim/include/dpsim/Simulation.h | 28 ++++++++++++------------- dpsim/src/MNASolverDirect.cpp | 10 +++++---- dpsim/src/RealTimeSimulation.cpp | 2 +- dpsim/src/Simulation.cpp | 30 ++++++++++++++++++--------- 6 files changed, 43 insertions(+), 32 deletions(-) diff --git a/dpsim-models/src/Logger.cpp b/dpsim-models/src/Logger.cpp index 167c668e10..b755e3bb10 100644 --- a/dpsim-models/src/Logger.cpp +++ b/dpsim-models/src/Logger.cpp @@ -203,7 +203,8 @@ Logger::Log Logger::create(Logger::LoggerType type, const std::string &name, con } if (filelevel == Logger::Level::off && clilevel == Logger::Level::off) { - logger = spdlog::create(name); + auto null_sink = std::make_shared(); + logger = std::make_shared(name, null_sink); } else { spdlog::sink_ptr dpsimSink = std::make_shared(file_sink, Logger::mStdoutSink, Logger::mStderrSink, filelevel, clilevel); logger = std::make_shared(name, dpsimSink); diff --git a/dpsim/include/dpsim/MNASolverDirect.h b/dpsim/include/dpsim/MNASolverDirect.h index be85e50799..4a3e93f0da 100644 --- a/dpsim/include/dpsim/MNASolverDirect.h +++ b/dpsim/include/dpsim/MNASolverDirect.h @@ -170,7 +170,7 @@ namespace DPsim { void logLUTimes() override; /// ### SynGen Interface ### - int mIter = 0; + const CPS::Attribute::Ptr mIter; // #### MNA Solver Tasks #### /// diff --git a/dpsim/include/dpsim/Simulation.h b/dpsim/include/dpsim/Simulation.h index 5d9dbf776a..cebbf1190c 100644 --- a/dpsim/include/dpsim/Simulation.h +++ b/dpsim/include/dpsim/Simulation.h @@ -79,6 +79,10 @@ namespace DPsim { CPS::Logger::Level mCliLevel; /// (Real) time needed for the timesteps std::vector mStepTimes; + /// List of data loggers. mLoggers[0] corresponds to the default simulation logger + DataLogger::List mDataLoggers; + /// Default simulation logger + DataLogger::Ptr mInternalDataLogger; // #### Solver Settings #### /// @@ -122,7 +126,8 @@ namespace DPsim { /// List of all tasks to be scheduled CPS::Task::List mTasks; /// Task dependencies as incoming / outgoing edges - Scheduler::Edges mTaskInEdges, mTaskOutEdges; + Scheduler::Edges mTaskInEdges; + Scheduler::Edges mTaskOutEdges; /// Vector of Interfaces std::vector mInterfaces; @@ -134,9 +139,6 @@ namespace DPsim { UInt downsampling; }; - /// The data loggers - DataLogger::List mLoggers; - /// Helper function for constructors void create(); /// Create solvers depending on simulation settings @@ -188,7 +190,7 @@ namespace DPsim { /// void doSplitSubnets(Bool splitSubnets = true) { **mSplitSubnets = splitSubnets; } /// - void setTearingComponents(CPS::IdentifiedObject::List tearComponents = CPS::IdentifiedObject::List()) { + void setTearingComponents(CPS::IdentifiedObject::List const& tearComponents = CPS::IdentifiedObject::List()) { mTearComponents = tearComponents; } /// Set the scheduling method @@ -232,10 +234,11 @@ namespace DPsim { } /// Add a new data logger void addLogger(DataLogger::Ptr logger) { - mLoggers.push_back(logger); + mDataLoggers.push_back(logger); } + /// Write step time measurements to log file - void logStepTimes(String logName); + void logStepTimes(const String &logName); /// Write LU decomposition times measurements to log file void logLUTimes(); @@ -256,20 +259,15 @@ namespace DPsim { Real finalTime() const { return **mFinalTime; } Int timeStepCount() const { return mTimeStepCount; } Real timeStep() const { return **mTimeStep; } - DataLogger::List& loggers() { return mLoggers; } - std::shared_ptr scheduler() { return mScheduler; } + DataLogger::List& loggers() { return mDataLoggers; } + std::shared_ptr scheduler() const { return mScheduler; } std::vector& stepTimes() { return mStepTimes; } - // #### Set component attributes during simulation #### - /// CHECK: Can these be deleted? getIdObjAttribute + "**attr =" should suffice - // void setIdObjAttr(const String &comp, const String &attr, Real value); - // void setIdObjAttr(const String &comp, const String &attr, Complex value); - // #### Get component attributes during simulation #### CPS::AttributeBase::Ptr getIdObjAttribute(const String &comp, const String &attr); void logIdObjAttribute(const String &comp, const String &attr); /// CHECK: Can we store the attribute name / UID intrinsically inside the attribute? - void logAttribute(String name, CPS::AttributeBase::Ptr attr); + void logAttribute(const String &name, CPS::AttributeBase::Ptr attr); }; } diff --git a/dpsim/src/MNASolverDirect.cpp b/dpsim/src/MNASolverDirect.cpp index 2f1cdbe6b7..6c6ccc52d4 100644 --- a/dpsim/src/MNASolverDirect.cpp +++ b/dpsim/src/MNASolverDirect.cpp @@ -15,8 +15,10 @@ using namespace CPS; namespace DPsim { template -MnaSolverDirect::MnaSolverDirect(String name, CPS::Domain domain, CPS::Logger::Level logLevel, CPS::Logger::Level cliLevel) : MnaSolver(name, domain, logLevel, cliLevel) { - mImplementationInUse = DirectLinearSolverImpl::SparseLU; +MnaSolverDirect::MnaSolverDirect(String name, CPS::Domain domain, CPS::Logger::Level logLevel, CPS::Logger::Level cliLevel) : + MnaSolver(name, domain, logLevel, cliLevel), + mIter(AttributeStatic::make()) { + mImplementationInUse = DirectLinearSolverImpl::SparseLU; } @@ -239,7 +241,7 @@ void MnaSolverDirect::solve(Real time, Int timeStepCount) { syncGen->updateVoltage(**mLeftSideVector); // Reset number of iterations - mIter = 0; + **mIter = 0; // Additional solve steps for iterative models if (mSyncGen.size() > 0) { @@ -253,7 +255,7 @@ void MnaSolverDirect::solve(Real time, Int timeStepCount) { // recompute solve step if at least one component demands iteration if (numCompsRequireIter > 0){ - mIter++; + (**mIter)++; // Reset source vector mRightSideVector.setZero(); diff --git a/dpsim/src/RealTimeSimulation.cpp b/dpsim/src/RealTimeSimulation.cpp index c1280dfdc6..4040f5e346 100644 --- a/dpsim/src/RealTimeSimulation.cpp +++ b/dpsim/src/RealTimeSimulation.cpp @@ -61,7 +61,7 @@ void RealTimeSimulation::run(const Timer::StartClock::time_point &startAt) { for (auto intf : mInterfaces) intf->close(); - for (auto lg : mLoggers) + for (auto lg : mDataLoggers) lg->close(); mTimer.stop(); diff --git a/dpsim/src/Simulation.cpp b/dpsim/src/Simulation.cpp index 78f0602904..c55174050e 100644 --- a/dpsim/src/Simulation.cpp +++ b/dpsim/src/Simulation.cpp @@ -55,6 +55,10 @@ void Simulation::create() { // Logging mLog = Logger::get(Logger::LoggerType::SIMULATION, **mName, mLogLevel, mCliLevel); + // Default data logger + mInternalDataLogger = DataLogger::make(**mName + "_data"); + mDataLoggers.push_back(mInternalDataLogger); + Eigen::setNbThreads(1); mInitialized = false; @@ -132,7 +136,7 @@ void Simulation::createSolvers() { template void Simulation::createMNASolver() { - Solver::Ptr solver; + Solver::Ptr solver; std::vector subnets; // The Diakoptics solver splits the system at a later point. // That is why the system is not split here if tear components exist. @@ -168,6 +172,16 @@ void Simulation::createMNASolver() { solver->setDirectLinearSolverConfiguration(mDirectLinearSolverConfiguration); solver->initialize(); solver->setMaxNumberOfIterations(mMaxIterations); + + // Log solver iteration numbers + if (mLogLevel < Logger::Level::info) { + if (auto mnaSolverDirect = std::dynamic_pointer_cast>(solver)) { + mInternalDataLogger->logAttribute("iters" + copySuffix, mnaSolverDirect->mIter); + } + else if (auto mnaSolverDirect = std::dynamic_pointer_cast>(solver)) { + mInternalDataLogger->logAttribute("iters" + copySuffix, mnaSolverDirect->mIter); + } + } } mSolvers.push_back(solver); } @@ -201,7 +215,7 @@ void Simulation::prepSchedule() { } } - for (auto logger : mLoggers) { + for (auto logger : mDataLoggers) { mTasks.push_back(logger->getTask()); } if (!mScheduler) { @@ -366,7 +380,7 @@ void Simulation::stop() { for (auto intf : mInterfaces) intf->close(); - for (auto lg : mLoggers) + for (auto lg : mDataLoggers) lg->close(); SPDLOG_LOGGER_INFO(mLog, "Simulation finished."); @@ -408,7 +422,7 @@ Real Simulation::step() { return mTime; } -void Simulation::logStepTimes(String logName) { +void Simulation::logStepTimes(const String &logName) { auto stepTimeLog = Logger::get(Logger::LoggerType::DEBUG, logName, Logger::Level::info); Logger::setLogPattern(stepTimeLog, "%v"); stepTimeLog->info("step_time"); @@ -454,10 +468,6 @@ void Simulation::logIdObjAttribute(const String &comp, const String &attr) { logAttribute(name, attrPtr); } -void Simulation::logAttribute(String name, CPS::AttributeBase::Ptr attr) { - if (mLoggers.size() > 0) { - mLoggers[0]->logAttribute(name, attr); - } else { - throw SystemError("Cannot log attributes when no logger is configured for this simulation!"); - } +void Simulation::logAttribute(const String &name, CPS::AttributeBase::Ptr attr) { + mInternalDataLogger->logAttribute(name, attr); } From 5fad5b64b798fdc08cbcd9c11bd01859db91ddfe Mon Sep 17 00:00:00 2001 From: Jonas Schroeder Date: Wed, 26 Jul 2023 09:46:59 +0000 Subject: [PATCH 24/31] remove old python log_attribute methods Signed-off-by: Jonas Schroeder --- dpsim/src/pybind/main.cpp | 12 +- .../Circuits/CS_R2CL print_attributes.ipynb | 18 +- examples/Notebooks/Circuits/CS_R2CL.ipynb | 16 +- ...SMIB_ReducedOrderSG_VBR_PCM_LoadStep.ipynb | 17 +- ...SMIB_ReducedOrderSG_VBR_TPM_LoadStep.ipynb | 2 +- .../Compare_EMT_DP_Slack_PiLine_PQLoad.ipynb | 32 +- ...7odTrapez_DP_SynGenTrStab_SMIB_Fault.ipynb | 62 ++-- .../DP_SP_SynGenTrStab_3Bus_Fault.ipynb | 136 ++++----- .../DP_SP_SynGenTrStab_3Bus_SteadyState.ipynb | 252 ++++++++-------- .../DP_SP_SynGenTrStab_SMIB_Fault.ipynb | 276 +++++++++--------- .../DP_SP_SynGenTrStab_SMIB_SteadyState.ipynb | 264 ++++++++--------- .../DP_Slack_PiLine_PQLoad_with_PF_Init.ipynb | 16 +- .../DP_Slack_PiLine_VSI_with_PF_Init.ipynb | 28 +- .../Circuits/EMT_DP_SP_Slack_PiLine_VSI.ipynb | 84 +++--- ...MT_DP_Slack_PiLine_VSI_Control_OnOff.ipynb | 112 +++---- .../Notebooks/Circuits/EMT_DP_VS_Init.ipynb | 12 +- .../Notebooks/Circuits/EMT_DP_VS_RLC.ipynb | 60 ++-- ...EMT_Slack_PiLine_PQLoad_with_PF_Init.ipynb | 18 +- .../EMT_Slack_PiLine_VSI_with_PF_Init.ipynb | 28 +- ...Slack_PiLine_VSI_with_PF_Init_Params.ipynb | 30 +- ...alParams_SMIB_Fault_JsonSyngenParams.ipynb | 56 ++-- ...Params_SMIB_Fault_ParamsModification.ipynb | 98 +++---- .../EMT_SynGenDQ7odTrapez_SMIB_Fault.ipynb | 32 +- .../SP_Slack_PiLine_VSI_with_PF_Init.ipynb | 28 +- ...ducedOrderSG_VBR_SMIB_Fault_withPSAT.ipynb | 32 +- examples/Notebooks/Circuits/VS_CS_R4.ipynb | 20 +- examples/Notebooks/Circuits/VS_R2L3.ipynb | 24 +- examples/Notebooks/Circuits/VS_RC1.ipynb | 12 +- examples/Notebooks/Circuits/VS_RL1.ipynb | 22 +- .../Notebooks/Components/Diakoptics.ipynb | 44 +-- .../Components/Inverter_Grid_Test.ipynb | 16 +- examples/Notebooks/Components/Line.ipynb | 78 ++--- examples/Notebooks/Components/Slack.ipynb | 24 +- .../Notebooks/Components/SynGenDq7od.ipynb | 16 +- .../SynGenDq7od_ParameterStudy.ipynb | 30 +- .../SynGenDq7od_SteadyState_DP_EMT.ipynb | 28 +- .../SynGenDq7od_ThreePhFault_DP_EMT.ipynb | 28 +- .../Notebooks/Components/SynGen_trStab.ipynb | 16 +- examples/Notebooks/Components/Trafo.ipynb | 36 +-- .../CIGRE_MV_pf-interactive-dpsimpy.ipynb | 2 +- .../Grids/CIGRE_MV_powerflow-dpsimpy.ipynb | 2 +- .../CIGRE_MV_powerflow_profiles-dpsimpy.ipynb | 2 +- .../Notebooks/Grids/DP_CIGRE_MV_withDG.ipynb | 24 +- .../DP_CIGRE_MV_withDG_withLoadStep.ipynb | 26 +- .../Grids/DP_CIGRE_MV_withoutDG.ipynb | 8 +- .../Grids/DP_WSCC9bus_SGTrStab.ipynb | 4 +- .../Grids/DP_WSCC9bus_SGTrStab_Switch.ipynb | 12 +- .../Grids/DP_WSCC9bus_SGVoltageSource.ipynb | 4 +- .../Notebooks/Grids/EMT_CIGRE_MV_withDG.ipynb | 24 +- .../EMT_CIGRE_MV_withDG_withLoadStep.ipynb | 26 +- .../Grids/EMT_CIGRE_MV_withoutDG.ipynb | 8 +- .../Notebooks/Grids/IEEE_LV_powerflow.ipynb | 2 +- .../Notebooks/Grids/PF_CIGRE_MV_withDG.ipynb | 2 +- ...9bus_SGTrStab_Switch_PSAT_Validation.ipynb | 10 +- examples/Notebooks/Grids/case14.ipynb | 2 +- examples/Notebooks/Grids/case145.ipynb | 2 +- examples/Notebooks/Grids/case300.ipynb | 2 +- examples/Notebooks/Grids/case9.ipynb | 2 +- examples/Notebooks/Quickstart Guide.ipynb | 10 +- examples/Notebooks/matpower-case9.ipynb | 4 +- .../cigre-mv-pf-profiles-shmem.ipynb | 2 +- .../shmem-distributed-villas.py | 18 +- .../test_shmem_cigre_mv_pf_profiles.py | 2 +- examples/villas/dpsim-file.py | 12 +- examples/villas/dpsim-mqtt.py | 14 +- .../villas/shmem-distributed-reference.py | 8 +- 66 files changed, 1171 insertions(+), 1178 deletions(-) diff --git a/dpsim/src/pybind/main.cpp b/dpsim/src/pybind/main.cpp index ea9526057c..e42b7a4792 100644 --- a/dpsim/src/pybind/main.cpp +++ b/dpsim/src/pybind/main.cpp @@ -142,17 +142,9 @@ PYBIND11_MODULE(dpsimpy, m) { .def(py::init()) .def_static("set_log_dir", &CPS::Logger::setLogDir) .def_static("get_log_dir", &CPS::Logger::logDir) - .def("log_attribute", py::overload_cast(&DPsim::DataLogger::logAttribute), "name"_a, "attr"_a, "max_cols"_a = 0, "max_rows"_a = 0) + .def("log_attribute", py::overload_cast(&DPsim::DataLogger::logAttribute), "name"_a, "attr"_a, "max_rows"_a = 0, "max_cols"_a = 0) /// Compatibility method. Might be removed later when the python examples have been fully adapted. - .def("log_attribute", py::overload_cast&, CPS::AttributeBase::Ptr>(&DPsim::DataLogger::logAttribute), "names"_a, "attr"_a) - /// Compatibility method. Might be removed later when the python examples have been fully adapted. - .def("log_attribute", [](DPsim::DataLogger &logger, const CPS::String &name, const CPS::String &attr, const CPS::IdentifiedObject &comp, CPS::UInt rowsMax, CPS::UInt colsMax) { - logger.logAttribute(name, comp.attribute(attr), rowsMax, colsMax); - }, "name"_a, "attr"_a, "comp"_a, "rows_max"_a = 0, "cols_max"_a = 0) - /// Compatibility method. Might be removed later when the python examples have been fully adapted.; - .def("log_attribute", [](DPsim::DataLogger &logger, const std::vector &names, const CPS::String &attr, const CPS::IdentifiedObject &comp) { - logger.logAttribute(names, comp.attribute(attr)); - }); + .def("log_attribute", py::overload_cast&, CPS::AttributeBase::Ptr>(&DPsim::DataLogger::logAttribute), "names"_a, "attr"_a); py::class_>(m, "IdentifiedObject") .def("name", &CPS::IdentifiedObject::name) diff --git a/examples/Notebooks/Circuits/CS_R2CL print_attributes.ipynb b/examples/Notebooks/Circuits/CS_R2CL print_attributes.ipynb index 7727043782..a2fb52588d 100644 --- a/examples/Notebooks/Circuits/CS_R2CL print_attributes.ipynb +++ b/examples/Notebooks/Circuits/CS_R2CL print_attributes.ipynb @@ -76,10 +76,10 @@ "\n", "# Logging\n", "logger = dpsimpy.Logger(name)\n", - "logger.log_attribute('n1.v', 'v', n1)\n", - "logger.log_attribute('n2.v', 'v', n2)\n", - "logger.log_attribute('cs.i_intf', 'i_intf', cs)\n", - "logger.log_attribute('c_1.i_intf', 'i_intf', c1)\n", + "logger.log_attribute('n1.v', n1.attr('v'))\n", + "logger.log_attribute('n2.v', n2.attr('v'))\n", + "logger.log_attribute('cs.i_intf', cs.attr('i_intf'))\n", + "logger.log_attribute('c_1.i_intf', c1.attr('i_intf'))\n", "\n", "sim = dpsimpy.Simulation(name)\n", "sim.set_domain(dpsimpy.Domain.EMT)\n", @@ -198,10 +198,10 @@ "\n", "# Logging\n", "logger = dpsimpy.Logger(name)\n", - "logger.log_attribute('n1.v', 'v', n1)\n", - "logger.log_attribute('n2.v', 'v', n2)\n", - "logger.log_attribute('cs.i_intf', 'i_intf', cs)\n", - "logger.log_attribute('c_1.i_intf', 'i_intf', c1)\n", + "logger.log_attribute('n1.v', n1.attr('v'))\n", + "logger.log_attribute('n2.v', n2.attr('v'))\n", + "logger.log_attribute('cs.i_intf', cs.attr('i_intf'))\n", + "logger.log_attribute('c_1.i_intf', c1.attr('i_intf'))\n", "\n", "sim = dpsimpy.Simulation(name)\n", "sim.set_system(system)\n", @@ -288,4 +288,4 @@ }, "nbformat": 4, "nbformat_minor": 4 -} \ No newline at end of file +} diff --git a/examples/Notebooks/Circuits/CS_R2CL.ipynb b/examples/Notebooks/Circuits/CS_R2CL.ipynb index 7496d77402..953f10e0d7 100644 --- a/examples/Notebooks/Circuits/CS_R2CL.ipynb +++ b/examples/Notebooks/Circuits/CS_R2CL.ipynb @@ -66,10 +66,10 @@ "\n", "# Logging\n", "logger = dpsimpy.Logger(name)\n", - "logger.log_attribute('n1.v', 'v', n1)\n", - "logger.log_attribute('n2.v', 'v', n2)\n", - "logger.log_attribute('cs.i_intf', 'i_intf', cs)\n", - "logger.log_attribute('c_1.i_intf', 'i_intf', c1)\n", + "logger.log_attribute('n1.v', n1.attr('v'))\n", + "logger.log_attribute('n2.v', n2.attr('v'))\n", + "logger.log_attribute('cs.i_intf', cs.attr('i_intf'))\n", + "logger.log_attribute('c_1.i_intf', c1.attr('i_intf'))\n", "\n", "sim = dpsimpy.Simulation(name)\n", "sim.set_domain(dpsimpy.Domain.EMT)\n", @@ -178,10 +178,10 @@ "\n", "# Logging\n", "logger = dpsimpy.Logger(name)\n", - "logger.log_attribute('n1.v', 'v', n1)\n", - "logger.log_attribute('n2.v', 'v', n2)\n", - "logger.log_attribute('cs.i_intf', 'i_intf', cs)\n", - "logger.log_attribute('c_1.i_intf', 'i_intf', c1)\n", + "logger.log_attribute('n1.v', n1.attr('v'))\n", + "logger.log_attribute('n2.v', n2.attr('v'))\n", + "logger.log_attribute('cs.i_intf', cs.attr('i_intf'))\n", + "logger.log_attribute('c_1.i_intf', c1.attr('i_intf'))\n", "\n", "sim = dpsimpy.Simulation(name)\n", "sim.set_system(system)\n", diff --git a/examples/Notebooks/Circuits/Compare_DP_SMIB_ReducedOrderSG_VBR_PCM_LoadStep.ipynb b/examples/Notebooks/Circuits/Compare_DP_SMIB_ReducedOrderSG_VBR_PCM_LoadStep.ipynb index 6688624907..d24910309b 100644 --- a/examples/Notebooks/Circuits/Compare_DP_SMIB_ReducedOrderSG_VBR_PCM_LoadStep.ipynb +++ b/examples/Notebooks/Circuits/Compare_DP_SMIB_ReducedOrderSG_VBR_PCM_LoadStep.ipynb @@ -183,12 +183,7 @@ "### Define system topology\n", "system_pf = dpsimpy.SystemTopology(frequency, [n1_pf, n2_pf], [gen_pf, pi_line_pf, extnet_pf])\n", "\n", - "# Logging\n", - "logger_pf = dpsimpy.Logger(sim_name_pf)\n", - "logger_pf.log_attribute('n1.v', 'v', n1_pf)\n", - "logger_pf.log_attribute('n2.v', 'v', n2_pf)\n", - "logger_pf.log_attribute('p_inj', 'p_inj', extnet_pf)\n", - "logger_pf.log_attribute('q_inj', 'q_inj', extnet_pf)\n", + "\n", "\n", "sim_pf = dpsimpy.Simulation(sim_name_pf, dpsimpy.LogLevel.debug)\n", "sim_pf.set_system(system_pf)\n", @@ -197,7 +192,13 @@ "sim_pf.set_solver_component_behaviour(dpsimpy.SolverBehaviour.Initialization)\n", "sim_pf.set_time_step(0.1)\n", "sim_pf.set_final_time(0.5)\n", - "sim_pf.add_logger(logger_pf)\n", + "\n", + "# Logging\n", + "sim_pf.log_attribute('n1.v', n1_pf.attr('v'))\n", + "sim_pf.log_attribute('n2.v', n2_pf.attr('v'))\n", + "sim_pf.log_attribute('p_inj', extnet_pf.attr('p_inj'))\n", + "sim_pf.log_attribute('q_inj', extnet_pf.attr('q_inj'))\n", + "\n", "sim_pf.run()" ] }, @@ -296,7 +297,7 @@ "\n", " ### Logging\n", " logger = dpsimpy.Logger(name)\n", - " logger.log_attribute('Te', 'Te', gen)\n", + " logger.log_attribute('Te', gen.attr('Te'))\n", "\n", " \n", " ### Simulation\n", diff --git a/examples/Notebooks/Circuits/Compare_DP_SMIB_ReducedOrderSG_VBR_TPM_LoadStep.ipynb b/examples/Notebooks/Circuits/Compare_DP_SMIB_ReducedOrderSG_VBR_TPM_LoadStep.ipynb index c1205244e5..09f0272539 100644 --- a/examples/Notebooks/Circuits/Compare_DP_SMIB_ReducedOrderSG_VBR_TPM_LoadStep.ipynb +++ b/examples/Notebooks/Circuits/Compare_DP_SMIB_ReducedOrderSG_VBR_TPM_LoadStep.ipynb @@ -284,7 +284,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.13" + "version": "3.10.11" }, "vscode": { "interpreter": { diff --git a/examples/Notebooks/Circuits/Compare_EMT_DP_Slack_PiLine_PQLoad.ipynb b/examples/Notebooks/Circuits/Compare_EMT_DP_Slack_PiLine_PQLoad.ipynb index 746aed8618..ceb0201633 100644 --- a/examples/Notebooks/Circuits/Compare_EMT_DP_Slack_PiLine_PQLoad.ipynb +++ b/examples/Notebooks/Circuits/Compare_EMT_DP_Slack_PiLine_PQLoad.ipynb @@ -66,9 +66,9 @@ "\n", "# Logging\n", "logger_pf = dpsimpy.Logger(sim_name_pf)\n", - "logger_pf.log_attribute('v1', 'v', n1_pf)\n", - "logger_pf.log_attribute('v2', 'v', n2_pf)\n", - "logger_pf.log_attribute('i12', 'i_intf', line_pf)\n", + "logger_pf.log_attribute('v1', n1_pf.attr('v'))\n", + "logger_pf.log_attribute('v2', n2_pf.attr('v'))\n", + "logger_pf.log_attribute('i12', line_pf.attr('i_intf'))\n", "\n", "# Simulation\n", "sim_pf = dpsimpy.Simulation(sim_name_pf, dpsimpy.LogLevel.debug)\n", @@ -118,10 +118,10 @@ "\n", "# Logging\n", "logger_emt = dpsimpy.Logger(sim_name_emt)\n", - "logger_emt.log_attribute('v1', 'v', n1_emt)\n", - "logger_emt.log_attribute('v2', 'v', n2_emt)\n", - "logger_emt.log_attribute('i12', 'i_intf', line_emt)\n", - "logger_emt.log_attribute('irx', 'i_intf', load_emt)\n", + "logger_emt.log_attribute('v1', n1_emt.attr('v'))\n", + "logger_emt.log_attribute('v2', n2_emt.attr('v'))\n", + "logger_emt.log_attribute('i12', line_emt.attr('i_intf'))\n", + "logger_emt.log_attribute('irx', load_emt.attr('i_intf'))\n", "\n", "# load step sized in absolute terms\n", "load_switch = dpsimpy.emt.ph3.Switch(\"Load_Add_Switch_n2\", dpsimpy.LogLevel.debug)\n", @@ -131,7 +131,7 @@ "load_switch.open()\n", "system_emt.add(load_switch)\n", "system_emt.connect_component(load_switch, [gnd, system_emt.node('n2')])\n", - "logger_emt.log_attribute('switchedload_i', 'i_intf', load_switch)\n", + "logger_emt.log_attribute('switchedload_i', load_switch.attr('i_intf'))\n", "load_step_event = dpsimpy.event.SwitchEvent3Ph(0.1 - time_step_emt, load_switch, True)\n", "\n", "# Simulation\n", @@ -201,9 +201,9 @@ "\n", "# Logging\n", "logger_pf = dpsimpy.Logger(sim_name_pf)\n", - "logger_pf.log_attribute('v1', 'v', n1_pf)\n", - "logger_pf.log_attribute('v2', 'v', n2_pf)\n", - "logger_pf.log_attribute('i12', 'i_intf', line_pf)\n", + "logger_pf.log_attribute('v1', n1_pf.attr('v'))\n", + "logger_pf.log_attribute('v2', n2_pf.attr('v'))\n", + "logger_pf.log_attribute('i12', line_pf.attr('i_intf'))\n", "\n", "# Simulation\n", "sim_pf = dpsimpy.Simulation(sim_name_pf, dpsimpy.LogLevel.debug)\n", @@ -248,10 +248,10 @@ "\n", "# Logging\n", "logger_dp = dpsimpy.Logger(sim_name_dp)\n", - "logger_dp.log_attribute('v1', 'v', n1_dp)\n", - "logger_dp.log_attribute('v2', 'v', n2_dp)\n", - "logger_dp.log_attribute('i12', 'i_intf', line_dp)\n", - "logger_dp.log_attribute('irx', 'i_intf', load_dp)\n", + "logger_dp.log_attribute('v1', n1_dp.attr('v'))\n", + "logger_dp.log_attribute('v2', n2_dp.attr('v'))\n", + "logger_dp.log_attribute('i12', line_dp.attr('i_intf'))\n", + "logger_dp.log_attribute('irx', load_dp.attr('i_intf'))\n", "\n", "# load step sized in absolute terms\n", "load_switch = dpsimpy.dp.ph1.Switch(\"Load_Add_Switch_n2\", dpsimpy.LogLevel.debug)\n", @@ -261,7 +261,7 @@ "load_switch.open()\n", "system_dp.add(load_switch)\n", "system_dp.connect_component(load_switch, [gnd, system_dp.node('n2')])\n", - "logger_dp.log_attribute('switchedload_i', 'i_intf', load_switch)\n", + "logger_dp.log_attribute('switchedload_i', load_switch.attr('i_intf'))\n", "load_step_event = dpsimpy.event.SwitchEvent(0.1 - time_step_dp, load_switch, True)\n", "\n", "# Simulation\n", diff --git a/examples/Notebooks/Circuits/Compare_EMT_SynGenDQ7odTrapez_DP_SynGenTrStab_SMIB_Fault.ipynb b/examples/Notebooks/Circuits/Compare_EMT_SynGenDQ7odTrapez_DP_SynGenTrStab_SMIB_Fault.ipynb index 71d1f14969..53562e2a09 100644 --- a/examples/Notebooks/Circuits/Compare_EMT_SynGenDQ7odTrapez_DP_SynGenTrStab_SMIB_Fault.ipynb +++ b/examples/Notebooks/Circuits/Compare_EMT_SynGenDQ7odTrapez_DP_SynGenTrStab_SMIB_Fault.ipynb @@ -136,12 +136,12 @@ "\n", "# Logging\n", "logger_pf = dpsimpy.Logger(sim_name_pf)\n", - "logger_pf.log_attribute(\"v1\", \"v\", n1_pf)\n", - "logger_pf.log_attribute(\"v2\", \"v\", n2_pf)\n", - "logger_pf.log_attribute(\"v_line\", \"v_intf\", line_pf)\n", - "logger_pf.log_attribute(\"i_line\", \"i_intf\", line_pf)\n", - "logger_pf.log_attribute(\"v_gen\", \"v_intf\", gen_pf)\n", - "logger_pf.log_attribute(\"ig\", \"i_intf\", gen_pf)\n", + "logger_pf.log_attribute(\"v1\", n1_pf.attr(\"v\"))\n", + "logger_pf.log_attribute(\"v2\", n2_pf.attr(\"v\"))\n", + "logger_pf.log_attribute(\"v_line\", line_pf.attr(\"v_intf\"))\n", + "logger_pf.log_attribute(\"i_line\", line_pf.attr(\"i_intf\"))\n", + "logger_pf.log_attribute(\"v_gen\", gen_pf.attr(\"v_intf\"))\n", + "logger_pf.log_attribute(\"ig\", gen_pf.attr(\"i_intf\"))\n", "\n", "# Simulation\n", "sim_pf = dpsimpy.Simulation(sim_name_pf, dpsimpy.LogLevel.debug)\n", @@ -222,14 +222,14 @@ "\n", "# Logging\n", "logger = dpsimpy.Logger(sim_name)\n", - "logger.log_attribute(\"v1\", \"v\", n1)\n", - "logger.log_attribute(\"v2\", \"v\", n2)\n", - "logger.log_attribute(\"v_line\", \"v_intf\", line)\n", - "logger.log_attribute(\"i_line\", \"i_intf\", line)\n", - "logger.log_attribute(\"v_gen\", \"v_intf\", gen)\n", - "logger.log_attribute(\"i_gen\", \"i_intf\", gen)\n", - "logger.log_attribute(\"wr_gen\", \"w_r\", gen)\n", - "logger.log_attribute(\"delta_r\", \"delta_r\", gen)\n", + "logger.log_attribute(\"v1\", n1.attr(\"v\"))\n", + "logger.log_attribute(\"v2\", n2.attr(\"v\"))\n", + "logger.log_attribute(\"v_line\", line.attr(\"v_intf\"))\n", + "logger.log_attribute(\"i_line\", line.attr(\"i_intf\"))\n", + "logger.log_attribute(\"v_gen\", gen.attr(\"v_intf\"))\n", + "logger.log_attribute(\"i_gen\", gen.attr(\"i_intf\"))\n", + "logger.log_attribute(\"wr_gen\", gen.attr(\"w_r\"))\n", + "logger.log_attribute(\"delta_r\", gen.attr(\"delta_r\"))\n", "\n", "# Events\n", "sw1 = dpsimpy.event.SwitchEvent3Ph(start_time_fault, fault, True)\n", @@ -368,8 +368,8 @@ "\n", "# Logging\n", "logger_pf = dpsimpy.Logger(sim_name_pf)\n", - "logger_pf.log_attribute(\"v1\", \"v\", n1_pf)\n", - "logger_pf.log_attribute(\"v2\", \"v\", n2_pf)\n", + "logger_pf.log_attribute(\"v1\", n1_pf.attr(\"v\"))\n", + "logger_pf.log_attribute(\"v2\", n2_pf.attr(\"v\"))\n", "\n", "# Simulation\n", "sim_pf = dpsimpy.Simulation(sim_name_pf, dpsimpy.LogLevel.debug)\n", @@ -439,25 +439,25 @@ "\n", "# Logging\n", "logger_dp = dpsimpy.Logger(sim_name_dp)\n", - "logger_dp.log_attribute(\"v1\", \"v\", n1_dp)\n", - "logger_dp.log_attribute(\"v2\", \"v\", n2_dp)\n", + "logger_dp.log_attribute(\"v1\", n1_dp.attr(\"v\"))\n", + "logger_dp.log_attribute(\"v2\", n2_dp.attr(\"v\"))\n", "\n", - "logger_dp.log_attribute(\"v_line\", \"v_intf\", line_dp)\n", - "logger_dp.log_attribute(\"i_line\", \"i_intf\", line_dp)\n", + "logger_dp.log_attribute(\"v_line\", line_dp.attr(\"v_intf\"))\n", + "logger_dp.log_attribute(\"i_line\", line_dp.attr(\"i_intf\"))\n", "\n", - "logger_dp.log_attribute(\"v_slack\", \"v_intf\", extnet_dp)\n", - "logger_dp.log_attribute(\"i_slack\", \"i_intf\", extnet_dp)\n", + "logger_dp.log_attribute(\"v_slack\", extnet_dp.attr(\"v_intf\"))\n", + "logger_dp.log_attribute(\"i_slack\", extnet_dp.attr(\"i_intf\"))\n", "\n", - "logger_dp.log_attribute(\"i_fault\", \"i_intf\", fault_dp)\n", + "logger_dp.log_attribute(\"i_fault\", fault_dp.attr(\"i_intf\"))\n", "\n", - "logger_dp.log_attribute(\"Ep\", \"Ep\", gen_dp)\n", - "logger_dp.log_attribute(\"v_gen\", \"v_intf\", gen_dp)\n", - "logger_dp.log_attribute(\"i_gen\", \"i_intf\", gen_dp)\n", - "logger_dp.log_attribute(\"wr_gen\", \"w_r\", gen_dp)\n", + "logger_dp.log_attribute(\"Ep\", gen_dp.attr(\"Ep\"))\n", + "logger_dp.log_attribute(\"v_gen\", gen_dp.attr(\"v_intf\"))\n", + "logger_dp.log_attribute(\"i_gen\", gen_dp.attr(\"i_intf\"))\n", + "logger_dp.log_attribute(\"wr_gen\", gen_dp.attr(\"w_r\"))\n", "# Name changed from CPP example to work in comparison below\n", - "logger_dp.log_attribute(\"delta_r\", \"delta_r\", gen_dp)\n", - "logger_dp.log_attribute(\"P_elec\", \"P_elec\", gen_dp)\n", - "logger_dp.log_attribute(\"P_mech\", \"P_mech\", gen_dp)\n", + "logger_dp.log_attribute(\"delta_r\", gen_dp.attr(\"delta_r\"))\n", + "logger_dp.log_attribute(\"P_elec\", gen_dp.attr(\"P_elec\"))\n", + "logger_dp.log_attribute(\"P_mech\", gen_dp.attr(\"P_mech\"))\n", "\n", "# Simulation\n", "sim_dp = dpsimpy.Simulation(sim_name, dpsimpy.LogLevel.debug)\n", @@ -757,4 +757,4 @@ }, "nbformat": 4, "nbformat_minor": 4 -} \ No newline at end of file +} diff --git a/examples/Notebooks/Circuits/DP_SP_SynGenTrStab_3Bus_Fault.ipynb b/examples/Notebooks/Circuits/DP_SP_SynGenTrStab_3Bus_Fault.ipynb index a4aae2ed07..3932c874a2 100644 --- a/examples/Notebooks/Circuits/DP_SP_SynGenTrStab_3Bus_Fault.ipynb +++ b/examples/Notebooks/Circuits/DP_SP_SynGenTrStab_3Bus_Fault.ipynb @@ -203,9 +203,9 @@ "\n", "# Logging\n", "logger_pf = dpsimpy.Logger(sim_name_pf)\n", - "logger_pf.log_attribute(\"v_bus1\", \"v\", n1_pf)\n", - "logger_pf.log_attribute(\"v_bus2\", \"v\", n2_pf)\n", - "logger_pf.log_attribute(\"v_bus3\", \"v\", n3_pf)\n", + "logger_pf.log_attribute(\"v_bus1\", n1_pf.attr(\"v\"))\n", + "logger_pf.log_attribute(\"v_bus2\", n2_pf.attr(\"v\"))\n", + "logger_pf.log_attribute(\"v_bus3\", n3_pf.attr(\"v\"))\n", "\n", "# Simulation\n", "sim_pf = dpsimpy.Simulation(sim_name_pf, dpsimpy.LogLevel.debug)\n", @@ -298,37 +298,37 @@ "\n", "# Logging\n", "logger_dp = dpsimpy.Logger(sim_name_dp)\n", - "logger_dp.log_attribute(\"v1\", \"v\", n1_dp)\n", - "logger_dp.log_attribute(\"v2\", \"v\", n2_dp)\n", - "logger_dp.log_attribute(\"v3\", \"v\", n3_dp)\n", - "\n", - "logger_dp.log_attribute(\"v_line12\", \"v_intf\", line12_dp)\n", - "logger_dp.log_attribute(\"v_line13\", \"v_intf\", line13_dp)\n", - "logger_dp.log_attribute(\"v_line23\", \"v_intf\", line23_dp)\n", - "logger_dp.log_attribute(\"i_line12\", \"i_intf\", line12_dp)\n", - "logger_dp.log_attribute(\"i_line13\", \"i_intf\", line13_dp)\n", - "logger_dp.log_attribute(\"i_line23\", \"i_intf\", line23_dp)\n", - "\n", - "logger_dp.log_attribute(\"Ep_gen1\", \"Ep_mag\", gen1_dp)\n", - "logger_dp.log_attribute(\"v_gen1\", \"v_intf\", gen1_dp)\n", - "logger_dp.log_attribute(\"i_gen1\", \"i_intf\", gen1_dp)\n", - "logger_dp.log_attribute(\"wr_gen1\", \"w_r\", gen1_dp)\n", - "logger_dp.log_attribute(\"delta_gen1\", \"delta_r\", gen1_dp)\n", - "logger_dp.log_attribute(\"P_mech1\", \"P_mech\", gen1_dp)\n", - "logger_dp.log_attribute(\"P_elec1\", \"P_elec\", gen1_dp)\n", - "\n", - "logger_dp.log_attribute(\"Ep_gen2\", \"Ep_mag\", gen2_dp)\n", - "logger_dp.log_attribute(\"v_gen2\", \"v_intf\", gen2_dp)\n", - "logger_dp.log_attribute(\"i_gen2\", \"i_intf\", gen2_dp)\n", - "logger_dp.log_attribute(\"wr_gen2\", \"w_r\", gen2_dp)\n", - "logger_dp.log_attribute(\"delta_gen2\", \"delta_r\", gen2_dp)\n", - "logger_dp.log_attribute(\"wref_gen2\", \"w_ref\", gen2_dp)\n", - "logger_dp.log_attribute(\"P_mech2\", \"P_mech\", gen2_dp)\n", - "logger_dp.log_attribute(\"P_elec2\", \"P_elec\", gen2_dp)\n", - "\n", - "logger_dp.log_attribute(\"i_fault\", \"i_intf\", fault_dp)\n", - "logger_dp.log_attribute(\"v_load\", \"v_intf\", load_dp)\n", - "logger_dp.log_attribute(\"i_load\", \"i_intf\", load_dp)\n", + "logger_dp.log_attribute(\"v1\", n1_dp.attr(\"v\"))\n", + "logger_dp.log_attribute(\"v2\", n2_dp.attr(\"v\"))\n", + "logger_dp.log_attribute(\"v3\", n3_dp.attr(\"v\"))\n", + "\n", + "logger_dp.log_attribute(\"v_line12\", line12_dp.attr(\"v_intf\"))\n", + "logger_dp.log_attribute(\"v_line13\", line13_dp.attr(\"v_intf\"))\n", + "logger_dp.log_attribute(\"v_line23\", line23_dp.attr(\"v_intf\"))\n", + "logger_dp.log_attribute(\"i_line12\", line12_dp.attr(\"i_intf\"))\n", + "logger_dp.log_attribute(\"i_line13\", line13_dp.attr(\"i_intf\"))\n", + "logger_dp.log_attribute(\"i_line23\", line23_dp.attr(\"i_intf\"))\n", + "\n", + "logger_dp.log_attribute(\"Ep_gen1\", gen1_dp.attr(\"Ep_mag\"))\n", + "logger_dp.log_attribute(\"v_gen1\", gen1_dp.attr(\"v_intf\"))\n", + "logger_dp.log_attribute(\"i_gen1\", gen1_dp.attr(\"i_intf\"))\n", + "logger_dp.log_attribute(\"wr_gen1\", gen1_dp.attr(\"w_r\"))\n", + "logger_dp.log_attribute(\"delta_gen1\", gen1_dp.attr(\"delta_r\"))\n", + "logger_dp.log_attribute(\"P_mech1\", gen1_dp.attr(\"P_mech\"))\n", + "logger_dp.log_attribute(\"P_elec1\", gen1_dp.attr(\"P_elec\"))\n", + "\n", + "logger_dp.log_attribute(\"Ep_gen2\", gen2_dp.attr(\"Ep_mag\"))\n", + "logger_dp.log_attribute(\"v_gen2\", gen2_dp.attr(\"v_intf\"))\n", + "logger_dp.log_attribute(\"i_gen2\", gen2_dp.attr(\"i_intf\"))\n", + "logger_dp.log_attribute(\"wr_gen2\", gen2_dp.attr(\"w_r\"))\n", + "logger_dp.log_attribute(\"delta_gen2\", gen2_dp.attr(\"delta_r\"))\n", + "logger_dp.log_attribute(\"wref_gen2\", gen2_dp.attr(\"w_ref\"))\n", + "logger_dp.log_attribute(\"P_mech2\", gen2_dp.attr(\"P_mech\"))\n", + "logger_dp.log_attribute(\"P_elec2\", gen2_dp.attr(\"P_elec\"))\n", + "\n", + "logger_dp.log_attribute(\"i_fault\", fault_dp.attr(\"i_intf\"))\n", + "logger_dp.log_attribute(\"v_load\", load_dp.attr(\"v_intf\"))\n", + "logger_dp.log_attribute(\"i_load\", load_dp.attr(\"i_intf\"))\n", "\n", "# Simulation\n", "sim_dp = dpsimpy.Simulation(sim_name_dp, dpsimpy.LogLevel.debug)\n", @@ -525,9 +525,9 @@ "\n", "# Logging\n", "logger_pf = dpsimpy.Logger(sim_name_pf)\n", - "logger_pf.log_attribute(\"v_bus1\", \"v\", n1_pf)\n", - "logger_pf.log_attribute(\"v_bus2\", \"v\", n2_pf)\n", - "logger_pf.log_attribute(\"v_bus3\", \"v\", n3_pf)\n", + "logger_pf.log_attribute(\"v_bus1\", n1_pf.attr(\"v\"))\n", + "logger_pf.log_attribute(\"v_bus2\", n2_pf.attr(\"v\"))\n", + "logger_pf.log_attribute(\"v_bus3\", n3_pf.attr(\"v\"))\n", "\n", "# Simulation\n", "sim_pf = dpsimpy.Simulation(sim_name_pf, dpsimpy.LogLevel.debug)\n", @@ -620,37 +620,37 @@ "\n", "# Logging\n", "logger_sp = dpsimpy.Logger(sim_name_sp)\n", - "logger_sp.log_attribute(\"v1\", \"v\", n1_sp)\n", - "logger_sp.log_attribute(\"v2\", \"v\", n2_sp)\n", - "logger_sp.log_attribute(\"v3\", \"v\", n3_sp)\n", - "\n", - "logger_sp.log_attribute(\"v_line12\", \"v_intf\", line12_sp)\n", - "logger_sp.log_attribute(\"v_line13\", \"v_intf\", line13_sp)\n", - "logger_sp.log_attribute(\"v_line23\", \"v_intf\", line23_sp)\n", - "logger_sp.log_attribute(\"i_line12\", \"i_intf\", line12_sp)\n", - "logger_sp.log_attribute(\"i_line13\", \"i_intf\", line13_sp)\n", - "logger_sp.log_attribute(\"i_line23\", \"i_intf\", line23_sp)\n", - "\n", - "logger_sp.log_attribute(\"Ep_gen1\", \"Ep_mag\", gen1_sp)\n", - "logger_sp.log_attribute(\"v_gen1\", \"v_intf\", gen1_sp)\n", - "logger_sp.log_attribute(\"i_gen1\", \"i_intf\", gen1_sp)\n", - "logger_sp.log_attribute(\"wr_gen1\", \"w_r\", gen1_sp)\n", - "logger_sp.log_attribute(\"delta_gen1\", \"delta_r\", gen1_sp)\n", - "logger_sp.log_attribute(\"P_mech1\", \"P_mech\", gen1_sp)\n", - "logger_sp.log_attribute(\"P_elec1\", \"P_elec\", gen1_sp)\n", - "\n", - "logger_sp.log_attribute(\"Ep_gen2\", \"Ep_mag\", gen2_sp)\n", - "logger_sp.log_attribute(\"v_gen2\", \"v_intf\", gen2_sp)\n", - "logger_sp.log_attribute(\"i_gen2\", \"i_intf\", gen2_sp)\n", - "logger_sp.log_attribute(\"wr_gen2\", \"w_r\", gen2_sp)\n", - "logger_sp.log_attribute(\"delta_gen2\", \"delta_r\", gen2_sp)\n", - "logger_sp.log_attribute(\"wref_gen2\", \"w_ref\", gen2_sp)\n", - "logger_sp.log_attribute(\"P_mech2\", \"P_mech\", gen2_sp)\n", - "logger_sp.log_attribute(\"P_elec2\", \"P_elec\", gen2_sp)\n", - "\n", - "logger_sp.log_attribute(\"i_fault\", \"i_intf\", fault_sp)\n", - "logger_sp.log_attribute(\"v_load\", \"v_intf\", load_sp)\n", - "logger_sp.log_attribute(\"i_load\", \"i_intf\", load_sp)\n", + "logger_sp.log_attribute(\"v1\", n1_sp.attr(\"v\"))\n", + "logger_sp.log_attribute(\"v2\", n2_sp.attr(\"v\"))\n", + "logger_sp.log_attribute(\"v3\", n3_sp.attr(\"v\"))\n", + "\n", + "logger_sp.log_attribute(\"v_line12\", line12_sp.attr(\"v_intf\"))\n", + "logger_sp.log_attribute(\"v_line13\", line13_sp.attr(\"v_intf\"))\n", + "logger_sp.log_attribute(\"v_line23\", line23_sp.attr(\"v_intf\"))\n", + "logger_sp.log_attribute(\"i_line12\", line12_sp.attr(\"i_intf\"))\n", + "logger_sp.log_attribute(\"i_line13\", line13_sp.attr(\"i_intf\"))\n", + "logger_sp.log_attribute(\"i_line23\", line23_sp.attr(\"i_intf\"))\n", + "\n", + "logger_sp.log_attribute(\"Ep_gen1\", gen1_sp.attr(\"Ep_mag\"))\n", + "logger_sp.log_attribute(\"v_gen1\", gen1_sp.attr(\"v_intf\"))\n", + "logger_sp.log_attribute(\"i_gen1\", gen1_sp.attr(\"i_intf\"))\n", + "logger_sp.log_attribute(\"wr_gen1\", gen1_sp.attr(\"w_r\"))\n", + "logger_sp.log_attribute(\"delta_gen1\", gen1_sp.attr(\"delta_r\"))\n", + "logger_sp.log_attribute(\"P_mech1\", gen1_sp.attr(\"P_mech\"))\n", + "logger_sp.log_attribute(\"P_elec1\", gen1_sp.attr(\"P_elec\"))\n", + "\n", + "logger_sp.log_attribute(\"Ep_gen2\", gen2_sp.attr(\"Ep_mag\"))\n", + "logger_sp.log_attribute(\"v_gen2\", gen2_sp.attr(\"v_intf\"))\n", + "logger_sp.log_attribute(\"i_gen2\", gen2_sp.attr(\"i_intf\"))\n", + "logger_sp.log_attribute(\"wr_gen2\", gen2_sp.attr(\"w_r\"))\n", + "logger_sp.log_attribute(\"delta_gen2\", gen2_sp.attr(\"delta_r\"))\n", + "logger_sp.log_attribute(\"wref_gen2\", gen2_sp.attr(\"w_ref\"))\n", + "logger_sp.log_attribute(\"P_mech2\", gen2_sp.attr(\"P_mech\"))\n", + "logger_sp.log_attribute(\"P_elec2\", gen2_sp.attr(\"P_elec\"))\n", + "\n", + "logger_sp.log_attribute(\"i_fault\", fault_sp.attr(\"i_intf\"))\n", + "logger_sp.log_attribute(\"v_load\", load_sp.attr(\"v_intf\"))\n", + "logger_sp.log_attribute(\"i_load\", load_sp.attr(\"i_intf\"))\n", "\n", "# Simulation\n", "sim_sp = dpsimpy.Simulation(sim_name_sp, dpsimpy.LogLevel.debug)\n", diff --git a/examples/Notebooks/Circuits/DP_SP_SynGenTrStab_3Bus_SteadyState.ipynb b/examples/Notebooks/Circuits/DP_SP_SynGenTrStab_3Bus_SteadyState.ipynb index 7083c9a790..d0765e0b6b 100644 --- a/examples/Notebooks/Circuits/DP_SP_SynGenTrStab_3Bus_SteadyState.ipynb +++ b/examples/Notebooks/Circuits/DP_SP_SynGenTrStab_3Bus_SteadyState.ipynb @@ -2,14 +2,16 @@ "cells": [ { "cell_type": "markdown", + "metadata": {}, "source": [ "# 3 Bus (2 Generators, 1 Load) Steady state SP vs DP" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "import villas.dataprocessing.readtools as rt\n", "from villas.dataprocessing.timeseries import TimeSeries as ts\n", @@ -20,27 +22,27 @@ "import dpsimpy\n", "\n", "#%matplotlib widget" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "## DP Simulation" - ], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "### Parameters" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "#-----------Power system-----------\n", "#Voltage level as Base Voltage\n", @@ -109,20 +111,20 @@ "final_time = 10\n", "time_step = 0.001\n", "scale_inertia= 1.0" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "### Powerflow for Initialization" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "time_step_pf = final_time\n", "final_time_pf = final_time + time_step_pf\n", @@ -179,9 +181,9 @@ "\n", "# Logging\n", "logger_pf = dpsimpy.Logger(sim_name_pf)\n", - "logger_pf.log_attribute(\"v_bus1\", \"v\", n1_pf)\n", - "logger_pf.log_attribute(\"v_bus2\", \"v\", n2_pf)\n", - "logger_pf.log_attribute(\"v_bus3\", \"v\", n3_pf)\n", + "logger_pf.log_attribute(\"v_bus1\", n1_pf.attr(\"v\"))\n", + "logger_pf.log_attribute(\"v_bus2\", n2_pf.attr(\"v\"))\n", + "logger_pf.log_attribute(\"v_bus3\", n3_pf.attr(\"v\"))\n", "\n", "# Simulation\n", "sim_pf = dpsimpy.Simulation(sim_name_pf, dpsimpy.LogLevel.debug)\n", @@ -194,20 +196,20 @@ "sim_pf.do_init_from_nodes_and_terminals(False)\n", "sim_pf.add_logger(logger_pf)\n", "sim_pf.run()" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "### Dynamic Simulation" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "sim_name_dp = sim_name + \"_DP\"\n", "dpsimpy.Logger.set_log_dir(\"logs/\" + sim_name_dp)\n", @@ -265,30 +267,30 @@ "\n", "# Logging\n", "logger_dp = dpsimpy.Logger(sim_name_dp)\n", - "logger_dp.log_attribute(\"v1\", \"v\", n1_dp)\n", - "logger_dp.log_attribute(\"v2\", \"v\", n2_dp)\n", - "logger_dp.log_attribute(\"v3\", \"v\", n3_dp)\n", + "logger_dp.log_attribute(\"v1\", n1_dp.attr(\"v\"))\n", + "logger_dp.log_attribute(\"v2\", n2_dp.attr(\"v\"))\n", + "logger_dp.log_attribute(\"v3\", n3_dp.attr(\"v\"))\n", "\n", - "logger_dp.log_attribute(\"v_line12\", \"v_intf\", line12_dp)\n", - "logger_dp.log_attribute(\"v_line13\", \"v_intf\", line13_dp)\n", - "logger_dp.log_attribute(\"v_line23\", \"v_intf\", line23_dp)\n", - "logger_dp.log_attribute(\"i_line12\", \"i_intf\", line12_dp)\n", - "logger_dp.log_attribute(\"i_line13\", \"i_intf\", line13_dp)\n", - "logger_dp.log_attribute(\"i_line23\", \"i_intf\", line23_dp)\n", + "logger_dp.log_attribute(\"v_line12\", line12_dp.attr(\"v_intf\"))\n", + "logger_dp.log_attribute(\"v_line13\", line13_dp.attr(\"v_intf\"))\n", + "logger_dp.log_attribute(\"v_line23\", line23_dp.attr(\"v_intf\"))\n", + "logger_dp.log_attribute(\"i_line12\", line12_dp.attr(\"i_intf\"))\n", + "logger_dp.log_attribute(\"i_line13\", line13_dp.attr(\"i_intf\"))\n", + "logger_dp.log_attribute(\"i_line23\", line23_dp.attr(\"i_intf\"))\n", "\n", - "logger_dp.log_attribute(\"Ep_gen1\", \"Ep_mag\", gen1_dp)\n", - "logger_dp.log_attribute(\"v_gen1\", \"v_intf\", gen1_dp)\n", - "logger_dp.log_attribute(\"i_gen1\", \"i_intf\", gen1_dp)\n", - "logger_dp.log_attribute(\"wr_gen1\", \"w_r\", gen1_dp)\n", - "logger_dp.log_attribute(\"delta_gen1\", \"delta_r\", gen1_dp)\n", + "logger_dp.log_attribute(\"Ep_gen1\", gen1_dp.attr(\"Ep_mag\"))\n", + "logger_dp.log_attribute(\"v_gen1\", gen1_dp.attr(\"v_intf\"))\n", + "logger_dp.log_attribute(\"i_gen1\", gen1_dp.attr(\"i_intf\"))\n", + "logger_dp.log_attribute(\"wr_gen1\", gen1_dp.attr(\"w_r\"))\n", + "logger_dp.log_attribute(\"delta_gen1\", gen1_dp.attr(\"delta_r\"))\n", "\n", - "logger_dp.log_attribute(\"Ep_gen2\", \"Ep_mag\", gen2_dp)\n", - "logger_dp.log_attribute(\"v_gen2\", \"v_intf\", gen2_dp)\n", - "logger_dp.log_attribute(\"i_gen2\", \"i_intf\", gen2_dp)\n", - "logger_dp.log_attribute(\"wr_gen2\", \"w_r\", gen2_dp)\n", - "logger_dp.log_attribute(\"delta_gen2\", \"delta_r\", gen2_dp)\n", + "logger_dp.log_attribute(\"Ep_gen2\", gen2_dp.attr(\"Ep_mag\"))\n", + "logger_dp.log_attribute(\"v_gen2\", gen2_dp.attr(\"v_intf\"))\n", + "logger_dp.log_attribute(\"i_gen2\", gen2_dp.attr(\"i_intf\"))\n", + "logger_dp.log_attribute(\"wr_gen2\", gen2_dp.attr(\"w_r\"))\n", + "logger_dp.log_attribute(\"delta_gen2\", gen2_dp.attr(\"delta_r\"))\n", "\n", - "logger_dp.log_attribute(\"P_elec2\", \"P_elec\", gen2_dp)\n", + "logger_dp.log_attribute(\"P_elec2\", gen2_dp.attr(\"P_elec\"))\n", "\n", "\n", "# Simulation\n", @@ -300,27 +302,27 @@ "sim_dp.add_logger(logger_dp)\n", "\n", "sim_dp.run()" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "## SP Simulation" - ], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "### Parameters" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "#-----------Power system-----------\n", "#Voltage level as Base Voltage\n", @@ -389,20 +391,20 @@ "final_time = 10\n", "time_step = 0.001\n", "scale_inertia= 1.0" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "### Powerflow for Initialization" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "time_step_pf = final_time\n", "final_time_pf = final_time + time_step_pf\n", @@ -459,9 +461,9 @@ "\n", "# Logging\n", "logger_pf = dpsimpy.Logger(sim_name_pf)\n", - "logger_pf.log_attribute(\"v_bus1\", \"v\", n1_pf)\n", - "logger_pf.log_attribute(\"v_bus2\", \"v\", n2_pf)\n", - "logger_pf.log_attribute(\"v_bus3\", \"v\", n3_pf)\n", + "logger_pf.log_attribute(\"v_bus1\", n1_pf.attr(\"v\"))\n", + "logger_pf.log_attribute(\"v_bus2\", n2_pf.attr(\"v\"))\n", + "logger_pf.log_attribute(\"v_bus3\", n3_pf.attr(\"v\"))\n", "\n", "# Simulation\n", "sim_pf = dpsimpy.Simulation(sim_name_pf, dpsimpy.LogLevel.debug)\n", @@ -473,20 +475,20 @@ "sim_pf.do_init_from_nodes_and_terminals(False)\n", "sim_pf.add_logger(logger_pf)\n", "sim_pf.run()" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "### Dynamic Simulation" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "sim_name_sp = sim_name + \"_SP\"\n", "dpsimpy.Logger.set_log_dir(\"logs/\" + sim_name_sp)\n", @@ -544,30 +546,30 @@ "\n", "# Logging\n", "logger_sp = dpsimpy.Logger(sim_name_sp)\n", - "logger_sp.log_attribute(\"v1\", \"v\", n1_sp)\n", - "logger_sp.log_attribute(\"v2\", \"v\", n2_sp)\n", - "logger_sp.log_attribute(\"v3\", \"v\", n3_sp)\n", - "\n", - "logger_sp.log_attribute(\"v_line12\", \"v_intf\", line12_sp)\n", - "logger_sp.log_attribute(\"v_line13\", \"v_intf\", line13_sp)\n", - "logger_sp.log_attribute(\"v_line23\", \"v_intf\", line23_sp)\n", - "logger_sp.log_attribute(\"i_line12\", \"i_intf\", line12_sp)\n", - "logger_sp.log_attribute(\"i_line13\", \"i_intf\", line13_sp)\n", - "logger_sp.log_attribute(\"i_line23\", \"i_intf\", line23_sp)\n", - "\n", - "logger_sp.log_attribute(\"Ep_gen1\", \"Ep_mag\", gen1_sp)\n", - "logger_sp.log_attribute(\"v_gen1\", \"v_intf\", gen1_sp)\n", - "logger_sp.log_attribute(\"i_gen1\", \"i_intf\", gen1_sp)\n", - "logger_sp.log_attribute(\"wr_gen1\", \"w_r\", gen1_sp)\n", - "logger_sp.log_attribute(\"delta_gen1\", \"delta_r\", gen1_sp)\n", - "\n", - "logger_sp.log_attribute(\"Ep_gen2\", \"Ep_mag\", gen2_sp)\n", - "logger_sp.log_attribute(\"v_gen2\", \"v_intf\", gen2_sp)\n", - "logger_sp.log_attribute(\"i_gen2\", \"i_intf\", gen2_sp)\n", - "logger_sp.log_attribute(\"wr_gen2\", \"w_r\", gen2_sp)\n", - "logger_sp.log_attribute(\"delta_gen2\", \"delta_r\", gen2_sp)\n", - "logger_sp.log_attribute(\"wref_gen2\", \"w_ref\", gen2_sp)\n", - "logger_sp.log_attribute(\"P_elec2\", \"P_elec\", gen2_sp)\n", + "logger_sp.log_attribute(\"v1\", n1_sp.attr(\"v\"))\n", + "logger_sp.log_attribute(\"v2\", n2_sp.attr(\"v\"))\n", + "logger_sp.log_attribute(\"v3\", n3_sp.attr(\"v\"))\n", + "\n", + "logger_sp.log_attribute(\"v_line12\", line12_sp.attr(\"v_intf\"))\n", + "logger_sp.log_attribute(\"v_line13\", line13_sp.attr(\"v_intf\"))\n", + "logger_sp.log_attribute(\"v_line23\", line23_sp.attr(\"v_intf\"))\n", + "logger_sp.log_attribute(\"i_line12\", line12_sp.attr(\"i_intf\"))\n", + "logger_sp.log_attribute(\"i_line13\", line13_sp.attr(\"i_intf\"))\n", + "logger_sp.log_attribute(\"i_line23\", line23_sp.attr(\"i_intf\"))\n", + "\n", + "logger_sp.log_attribute(\"Ep_gen1\", gen1_sp.attr(\"Ep_mag\"))\n", + "logger_sp.log_attribute(\"v_gen1\", gen1_sp.attr(\"v_intf\"))\n", + "logger_sp.log_attribute(\"i_gen1\", gen1_sp.attr(\"i_intf\"))\n", + "logger_sp.log_attribute(\"wr_gen1\", gen1_sp.attr(\"w_r\"))\n", + "logger_sp.log_attribute(\"delta_gen1\", gen1_sp.attr(\"delta_r\"))\n", + "\n", + "logger_sp.log_attribute(\"Ep_gen2\", gen2_sp.attr(\"Ep_mag\"))\n", + "logger_sp.log_attribute(\"v_gen2\", gen2_sp.attr(\"v_intf\"))\n", + "logger_sp.log_attribute(\"i_gen2\", gen2_sp.attr(\"i_intf\"))\n", + "logger_sp.log_attribute(\"wr_gen2\", gen2_sp.attr(\"w_r\"))\n", + "logger_sp.log_attribute(\"delta_gen2\", gen2_sp.attr(\"delta_r\"))\n", + "logger_sp.log_attribute(\"wref_gen2\", gen2_sp.attr(\"w_ref\"))\n", + "logger_sp.log_attribute(\"P_elec2\", gen2_sp.attr(\"P_elec\"))\n", "\n", "\n", "# Simulation\n", @@ -579,58 +581,58 @@ "sim_sp.add_logger(logger_sp)\n", "\n", "sim_sp.run()" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "## SP Results" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "work_dir = 'logs/SP_SynGenTrStab_3Bus_SteadyState_SP/'\n", "log_name = 'SP_SynGenTrStab_3Bus_SteadyState_SP'\n", "print(work_dir + log_name + '.csv')\n", "ts_sp1ph_TrStab_dl= rt.read_timeseries_dpsim(work_dir + log_name + '.csv')" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "## DP Results" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "work_dir = 'logs/DP_SynGenTrStab_3Bus_SteadyState_DP/'\n", "log_name = 'DP_SynGenTrStab_3Bus_SteadyState_DP'\n", "print(work_dir + log_name + '.csv')\n", "ts_dp1ph_TrStab_dl = rt.read_timeseries_dpsim(work_dir + log_name + '.csv')" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "## Generator 1&2 terminal voltage" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "timestep=50e-6;\n", "t_begin=0\n", @@ -658,20 +660,20 @@ "plt.legend()\n", "\n", "f.show()" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "## Generator 1&2 terminal Current" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "f= plt.figure(figsize=(16,8))\n", "\n", @@ -692,20 +694,20 @@ "plt.legend()\n", "\n", "f.show()" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "## Generator 1&2 Rotor frequency" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "f= plt.figure(figsize=(16,8))\n", "\n", @@ -734,20 +736,20 @@ "plt.legend()\n", "\n", "f.show()" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "## Generator 1&2 Rotor angular velocity $\\omega _r$" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "f= plt.figure(figsize=(16,8))\n", "\n", @@ -776,20 +778,20 @@ "plt.legend()\n", "\n", "f.show()" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "## Generator 1&2 Rotor angle $\\delta _r$" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "f= plt.figure(figsize=(16,8))\n", "\n", @@ -818,16 +820,14 @@ "plt.legend()\n", "\n", "f.show()" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, - "source": [], + "metadata": {}, "outputs": [], - "metadata": {} + "source": [] } ], "metadata": { diff --git a/examples/Notebooks/Circuits/DP_SP_SynGenTrStab_SMIB_Fault.ipynb b/examples/Notebooks/Circuits/DP_SP_SynGenTrStab_SMIB_Fault.ipynb index 2b6dd3b650..a95a0353da 100644 --- a/examples/Notebooks/Circuits/DP_SP_SynGenTrStab_SMIB_Fault.ipynb +++ b/examples/Notebooks/Circuits/DP_SP_SynGenTrStab_SMIB_Fault.ipynb @@ -2,14 +2,16 @@ "cells": [ { "cell_type": "markdown", + "metadata": {}, "source": [ "# SMIB Fault SP vs DP" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "import villas.dataprocessing.readtools as rt\n", "from villas.dataprocessing.timeseries import TimeSeries as ts\n", @@ -21,27 +23,27 @@ "import dpsimpy\n", "\n", "#%matplotlib widget" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "## DP Simulation" - ], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "### Parametrization" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "# Power System\n", "V_nom = 230e3\n", @@ -85,20 +87,20 @@ "end_time_fault = 10.2\n", "cmd_Inertia = 1.0\n", "cmd_Damping = 1.0" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "### Powerflow for Initialization" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "sim_name_pf = sim_name + \"_PF\"\n", "dpsimpy.Logger.set_log_dir(\"logs/\" + sim_name_pf)\n", @@ -143,8 +145,8 @@ "\n", "# Logging\n", "logger_pf = dpsimpy.Logger(sim_name_pf)\n", - "logger_pf.log_attribute(\"v1\", \"v\", n1_pf)\n", - "logger_pf.log_attribute(\"v2\", \"v\", n2_pf)\n", + "logger_pf.log_attribute(\"v1\", n1_pf.attr(\"v\"))\n", + "logger_pf.log_attribute(\"v2\", n2_pf.attr(\"v\"))\n", "\n", "# Simulation\n", "sim_pf = dpsimpy.Simulation(sim_name_pf, dpsimpy.LogLevel.debug)\n", @@ -157,20 +159,20 @@ "sim_pf.do_init_from_nodes_and_terminals(False)\n", "sim_pf.add_logger(logger_pf)\n", "sim_pf.run()" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "### Dynamic simulation" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "sim_name_dp = sim_name + \"_DP\" \n", "dpsimpy.Logger.set_log_dir(\"logs/\"+sim_name_dp)\n", @@ -216,24 +218,24 @@ "\n", "# Logging\n", "logger_dp = dpsimpy.Logger(sim_name_dp)\n", - "logger_dp.log_attribute(\"v1\", \"v\", n1_dp)\n", - "logger_dp.log_attribute(\"v2\", \"v\", n2_dp)\n", + "logger_dp.log_attribute(\"v1\", n1_dp.attr(\"v\"))\n", + "logger_dp.log_attribute(\"v2\", n2_dp.attr(\"v\"))\n", "\n", - "logger_dp.log_attribute(\"v_line\", \"v_intf\", line_dp)\n", - "logger_dp.log_attribute(\"i_line\", \"i_intf\", line_dp)\n", + "logger_dp.log_attribute(\"v_line\", line_dp.attr(\"v_intf\"))\n", + "logger_dp.log_attribute(\"i_line\", line_dp.attr(\"i_intf\"))\n", "\n", - "logger_dp.log_attribute(\"v_slack\", \"v_intf\", extnet_dp)\n", - "logger_dp.log_attribute(\"i_slack\", \"i_intf\", extnet_dp)\n", + "logger_dp.log_attribute(\"v_slack\", extnet_dp.attr(\"v_intf\"))\n", + "logger_dp.log_attribute(\"i_slack\", extnet_dp.attr(\"i_intf\"))\n", "\n", - "logger_dp.log_attribute(\"i_fault\", \"i_intf\", fault_dp)\n", + "logger_dp.log_attribute(\"i_fault\", fault_dp.attr(\"i_intf\"))\n", "\n", - "logger_dp.log_attribute(\"Ep\", \"Ep\", gen_dp)\n", - "logger_dp.log_attribute(\"v_gen\", \"v_intf\", gen_dp)\n", - "logger_dp.log_attribute(\"i_gen\", \"i_intf\", gen_dp)\n", - "logger_dp.log_attribute(\"wr_gen\", \"w_r\", gen_dp)\n", - "logger_dp.log_attribute(\"delta_r_gen\", \"delta_r\", gen_dp)\n", - "logger_dp.log_attribute(\"P_elec\", \"P_elec\", gen_dp)\n", - "logger_dp.log_attribute(\"P_mech\", \"P_mech\", gen_dp)\n", + "logger_dp.log_attribute(\"Ep\", gen_dp.attr(\"Ep\"))\n", + "logger_dp.log_attribute(\"v_gen\", gen_dp.attr(\"v_intf\"))\n", + "logger_dp.log_attribute(\"i_gen\", gen_dp.attr(\"i_intf\"))\n", + "logger_dp.log_attribute(\"wr_gen\", gen_dp.attr(\"w_r\"))\n", + "logger_dp.log_attribute(\"delta_r_gen\", gen_dp.attr(\"delta_r\"))\n", + "logger_dp.log_attribute(\"P_elec\", gen_dp.attr(\"P_elec\"))\n", + "logger_dp.log_attribute(\"P_mech\", gen_dp.attr(\"P_mech\"))\n", "\n", "# Simulation\n", "sim_dp = dpsimpy.Simulation(sim_name, dpsimpy.LogLevel.debug)\n", @@ -256,27 +258,27 @@ " sim_dp.add_event(sw2)\n", " \n", "sim_dp.run()" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "## SP Simulation" - ], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "### Parametrization" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "# Power System\n", "V_nom = 230e3\n", @@ -320,20 +322,20 @@ "end_time_fault = 10.2\n", "cmd_Inertia = 1.0\n", "cmd_Damping = 1.0" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "### Powerflow for Initialization" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "sim_name_pf = sim_name + \"_PF\"\n", "dpsimpy.Logger.set_log_dir(\"logs/\" + sim_name_pf)\n", @@ -378,8 +380,8 @@ "\n", "# Logging\n", "logger_pf = dpsimpy.Logger(sim_name_pf)\n", - "logger_pf.log_attribute(\"v1\", \"v\", n1_pf)\n", - "logger_pf.log_attribute(\"v2\", \"v\", n2_pf)\n", + "logger_pf.log_attribute(\"v1\", n1_pf.attr(\"v\"))\n", + "logger_pf.log_attribute(\"v2\", n2_pf.attr(\"v\"))\n", "\n", "# Simulation\n", "sim_pf = dpsimpy.Simulation(sim_name_pf, dpsimpy.LogLevel.debug)\n", @@ -392,20 +394,20 @@ "sim_pf.do_init_from_nodes_and_terminals(False)\n", "sim_pf.add_logger(logger_pf)\n", "sim_pf.run()" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "### Dynamic simulation" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "sim_name_sp = sim_name + \"_SP\" \n", "dpsimpy.Logger.set_log_dir(\"logs/\"+sim_name_sp)\n", @@ -450,24 +452,24 @@ "\n", "# Logging\n", "logger_sp = dpsimpy.Logger(sim_name_sp)\n", - "logger_sp.log_attribute(\"v1\", \"v\", n1_sp)\n", - "logger_sp.log_attribute(\"v2\", \"v\", n2_sp)\n", + "logger_sp.log_attribute(\"v1\", n1_sp.attr(\"v\"))\n", + "logger_sp.log_attribute(\"v2\", n2_sp.attr(\"v\"))\n", "\n", - "logger_sp.log_attribute(\"v_line\", \"v_intf\", line_sp)\n", - "logger_sp.log_attribute(\"i_line\", \"i_intf\", line_sp)\n", + "logger_sp.log_attribute(\"v_line\", line_sp.attr(\"v_intf\"))\n", + "logger_sp.log_attribute(\"i_line\", line_sp.attr(\"i_intf\"))\n", "\n", - "logger_sp.log_attribute(\"v_slack\", \"v_intf\", extnet_sp)\n", - "logger_sp.log_attribute(\"i_slack\", \"i_intf\", extnet_sp)\n", + "logger_sp.log_attribute(\"v_slack\", extnet_sp.attr(\"v_intf\"))\n", + "logger_sp.log_attribute(\"i_slack\", extnet_sp.attr(\"i_intf\"))\n", "\n", - "logger_sp.log_attribute(\"i_fault\", \"i_intf\", fault_sp)\n", + "logger_sp.log_attribute(\"i_fault\", fault_sp.attr(\"i_intf\"))\n", "\n", - "logger_sp.log_attribute(\"Ep\", \"Ep\", gen_sp)\n", - "logger_sp.log_attribute(\"v_gen\", \"v_intf\", gen_sp)\n", - "logger_sp.log_attribute(\"i_gen\", \"i_intf\", gen_sp)\n", - "logger_sp.log_attribute(\"wr_gen\", \"w_r\", gen_sp)\n", - "logger_sp.log_attribute(\"delta_r_gen\", \"delta_r\", gen_sp)\n", - "logger_sp.log_attribute(\"P_elec\", \"P_elec\", gen_sp)\n", - "logger_sp.log_attribute(\"P_mech\", \"P_mech\", gen_sp)\n", + "logger_sp.log_attribute(\"Ep\", gen_sp.attr(\"Ep\"))\n", + "logger_sp.log_attribute(\"v_gen\", gen_sp.attr(\"v_intf\"))\n", + "logger_sp.log_attribute(\"i_gen\", gen_sp.attr(\"i_intf\"))\n", + "logger_sp.log_attribute(\"wr_gen\", gen_sp.attr(\"w_r\"))\n", + "logger_sp.log_attribute(\"delta_r_gen\", gen_sp.attr(\"delta_r\"))\n", + "logger_sp.log_attribute(\"P_elec\", gen_sp.attr(\"P_elec\"))\n", + "logger_sp.log_attribute(\"P_mech\", gen_sp.attr(\"P_mech\"))\n", "\n", "# Simulation\n", "sim_sp = dpsimpy.Simulation(sim_name, dpsimpy.LogLevel.debug)\n", @@ -490,78 +492,78 @@ " sim_sp.add_event(sw2)\n", " \n", "sim_sp.run()" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "## Results 1ph SP" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "work_dir = 'logs/SP_SynGenTrStab_SMIB_Fault_SP/'\n", "log_name = 'SP_SynGenTrStab_SMIB_Fault_SP'\n", "print(work_dir + log_name + '.csv')\n", "ts_sp1ph_TrStab_dl= rt.read_timeseries_dpsim(work_dir + log_name + '.csv')" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "## Results 1ph DP" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "work_dir = 'logs/DP_SynGenTrStab_SMIB_Fault_DP/' \n", "log_name = 'DP_SynGenTrStab_SMIB_Fault_DP'\n", "print(work_dir + log_name + '.csv')\n", "ts_dp1ph_TrStab_dl = rt.read_timeseries_dpsim(work_dir + log_name + '.csv')" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "## Results 3ph EMT Reference" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "# work_dir = 'logs/EMT_SynGenTrStab_SMIB_Fault_EMT/'\n", "# log_name = 'EMT_SynGenTrStab_SMIB_Fault_EMT'\n", "# print(work_dir + log_name + '.csv')\n", "# #os.path.getsize(work_dir + log_name + '.csv')\n", "# ts_emt3ph_TrStab_dl = rt.read_timeseries_dpsim(work_dir + log_name + '.csv')" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "## Generator emf" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "plt.figure(figsize=(12,8))\n", "plt.ylabel('Generator emf (V)')\n", @@ -578,20 +580,20 @@ " plt.plot(ts_sp1ph_TrStab_dl[name].interpolate(timestep).time[begin_idx:end_idx], ts_sp1ph_TrStab_dl[name].interpolate(timestep).frequency_shift(60).values[begin_idx:end_idx], label=name + ' SP backshift')\n", " plt.plot(ts_dp1ph_TrStab_dl[name].interpolate(timestep).time[begin_idx:end_idx], ts_dp1ph_TrStab_dl[name].interpolate(timestep).frequency_shift(60).values[begin_idx:end_idx], label=name + ' DP backshift', linestyle='--')\n", " #plt.plot(ts_emt3ph_TrStab_dl[name].interpolate(timestep).time[begin_idx:end_idx], ts_emt3ph_TrStab_dl[name].interpolate(timestep).frequency_shift(60).values[begin_idx:end_idx], label=name + ' EMT')" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "## Generator terminal voltage" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "plt.figure(figsize=(12,8))\n", "plt.ylabel('Generator terminal voltage (V)')\n", @@ -602,20 +604,20 @@ " #plt.plot(ts_emt3ph_TrStab_dl[name].interpolate(timestep).time[begin_idx:end_idx], np.sqrt(3/2)*ts_emt3ph_TrStab_dl[name].interpolate(timestep).values[begin_idx:end_idx], label=name + ' EMT')\n", "plt.legend()\n", "plt.show()" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "## Genrerator terminal Current" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "plt.figure(figsize=(12,8))\n", "plt.ylabel('Generator terminal current (A)')\n", @@ -628,20 +630,20 @@ "#plt.plot(ts_sp1ph_TrStab_dl['Ep'].interpolate(timestep).time[begin_idx:end_idx], 0.05*(ts_sp1ph_TrStab_dl['Ep'].interpolate(timestep).frequency_shift(60).values[begin_idx:end_idx]- ts_sp1ph_TrStab_dl['v_gen'].interpolate(timestep).frequency_shift(60).values[begin_idx:end_idx]))\n", "plt.legend()\n", "plt.show()" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "Fault Current" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "plt.figure(figsize=(12,8))\n", "plt.ylabel('Fault current (A)')\n", @@ -654,20 +656,20 @@ "#plt.plot(ts_sp1ph_TrStab_dl['Ep'].interpolate(timestep).time[begin_idx:end_idx], 0.05*(ts_sp1ph_TrStab_dl['Ep'].interpolate(timestep).frequency_shift(60).values[begin_idx:end_idx]- ts_sp1ph_TrStab_dl['v_gen'].interpolate(timestep).frequency_shift(60).values[begin_idx:end_idx]))\n", "plt.legend()\n", "plt.show()" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "## Voltage across line" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "plt.figure(figsize=(12,8))\n", "\n", @@ -677,20 +679,20 @@ " #plt.plot(ts_emt3ph_TrStab_dl[name].interpolate(timestep).time[begin_idx:end_idx], np.sqrt(3/2)*ts_emt3ph_TrStab_dl[name].interpolate(timestep).values[begin_idx:end_idx], label=name + ' EMT')\n", "plt.legend()\n", "plt.show()" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "## Current through line" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "plt.figure(figsize=(12,8))\n", "\n", @@ -700,20 +702,20 @@ " #plt.plot(ts_emt3ph_TrStab_dl[name].interpolate(timestep).time[begin_idx:end_idx], np.sqrt(3/2)*ts_emt3ph_TrStab_dl[name].interpolate(timestep).values[begin_idx:end_idx], label=name + ' EMT')\n", "plt.legend()\n", "plt.show()" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "## Generator electrical & mechanical energy" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "plt.figure(figsize=(12,8))\n", "#plt.ylim(250e6,350e6)\n", @@ -724,20 +726,20 @@ " #plt.plot(ts_emt3ph_TrStab_dl[name].interpolate(timestep).time[begin_idx:end_idx], np.sqrt(3/2)*ts_emt3ph_TrStab_dl[name].interpolate(timestep).values[begin_idx:end_idx], label=name + ' EMT')\n", "plt.legend()\n", "plt.show()" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "## Rotor frequency" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "#plt.figure(figsize=(12,8))\n", "#plt.xlabel('time (s)', fontsize=20)\n", @@ -756,20 +758,20 @@ "#plt.legend(fontsize=18)\n", "##plt.title('Post-Fault',fontsize=20)\n", "#plt.show()\n" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "## Rotor angular velocity $\\omega _r$" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "plt.figure(figsize=(12,8))\n", "plt.xlabel('time (s)', fontsize=20)\n", @@ -786,20 +788,20 @@ "plt.legend(fontsize=18)\n", "#plt.title('Post-Fault',fontsize=20)\n", "plt.show()\n" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "## Rotor angle $\\delta _r$" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "plt.figure(figsize=(12,8))\n", "plt.xlabel('time (s)', fontsize=20)\n", @@ -816,16 +818,14 @@ "plt.legend(fontsize=18)\n", "#plt.title('Post-Fault',fontsize=20)\n", "plt.show()\n" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "Frequency of load angle in 1hz-2hz range" - ], - "metadata": {} + ] } ], "metadata": { diff --git a/examples/Notebooks/Circuits/DP_SP_SynGenTrStab_SMIB_SteadyState.ipynb b/examples/Notebooks/Circuits/DP_SP_SynGenTrStab_SMIB_SteadyState.ipynb index 87a001197c..303e0d3019 100644 --- a/examples/Notebooks/Circuits/DP_SP_SynGenTrStab_SMIB_SteadyState.ipynb +++ b/examples/Notebooks/Circuits/DP_SP_SynGenTrStab_SMIB_SteadyState.ipynb @@ -2,14 +2,16 @@ "cells": [ { "cell_type": "markdown", + "metadata": {}, "source": [ "# SMIB Steady state SP vs DP" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "import villas.dataprocessing.readtools as rt\n", "from villas.dataprocessing.timeseries import TimeSeries as ts\n", @@ -21,27 +23,27 @@ "import dpsimpy\n", "\n", "#%matplotlib widget" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "## DP Simulation" - ], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "### Parametrization" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "# Power System\n", "V_nom = 230e3\n", @@ -84,20 +86,20 @@ "time_step = 0.001\n", "cmd_Inertia = 1.0\n", "cmd_Damping = 1.0" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "### Powerflow for Initialization" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "sim_name_pf = sim_name + \"_PF\"\n", "dpsimpy.Logger.set_log_dir(\"logs/\" + sim_name_pf)\n", @@ -136,8 +138,8 @@ "\n", "# Logging\n", "logger_pf = dpsimpy.Logger(sim_name_pf)\n", - "logger_pf.log_attribute(\"v1\", \"v\", n1_pf)\n", - "logger_pf.log_attribute(\"v2\", \"v\", n2_pf)\n", + "logger_pf.log_attribute(\"v1\", n1_pf.attr(\"v\"))\n", + "logger_pf.log_attribute(\"v2\", n2_pf.attr(\"v\"))\n", "\n", "# Simulation\n", "sim_pf = dpsimpy.Simulation(sim_name_pf, dpsimpy.LogLevel.debug)\n", @@ -150,20 +152,20 @@ "sim_pf.do_init_from_nodes_and_terminals(False)\n", "sim_pf.add_logger(logger_pf)\n", "sim_pf.run()" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "### Dynamic simulation" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "sim_name_dp = sim_name + \"_DP\" \n", "dpsimpy.Logger.set_log_dir(\"logs/\"+sim_name_dp)\n", @@ -202,22 +204,22 @@ "\n", "# Logging\n", "logger_dp = dpsimpy.Logger(sim_name_dp)\n", - "logger_dp.log_attribute(\"v1\", \"v\", n1_dp)\n", - "logger_dp.log_attribute(\"v2\", \"v\", n2_dp)\n", + "logger_dp.log_attribute(\"v1\", n1_dp.attr(\"v\"))\n", + "logger_dp.log_attribute(\"v2\", n2_dp.attr(\"v\"))\n", "\n", - "logger_dp.log_attribute(\"v_line\", \"v_intf\", line_dp)\n", - "logger_dp.log_attribute(\"i_line\", \"i_intf\", line_dp)\n", + "logger_dp.log_attribute(\"v_line\", line_dp.attr(\"v_intf\"))\n", + "logger_dp.log_attribute(\"i_line\", line_dp.attr(\"i_intf\"))\n", "\n", - "logger_dp.log_attribute(\"v_slack\", \"v_intf\", extnet_dp)\n", - "logger_dp.log_attribute(\"i_slack\", \"i_intf\", extnet_dp)\n", + "logger_dp.log_attribute(\"v_slack\", extnet_dp.attr(\"v_intf\"))\n", + "logger_dp.log_attribute(\"i_slack\", extnet_dp.attr(\"i_intf\"))\n", "\n", - "logger_dp.log_attribute(\"Ep\", \"Ep\", gen_dp)\n", - "logger_dp.log_attribute(\"v_gen\", \"v_intf\", gen_dp)\n", - "logger_dp.log_attribute(\"i_gen\", \"i_intf\", gen_dp)\n", - "logger_dp.log_attribute(\"wr_gen\", \"w_r\", gen_dp)\n", - "logger_dp.log_attribute(\"delta_r_gen\", \"delta_r\", gen_dp)\n", - "logger_dp.log_attribute(\"P_elec\", \"P_elec\", gen_dp)\n", - "logger_dp.log_attribute(\"P_mech\", \"P_mech\", gen_dp)\n", + "logger_dp.log_attribute(\"Ep\", gen_dp.attr(\"Ep\"))\n", + "logger_dp.log_attribute(\"v_gen\", gen_dp.attr(\"v_intf\"))\n", + "logger_dp.log_attribute(\"i_gen\", gen_dp.attr(\"i_intf\"))\n", + "logger_dp.log_attribute(\"wr_gen\", gen_dp.attr(\"w_r\"))\n", + "logger_dp.log_attribute(\"delta_r_gen\", gen_dp.attr(\"delta_r\"))\n", + "logger_dp.log_attribute(\"P_elec\", gen_dp.attr(\"P_elec\"))\n", + "logger_dp.log_attribute(\"P_mech\", gen_dp.attr(\"P_mech\"))\n", "\n", "# Simulation\n", "sim_dp = dpsimpy.Simulation(sim_name, dpsimpy.LogLevel.debug)\n", @@ -228,27 +230,27 @@ "sim_dp.add_logger(logger_dp)\n", " \n", "sim_dp.run()" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "## SP Simulation" - ], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "### Parametrization" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "# Power System\n", "V_nom = 230e3\n", @@ -293,20 +295,20 @@ "end_time_fault = 10.2\n", "cmd_Inertia = 1.0\n", "cmd_Damping = 1.0" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "### Powerflow for Initialization" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "sim_name_pf = sim_name + \"_PF\"\n", "dpsimpy.Logger.set_log_dir(\"logs/\" + sim_name_pf)\n", @@ -345,8 +347,8 @@ "\n", "# Logging\n", "logger_pf = dpsimpy.Logger(sim_name_pf)\n", - "logger_pf.log_attribute(\"v1\", \"v\", n1_pf)\n", - "logger_pf.log_attribute(\"v2\", \"v\", n2_pf)\n", + "logger_pf.log_attribute(\"v1\", n1_pf.attr(\"v\"))\n", + "logger_pf.log_attribute(\"v2\", n2_pf.attr(\"v\"))\n", "\n", "# Simulation\n", "sim_pf = dpsimpy.Simulation(sim_name_pf, dpsimpy.LogLevel.debug)\n", @@ -358,20 +360,20 @@ "sim_pf.do_init_from_nodes_and_terminals(False)\n", "sim_pf.add_logger(logger_pf)\n", "sim_pf.run()" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "### Dynamic simulation" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "sim_name_sp = sim_name + \"_SP\" \n", "dpsimpy.Logger.set_log_dir(\"logs/\"+sim_name_sp)\n", @@ -416,23 +418,23 @@ "\n", "# Logging\n", "logger_sp = dpsimpy.Logger(sim_name_sp)\n", - "logger_sp.log_attribute(\"v1\", \"v\", n1_sp)\n", - "logger_sp.log_attribute(\"v2\", \"v\", n2_sp)\n", + "logger_sp.log_attribute(\"v1\", n1_sp.attr(\"v\"))\n", + "logger_sp.log_attribute(\"v2\", n2_sp.attr(\"v\"))\n", "\n", - "logger_sp.log_attribute(\"v_line\", \"v_intf\", line_sp)\n", - "logger_sp.log_attribute(\"i_line\", \"i_intf\", line_sp)\n", + "logger_sp.log_attribute(\"v_line\", line_sp.attr(\"v_intf\"))\n", + "logger_sp.log_attribute(\"i_line\", line_sp.attr(\"i_intf\"))\n", "\n", - "logger_sp.log_attribute(\"v_slack\", \"v_intf\", extnet_sp)\n", - "logger_sp.log_attribute(\"i_slack\", \"i_intf\", extnet_sp)\n", + "logger_sp.log_attribute(\"v_slack\", extnet_sp.attr(\"v_intf\"))\n", + "logger_sp.log_attribute(\"i_slack\", extnet_sp.attr(\"i_intf\"))\n", "\n", "\n", - "logger_sp.log_attribute(\"Ep\", \"Ep\", gen_sp)\n", - "logger_sp.log_attribute(\"v_gen\", \"v_intf\", gen_sp)\n", - "logger_sp.log_attribute(\"i_gen\", \"i_intf\", gen_sp)\n", - "logger_sp.log_attribute(\"wr_gen\", \"w_r\", gen_sp)\n", - "logger_sp.log_attribute(\"delta_r_gen\", \"delta_r\", gen_sp)\n", - "logger_sp.log_attribute(\"P_elec\", \"P_elec\", gen_sp)\n", - "logger_sp.log_attribute(\"P_mech\", \"P_mech\", gen_sp)\n", + "logger_sp.log_attribute(\"Ep\", gen_sp.attr(\"Ep\"))\n", + "logger_sp.log_attribute(\"v_gen\", gen_sp.attr(\"v_intf\"))\n", + "logger_sp.log_attribute(\"i_gen\", gen_sp.attr(\"i_intf\"))\n", + "logger_sp.log_attribute(\"wr_gen\", gen_sp.attr(\"w_r\"))\n", + "logger_sp.log_attribute(\"delta_r_gen\", gen_sp.attr(\"delta_r\"))\n", + "logger_sp.log_attribute(\"P_elec\", gen_sp.attr(\"P_elec\"))\n", + "logger_sp.log_attribute(\"P_mech\", gen_sp.attr(\"P_mech\"))\n", "\n", "# Simulation\n", "sim_sp = dpsimpy.Simulation(sim_name, dpsimpy.LogLevel.debug)\n", @@ -443,78 +445,78 @@ "sim_sp.add_logger(logger_sp)\n", " \n", "sim_sp.run()" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "## Results 1ph SP" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "work_dir = 'logs/SP_SynGenTrStab_SMIB_SteadyState_SP/'\n", "log_name = 'SP_SynGenTrStab_SMIB_SteadyState_SP'\n", "print(work_dir + log_name + '.csv')\n", "ts_sp1ph_TrStab_dl= rt.read_timeseries_dpsim(work_dir + log_name + '.csv')" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "## Results 1ph DP" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "work_dir = 'logs/DP_SynGenTrStab_SMIB_SteadyState_DP/' \n", "log_name = 'DP_SynGenTrStab_SMIB_SteadyState_DP'\n", "print(work_dir + log_name + '.csv')\n", "ts_dp1ph_TrStab_dl = rt.read_timeseries_dpsim(work_dir + log_name + '.csv')" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "## Results 3ph EMT Reference" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "# work_dir = 'logs/EMT_SynGenTrStab_SMIB_SteadyState_EMT/'\n", "# log_name = 'EMT_SynGenTrStab_SMIB_SteadyState_EMT'\n", "# print(work_dir + log_name + '.csv')\n", "# #os.path.getsize(work_dir + log_name + '.csv')\n", "# ts_emt3ph_TrStab_dl = rt.read_timeseries_dpsim(work_dir + log_name + '.csv')" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "## Generator emf" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "plt.figure(figsize=(12,8))\n", "plt.ylabel('Generator emf (V)')\n", @@ -531,20 +533,20 @@ " plt.plot(ts_sp1ph_TrStab_dl[name].interpolate(timestep).time[begin_idx:end_idx], ts_sp1ph_TrStab_dl[name].interpolate(timestep).frequency_shift(60).values[begin_idx:end_idx], label=name + ' SP backshift')\n", " plt.plot(ts_dp1ph_TrStab_dl[name].interpolate(timestep).time[begin_idx:end_idx], ts_dp1ph_TrStab_dl[name].interpolate(timestep).frequency_shift(60).values[begin_idx:end_idx], label=name + ' DP backshift', linestyle='--')\n", " #plt.plot(ts_emt3ph_TrStab_dl[name].interpolate(timestep).time[begin_idx:end_idx], ts_emt3ph_TrStab_dl[name].interpolate(timestep).frequency_shift(60).values[begin_idx:end_idx], label=name + ' EMT')" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "## Generator terminal voltage" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "plt.figure(figsize=(12,8))\n", "plt.ylabel('Generator terminal voltage (V)')\n", @@ -555,20 +557,20 @@ " #plt.plot(ts_emt3ph_TrStab_dl[name].interpolate(timestep).time[begin_idx:end_idx], np.sqrt(3/2)*ts_emt3ph_TrStab_dl[name].interpolate(timestep).values[begin_idx:end_idx], label=name + ' EMT')\n", "plt.legend()\n", "plt.show()" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "## Genrerator terminal Current" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "plt.figure(figsize=(12,8))\n", "plt.ylabel('Generator terminal current (A)')\n", @@ -580,20 +582,20 @@ "\n", "plt.legend()\n", "plt.show()" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "## Voltage across line" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "plt.figure(figsize=(12,8))\n", "\n", @@ -603,20 +605,20 @@ " #plt.plot(ts_emt3ph_TrStab_dl[name].interpolate(timestep).time[begin_idx:end_idx], np.sqrt(3/2)*ts_emt3ph_TrStab_dl[name].interpolate(timestep).values[begin_idx:end_idx], label=name + ' EMT')\n", "plt.legend()\n", "plt.show()" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "## Current through line" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "plt.figure(figsize=(12,8))\n", "\n", @@ -626,20 +628,20 @@ " #plt.plot(ts_emt3ph_TrStab_dl[name].interpolate(timestep).time[begin_idx:end_idx], np.sqrt(3/2)*ts_emt3ph_TrStab_dl[name].interpolate(timestep).values[begin_idx:end_idx], label=name + ' EMT')\n", "plt.legend()\n", "plt.show()" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "## Generator electrical & mechanical energy" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "plt.figure(figsize=(12,8))\n", "plt.ylim(250e6,350e6)\n", @@ -650,20 +652,20 @@ " #plt.plot(ts_emt3ph_TrStab_dl[name].interpolate(timestep).time[begin_idx:end_idx], np.sqrt(3/2)*ts_emt3ph_TrStab_dl[name].interpolate(timestep).values[begin_idx:end_idx], label=name + ' EMT')\n", "plt.legend()\n", "plt.show()" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "## Rotor frequency" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "# plt.figure(figsize=(12,8))\n", "# plt.xlabel('time (s)', fontsize=20)\n", @@ -682,22 +684,22 @@ "# plt.legend(fontsize=18)\n", "# #plt.title('Post-Fault',fontsize=20)\n", "# plt.show()\n" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "## Rotor angular velocity $\\omega _r$" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "plt.figure(figsize=(12,8))\n", "plt.xlabel('time (s)', fontsize=20)\n", @@ -714,20 +716,20 @@ "plt.legend(fontsize=18)\n", "#plt.title('Post-Fault',fontsize=20)\n", "plt.show()\n" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "## Rotor angle $\\delta _r$" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "plt.figure(figsize=(12,8))\n", "plt.xlabel('time (s)', fontsize=20)\n", @@ -744,16 +746,14 @@ "plt.legend(fontsize=18)\n", "#plt.title('Post-Fault',fontsize=20)\n", "plt.show()\n" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "Frequency of load angle in 1hz-2hz range" - ], - "metadata": {} + ] } ], "metadata": { diff --git a/examples/Notebooks/Circuits/DP_Slack_PiLine_PQLoad_with_PF_Init.ipynb b/examples/Notebooks/Circuits/DP_Slack_PiLine_PQLoad_with_PF_Init.ipynb index eb19944b7c..918717677f 100644 --- a/examples/Notebooks/Circuits/DP_Slack_PiLine_PQLoad_with_PF_Init.ipynb +++ b/examples/Notebooks/Circuits/DP_Slack_PiLine_PQLoad_with_PF_Init.ipynb @@ -76,9 +76,9 @@ "\n", "# Logging\n", "logger_pf = dpsimpy.Logger(sim_name_pf)\n", - "logger_pf.log_attribute('v1', 'v', n1_pf)\n", - "logger_pf.log_attribute('v2', 'v', n2_pf)\n", - "logger_pf.log_attribute('i12', 'i_intf', line_pf)\n", + "logger_pf.log_attribute('v1', n1_pf.attr('v'))\n", + "logger_pf.log_attribute('v2', n2_pf.attr('v'))\n", + "logger_pf.log_attribute('i12', line_pf.attr('i_intf'))\n", "\n", "# Simulation\n", "sim_pf = dpsimpy.Simulation(sim_name_pf, dpsimpy.LogLevel.debug)\n", @@ -124,10 +124,10 @@ "\n", "# Logging\n", "logger_dp = dpsimpy.Logger(sim_name_dp)\n", - "logger_dp.log_attribute('v1', 'v', n1_dp)\n", - "logger_dp.log_attribute('v2', 'v', n2_dp)\n", - "logger_dp.log_attribute('i12', 'i_intf', line_dp)\n", - "logger_dp.log_attribute('irx', 'i_intf', load_dp)\n", + "logger_dp.log_attribute('v1', n1_dp.attr('v'))\n", + "logger_dp.log_attribute('v2', n2_dp.attr('v'))\n", + "logger_dp.log_attribute('i12', line_dp.attr('i_intf'))\n", + "logger_dp.log_attribute('irx', load_dp.attr('i_intf'))\n", "\n", "# load step sized in absolute terms\n", "load_switch = dpsimpy.dp.ph1.Switch(\"Load_Add_Switch_n2\", dpsimpy.LogLevel.debug)\n", @@ -137,7 +137,7 @@ "load_switch.open()\n", "system_dp.add(load_switch)\n", "system_dp.connect_component(load_switch, [gnd, system_dp.node('n2')])\n", - "logger_dp.log_attribute('switchedload_i', 'i_intf', load_switch)\n", + "logger_dp.log_attribute('switchedload_i', load_switch.attr('i_intf'))\n", "load_step_event = dpsimpy.event.SwitchEvent(0.1 - time_step_dp, load_switch, True)\n", "\n", "# Simulation\n", diff --git a/examples/Notebooks/Circuits/DP_Slack_PiLine_VSI_with_PF_Init.ipynb b/examples/Notebooks/Circuits/DP_Slack_PiLine_VSI_with_PF_Init.ipynb index ff637bcfef..123803f5e0 100644 --- a/examples/Notebooks/Circuits/DP_Slack_PiLine_VSI_with_PF_Init.ipynb +++ b/examples/Notebooks/Circuits/DP_Slack_PiLine_VSI_with_PF_Init.ipynb @@ -92,8 +92,8 @@ "\n", "# Logging\n", "logger_pf = dpsimpy.Logger(sim_name_pf)\n", - "logger_pf.log_attribute('v1', 'v', n1_pf)\n", - "logger_pf.log_attribute('v2', 'v', n2_pf)\n", + "logger_pf.log_attribute('v1', n1_pf.attr('v'))\n", + "logger_pf.log_attribute('v2', n2_pf.attr('v'))\n", "\n", "# Simulation\n", "sim_pf = dpsimpy.Simulation(sim_name_pf, dpsimpy.LogLevel.debug)\n", @@ -159,34 +159,34 @@ "\n", "# Logging\n", "logger_dp = dpsimpy.Logger(sim_name_dp)\n", - "logger_dp.log_attribute('v1', 'v', n1_dp)\n", - "logger_dp.log_attribute('v2', 'v', n2_dp)\n", - "logger_dp.log_attribute('i12', 'i_intf', line_dp)\n", + "logger_dp.log_attribute('v1', n1_dp.attr('v'))\n", + "logger_dp.log_attribute('v2', n2_dp.attr('v'))\n", + "logger_dp.log_attribute('i12', line_dp.attr('i_intf'))\n", "\n", "\n", "input_names = [\n", " \"pv_powerctrl_input_pref\", \"pv_powerctrl_input_qref\", \"pv_powerctrl_input_vcd\",\n", " \"pv_powerctrl_input_vcq\", \"pv_powerctrl_input_ircd\", \"pv_powerctrl_input_ircq\"\n", "]\n", - "logger_dp.log_attribute(input_names, 'powerctrl_inputs', pv)\n", + "logger_dp.log_attribute(input_names, pv.attr('powerctrl_inputs'))\n", "\n", "state_names = [\n", " \"pv_powerctrl_state_p\", \"pv_powerctrl_state_q\", \"pv_powerctrl_state_phid\",\n", " \"pv_powerctrl_state_phiq\", \"pv_powerctrl_state_gammad\", \"pv_powerctrl_state_gammaq\"\n", "]\n", - "logger_dp.log_attribute(state_names, 'powerctrl_states', pv)\n", + "logger_dp.log_attribute(state_names, pv.attr('powerctrl_states'))\n", "\n", "output_names = [\n", " \"pv_powerctrl_output_vsd\", \"pv_powerctrl_output_vsq\"\n", "]\n", "\n", - "logger_dp.log_attribute(output_names, 'powerctrl_outputs', pv)\n", + "logger_dp.log_attribute(output_names, pv.attr('powerctrl_outputs'))\n", "\n", - "logger_dp.log_attribute('pv_v_intf', 'v_intf', pv)\n", - "logger_dp.log_attribute('pv_i_intf', 'i_intf', pv)\n", - "logger_dp.log_attribute('pv_pll_output', 'pll_output', pv)\n", - "logger_dp.log_attribute('pv_vsref', 'Vsref', pv)\n", - "logger_dp.log_attribute('pv_vs', 'Vs', pv)\n", + "logger_dp.log_attribute('pv_v_intf', pv.attr('v_intf'))\n", + "logger_dp.log_attribute('pv_i_intf', pv.attr('i_intf'))\n", + "logger_dp.log_attribute('pv_pll_output', pv.attr('pll_output'))\n", + "logger_dp.log_attribute('pv_vsref', pv.attr('Vsref'))\n", + "logger_dp.log_attribute('pv_vs', pv.attr('Vs'))\n", "\n", "# load step sized in absolute terms\n", "load_switch = dpsimpy.dp.ph1.Switch(\"Load_Add_Switch_n2\", dpsimpy.LogLevel.debug)\n", @@ -196,7 +196,7 @@ "load_switch.open()\n", "system_dp.add(load_switch)\n", "system_dp.connect_component(load_switch, [gnd, system_dp.node('n2')])\n", - "logger_dp.log_attribute('switchedload_i', 'i_intf', load_switch)\n", + "logger_dp.log_attribute('switchedload_i', load_switch.attr('i_intf'))\n", "load_step_event = dpsimpy.event.SwitchEvent(np.round(5.0/time_step)*time_step, load_switch, True)\n", "\n", "# Simulation\n", diff --git a/examples/Notebooks/Circuits/EMT_DP_SP_Slack_PiLine_VSI.ipynb b/examples/Notebooks/Circuits/EMT_DP_SP_Slack_PiLine_VSI.ipynb index bd3a522a00..5f61b2c5a7 100644 --- a/examples/Notebooks/Circuits/EMT_DP_SP_Slack_PiLine_VSI.ipynb +++ b/examples/Notebooks/Circuits/EMT_DP_SP_Slack_PiLine_VSI.ipynb @@ -84,8 +84,8 @@ "\n", "# Logging\n", "logger_pf = dpsimpy.Logger(sim_name_pf)\n", - "logger_pf.log_attribute('v1', 'v', n1_pf)\n", - "logger_pf.log_attribute('v2', 'v', n2_pf)\n", + "logger_pf.log_attribute('v1', n1_pf.attr('v'))\n", + "logger_pf.log_attribute('v2', n2_pf.attr('v'))\n", "\n", "# Simulation\n", "sim_pf = dpsimpy.Simulation(sim_name_pf, dpsimpy.LogLevel.debug)\n", @@ -153,34 +153,34 @@ "\n", "# Logging\n", "logger_emt = dpsimpy.Logger(sim_name_emt)\n", - "logger_emt.log_attribute('v1', 'v', n1_emt)\n", - "logger_emt.log_attribute('v2', 'v', n2_emt)\n", - "logger_emt.log_attribute('i12', 'i_intf', line_emt)\n", + "logger_emt.log_attribute('v1', n1_emt.attr('v'))\n", + "logger_emt.log_attribute('v2', n2_emt.attr('v'))\n", + "logger_emt.log_attribute('i12', line_emt.attr('i_intf'))\n", "\n", "\n", "input_names = [\n", " \"pv_powerctrl_input_pref\", \"pv_powerctrl_input_qref\", \"pv_powerctrl_input_vcd\",\n", " \"pv_powerctrl_input_vcq\", \"pv_powerctrl_input_ircd\", \"pv_powerctrl_input_ircq\"\n", "]\n", - "logger_emt.log_attribute(input_names, 'powerctrl_inputs', pv)\n", + "logger_emt.log_attribute(input_names, pv.attr('powerctrl_inputs'))\n", "\n", "state_names = [\n", " \"pv_powerctrl_state_p\", \"pv_powerctrl_state_q\", \"pv_powerctrl_state_phid\",\n", " \"pv_powerctrl_state_phiq\", \"pv_powerctrl_state_gammad\", \"pv_powerctrl_state_gammaq\"\n", "]\n", - "logger_emt.log_attribute(state_names, 'powerctrl_states', pv)\n", + "logger_emt.log_attribute(state_names, pv.attr('powerctrl_states'))\n", "\n", "output_names = [\n", " \"pv_powerctrl_output_vsd\", \"pv_powerctrl_output_vsq\"\n", "]\n", "\n", - "logger_emt.log_attribute(output_names, 'powerctrl_outputs', pv)\n", + "logger_emt.log_attribute(output_names, pv.attr('powerctrl_outputs'))\n", "\n", - "logger_emt.log_attribute('pv_v_intf', 'v_intf', pv)\n", - "logger_emt.log_attribute('pv_i_intf', 'i_intf', pv)\n", - "logger_emt.log_attribute('pv_pll_output', 'pll_output', pv)\n", - "logger_emt.log_attribute('pv_vsref', 'Vsref', pv)\n", - "logger_emt.log_attribute('pv_vs', 'Vs', pv)\n", + "logger_emt.log_attribute('pv_v_intf', pv.attr('v_intf'))\n", + "logger_emt.log_attribute('pv_i_intf', pv.attr('i_intf'))\n", + "logger_emt.log_attribute('pv_pll_output', pv.attr('pll_output'))\n", + "logger_emt.log_attribute('pv_vsref', pv.attr('Vsref'))\n", + "logger_emt.log_attribute('pv_vs', pv.attr('Vs'))\n", "\n", "# load step sized in absolute terms\n", "load_switch = dpsimpy.emt.ph3.Switch(\"Load_Add_Switch_n2\", dpsimpy.LogLevel.debug)\n", @@ -190,7 +190,7 @@ "load_switch.open()\n", "system_emt.add(load_switch)\n", "system_emt.connect_component(load_switch, [gnd, system_emt.node('n2')])\n", - "logger_emt.log_attribute('switchedload_i', 'i_intf', load_switch)\n", + "logger_emt.log_attribute('switchedload_i', load_switch.attr('i_intf'))\n", "load_step_event = dpsimpy.event.SwitchEvent3Ph(np.round(5.0/time_step)*time_step, load_switch, True)\n", "\n", "# Simulation\n", @@ -276,8 +276,8 @@ "\n", "# Logging\n", "logger_pf = dpsimpy.Logger(sim_name_pf)\n", - "logger_pf.log_attribute('v1', 'v', n1_pf)\n", - "logger_pf.log_attribute('v2', 'v', n2_pf)\n", + "logger_pf.log_attribute('v1', n1_pf.attr('v'))\n", + "logger_pf.log_attribute('v2', n2_pf.attr('v'))\n", "\n", "# Simulation\n", "sim_pf = dpsimpy.Simulation(sim_name_pf, dpsimpy.LogLevel.debug)\n", @@ -342,34 +342,34 @@ "\n", "# Logging\n", "logger_dp = dpsimpy.Logger(sim_name_dp)\n", - "logger_dp.log_attribute('v1', 'v', n1_dp)\n", - "logger_dp.log_attribute('v2', 'v', n2_dp)\n", - "logger_dp.log_attribute('i12', 'i_intf', line_dp)\n", + "logger_dp.log_attribute('v1', n1_dp.attr('v'))\n", + "logger_dp.log_attribute('v2', n2_dp.attr('v'))\n", + "logger_dp.log_attribute('i12', line_dp.attr('i_intf'))\n", "\n", "\n", "input_names = [\n", " \"pv_powerctrl_input_pref\", \"pv_powerctrl_input_qref\", \"pv_powerctrl_input_vcd\",\n", " \"pv_powerctrl_input_vcq\", \"pv_powerctrl_input_ircd\", \"pv_powerctrl_input_ircq\"\n", "]\n", - "logger_dp.log_attribute(input_names, 'powerctrl_inputs', pv)\n", + "logger_dp.log_attribute(input_names, pv.attr('powerctrl_inputs'))\n", "\n", "state_names = [\n", " \"pv_powerctrl_state_p\", \"pv_powerctrl_state_q\", \"pv_powerctrl_state_phid\",\n", " \"pv_powerctrl_state_phiq\", \"pv_powerctrl_state_gammad\", \"pv_powerctrl_state_gammaq\"\n", "]\n", - "logger_dp.log_attribute(state_names, 'powerctrl_states', pv)\n", + "logger_dp.log_attribute(state_names, pv.attr('powerctrl_states'))\n", "\n", "output_names = [\n", " \"pv_powerctrl_output_vsd\", \"pv_powerctrl_output_vsq\"\n", "]\n", "\n", - "logger_dp.log_attribute(output_names, 'powerctrl_outputs', pv)\n", + "logger_dp.log_attribute(output_names, pv.attr('powerctrl_outputs'))\n", "\n", - "logger_dp.log_attribute('pv_v_intf', 'v_intf', pv)\n", - "logger_dp.log_attribute('pv_i_intf', 'i_intf', pv)\n", - "logger_dp.log_attribute('pv_pll_output', 'pll_output', pv)\n", - "logger_dp.log_attribute('pv_vsref', 'Vsref', pv)\n", - "logger_dp.log_attribute('pv_vs', 'Vs', pv)\n", + "logger_dp.log_attribute('pv_v_intf', pv.attr('v_intf'))\n", + "logger_dp.log_attribute('pv_i_intf', pv.attr('i_intf'))\n", + "logger_dp.log_attribute('pv_pll_output', pv.attr('pll_output'))\n", + "logger_dp.log_attribute('pv_vsref', pv.attr('Vsref'))\n", + "logger_dp.log_attribute('pv_vs', pv.attr('Vs'))\n", "\n", "# load step sized in absolute terms\n", "load_switch = dpsimpy.dp.ph1.Switch(\"Load_Add_Switch_n2\", dpsimpy.LogLevel.debug)\n", @@ -379,7 +379,7 @@ "load_switch.open()\n", "system_dp.add(load_switch)\n", "system_dp.connect_component(load_switch, [gnd, system_dp.node('n2')])\n", - "logger_dp.log_attribute('switchedload_i', 'i_intf', load_switch)\n", + "logger_dp.log_attribute('switchedload_i', load_switch.attr('i_intf'))\n", "load_step_event = dpsimpy.event.SwitchEvent(np.round(5.0/time_step)*time_step, load_switch, True)\n", "\n", "# Simulation\n", @@ -465,8 +465,8 @@ "\n", "# Logging\n", "logger_pf = dpsimpy.Logger(sim_name_pf)\n", - "logger_pf.log_attribute('v1', 'v', n1_pf)\n", - "logger_pf.log_attribute('v2', 'v', n2_pf)\n", + "logger_pf.log_attribute('v1', n1_pf.attr('v'))\n", + "logger_pf.log_attribute('v2', n2_pf.attr('v'))\n", "\n", "# Simulation\n", "sim_pf = dpsimpy.Simulation(sim_name_pf, dpsimpy.LogLevel.debug)\n", @@ -531,34 +531,34 @@ "\n", "# Logging\n", "logger_sp = dpsimpy.Logger(sim_name_sp)\n", - "logger_sp.log_attribute('v1', 'v', n1_sp)\n", - "logger_sp.log_attribute('v2', 'v', n2_sp)\n", - "logger_sp.log_attribute('i12', 'i_intf', line_sp)\n", + "logger_sp.log_attribute('v1', n1_sp.attr('v'))\n", + "logger_sp.log_attribute('v2', n2_sp.attr('v'))\n", + "logger_sp.log_attribute('i12', line_sp.attr('i_intf'))\n", "\n", "\n", "input_names = [\n", " \"pv_powerctrl_input_pref\", \"pv_powerctrl_input_qref\", \"pv_powerctrl_input_vcd\",\n", " \"pv_powerctrl_input_vcq\", \"pv_powerctrl_input_ircd\", \"pv_powerctrl_input_ircq\"\n", "]\n", - "logger_sp.log_attribute(input_names, 'powerctrl_inputs', pv)\n", + "logger_sp.log_attribute(input_names, pv.attr('powerctrl_inputs'))\n", "\n", "state_names = [\n", " \"pv_powerctrl_state_p\", \"pv_powerctrl_state_q\", \"pv_powerctrl_state_phid\",\n", " \"pv_powerctrl_state_phiq\", \"pv_powerctrl_state_gammad\", \"pv_powerctrl_state_gammaq\"\n", "]\n", - "logger_sp.log_attribute(state_names, 'powerctrl_states', pv)\n", + "logger_sp.log_attribute(state_names, pv.attr('powerctrl_states'))\n", "\n", "output_names = [\n", " \"pv_powerctrl_output_vsd\", \"pv_powerctrl_output_vsq\"\n", "]\n", "\n", - "logger_sp.log_attribute(output_names, 'powerctrl_outputs', pv)\n", + "logger_sp.log_attribute(output_names, pv.attr('powerctrl_outputs'))\n", "\n", - "logger_sp.log_attribute('pv_v_intf', 'v_intf', pv)\n", - "logger_sp.log_attribute('pv_i_intf', 'i_intf', pv)\n", - "logger_sp.log_attribute('pv_pll_output', 'pll_output', pv)\n", - "logger_sp.log_attribute('pv_vsref', 'Vsref', pv)\n", - "logger_sp.log_attribute('pv_vs', 'Vs', pv)\n", + "logger_sp.log_attribute('pv_v_intf', pv.attr('v_intf'))\n", + "logger_sp.log_attribute('pv_i_intf', pv.attr('i_intf'))\n", + "logger_sp.log_attribute('pv_pll_output', pv.attr('pll_output'))\n", + "logger_sp.log_attribute('pv_vsref', pv.attr('Vsref'))\n", + "logger_sp.log_attribute('pv_vs', pv.attr('Vs'))\n", "\n", "# load step sized in absolute terms\n", "load_switch = dpsimpy.sp.ph1.Switch(\"Load_Add_Switch_n2\", dpsimpy.LogLevel.debug)\n", @@ -568,7 +568,7 @@ "load_switch.open()\n", "system_sp.add(load_switch)\n", "system_sp.connect_component(load_switch, [gnd, system_sp.node('n2')])\n", - "logger_sp.log_attribute('switchedload_i', 'i_intf', load_switch)\n", + "logger_sp.log_attribute('switchedload_i', load_switch.attr('i_intf'))\n", "load_step_event = dpsimpy.event.SwitchEvent(np.round(5.0/time_step)*time_step, load_switch, True)\n", "\n", "# Simulation\n", diff --git a/examples/Notebooks/Circuits/EMT_DP_Slack_PiLine_VSI_Control_OnOff.ipynb b/examples/Notebooks/Circuits/EMT_DP_Slack_PiLine_VSI_Control_OnOff.ipynb index 8a74c2be7a..6e07f48cb6 100644 --- a/examples/Notebooks/Circuits/EMT_DP_Slack_PiLine_VSI_Control_OnOff.ipynb +++ b/examples/Notebooks/Circuits/EMT_DP_Slack_PiLine_VSI_Control_OnOff.ipynb @@ -93,8 +93,8 @@ "\n", "# Logging\n", "logger_pf = dpsimpy.Logger(sim_name_pf)\n", - "logger_pf.log_attribute('v1', 'v', n1_pf)\n", - "logger_pf.log_attribute('v2', 'v', n2_pf)\n", + "logger_pf.log_attribute('v1', n1_pf.attr('v'))\n", + "logger_pf.log_attribute('v2', n2_pf.attr('v'))\n", "\n", "# Simulation\n", "sim_pf = dpsimpy.Simulation(sim_name_pf, dpsimpy.LogLevel.debug)\n", @@ -162,34 +162,34 @@ "\n", "# Logging\n", "logger_emt = dpsimpy.Logger(sim_name_emt)\n", - "logger_emt.log_attribute('v1', 'v', n1_emt)\n", - "logger_emt.log_attribute('v2', 'v', n2_emt)\n", - "logger_emt.log_attribute('i12', 'i_intf', line_emt)\n", + "logger_emt.log_attribute('v1', n1_emt.attr('v'))\n", + "logger_emt.log_attribute('v2', n2_emt.attr('v'))\n", + "logger_emt.log_attribute('i12', line_emt.attr('i_intf'))\n", "\n", "\n", "input_names = [\n", " \"pv_powerctrl_input_pref\", \"pv_powerctrl_input_qref\", \"pv_powerctrl_input_vcd\",\n", " \"pv_powerctrl_input_vcq\", \"pv_powerctrl_input_ircd\", \"pv_powerctrl_input_ircq\"\n", "]\n", - "logger_emt.log_attribute(input_names, 'powerctrl_inputs', pv)\n", + "logger_emt.log_attribute(input_names, pv.attr('powerctrl_inputs'))\n", "\n", "state_names = [\n", " \"pv_powerctrl_state_p\", \"pv_powerctrl_state_q\", \"pv_powerctrl_state_phid\",\n", " \"pv_powerctrl_state_phiq\", \"pv_powerctrl_state_gammad\", \"pv_powerctrl_state_gammaq\"\n", "]\n", - "logger_emt.log_attribute(state_names, 'powerctrl_states', pv)\n", + "logger_emt.log_attribute(state_names, pv.attr('powerctrl_states'))\n", "\n", "output_names = [\n", " \"pv_powerctrl_output_vsd\", \"pv_powerctrl_output_vsq\"\n", "]\n", "\n", - "logger_emt.log_attribute(output_names, 'powerctrl_outputs', pv)\n", + "logger_emt.log_attribute(output_names, pv.attr('powerctrl_outputs'))\n", "\n", - "logger_emt.log_attribute('pv_v_intf', 'v_intf', pv)\n", - "logger_emt.log_attribute('pv_i_intf', 'i_intf', pv)\n", - "logger_emt.log_attribute('pv_pll_output', 'pll_output', pv)\n", - "logger_emt.log_attribute('pv_vsref', 'Vsref', pv)\n", - "logger_emt.log_attribute('pv_vs', 'Vs', pv)\n", + "logger_emt.log_attribute('pv_v_intf', pv.attr('v_intf'))\n", + "logger_emt.log_attribute('pv_i_intf', pv.attr('i_intf'))\n", + "logger_emt.log_attribute('pv_pll_output', pv.attr('pll_output'))\n", + "logger_emt.log_attribute('pv_vsref', pv.attr('Vsref'))\n", + "logger_emt.log_attribute('pv_vs', pv.attr('Vs'))\n", "\n", "# load step sized in absolute terms\n", "load_switch = dpsimpy.emt.ph3.Switch(\"Load_Add_Switch_n2\", dpsimpy.LogLevel.debug)\n", @@ -199,7 +199,7 @@ "load_switch.open()\n", "system_emt.add(load_switch)\n", "system_emt.connect_component(load_switch, [gnd, system_emt.node('n2')])\n", - "logger_emt.log_attribute('switchedload_i', 'i_intf', load_switch)\n", + "logger_emt.log_attribute('switchedload_i', load_switch.attr('i_intf'))\n", "load_step_event = dpsimpy.event.SwitchEvent3Ph(np.round(5.0/time_step)*time_step, load_switch, True)\n", "\n", "# Simulation\n", @@ -285,8 +285,8 @@ "\n", "# Logging\n", "logger_pf = dpsimpy.Logger(sim_name_pf)\n", - "logger_pf.log_attribute('v1', 'v', n1_pf)\n", - "logger_pf.log_attribute('v2', 'v', n2_pf)\n", + "logger_pf.log_attribute('v1', n1_pf.attr('v'))\n", + "logger_pf.log_attribute('v2', n2_pf.attr('v'))\n", "\n", "# Simulation\n", "sim_pf = dpsimpy.Simulation(sim_name_pf, dpsimpy.LogLevel.debug)\n", @@ -354,34 +354,34 @@ "\n", "# Logging\n", "logger_emt = dpsimpy.Logger(sim_name_emt)\n", - "logger_emt.log_attribute('v1', 'v', n1_emt)\n", - "logger_emt.log_attribute('v2', 'v', n2_emt)\n", - "logger_emt.log_attribute('i12', 'i_intf', line_emt)\n", + "logger_emt.log_attribute('v1', n1_emt.attr('v'))\n", + "logger_emt.log_attribute('v2', n2_emt.attr('v'))\n", + "logger_emt.log_attribute('i12', line_emt.attr('i_intf'))\n", "\n", "\n", "input_names = [\n", " \"pv_powerctrl_input_pref\", \"pv_powerctrl_input_qref\", \"pv_powerctrl_input_vcd\",\n", " \"pv_powerctrl_input_vcq\", \"pv_powerctrl_input_ircd\", \"pv_powerctrl_input_ircq\"\n", "]\n", - "logger_emt.log_attribute(input_names, 'powerctrl_inputs', pv)\n", + "logger_emt.log_attribute(input_names, pv.attr('powerctrl_inputs'))\n", "\n", "state_names = [\n", " \"pv_powerctrl_state_p\", \"pv_powerctrl_state_q\", \"pv_powerctrl_state_phid\",\n", " \"pv_powerctrl_state_phiq\", \"pv_powerctrl_state_gammad\", \"pv_powerctrl_state_gammaq\"\n", "]\n", - "logger_emt.log_attribute(state_names, 'powerctrl_states', pv)\n", + "logger_emt.log_attribute(state_names, pv.attr('powerctrl_states'))\n", "\n", "output_names = [\n", " \"pv_powerctrl_output_vsd\", \"pv_powerctrl_output_vsq\"\n", "]\n", "\n", - "logger_emt.log_attribute(output_names, 'powerctrl_outputs', pv)\n", + "logger_emt.log_attribute(output_names, pv.attr('powerctrl_outputs'))\n", "\n", - "logger_emt.log_attribute('pv_v_intf', 'v_intf', pv)\n", - "logger_emt.log_attribute('pv_i_intf', 'i_intf', pv)\n", - "logger_emt.log_attribute('pv_pll_output', 'pll_output', pv)\n", - "logger_emt.log_attribute('pv_vsref', 'Vsref', pv)\n", - "logger_emt.log_attribute('pv_vs', 'Vs', pv)\n", + "logger_emt.log_attribute('pv_v_intf', pv.attr('v_intf'))\n", + "logger_emt.log_attribute('pv_i_intf', pv.attr('i_intf'))\n", + "logger_emt.log_attribute('pv_pll_output', pv.attr('pll_output'))\n", + "logger_emt.log_attribute('pv_vsref', pv.attr('Vsref'))\n", + "logger_emt.log_attribute('pv_vs', pv.attr('Vs'))\n", "\n", "# load step sized in absolute terms\n", "load_switch = dpsimpy.emt.ph3.Switch(\"Load_Add_Switch_n2\", dpsimpy.LogLevel.debug)\n", @@ -391,7 +391,7 @@ "load_switch.open()\n", "system_emt.add(load_switch)\n", "system_emt.connect_component(load_switch, [gnd, system_emt.node('n2')])\n", - "logger_emt.log_attribute('switchedload_i', 'i_intf', load_switch)\n", + "logger_emt.log_attribute('switchedload_i', load_switch.attr('i_intf'))\n", "load_step_event = dpsimpy.event.SwitchEvent3Ph(np.round(5.0/time_step)*time_step, load_switch, True)\n", "\n", "# Simulation\n", @@ -658,8 +658,8 @@ "\n", "# Logging\n", "logger_pf = dpsimpy.Logger(sim_name_pf)\n", - "logger_pf.log_attribute('v1', 'v', n1_pf)\n", - "logger_pf.log_attribute('v2', 'v', n2_pf)\n", + "logger_pf.log_attribute('v1', n1_pf.attr('v'))\n", + "logger_pf.log_attribute('v2', n2_pf.attr('v'))\n", "\n", "# Simulation\n", "sim_pf = dpsimpy.Simulation(sim_name_pf, dpsimpy.LogLevel.debug)\n", @@ -724,34 +724,34 @@ "\n", "# Logging\n", "logger_dp = dpsimpy.Logger(sim_name_dp)\n", - "logger_dp.log_attribute('v1', 'v', n1_dp)\n", - "logger_dp.log_attribute('v2', 'v', n2_dp)\n", - "logger_dp.log_attribute('i12', 'i_intf', line_dp)\n", + "logger_dp.log_attribute('v1', n1_dp.attr('v'))\n", + "logger_dp.log_attribute('v2', n2_dp.attr('v'))\n", + "logger_dp.log_attribute('i12', line_dp.attr('i_intf'))\n", "\n", "\n", "input_names = [\n", " \"pv_powerctrl_input_pref\", \"pv_powerctrl_input_qref\", \"pv_powerctrl_input_vcd\",\n", " \"pv_powerctrl_input_vcq\", \"pv_powerctrl_input_ircd\", \"pv_powerctrl_input_ircq\"\n", "]\n", - "logger_dp.log_attribute(input_names, 'powerctrl_inputs', pv)\n", + "logger_dp.log_attribute(input_names, pv.attr('powerctrl_inputs'))\n", "\n", "state_names = [\n", " \"pv_powerctrl_state_p\", \"pv_powerctrl_state_q\", \"pv_powerctrl_state_phid\",\n", " \"pv_powerctrl_state_phiq\", \"pv_powerctrl_state_gammad\", \"pv_powerctrl_state_gammaq\"\n", "]\n", - "logger_dp.log_attribute(state_names, 'powerctrl_states', pv)\n", + "logger_dp.log_attribute(state_names, pv.attr('powerctrl_states'))\n", "\n", "output_names = [\n", " \"pv_powerctrl_output_vsd\", \"pv_powerctrl_output_vsq\"\n", "]\n", "\n", - "logger_dp.log_attribute(output_names, 'powerctrl_outputs', pv)\n", + "logger_dp.log_attribute(output_names, pv.attr('powerctrl_outputs'))\n", "\n", - "logger_dp.log_attribute('pv_v_intf', 'v_intf', pv)\n", - "logger_dp.log_attribute('pv_i_intf', 'i_intf', pv)\n", - "logger_dp.log_attribute('pv_pll_output', 'pll_output', pv)\n", - "logger_dp.log_attribute('pv_vsref', 'Vsref', pv)\n", - "logger_dp.log_attribute('pv_vs', 'Vs', pv)\n", + "logger_dp.log_attribute('pv_v_intf', pv.attr('v_intf'))\n", + "logger_dp.log_attribute('pv_i_intf', pv.attr('i_intf'))\n", + "logger_dp.log_attribute('pv_pll_output', pv.attr('pll_output'))\n", + "logger_dp.log_attribute('pv_vsref', pv.attr('Vsref'))\n", + "logger_dp.log_attribute('pv_vs', pv.attr('Vs'))\n", "\n", "# load step sized in absolute terms\n", "load_switch = dpsimpy.dp.ph1.Switch(\"Load_Add_Switch_n2\", dpsimpy.LogLevel.debug)\n", @@ -761,7 +761,7 @@ "load_switch.open()\n", "system_dp.add(load_switch)\n", "system_dp.connect_component(load_switch, [gnd, system_dp.node('n2')])\n", - "logger_dp.log_attribute('switchedload_i', 'i_intf', load_switch)\n", + "logger_dp.log_attribute('switchedload_i', load_switch.attr('i_intf'))\n", "load_step_event = dpsimpy.event.SwitchEvent(np.round(5.0/time_step)*time_step, load_switch, True)\n", "\n", "# Simulation\n", @@ -847,8 +847,8 @@ "\n", "# Logging\n", "logger_pf = dpsimpy.Logger(sim_name_pf)\n", - "logger_pf.log_attribute('v1', 'v', n1_pf)\n", - "logger_pf.log_attribute('v2', 'v', n2_pf)\n", + "logger_pf.log_attribute('v1', n1_pf.attr('v'))\n", + "logger_pf.log_attribute('v2', n2_pf.attr('v'))\n", "\n", "# Simulation\n", "sim_pf = dpsimpy.Simulation(sim_name_pf, dpsimpy.LogLevel.debug)\n", @@ -913,34 +913,34 @@ "\n", "# Logging\n", "logger_dp = dpsimpy.Logger(sim_name_dp)\n", - "logger_dp.log_attribute('v1', 'v', n1_dp)\n", - "logger_dp.log_attribute('v2', 'v', n2_dp)\n", - "logger_dp.log_attribute('i12', 'i_intf', line_dp)\n", + "logger_dp.log_attribute('v1', n1_dp.attr('v'))\n", + "logger_dp.log_attribute('v2', n2_dp.attr('v'))\n", + "logger_dp.log_attribute('i12', line_dp.attr('i_intf'))\n", "\n", "\n", "input_names = [\n", " \"pv_powerctrl_input_pref\", \"pv_powerctrl_input_qref\", \"pv_powerctrl_input_vcd\",\n", " \"pv_powerctrl_input_vcq\", \"pv_powerctrl_input_ircd\", \"pv_powerctrl_input_ircq\"\n", "]\n", - "logger_dp.log_attribute(input_names, 'powerctrl_inputs', pv)\n", + "logger_dp.log_attribute(input_names, pv.attr('powerctrl_inputs'))\n", "\n", "state_names = [\n", " \"pv_powerctrl_state_p\", \"pv_powerctrl_state_q\", \"pv_powerctrl_state_phid\",\n", " \"pv_powerctrl_state_phiq\", \"pv_powerctrl_state_gammad\", \"pv_powerctrl_state_gammaq\"\n", "]\n", - "logger_dp.log_attribute(state_names, 'powerctrl_states', pv)\n", + "logger_dp.log_attribute(state_names, pv.attr('powerctrl_states'))\n", "\n", "output_names = [\n", " \"pv_powerctrl_output_vsd\", \"pv_powerctrl_output_vsq\"\n", "]\n", "\n", - "logger_dp.log_attribute(output_names, 'powerctrl_outputs', pv)\n", + "logger_dp.log_attribute(output_names, pv.attr('powerctrl_outputs'))\n", "\n", - "logger_dp.log_attribute('pv_v_intf', 'v_intf', pv)\n", - "logger_dp.log_attribute('pv_i_intf', 'i_intf', pv)\n", - "logger_dp.log_attribute('pv_pll_output', 'pll_output', pv)\n", - "logger_dp.log_attribute('pv_vsref', 'Vsref', pv)\n", - "logger_dp.log_attribute('pv_vs', 'Vs', pv)\n", + "logger_dp.log_attribute('pv_v_intf', pv.attr('v_intf'))\n", + "logger_dp.log_attribute('pv_i_intf', pv.attr('i_intf'))\n", + "logger_dp.log_attribute('pv_pll_output', pv.attr('pll_output'))\n", + "logger_dp.log_attribute('pv_vsref', pv.attr('Vsref'))\n", + "logger_dp.log_attribute('pv_vs', pv.attr('Vs'))\n", "\n", "# load step sized in absolute terms\n", "load_switch = dpsimpy.dp.ph1.Switch(\"Load_Add_Switch_n2\", dpsimpy.LogLevel.debug)\n", @@ -950,7 +950,7 @@ "load_switch.open()\n", "system_dp.add(load_switch)\n", "system_dp.connect_component(load_switch, [gnd, system_dp.node('n2')])\n", - "logger_dp.log_attribute('switchedload_i', 'i_intf', load_switch)\n", + "logger_dp.log_attribute('switchedload_i', load_switch.attr('i_intf'))\n", "load_step_event = dpsimpy.event.SwitchEvent(np.round(5.0/time_step)*time_step, load_switch, True)\n", "\n", "# Simulation\n", diff --git a/examples/Notebooks/Circuits/EMT_DP_VS_Init.ipynb b/examples/Notebooks/Circuits/EMT_DP_VS_Init.ipynb index f8d097ba54..091d49f5dd 100644 --- a/examples/Notebooks/Circuits/EMT_DP_VS_Init.ipynb +++ b/examples/Notebooks/Circuits/EMT_DP_VS_Init.ipynb @@ -65,7 +65,7 @@ "\n", "# Logging\n", "logger = dpsimpy.Logger(sim_name)\n", - "logger.log_attribute('v1', 'v', n1)\n", + "logger.log_attribute('v1', n1.attr('v'))\n", "\n", "sim = dpsimpy.Simulation(sim_name)\n", "sim.set_domain(dpsimpy.Domain.DP)\n", @@ -101,7 +101,7 @@ "\n", "# Logging\n", "logger = dpsimpy.Logger(sim_name)\n", - "logger.log_attribute('v1', 'v', n1)\n", + "logger.log_attribute('v1', n1.attr('v'))\n", "\n", "sim = dpsimpy.Simulation(sim_name)\n", "sim.set_domain(dpsimpy.Domain.EMT)\n", @@ -233,7 +233,7 @@ "\n", "# Logging\n", "logger = dpsimpy.Logger(sim_name)\n", - "logger.log_attribute('v1', 'v', n1)\n", + "logger.log_attribute('v1', n1.attr('v'))\n", "\n", "sim = dpsimpy.Simulation(sim_name)\n", "sim.set_domain(dpsimpy.Domain.DP)\n", @@ -271,7 +271,7 @@ "\n", "# Logging\n", "logger = dpsimpy.Logger(sim_name)\n", - "logger.log_attribute('v1', 'v', n1)\n", + "logger.log_attribute('v1', n1.attr('v'))\n", "\n", "sim = dpsimpy.Simulation(sim_name)\n", "sim.set_domain(dpsimpy.Domain.EMT)\n", @@ -403,7 +403,7 @@ "\n", "# Logging\n", "logger = dpsimpy.Logger(sim_name)\n", - "logger.log_attribute('v1', 'v', n1)\n", + "logger.log_attribute('v1', n1.attr('v'))\n", "\n", "sim = dpsimpy.Simulation(sim_name)\n", "sim.set_domain(dpsimpy.Domain.DP)\n", @@ -441,7 +441,7 @@ "\n", "# Logging\n", "logger = dpsimpy.Logger(sim_name)\n", - "logger.log_attribute('v1', 'v', n1)\n", + "logger.log_attribute('v1', n1.attr('v'))\n", "\n", "sim = dpsimpy.Simulation(sim_name)\n", "sim.set_domain(dpsimpy.Domain.EMT)\n", diff --git a/examples/Notebooks/Circuits/EMT_DP_VS_RLC.ipynb b/examples/Notebooks/Circuits/EMT_DP_VS_RLC.ipynb index a923161883..34097150a0 100644 --- a/examples/Notebooks/Circuits/EMT_DP_VS_RLC.ipynb +++ b/examples/Notebooks/Circuits/EMT_DP_VS_RLC.ipynb @@ -64,8 +64,8 @@ "\n", "# Logging\n", "logger = dpsimpy.Logger(sim_name)\n", - "logger.log_attribute(\"v1\", \"v\", n1)\n", - "logger.log_attribute(\"iR\", \"i_intf\", res)\n", + "logger.log_attribute(\"v1\", n1.attr(\"v\"))\n", + "logger.log_attribute(\"iR\", res.attr(\"i_intf\"))\n", "\n", "# Simulation\n", "sim = dpsimpy.Simulation(sim_name)\n", @@ -105,8 +105,8 @@ "\n", "# Logging\n", "logger = dpsimpy.Logger(sim_name)\n", - "logger.log_attribute(\"v1\", \"v\", n1)\n", - "logger.log_attribute(\"iR\", \"i_intf\", res)\n", + "logger.log_attribute(\"v1\", n1.attr(\"v\"))\n", + "logger.log_attribute(\"iR\", res.attr(\"i_intf\"))\n", "\n", "# Simulation\n", "sim = dpsimpy.Simulation(sim_name)\n", @@ -146,8 +146,8 @@ "\n", "# Logging\n", "logger = dpsimpy.Logger(sim_name)\n", - "logger.log_attribute(\"v1\", \"v\", n1)\n", - "logger.log_attribute(\"iR\", \"i_intf\", res)\n", + "logger.log_attribute(\"v1\", n1.attr(\"v\"))\n", + "logger.log_attribute(\"iR\", res.attr(\"i_intf\"))\n", "\n", "# Simulation\n", "sim = dpsimpy.Simulation(sim_name)\n", @@ -414,10 +414,10 @@ "\n", "# Logging\n", "logger = dpsimpy.Logger(sim_name)\n", - "logger.log_attribute(\"v1\", \"v\", n1)\n", - "logger.log_attribute(\"v2\", \"v\", n2)\n", - "logger.log_attribute(\"iR\", \"i_intf\", res)\n", - "logger.log_attribute(\"iL\", \"i_intf\", ind)\n", + "logger.log_attribute(\"v1\", n1.attr(\"v\"))\n", + "logger.log_attribute(\"v2\", n2.attr(\"v\"))\n", + "logger.log_attribute(\"iR\", res.attr(\"i_intf\"))\n", + "logger.log_attribute(\"iL\", ind.attr(\"i_intf\"))\n", "\n", "# Simulation\n", "sim = dpsimpy.Simulation(sim_name)\n", @@ -462,10 +462,10 @@ "\n", "# Logging\n", "logger = dpsimpy.Logger(sim_name)\n", - "logger.log_attribute(\"v1\", \"v\", n1)\n", - "logger.log_attribute(\"v2\", \"v\", n2)\n", - "logger.log_attribute(\"iR\", \"i_intf\", res)\n", - "logger.log_attribute(\"iL\", \"i_intf\", ind)\n", + "logger.log_attribute(\"v1\", n1.attr(\"v\"))\n", + "logger.log_attribute(\"v2\", n2.attr(\"v\"))\n", + "logger.log_attribute(\"iR\", res.attr(\"i_intf\"))\n", + "logger.log_attribute(\"iL\", ind.attr(\"i_intf\"))\n", "\n", "# Simulation\n", "sim = dpsimpy.Simulation(sim_name)\n", @@ -510,10 +510,10 @@ "\n", "# Logging\n", "logger = dpsimpy.Logger(sim_name)\n", - "logger.log_attribute(\"v1\", \"v\", n1)\n", - "logger.log_attribute(\"v2\", \"v\", n2)\n", - "logger.log_attribute(\"iR\", \"i_intf\", res)\n", - "logger.log_attribute(\"iL\", \"i_intf\", ind)\n", + "logger.log_attribute(\"v1\", n1.attr(\"v\"))\n", + "logger.log_attribute(\"v2\", n2.attr(\"v\"))\n", + "logger.log_attribute(\"iR\", res.attr(\"i_intf\"))\n", + "logger.log_attribute(\"iL\", ind.attr(\"i_intf\"))\n", "\n", "# Simulation\n", "sim = dpsimpy.Simulation(sim_name)\n", @@ -780,10 +780,10 @@ "\n", "# Logging\n", "logger = dpsimpy.Logger(sim_name)\n", - "logger.log_attribute(\"v1\", \"v\", n1)\n", - "logger.log_attribute(\"v2\", \"v\", n2)\n", - "logger.log_attribute(\"iR\", \"i_intf\", res)\n", - "logger.log_attribute(\"iC\", \"i_intf\", cap)\n", + "logger.log_attribute(\"v1\", n1.attr(\"v\"))\n", + "logger.log_attribute(\"v2\", n2.attr(\"v\"))\n", + "logger.log_attribute(\"iR\", res.attr(\"i_intf\"))\n", + "logger.log_attribute(\"iC\", cap.attr(\"i_intf\"))\n", "\n", "# Simulation\n", "sim = dpsimpy.Simulation(sim_name)\n", @@ -828,10 +828,10 @@ "\n", "# Logging\n", "logger = dpsimpy.Logger(sim_name)\n", - "logger.log_attribute(\"v1\", \"v\", n1)\n", - "logger.log_attribute(\"v2\", \"v\", n2)\n", - "logger.log_attribute(\"iR\", \"i_intf\", res)\n", - "logger.log_attribute(\"iC\", \"i_intf\", cap)\n", + "logger.log_attribute(\"v1\", n1.attr(\"v\"))\n", + "logger.log_attribute(\"v2\", n2.attr(\"v\"))\n", + "logger.log_attribute(\"iR\", res.attr(\"i_intf\"))\n", + "logger.log_attribute(\"iC\", cap.attr(\"i_intf\"))\n", "\n", "# Simulation\n", "sim = dpsimpy.Simulation(sim_name)\n", @@ -876,10 +876,10 @@ "\n", "# Logging\n", "logger = dpsimpy.Logger(sim_name)\n", - "logger.log_attribute(\"v1\", \"v\", n1)\n", - "logger.log_attribute(\"v2\", \"v\", n2)\n", - "logger.log_attribute(\"iR\", \"i_intf\", res)\n", - "logger.log_attribute(\"iC\", \"i_intf\", cap)\n", + "logger.log_attribute(\"v1\", n1.attr(\"v\"))\n", + "logger.log_attribute(\"v2\", n2.attr(\"v\"))\n", + "logger.log_attribute(\"iR\", res.attr(\"i_intf\"))\n", + "logger.log_attribute(\"iC\", cap.attr(\"i_intf\"))\n", "\n", "# Simulation\n", "sim = dpsimpy.Simulation(sim_name)\n", diff --git a/examples/Notebooks/Circuits/EMT_Slack_PiLine_PQLoad_with_PF_Init.ipynb b/examples/Notebooks/Circuits/EMT_Slack_PiLine_PQLoad_with_PF_Init.ipynb index 013d44e0f3..0f57201bc4 100644 --- a/examples/Notebooks/Circuits/EMT_Slack_PiLine_PQLoad_with_PF_Init.ipynb +++ b/examples/Notebooks/Circuits/EMT_Slack_PiLine_PQLoad_with_PF_Init.ipynb @@ -76,9 +76,9 @@ "\n", "# Logging\n", "logger_pf = dpsimpy.Logger(sim_name_pf)\n", - "logger_pf.log_attribute('v1', 'v', n1_pf)\n", - "logger_pf.log_attribute('v2', 'v', n2_pf)\n", - "logger_pf.log_attribute('i12', 'i_intf', line_pf)\n", + "logger_pf.log_attribute('v1', n1_pf.attr('v'))\n", + "logger_pf.log_attribute('v2', n2_pf.attr('v'))\n", + "logger_pf.log_attribute('i12', line_pf.attr('i_intf'))\n", "\n", "# Simulation\n", "sim_pf = dpsimpy.Simulation(sim_name_pf, dpsimpy.LogLevel.debug)\n", @@ -127,10 +127,10 @@ "\n", "# Logging\n", "logger_emt = dpsimpy.Logger(sim_name_emt)\n", - "logger_emt.log_attribute('v1', 'v', n1_emt)\n", - "logger_emt.log_attribute('v2', 'v', n2_emt)\n", - "logger_emt.log_attribute('i12', 'i_intf', line_emt)\n", - "logger_emt.log_attribute('irx', 'i_intf', load_emt)\n", + "logger_emt.log_attribute('v1', n1_emt.attr('v'))\n", + "logger_emt.log_attribute('v2', n2_emt.attr('v'))\n", + "logger_emt.log_attribute('i12', line_emt.attr('i_intf'))\n", + "logger_emt.log_attribute('irx', load_emt.attr('i_intf'))\n", "\n", "# load step sized in absolute terms\n", "load_switch = dpsimpy.emt.ph3.Switch(\"Load_Add_Switch_n2\", dpsimpy.LogLevel.debug)\n", @@ -140,7 +140,7 @@ "load_switch.open()\n", "system_emt.add(load_switch)\n", "system_emt.connect_component(load_switch, [gnd, system_emt.node('n2')])\n", - "logger_emt.log_attribute('switchedload_i', 'i_intf', load_switch)\n", + "logger_emt.log_attribute('switchedload_i', load_switch.attr('i_intf'))\n", "load_step_event = dpsimpy.event.SwitchEvent3Ph(0.1 - time_step_emt, load_switch, True)\n", "\n", "# Simulation\n", @@ -276,4 +276,4 @@ }, "nbformat": 4, "nbformat_minor": 4 -} \ No newline at end of file +} diff --git a/examples/Notebooks/Circuits/EMT_Slack_PiLine_VSI_with_PF_Init.ipynb b/examples/Notebooks/Circuits/EMT_Slack_PiLine_VSI_with_PF_Init.ipynb index d74e43d954..ae37d61881 100644 --- a/examples/Notebooks/Circuits/EMT_Slack_PiLine_VSI_with_PF_Init.ipynb +++ b/examples/Notebooks/Circuits/EMT_Slack_PiLine_VSI_with_PF_Init.ipynb @@ -94,8 +94,8 @@ "\n", "# Logging\n", "logger_pf = dpsimpy.Logger(sim_name_pf)\n", - "logger_pf.log_attribute('v1', 'v', n1_pf)\n", - "logger_pf.log_attribute('v2', 'v', n2_pf)\n", + "logger_pf.log_attribute('v1', n1_pf.attr('v'))\n", + "logger_pf.log_attribute('v2', n2_pf.attr('v'))\n", "\n", "# Simulation\n", "sim_pf = dpsimpy.Simulation(sim_name_pf, dpsimpy.LogLevel.debug)\n", @@ -163,34 +163,34 @@ "\n", "# Logging\n", "logger_emt = dpsimpy.Logger(sim_name_emt)\n", - "logger_emt.log_attribute('v1', 'v', n1_emt)\n", - "logger_emt.log_attribute('v2', 'v', n2_emt)\n", - "logger_emt.log_attribute('i12', 'i_intf', line_emt)\n", + "logger_emt.log_attribute('v1', n1_emt.attr('v'))\n", + "logger_emt.log_attribute('v2', n2_emt.attr('v'))\n", + "logger_emt.log_attribute('i12', line_emt.attr('i_intf'))\n", "\n", "\n", "input_names = [\n", " \"pv_powerctrl_input_pref\", \"pv_powerctrl_input_qref\", \"pv_powerctrl_input_vcd\",\n", " \"pv_powerctrl_input_vcq\", \"pv_powerctrl_input_ircd\", \"pv_powerctrl_input_ircq\"\n", "]\n", - "logger_emt.log_attribute(input_names, 'powerctrl_inputs', pv)\n", + "logger_emt.log_attribute(input_names, pv.attr('powerctrl_inputs'))\n", "\n", "state_names = [\n", " \"pv_powerctrl_state_p\", \"pv_powerctrl_state_q\", \"pv_powerctrl_state_phid\",\n", " \"pv_powerctrl_state_phiq\", \"pv_powerctrl_state_gammad\", \"pv_powerctrl_state_gammaq\"\n", "]\n", - "logger_emt.log_attribute(state_names, 'powerctrl_states', pv)\n", + "logger_emt.log_attribute(state_names, pv.attr('powerctrl_states'))\n", "\n", "output_names = [\n", " \"pv_powerctrl_output_vsd\", \"pv_powerctrl_output_vsq\"\n", "]\n", "\n", - "logger_emt.log_attribute(output_names, 'powerctrl_outputs', pv)\n", + "logger_emt.log_attribute(output_names, pv.attr('powerctrl_outputs'))\n", "\n", - "logger_emt.log_attribute('pv_v_intf', 'v_intf', pv)\n", - "logger_emt.log_attribute('pv_i_intf', 'i_intf', pv)\n", - "logger_emt.log_attribute('pv_pll_output', 'pll_output', pv)\n", - "logger_emt.log_attribute('pv_vsref', 'Vsref', pv)\n", - "logger_emt.log_attribute('pv_vs', 'Vs', pv)\n", + "logger_emt.log_attribute('pv_v_intf', pv.attr('v_intf'))\n", + "logger_emt.log_attribute('pv_i_intf', pv.attr('i_intf'))\n", + "logger_emt.log_attribute('pv_pll_output', pv.attr('pll_output'))\n", + "logger_emt.log_attribute('pv_vsref', pv.attr('Vsref'))\n", + "logger_emt.log_attribute('pv_vs', pv.attr('Vs'))\n", "\n", "# load step sized in absolute terms\n", "load_switch = dpsimpy.emt.ph3.Switch(\"Load_Add_Switch_n2\", dpsimpy.LogLevel.debug)\n", @@ -200,7 +200,7 @@ "load_switch.open()\n", "system_emt.add(load_switch)\n", "system_emt.connect_component(load_switch, [gnd, system_emt.node('n2')])\n", - "logger_emt.log_attribute('switchedload_i', 'i_intf', load_switch)\n", + "logger_emt.log_attribute('switchedload_i', load_switch.attr('i_intf'))\n", "load_step_event = dpsimpy.event.SwitchEvent3Ph(np.round(5.0/time_step)*time_step, load_switch, True)\n", "\n", "# Simulation\n", diff --git a/examples/Notebooks/Circuits/EMT_Slack_PiLine_VSI_with_PF_Init_Params.ipynb b/examples/Notebooks/Circuits/EMT_Slack_PiLine_VSI_with_PF_Init_Params.ipynb index def43786d9..829a3eac3e 100644 --- a/examples/Notebooks/Circuits/EMT_Slack_PiLine_VSI_with_PF_Init_Params.ipynb +++ b/examples/Notebooks/Circuits/EMT_Slack_PiLine_VSI_with_PF_Init_Params.ipynb @@ -67,8 +67,8 @@ "\n", " # Logging\n", " logger_pf = dpsimpy.Logger(sim_name_pf)\n", - " logger_pf.log_attribute('v1', 'v', n1_pf)\n", - " logger_pf.log_attribute('v2', 'v', n2_pf)\n", + " logger_pf.log_attribute('v1', n1_pf.attr('v'))\n", + " logger_pf.log_attribute('v2', n2_pf.attr('v'))\n", "\n", " # Simulation\n", " sim_pf = dpsimpy.Simulation(sim_name_pf, dpsimpy.LogLevel.debug)\n", @@ -122,34 +122,34 @@ "\n", " # Logging\n", " logger_emt = dpsimpy.Logger(sim_name_emt)\n", - " logger_emt.log_attribute('v1', 'v', n1_emt)\n", - " logger_emt.log_attribute('v2', 'v', n2_emt)\n", - " logger_emt.log_attribute('i12', 'i_intf', line_emt)\n", + " logger_emt.log_attribute('v1', n1_emt.attr('v'))\n", + " logger_emt.log_attribute('v2', n2_emt.attr('v'))\n", + " logger_emt.log_attribute('i12', line_emt.attr('i_intf'))\n", "\n", "\n", " input_names = [\n", " \"pv_powerctrl_input_pref\", \"pv_powerctrl_input_qref\", \"pv_powerctrl_input_vcd\",\n", " \"pv_powerctrl_input_vcq\", \"pv_powerctrl_input_ircd\", \"pv_powerctrl_input_ircq\"\n", " ]\n", - " logger_emt.log_attribute(input_names, 'powerctrl_inputs', pv)\n", + " logger_emt.log_attribute(input_names, pv.attr('powerctrl_inputs'))\n", "\n", " state_names = [\n", " \"pv_powerctrl_state_p\", \"pv_powerctrl_state_q\", \"pv_powerctrl_state_phid\",\n", " \"pv_powerctrl_state_phiq\", \"pv_powerctrl_state_gammad\", \"pv_powerctrl_state_gammaq\"\n", " ]\n", - " logger_emt.log_attribute(state_names, 'powerctrl_states', pv)\n", + " logger_emt.log_attribute(state_names, pv.attr('powerctrl_states'))\n", "\n", " output_names = [\n", " \"pv_powerctrl_output_vsd\", \"pv_powerctrl_output_vsq\"\n", " ]\n", "\n", - " logger_emt.log_attribute(output_names, 'powerctrl_outputs', pv)\n", + " logger_emt.log_attribute(output_names, pv.attr('powerctrl_outputs'))\n", "\n", - " logger_emt.log_attribute('pv_v_intf', 'v_intf', pv)\n", - " logger_emt.log_attribute('pv_i_intf', 'i_intf', pv)\n", - " logger_emt.log_attribute('pv_pll_output', 'pll_output', pv)\n", - " logger_emt.log_attribute('pv_vsref', 'Vsref', pv)\n", - " logger_emt.log_attribute('pv_vs', 'Vs', pv)\n", + " logger_emt.log_attribute('pv_v_intf', pv.attr('v_intf'))\n", + " logger_emt.log_attribute('pv_i_intf', pv.attr('i_intf'))\n", + " logger_emt.log_attribute('pv_pll_output', pv.attr('pll_output'))\n", + " logger_emt.log_attribute('pv_vsref', pv.attr('Vsref'))\n", + " logger_emt.log_attribute('pv_vs', pv.attr('Vs'))\n", "\n", " # load step sized in absolute terms\n", " load_switch = dpsimpy.emt.ph3.Switch(\"Load_Add_Switch_n2\", dpsimpy.LogLevel.debug)\n", @@ -159,7 +159,7 @@ " load_switch.open()\n", " system_emt.add(load_switch)\n", " system_emt.connect_component(load_switch, [gnd, system_emt.node('n2')])\n", - " logger_emt.log_attribute('switchedload_i', 'i_intf', load_switch)\n", + " logger_emt.log_attribute('switchedload_i', load_switch.attr('i_intf'))\n", " load_step_event = dpsimpy.event.SwitchEvent3Ph(np.round(5.0/time_step)*time_step, load_switch, True)\n", "\n", " # Simulation\n", @@ -529,4 +529,4 @@ }, "nbformat": 4, "nbformat_minor": 4 -} \ No newline at end of file +} diff --git a/examples/Notebooks/Circuits/EMT_SynGenDQ7odTrapez_OperationalParams_SMIB_Fault_JsonSyngenParams.ipynb b/examples/Notebooks/Circuits/EMT_SynGenDQ7odTrapez_OperationalParams_SMIB_Fault_JsonSyngenParams.ipynb index 57e86ba2d8..317dc43bcc 100644 --- a/examples/Notebooks/Circuits/EMT_SynGenDQ7odTrapez_OperationalParams_SMIB_Fault_JsonSyngenParams.ipynb +++ b/examples/Notebooks/Circuits/EMT_SynGenDQ7odTrapez_OperationalParams_SMIB_Fault_JsonSyngenParams.ipynb @@ -149,12 +149,12 @@ "\n", "# Logging\n", "logger_pf = dpsimpy.Logger(sim_name_pf)\n", - "logger_pf.log_attribute(\"v1\", \"v\", n1_pf)\n", - "logger_pf.log_attribute(\"v2\", \"v\", n2_pf)\n", - "logger_pf.log_attribute(\"v_line\", \"v_intf\", line_pf)\n", - "logger_pf.log_attribute(\"i_line\", \"i_intf\", line_pf)\n", - "logger_pf.log_attribute(\"v_gen\", \"v_intf\", gen_pf)\n", - "logger_pf.log_attribute(\"ig\", \"i_intf\", gen_pf)\n", + "logger_pf.log_attribute(\"v1\", n1_pf.attr(\"v\"))\n", + "logger_pf.log_attribute(\"v2\", n2_pf.attr(\"v\"))\n", + "logger_pf.log_attribute(\"v_line\", line_pf.attr(\"v_intf\"))\n", + "logger_pf.log_attribute(\"i_line\", line_pf.attr(\"i_intf\"))\n", + "logger_pf.log_attribute(\"v_gen\", gen_pf.attr(\"v_intf\"))\n", + "logger_pf.log_attribute(\"ig\", gen_pf.attr(\"i_intf\"))\n", "\n", "# Simulation\n", "sim_pf = dpsimpy.Simulation(sim_name_pf, dpsimpy.LogLevel.debug)\n", @@ -236,14 +236,14 @@ "\n", "# Logging\n", "logger = dpsimpy.Logger(sim_name)\n", - "logger.log_attribute(\"v1\", \"v\", n1)\n", - "logger.log_attribute(\"v2\", \"v\", n2)\n", - "logger.log_attribute(\"v_line\", \"v_intf\", line)\n", - "logger.log_attribute(\"i_line\", \"i_intf\", line)\n", - "logger.log_attribute(\"v_gen\", \"v_intf\", gen)\n", - "logger.log_attribute(\"i_gen\", \"i_intf\", gen)\n", - "logger.log_attribute(\"wr_gen\", \"w_r\", gen)\n", - "logger.log_attribute(\"delta_r\", \"delta_r\", gen)\n", + "logger.log_attribute(\"v1\", n1.attr(\"v\"))\n", + "logger.log_attribute(\"v2\", n2.attr(\"v\"))\n", + "logger.log_attribute(\"v_line\", line.attr(\"v_intf\"))\n", + "logger.log_attribute(\"i_line\", line.attr(\"i_intf\"))\n", + "logger.log_attribute(\"v_gen\", gen.attr(\"v_intf\"))\n", + "logger.log_attribute(\"i_gen\", gen.attr(\"i_intf\"))\n", + "logger.log_attribute(\"wr_gen\", gen.attr(\"w_r\"))\n", + "logger.log_attribute(\"delta_r\", gen.attr(\"delta_r\"))\n", "\n", "# Events\n", "sw1 = dpsimpy.event.SwitchEvent3Ph(start_time_fault, fault, True)\n", @@ -368,12 +368,12 @@ "\n", "# Logging\n", "logger_pf = dpsimpy.Logger(sim_name_pf)\n", - "logger_pf.log_attribute(\"v1\", \"v\", n1_pf)\n", - "logger_pf.log_attribute(\"v2\", \"v\", n2_pf)\n", - "logger_pf.log_attribute(\"v_line\", \"v_intf\", line_pf)\n", - "logger_pf.log_attribute(\"i_line\", \"i_intf\", line_pf)\n", - "logger_pf.log_attribute(\"v_gen\", \"v_intf\", gen_pf)\n", - "logger_pf.log_attribute(\"ig\", \"i_intf\", gen_pf)\n", + "logger_pf.log_attribute(\"v1\", n1_pf.attr(\"v\"))\n", + "logger_pf.log_attribute(\"v2\", n2_pf.attr(\"v\"))\n", + "logger_pf.log_attribute(\"v_line\", line_pf.attr(\"v_intf\"))\n", + "logger_pf.log_attribute(\"i_line\", line_pf.attr(\"i_intf\"))\n", + "logger_pf.log_attribute(\"v_gen\", gen_pf.attr(\"v_intf\"))\n", + "logger_pf.log_attribute(\"ig\", gen_pf.attr(\"i_intf\"))\n", "\n", "# Simulation\n", "sim_pf = dpsimpy.Simulation(sim_name_pf, dpsimpy.LogLevel.debug)\n", @@ -455,14 +455,14 @@ "\n", "# Logging\n", "logger = dpsimpy.Logger(sim_name)\n", - "logger.log_attribute(\"v1\", \"v\", n1)\n", - "logger.log_attribute(\"v2\", \"v\", n2)\n", - "logger.log_attribute(\"v_line\", \"v_intf\", line)\n", - "logger.log_attribute(\"i_line\", \"i_intf\", line)\n", - "logger.log_attribute(\"v_gen\", \"v_intf\", gen)\n", - "logger.log_attribute(\"i_gen\", \"i_intf\", gen)\n", - "logger.log_attribute(\"wr_gen\", \"w_r\", gen)\n", - "logger.log_attribute(\"delta_r\", \"delta_r\", gen)\n", + "logger.log_attribute(\"v1\", n1.attr(\"v\"))\n", + "logger.log_attribute(\"v2\", n2.attr(\"v\"))\n", + "logger.log_attribute(\"v_line\", line.attr(\"v_intf\"))\n", + "logger.log_attribute(\"i_line\", line.attr(\"i_intf\"))\n", + "logger.log_attribute(\"v_gen\", gen.attr(\"v_intf\"))\n", + "logger.log_attribute(\"i_gen\", gen.attr(\"i_intf\"))\n", + "logger.log_attribute(\"wr_gen\", gen.attr(\"w_r\"))\n", + "logger.log_attribute(\"delta_r\", gen.attr(\"delta_r\"))\n", "\n", "# Events\n", "sw1 = dpsimpy.event.SwitchEvent3Ph(start_time_fault, fault, True)\n", diff --git a/examples/Notebooks/Circuits/EMT_SynGenDQ7odTrapez_OperationalParams_SMIB_Fault_ParamsModification.ipynb b/examples/Notebooks/Circuits/EMT_SynGenDQ7odTrapez_OperationalParams_SMIB_Fault_ParamsModification.ipynb index 1ab46d5a32..44c632c362 100644 --- a/examples/Notebooks/Circuits/EMT_SynGenDQ7odTrapez_OperationalParams_SMIB_Fault_ParamsModification.ipynb +++ b/examples/Notebooks/Circuits/EMT_SynGenDQ7odTrapez_OperationalParams_SMIB_Fault_ParamsModification.ipynb @@ -2,14 +2,16 @@ "cells": [ { "cell_type": "markdown", + "metadata": {}, "source": [ "# Synchronous Generator dq 7th order model - Parameter Modification" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "import villas.dataprocessing.readtools as rt\n", "from villas.dataprocessing.timeseries import TimeSeries as ts\n", @@ -20,20 +22,20 @@ "import dpsimpy\n", "\n", "#matplotlib widget" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "## Set up simulation" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "def Simulation(name, Ld_s):\n", " # General grid parameters\n", @@ -117,12 +119,12 @@ "\n", " # Logging\n", " logger_pf = dpsimpy.Logger(sim_name_pf)\n", - " logger_pf.log_attribute(\"v1\", \"v\", n1_pf)\n", - " logger_pf.log_attribute(\"v2\", \"v\", n2_pf)\n", - " logger_pf.log_attribute(\"v_line\", \"v_intf\", line_pf)\n", - " logger_pf.log_attribute(\"i_line\", \"i_intf\", line_pf)\n", - " logger_pf.log_attribute(\"v_gen\", \"v_intf\", gen_pf)\n", - " logger_pf.log_attribute(\"ig\", \"i_intf\", gen_pf)\n", + " logger_pf.log_attribute(\"v1\", n1_pf.attr(\"v\"))\n", + " logger_pf.log_attribute(\"v2\", n2_pf.attr(\"v\"))\n", + " logger_pf.log_attribute(\"v_line\", line_pf.attr(\"v_intf\"))\n", + " logger_pf.log_attribute(\"i_line\", line_pf.attr(\"i_intf\"))\n", + " logger_pf.log_attribute(\"v_gen\", gen_pf.attr(\"v_intf\"))\n", + " logger_pf.log_attribute(\"ig\", gen_pf.attr(\"i_intf\"))\n", "\n", " # Simulation\n", " sim_pf = dpsimpy.Simulation(sim_name_pf, dpsimpy.LogLevel.debug)\n", @@ -189,14 +191,14 @@ "\n", " # Logging\n", " logger = dpsimpy.Logger(sim_name)\n", - " logger.log_attribute(\"v1\", \"v\", n1)\n", - " logger.log_attribute(\"v2\", \"v\", n2)\n", - " logger.log_attribute(\"v_line\", \"v_intf\", line)\n", - " logger.log_attribute(\"i_line\", \"i_intf\", line)\n", - " logger.log_attribute(\"v_gen\", \"v_intf\", gen)\n", - " logger.log_attribute(\"i_gen\", \"i_intf\", gen)\n", - " logger.log_attribute(\"wr_gen\", \"w_r\", gen)\n", - " logger.log_attribute(\"delta_r\", \"delta_r\", gen)\n", + " logger.log_attribute(\"v1\", n1.attr(\"v\"))\n", + " logger.log_attribute(\"v2\", n2.attr(\"v\"))\n", + " logger.log_attribute(\"v_line\", line.attr(\"v_intf\"))\n", + " logger.log_attribute(\"i_line\", line.attr(\"i_intf\"))\n", + " logger.log_attribute(\"v_gen\", gen.attr(\"v_intf\"))\n", + " logger.log_attribute(\"i_gen\", gen.attr(\"i_intf\"))\n", + " logger.log_attribute(\"wr_gen\", gen.attr(\"w_r\"))\n", + " logger.log_attribute(\"delta_r\", gen.attr(\"delta_r\"))\n", "\n", " # Events\n", " sw1 = dpsimpy.event.SwitchEvent3Ph(start_time_fault, fault, True)\n", @@ -210,90 +212,90 @@ " sim.add_logger(logger)\n", " sim.add_event(sw1)\n", " sim.run()" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "## Run with first parameter set" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "Simulation(name=\"SMIB_Fault_Params1\", Ld_s=0.2299)" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "## Results with first parameter set" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "work_dir = 'logs/SMIB_Fault_Params1/'\n", "log_name = 'SMIB_Fault_Params1'\n", "print(work_dir + log_name + '.csv')\n", "ts_smib_fault_params1 = rt.read_timeseries_dpsim(work_dir + log_name + '.csv')" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "## Run with second parameter set" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "Simulation(name=\"SMIB_Fault_Params2\", Ld_s=0.1149)" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "## Results with second parameter set" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "work_dir = 'logs/SMIB_Fault_Params2/'\n", "log_name = 'SMIB_Fault_Params2'\n", "print(work_dir + log_name + '.csv')\n", "ts_smib_fault_params2 = rt.read_timeseries_dpsim(work_dir + log_name + '.csv')" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "## Genrerator terminal Current" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "plt.figure(figsize=(12,8))\n", "plt.ylabel('Generator terminal current (V)', fontsize=18)\n", @@ -304,9 +306,7 @@ "\n", "plt.legend()\n", "plt.show()" - ], - "outputs": [], - "metadata": {} + ] } ], "metadata": { diff --git a/examples/Notebooks/Circuits/EMT_SynGenDQ7odTrapez_SMIB_Fault.ipynb b/examples/Notebooks/Circuits/EMT_SynGenDQ7odTrapez_SMIB_Fault.ipynb index b08228f00c..050e6af577 100644 --- a/examples/Notebooks/Circuits/EMT_SynGenDQ7odTrapez_SMIB_Fault.ipynb +++ b/examples/Notebooks/Circuits/EMT_SynGenDQ7odTrapez_SMIB_Fault.ipynb @@ -133,12 +133,12 @@ "\n", "# Logging\n", "logger_pf = dpsimpy.Logger(sim_name_pf)\n", - "logger_pf.log_attribute(\"v1\", \"v\", n1_pf)\n", - "logger_pf.log_attribute(\"v2\", \"v\", n2_pf)\n", - "logger_pf.log_attribute(\"v_line\", \"v_intf\", line_pf)\n", - "logger_pf.log_attribute(\"i_line\", \"i_intf\", line_pf)\n", - "logger_pf.log_attribute(\"v_gen\", \"v_intf\", gen_pf)\n", - "logger_pf.log_attribute(\"ig\", \"i_intf\", gen_pf)\n", + "logger_pf.log_attribute(\"v1\", n1_pf.attr(\"v\"))\n", + "logger_pf.log_attribute(\"v2\", n2_pf.attr(\"v\"))\n", + "logger_pf.log_attribute(\"v_line\", line_pf.attr(\"v_intf\"))\n", + "logger_pf.log_attribute(\"i_line\", line_pf.attr(\"i_intf\"))\n", + "logger_pf.log_attribute(\"v_gen\", gen_pf.attr(\"v_intf\"))\n", + "logger_pf.log_attribute(\"ig\", gen_pf.attr(\"i_intf\"))\n", "\n", "# Simulation\n", "sim_pf = dpsimpy.Simulation(sim_name_pf, dpsimpy.LogLevel.debug)\n", @@ -219,16 +219,16 @@ "\n", "# Logging\n", "logger = dpsimpy.Logger(sim_name)\n", - "logger.log_attribute(\"v1\", \"v\", n1)\n", - "logger.log_attribute(\"v2\", \"v\", n2)\n", - "logger.log_attribute(\"v_line\", \"v_intf\", line)\n", - "logger.log_attribute(\"i_line\", \"i_intf\", line)\n", - "logger.log_attribute(\"v_gen\", \"v_intf\", gen)\n", - "logger.log_attribute(\"i_gen\", \"i_intf\", gen)\n", - "logger.log_attribute(\"wr_gen\", \"w_r\", gen)\n", - "logger.log_attribute(\"delta_r\", \"delta_r\", gen)\n", - "logger.log_attribute(\"T_e\", \"T_e\", gen)\n", - "logger.log_attribute(\"T_m\", \"T_m\", gen)\n", + "logger.log_attribute(\"v1\", n1.attr(\"v\"))\n", + "logger.log_attribute(\"v2\", n2.attr(\"v\"))\n", + "logger.log_attribute(\"v_line\", line.attr(\"v_intf\"))\n", + "logger.log_attribute(\"i_line\", line.attr(\"i_intf\"))\n", + "logger.log_attribute(\"v_gen\", gen.attr(\"v_intf\"))\n", + "logger.log_attribute(\"i_gen\", gen.attr(\"i_intf\"))\n", + "logger.log_attribute(\"wr_gen\", gen.attr(\"w_r\"))\n", + "logger.log_attribute(\"delta_r\", gen.attr(\"delta_r\"))\n", + "logger.log_attribute(\"T_e\", gen.attr(\"T_e\"))\n", + "logger.log_attribute(\"T_m\", gen.attr(\"T_m\"))\n", "\n", "# Events\n", "sw1 = dpsimpy.event.SwitchEvent3Ph(start_time_fault, fault, True)\n", diff --git a/examples/Notebooks/Circuits/SP_Slack_PiLine_VSI_with_PF_Init.ipynb b/examples/Notebooks/Circuits/SP_Slack_PiLine_VSI_with_PF_Init.ipynb index 85c245d0bd..a983662a81 100644 --- a/examples/Notebooks/Circuits/SP_Slack_PiLine_VSI_with_PF_Init.ipynb +++ b/examples/Notebooks/Circuits/SP_Slack_PiLine_VSI_with_PF_Init.ipynb @@ -92,8 +92,8 @@ "\n", "# Logging\n", "logger_pf = dpsimpy.Logger(sim_name_pf)\n", - "logger_pf.log_attribute('v1', 'v', n1_pf)\n", - "logger_pf.log_attribute('v2', 'v', n2_pf)\n", + "logger_pf.log_attribute('v1', n1_pf.attr('v'))\n", + "logger_pf.log_attribute('v2', n2_pf.attr('v'))\n", "\n", "# Simulation\n", "sim_pf = dpsimpy.Simulation(sim_name_pf, dpsimpy.LogLevel.debug)\n", @@ -158,34 +158,34 @@ "\n", "# Logging\n", "logger_sp = dpsimpy.Logger(sim_name_sp)\n", - "logger_sp.log_attribute('v1', 'v', n1_sp)\n", - "logger_sp.log_attribute('v2', 'v', n2_sp)\n", - "logger_sp.log_attribute('i12', 'i_intf', line_sp)\n", + "logger_sp.log_attribute('v1', n1_sp.attr('v'))\n", + "logger_sp.log_attribute('v2', n2_sp.attr('v'))\n", + "logger_sp.log_attribute('i12', line_sp.attr('i_intf'))\n", "\n", "\n", "input_names = [\n", " \"pv_powerctrl_input_pref\", \"pv_powerctrl_input_qref\", \"pv_powerctrl_input_vcd\",\n", " \"pv_powerctrl_input_vcq\", \"pv_powerctrl_input_ircd\", \"pv_powerctrl_input_ircq\"\n", "]\n", - "logger_sp.log_attribute(input_names, 'powerctrl_inputs', pv)\n", + "logger_sp.log_attribute(input_names, pv.attr('powerctrl_inputs'))\n", "\n", "state_names = [\n", " \"pv_powerctrl_state_p\", \"pv_powerctrl_state_q\", \"pv_powerctrl_state_phid\",\n", " \"pv_powerctrl_state_phiq\", \"pv_powerctrl_state_gammad\", \"pv_powerctrl_state_gammaq\"\n", "]\n", - "logger_sp.log_attribute(state_names, 'powerctrl_states', pv)\n", + "logger_sp.log_attribute(state_names, pv.attr('powerctrl_states'))\n", "\n", "output_names = [\n", " \"pv_powerctrl_output_vsd\", \"pv_powerctrl_output_vsq\"\n", "]\n", "\n", - "logger_sp.log_attribute(output_names, 'powerctrl_outputs', pv)\n", + "logger_sp.log_attribute(output_names, pv.attr('powerctrl_outputs'))\n", "\n", - "logger_sp.log_attribute('pv_v_intf', 'v_intf', pv)\n", - "logger_sp.log_attribute('pv_i_intf', 'i_intf', pv)\n", - "logger_sp.log_attribute('pv_pll_output', 'pll_output', pv)\n", - "logger_sp.log_attribute('pv_vsref', 'Vsref', pv)\n", - "logger_sp.log_attribute('pv_vs', 'Vs', pv)\n", + "logger_sp.log_attribute('pv_v_intf', pv.attr('v_intf'))\n", + "logger_sp.log_attribute('pv_i_intf', pv.attr('i_intf'))\n", + "logger_sp.log_attribute('pv_pll_output', pv.attr('pll_output'))\n", + "logger_sp.log_attribute('pv_vsref', pv.attr('Vsref'))\n", + "logger_sp.log_attribute('pv_vs', pv.attr('Vs'))\n", "\n", "# load step sized in absolute terms\n", "load_switch = dpsimpy.sp.ph1.Switch(\"Load_Add_Switch_n2\", dpsimpy.LogLevel.debug)\n", @@ -195,7 +195,7 @@ "load_switch.open()\n", "system_sp.add(load_switch)\n", "system_sp.connect_component(load_switch, [gnd, system_sp.node('n2')])\n", - "logger_sp.log_attribute('switchedload_i', 'i_intf', load_switch)\n", + "logger_sp.log_attribute('switchedload_i', load_switch.attr('i_intf'))\n", "load_step_event = dpsimpy.event.SwitchEvent(np.round(5.0/time_step)*time_step, load_switch, True)\n", "\n", "# Simulation\n", diff --git a/examples/Notebooks/Circuits/SP_Validation_ReducedOrderSG_VBR_SMIB_Fault_withPSAT.ipynb b/examples/Notebooks/Circuits/SP_Validation_ReducedOrderSG_VBR_SMIB_Fault_withPSAT.ipynb index 7da2d81eb8..8ed81cbb26 100644 --- a/examples/Notebooks/Circuits/SP_Validation_ReducedOrderSG_VBR_SMIB_Fault_withPSAT.ipynb +++ b/examples/Notebooks/Circuits/SP_Validation_ReducedOrderSG_VBR_SMIB_Fault_withPSAT.ipynb @@ -440,10 +440,10 @@ "\n", "# Logging\n", "logger_pf = dpsimpy.Logger(sim_name_pf)\n", - "logger_pf.log_attribute('n1.v', 'v', n1_pf)\n", - "logger_pf.log_attribute('n2.v', 'v', n2_pf)\n", - "logger_pf.log_attribute('p_inj', 'p_inj', extnet_pf)\n", - "logger_pf.log_attribute('q_inj', 'q_inj', extnet_pf)\n", + "logger_pf.log_attribute('n1.v', n1_pf.attr('v'))\n", + "logger_pf.log_attribute('n2.v', n2_pf.attr('v'))\n", + "logger_pf.log_attribute('p_inj', extnet_pf.attr('p_inj'))\n", + "logger_pf.log_attribute('q_inj', extnet_pf.attr('q_inj'))\n", "\n", "sim_pf = dpsimpy.Simulation(sim_name_pf, dpsimpy.LogLevel.debug)\n", "sim_pf.set_system(system_pf)\n", @@ -540,19 +540,19 @@ "\n", " ### Logging\n", " logger = dpsimpy.Logger(name)\n", - " logger.log_attribute('n1.v', 'v', n1)\n", - " logger.log_attribute('n2.v', 'v', n2)\n", - " logger.log_attribute('Te', 'Te', gen)\n", - " logger.log_attribute('delta', 'delta', gen)\n", - " logger.log_attribute('w_r', 'w_r', gen)\n", - " logger.log_attribute('Vdq0', 'Vdq0', gen)\n", - " logger.log_attribute('Idq0', 'Idq0', gen)\n", - " logger.log_attribute('i_gen', 'i_intf', gen)\n", + " logger.log_attribute('n1.v', n1.attr('v'))\n", + " logger.log_attribute('n2.v', n2.attr('v'))\n", + " logger.log_attribute('Te', gen.attr('Te'))\n", + " logger.log_attribute('delta', gen.attr('delta'))\n", + " logger.log_attribute('w_r', gen.attr('w_r'))\n", + " logger.log_attribute('Vdq0', gen.attr('Vdq0'))\n", + " logger.log_attribute('Idq0', gen.attr('Idq0'))\n", + " logger.log_attribute('i_gen', gen.attr('i_intf'))\n", " if (gen_model==\"6aOrder\" or gen_model==\"6bOrder\"):\n", - " logger.log_attribute(\"Edq0_s\", \"Edq_s\", gen)\n", - " logger.log_attribute(\"Edq0_t\", \"Edq_t\", gen)\n", + " logger.log_attribute(\"Edq0_s\", gen.attr(\"Edq_s\"))\n", + " logger.log_attribute(\"Edq0_t\", gen.attr(\"Edq_t\"))\n", " else:\n", - " logger.log_attribute(\"Edq0\", \"Edq_t\", gen)\n", + " logger.log_attribute(\"Edq0\", gen.attr(\"Edq_t\"))\n", " \n", " ### Simulation\n", " sim = dpsimpy.Simulation(name, dpsimpy.LogLevel.debug)\n", @@ -1788,7 +1788,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.13" + "version": "3.10.11" }, "vscode": { "interpreter": { diff --git a/examples/Notebooks/Circuits/VS_CS_R4.ipynb b/examples/Notebooks/Circuits/VS_CS_R4.ipynb index a6eaf718bd..9e01e88853 100644 --- a/examples/Notebooks/Circuits/VS_CS_R4.ipynb +++ b/examples/Notebooks/Circuits/VS_CS_R4.ipynb @@ -66,11 +66,11 @@ "system = dpsimpy.SystemTopology(50, [gnd, n1, n2, n3], [vs, r1, r2, r3, r4, cs])\n", "\n", "logger = dpsimpy.Logger(name)\n", - "logger.log_attribute('n1.v', 'v', n1);\n", - "logger.log_attribute('n2.v', 'v', n2);\n", - "logger.log_attribute('n3.v', 'v', n3);\n", - "logger.log_attribute('r1.i_intf', 'i_intf', r1);\n", - "logger.log_attribute('r3.i_intf', 'i_intf', r3);\n", + "logger.log_attribute('n1.v', n1.attr('v'));\n", + "logger.log_attribute('n2.v', n2.attr('v'));\n", + "logger.log_attribute('n3.v', n3.attr('v'));\n", + "logger.log_attribute('r1.i_intf', r1.attr('i_intf'));\n", + "logger.log_attribute('r3.i_intf', r3.attr('i_intf'));\n", "\n", "sim = dpsimpy.Simulation(name)\n", "sim.set_domain(dpsimpy.Domain.EMT)\n", @@ -162,11 +162,11 @@ "system = dpsimpy.SystemTopology(50, [gnd, n1, n2, n3], [vs, r1, r2, r3, r4, cs])\n", "\n", "logger = dpsimpy.Logger(name)\n", - "logger.log_attribute('n1.v', 'v', n1);\n", - "logger.log_attribute('n2.v', 'v', n2);\n", - "logger.log_attribute('n3.v', 'v', n3);\n", - "logger.log_attribute('r1.i_intf', 'i_intf', r1);\n", - "logger.log_attribute('r3.i_intf', 'i_intf', r3);\n", + "logger.log_attribute('n1.v', n1.attr('v'));\n", + "logger.log_attribute('n2.v', n2.attr('v'));\n", + "logger.log_attribute('n3.v', n3.attr('v'));\n", + "logger.log_attribute('r1.i_intf', r1.attr('i_intf'));\n", + "logger.log_attribute('r3.i_intf', r3.attr('i_intf'));\n", "\n", "sim = dpsimpy.Simulation(name)\n", "sim.set_domain(dpsimpy.Domain.DP)\n", diff --git a/examples/Notebooks/Circuits/VS_R2L3.ipynb b/examples/Notebooks/Circuits/VS_R2L3.ipynb index d800cf4546..97bc8b988e 100644 --- a/examples/Notebooks/Circuits/VS_R2L3.ipynb +++ b/examples/Notebooks/Circuits/VS_R2L3.ipynb @@ -70,12 +70,12 @@ "\n", "# Logging\n", "logger = dpsimpy.Logger(name)\n", - "logger.log_attribute('n1.v', 'v', n1)\n", - "logger.log_attribute('n2.v', 'v', n2)\n", - "logger.log_attribute('n3.v', 'v', n3)\n", - "logger.log_attribute('n4.v', 'v', n4)\n", - "logger.log_attribute('r_1.i_intf', 'i_intf', r1)\n", - "logger.log_attribute('l_3.i_intf', 'i_intf', l3)\n", + "logger.log_attribute('n1.v', n1.attr('v'))\n", + "logger.log_attribute('n2.v', n2.attr('v'))\n", + "logger.log_attribute('n3.v', n3.attr('v'))\n", + "logger.log_attribute('n4.v', n4.attr('v'))\n", + "logger.log_attribute('r_1.i_intf', r1.attr('i_intf'))\n", + "logger.log_attribute('l_3.i_intf', l3.attr('i_intf'))\n", "\n", "sim = dpsimpy.Simulation(name)\n", "sim.set_system(system)\n", @@ -180,12 +180,12 @@ "\n", "# Logging\n", "logger = dpsimpy.Logger(name)\n", - "logger.log_attribute('n1.v', 'v', n1)\n", - "logger.log_attribute('n2.v', 'v', n2)\n", - "logger.log_attribute('n3.v', 'v', n3)\n", - "logger.log_attribute('n4.v', 'v', n4)\n", - "logger.log_attribute('r_1.i_intf', 'i_intf', r1)\n", - "logger.log_attribute('l_3.i_intf', 'i_intf', l3)\n", + "logger.log_attribute('n1.v', n1.attr('v'))\n", + "logger.log_attribute('n2.v', n2.attr('v'))\n", + "logger.log_attribute('n3.v', n3.attr('v'))\n", + "logger.log_attribute('n4.v', n4.attr('v'))\n", + "logger.log_attribute('r_1.i_intf', r1.attr('i_intf'))\n", + "logger.log_attribute('l_3.i_intf', l3.attr('i_intf'))\n", "\n", "sim = dpsimpy.Simulation(name)\n", "sim.set_domain(dpsimpy.Domain.DP)\n", diff --git a/examples/Notebooks/Circuits/VS_RC1.ipynb b/examples/Notebooks/Circuits/VS_RC1.ipynb index 4475942c2d..167e4aae1e 100644 --- a/examples/Notebooks/Circuits/VS_RC1.ipynb +++ b/examples/Notebooks/Circuits/VS_RC1.ipynb @@ -59,9 +59,9 @@ "\n", "# Logging\n", "logger = dpsimpy.Logger(name)\n", - "logger.log_attribute('n1.v', 'v', n1)\n", - "logger.log_attribute('n2.v', 'v', n2)\n", - "logger.log_attribute('r_1.i_intf', 'i_intf', r1)\n", + "logger.log_attribute('n1.v', n1.attr('v'))\n", + "logger.log_attribute('n2.v', n2.attr('v'))\n", + "logger.log_attribute('r_1.i_intf', r1.attr('i_intf'))\n", "\n", "sim = dpsimpy.Simulation(name)\n", "sim.set_system(system)\n", @@ -142,9 +142,9 @@ "\n", "# Logging\n", "logger = dpsimpy.Logger(name)\n", - "logger.log_attribute('n1.v', 'v', n1)\n", - "logger.log_attribute('n2.v', 'v', n2)\n", - "logger.log_attribute('r_1.i_intf', 'i_intf', r1)\n", + "logger.log_attribute('n1.v', n1.attr('v'))\n", + "logger.log_attribute('n2.v', n2.attr('v'))\n", + "logger.log_attribute('r_1.i_intf', r1.attr('i_intf'))\n", "\n", "sim = dpsimpy.Simulation(name)\n", "sim.set_system(system)\n", diff --git a/examples/Notebooks/Circuits/VS_RL1.ipynb b/examples/Notebooks/Circuits/VS_RL1.ipynb index d41f6a1114..c6c79c6d6d 100644 --- a/examples/Notebooks/Circuits/VS_RL1.ipynb +++ b/examples/Notebooks/Circuits/VS_RL1.ipynb @@ -58,8 +58,8 @@ "\n", "# Logging\n", "logger_pf = dpsimpy.Logger(sim_name_pf)\n", - "logger_pf.log_attribute('n1.v', 'v', n1_pf)\n", - "logger_pf.log_attribute('n2.v', 'v', n2_pf)\n", + "logger_pf.log_attribute('n1.v', n1_pf.attr('v'))\n", + "logger_pf.log_attribute('n2.v', n2_pf.attr('v'))\n", "\n", "sim_pf = dpsimpy.Simulation(sim_name_pf, dpsimpy.LogLevel.debug)\n", "sim_pf.set_system(system_pf)\n", @@ -108,12 +108,12 @@ "system = dpsimpy.SystemTopology(50, [gnd, n1, n2], [vs, l1, r1])\n", "\n", "logger = dpsimpy.Logger(name)\n", - "logger.log_attribute('n1.v', 'v', n1)\n", - "logger.log_attribute('n2.v', 'v', n2)\n", - "logger.log_attribute('r1.v_intf', 'v_intf', r1)\n", - "logger.log_attribute('r1.i_intf', 'i_intf', r1)\n", - "logger.log_attribute('l1.v_intf', 'v_intf', l1)\n", - "logger.log_attribute('l1.i_intf', 'i_intf', l1)\n", + "logger.log_attribute('n1.v', n1.attr('v'))\n", + "logger.log_attribute('n2.v', n2.attr('v'))\n", + "logger.log_attribute('r1.v_intf', r1.attr('v_intf'))\n", + "logger.log_attribute('r1.i_intf', r1.attr('i_intf'))\n", + "logger.log_attribute('l1.v_intf', l1.attr('v_intf'))\n", + "logger.log_attribute('l1.i_intf', l1.attr('i_intf'))\n", "\n", "sim = dpsimpy.Simulation(name)\n", "sim.add_logger(logger)\n", @@ -196,9 +196,9 @@ "system = dpsimpy.SystemTopology(50, [gnd, n1, n2], [vs, l1, r1])\n", "\n", "logger = dpsimpy.Logger(name)\n", - "logger.log_attribute('n1.v', 'v', n1);\n", - "logger.log_attribute('n2.v', 'v', n2);\n", - "logger.log_attribute('r1.i_intf', 'i_intf', r1);\n", + "logger.log_attribute('n1.v', n1.attr('v'));\n", + "logger.log_attribute('n2.v', n2.attr('v'));\n", + "logger.log_attribute('r1.i_intf', r1.attr('i_intf'));\n", "\n", "sim = dpsimpy.Simulation(name)\n", "sim.add_logger(logger)\n", diff --git a/examples/Notebooks/Components/Diakoptics.ipynb b/examples/Notebooks/Components/Diakoptics.ipynb index a529581dfd..e0231e09f6 100644 --- a/examples/Notebooks/Components/Diakoptics.ipynb +++ b/examples/Notebooks/Components/Diakoptics.ipynb @@ -71,11 +71,11 @@ "sys = dpsimpy.SystemTopology(50, [n1, n2, n3], [vs, r1, r2, r3, r4, cs])\n", "\n", "logger = dpsimpy.Logger(sim_name)\n", - "logger.log_attribute('v1', 'v', n1)\n", - "logger.log_attribute('v2', 'v', n2)\n", - "logger.log_attribute('v3', 'v', n3)\n", - "logger.log_attribute('i12', 'i_intf', r1)\n", - "logger.log_attribute('i23', 'i_intf', r3)\n", + "logger.log_attribute('v1', n1.attr('v'))\n", + "logger.log_attribute('v2', n2.attr('v'))\n", + "logger.log_attribute('v3', n3.attr('v'))\n", + "logger.log_attribute('i12', r1.attr('i_intf'))\n", + "logger.log_attribute('i23', r3.attr('i_intf'))\n", "\n", "sim = dpsimpy.Simulation(sim_name)\n", "sim.set_system(sys)\n", @@ -132,11 +132,11 @@ "sys.add_tear_component(r3)\n", "\n", "logger = dpsimpy.Logger(sim_name)\n", - "logger.log_attribute('v1', 'v', n1)\n", - "logger.log_attribute('v2', 'v', n2)\n", - "logger.log_attribute('v3', 'v', n3)\n", - "logger.log_attribute('i12', 'i_intf', r1)\n", - "logger.log_attribute('i23', 'i_intf', r3)\n", + "logger.log_attribute('v1', n1.attr('v'))\n", + "logger.log_attribute('v2', n2.attr('v'))\n", + "logger.log_attribute('v3', n3.attr('v'))\n", + "logger.log_attribute('i12', r1.attr('i_intf'))\n", + "logger.log_attribute('i23', r3.attr('i_intf'))\n", "\n", "sim = dpsimpy.Simulation(sim_name)\n", "sim.set_system(sys)\n", @@ -244,12 +244,12 @@ "sys = dpsimpy.SystemTopology(50, [n1, n2, n3, n4], [vs, r1, l1, l2, l3, r2])\n", "\n", "logger = dpsimpy.Logger(sim_name)\n", - "logger.log_attribute('v1', 'v', n1)\n", - "logger.log_attribute('v2', 'v', n2)\n", - "logger.log_attribute('v3', 'v', n3)\n", - "logger.log_attribute('v4', 'v', n4)\n", - "logger.log_attribute('i12', 'i_intf', r1)\n", - "logger.log_attribute('i34', 'i_intf', l3)\n", + "logger.log_attribute('v1', n1.attr('v'))\n", + "logger.log_attribute('v2', n2.attr('v'))\n", + "logger.log_attribute('v3', n3.attr('v'))\n", + "logger.log_attribute('v4', n4.attr('v'))\n", + "logger.log_attribute('i12', r1.attr('i_intf'))\n", + "logger.log_attribute('i34', l3.attr('i_intf'))\n", "\n", "sim = dpsimpy.Simulation(sim_name)\n", "sim.set_system(sys)\n", @@ -307,12 +307,12 @@ "sys.add_tear_component(l1)\n", "\n", "logger = dpsimpy.Logger(sim_name)\n", - "logger.log_attribute('v1', 'v', n1)\n", - "logger.log_attribute('v2', 'v', n2)\n", - "logger.log_attribute('v3', 'v', n3)\n", - "logger.log_attribute('v4', 'v', n4)\n", - "logger.log_attribute('i12', 'i_intf', r1)\n", - "logger.log_attribute('i34', 'i_intf', l3)\n", + "logger.log_attribute('v1', n1.attr('v'))\n", + "logger.log_attribute('v2', n2.attr('v'))\n", + "logger.log_attribute('v3', n3.attr('v'))\n", + "logger.log_attribute('v4', n4.attr('v'))\n", + "logger.log_attribute('i12', r1.attr('i_intf'))\n", + "logger.log_attribute('i34', l3.attr('i_intf'))\n", "\n", "sim = dpsimpy.Simulation(sim_name)\n", "sim.set_system(sys)\n", diff --git a/examples/Notebooks/Components/Inverter_Grid_Test.ipynb b/examples/Notebooks/Components/Inverter_Grid_Test.ipynb index 2f448862b6..2e63ca16ac 100644 --- a/examples/Notebooks/Components/Inverter_Grid_Test.ipynb +++ b/examples/Notebooks/Components/Inverter_Grid_Test.ipynb @@ -73,13 +73,13 @@ " [inv, r1, l1, r2, l2, c1, rc, grid])\n", "\n", "logger = dpsimpy.Logger(sim_name)\n", - "logger.log_attribute('v1', 'v', n1, 1, 9)\n", - "logger.log_attribute('v2', 'v', n2, 1, 1)\n", - "logger.log_attribute('v3', 'v', n3, 1, 9)\n", - "logger.log_attribute('v4', 'v', n4, 1, 1)\n", - "logger.log_attribute('v5', 'v', n5, 1, 1)\n", - "logger.log_attribute('i12', 'i_intf', r1, 1, 1)\n", - "logger.log_attribute('i34', 'i_intf', r2, 1, 1)\n", + "logger.log_attribute('v1', n1.attr('v'), 1, 9)\n", + "logger.log_attribute('v2', n2.attr('v'), 1, 1)\n", + "logger.log_attribute('v3', n3.attr('v'), 1, 9)\n", + "logger.log_attribute('v4', n4.attr('v'), 1, 1)\n", + "logger.log_attribute('v5', n5.attr('v'), 1, 1)\n", + "logger.log_attribute('i12', r1.attr('i_intf'), 1, 1)\n", + "logger.log_attribute('i34', r2.attr('i_intf'), 1, 1)\n", "\n", "sim = dpsimpy.Simulation(sim_name, log_level)\n", "sim.set_system(sys)\n", @@ -334,7 +334,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.10" + "version": "3.10.11" }, "orig_nbformat": 3 }, diff --git a/examples/Notebooks/Components/Line.ipynb b/examples/Notebooks/Components/Line.ipynb index 1c6a275061..97bea1b458 100644 --- a/examples/Notebooks/Components/Line.ipynb +++ b/examples/Notebooks/Components/Line.ipynb @@ -82,10 +82,10 @@ "sys = dpsimpy.SystemTopology(50, [n1, n2, vn1], [vs, res, ind, cap1, cap2, con1, con2, load])\n", "\n", "logger = dpsimpy.Logger(sim_name)\n", - "logger.log_attribute('v1', 'v', n1)\n", - "logger.log_attribute('v2', 'v', n2)\n", - "logger.log_attribute('iline', 'i_intf', ind)\n", - "logger.log_attribute('iload', 'i_intf', load)\n", + "logger.log_attribute('v1', n1.attr('v'))\n", + "logger.log_attribute('v2', n2.attr('v'))\n", + "logger.log_attribute('iline', ind.attr('i_intf'))\n", + "logger.log_attribute('iload', load.attr('i_intf'))\n", "\n", "sim = dpsimpy.Simulation(sim_name)\n", "sim.set_system(sys)\n", @@ -133,10 +133,10 @@ "sys = dpsimpy.SystemTopology(50, [n1, n2], [vs, line, load])\n", "\n", "logger = dpsimpy.Logger(sim_name)\n", - "logger.log_attribute('v1', 'v', n1)\n", - "logger.log_attribute('v2', 'v', n2)\n", - "logger.log_attribute('iline', 'i_intf', line)\n", - "logger.log_attribute('iload', 'i_intf', load)\n", + "logger.log_attribute('v1', n1.attr('v'))\n", + "logger.log_attribute('v2', n2.attr('v'))\n", + "logger.log_attribute('iline', line.attr('i_intf'))\n", + "logger.log_attribute('iload', load.attr('i_intf'))\n", "\n", "sim = dpsimpy.Simulation(sim_name)\n", "sim.set_system(sys)\n", @@ -329,10 +329,10 @@ "sys = dpsimpy.SystemTopology(50, [n1, n2, vn1], [vs, res, ind, cap1, cap2, con1, con2, load])\n", "\n", "logger = dpsimpy.Logger(sim_name)\n", - "logger.log_attribute('v1', 'v', n1)\n", - "logger.log_attribute('v2', 'v', n2)\n", - "logger.log_attribute('iline', 'i_intf', ind)\n", - "logger.log_attribute('iload', 'i_intf', load)\n", + "logger.log_attribute('v1', n1.attr('v'))\n", + "logger.log_attribute('v2', n2.attr('v'))\n", + "logger.log_attribute('iline', ind.attr('i_intf'))\n", + "logger.log_attribute('iload', load.attr('i_intf'))\n", "\n", "sim = dpsimpy.Simulation(sim_name)\n", "sim.set_system(sys)\n", @@ -380,10 +380,10 @@ "sys = dpsimpy.SystemTopology(50, [n1, n2], [vs, line, load])\n", "\n", "logger = dpsimpy.Logger(sim_name)\n", - "logger.log_attribute('v1', 'v', n1)\n", - "logger.log_attribute('v2', 'v', n2)\n", - "logger.log_attribute('iline', 'i_intf', line)\n", - "logger.log_attribute('iload', 'i_intf', load)\n", + "logger.log_attribute('v1', n1.attr('v'))\n", + "logger.log_attribute('v2', n2.attr('v'))\n", + "logger.log_attribute('iline', line.attr('i_intf'))\n", + "logger.log_attribute('iload', load.attr('i_intf'))\n", "\n", "sim = dpsimpy.Simulation(sim_name)\n", "sim.set_system(sys)\n", @@ -427,8 +427,8 @@ "sys.add_tear_component(line)\n", "\n", "logger = dpsimpy.Logger(sim_name)\n", - "logger.log_attribute('v1', 'v', n1)\n", - "logger.log_attribute('v2', 'v', n2)\n", + "logger.log_attribute('v1', n1.attr('v'))\n", + "logger.log_attribute('v2', n2.attr('v'))\n", "\n", "sim = dpsimpy.Simulation(sim_name)\n", "sim.set_system(sys)\n", @@ -622,9 +622,9 @@ "sys = dpsimpy.SystemTopology(50, [n1, n2, vn1], [vs, res, ind, cap1, cap2, con1, con2, load])\n", "\n", "logger = dpsimpy.Logger(sim_name)\n", - "logger.log_attribute('v1', 'v', n1)\n", - "logger.log_attribute('v2', 'v', n2)\n", - "logger.log_attribute('iline', 'i_intf', ind)\n", + "logger.log_attribute('v1', n1.attr('v'))\n", + "logger.log_attribute('v2', n2.attr('v'))\n", + "logger.log_attribute('iline', ind.attr('i_intf'))\n", "\n", "sim = dpsimpy.Simulation(sim_name, dpsimpy.LogLevel.debug)\n", "sim.set_system(sys)\n", @@ -675,10 +675,10 @@ "sys = dpsimpy.SystemTopology(50, [n1, n2], [vs, line, load])\n", "\n", "logger = dpsimpy.Logger(sim_name)\n", - "logger.log_attribute('v1', 'v', n1)\n", - "logger.log_attribute('v2', 'v', n2)\n", - "logger.log_attribute('iline', 'i_intf', line)\n", - "logger.log_attribute('iload', 'i_intf', load)\n", + "logger.log_attribute('v1', n1.attr('v'))\n", + "logger.log_attribute('v2', n2.attr('v'))\n", + "logger.log_attribute('iline', line.attr('i_intf'))\n", + "logger.log_attribute('iload', load.attr('i_intf'))\n", "\n", "sim = dpsimpy.Simulation(sim_name)\n", "sim.set_system(sys)\n", @@ -951,8 +951,8 @@ "sys = dpsimpy.SystemTopology(50, [n1, n2, vn1], [vs, res, ind, cap1, cap2, load])\n", "\n", "logger = dpsimpy.Logger(sim_name)\n", - "logger.log_attribute('v1', 'v', n1)\n", - "logger.log_attribute('v2', 'v', n2)\n", + "logger.log_attribute('v1', n1.attr('v'))\n", + "logger.log_attribute('v2', n2.attr('v'))\n", "\n", "sim = dpsimpy.Simulation(sim_name)\n", "sim.set_system(sys)\n", @@ -999,12 +999,12 @@ "sys.add(dline.get_line_components())\n", "\n", "logger = dpsimpy.Logger(sim_name)\n", - "logger.log_attribute('v1', 'v', n1)\n", - "logger.log_attribute('v2', 'v', n2)\n", - "logger.log_attribute('i1', 'i_intf', vs)\n", - "logger.log_attribute('i2', 'i_intf', load)\n", - "logger.log_attribute('i_src1', 'i_src1', dline)\n", - "logger.log_attribute('i_src2', 'i_src2', dline)\n", + "logger.log_attribute('v1', n1.attr('v'))\n", + "logger.log_attribute('v2', n2.attr('v'))\n", + "logger.log_attribute('i1', vs.attr('i_intf'))\n", + "logger.log_attribute('i2', load.attr('i_intf'))\n", + "logger.log_attribute('i_src1', dline.attr('i_src1'))\n", + "logger.log_attribute('i_src2', dline.attr('i_src2'))\n", "\n", "sim = dpsimpy.Simulation(sim_name)\n", "sim.set_system(sys)\n", @@ -1050,12 +1050,12 @@ "sys.add(dline.get_line_components())\n", "\n", "logger = dpsimpy.Logger(sim_name)\n", - "logger.log_attribute('v1', 'v', n1)\n", - "logger.log_attribute('v2', 'v', n2)\n", - "logger.log_attribute('i1', 'i_intf', vs)\n", - "logger.log_attribute('i2', 'i_intf', load)\n", - "logger.log_attribute('i_src1', 'i_src1', dline)\n", - "logger.log_attribute('i_src2', 'i_src2', dline)\n", + "logger.log_attribute('v1', n1.attr('v'))\n", + "logger.log_attribute('v2', n2.attr('v'))\n", + "logger.log_attribute('i1', vs.attr('i_intf'))\n", + "logger.log_attribute('i2', load.attr('i_intf'))\n", + "logger.log_attribute('i_src1', dline.attr('i_src1'))\n", + "logger.log_attribute('i_src2', dline.attr('i_src2'))\n", "\n", "sim = dpsimpy.Simulation(sim_name)\n", "sim.set_system(sys)\n", diff --git a/examples/Notebooks/Components/Slack.ipynb b/examples/Notebooks/Components/Slack.ipynb index e45e35c5f7..6ecb5ab49b 100644 --- a/examples/Notebooks/Components/Slack.ipynb +++ b/examples/Notebooks/Components/Slack.ipynb @@ -57,8 +57,8 @@ "sys = dpsimpy.SystemTopology(50, [n1], [vs, load])\n", "\n", "logger = dpsimpy.Logger(sim_name)\n", - "logger.log_attribute('v1', 'v', n1)\n", - "logger.log_attribute('i1', 'i_intf', vs)\n", + "logger.log_attribute('v1', n1.attr('v'))\n", + "logger.log_attribute('i1', vs.attr('i_intf'))\n", "\n", "sim = dpsimpy.Simulation(sim_name)\n", "sim.set_system(sys)\n", @@ -95,8 +95,8 @@ "sys = dpsimpy.SystemTopology(50, [n1], [sl, load])\n", "\n", "logger = dpsimpy.Logger(sim_name)\n", - "logger.log_attribute('v1', 'v', n1)\n", - "logger.log_attribute('i1', 'i_intf', sl)\n", + "logger.log_attribute('v1', n1.attr('v'))\n", + "logger.log_attribute('i1', sl.attr('i_intf'))\n", "\n", "sim = dpsimpy.Simulation(sim_name)\n", "sim.set_system(sys)\n", @@ -133,8 +133,8 @@ "sys = dpsimpy.SystemTopology(50, [n1], [vs, load])\n", "\n", "logger = dpsimpy.Logger(sim_name)\n", - "logger.log_attribute('v1', 'v', n1)\n", - "logger.log_attribute('i1', 'i_intf', vs)\n", + "logger.log_attribute('v1', n1.attr('v'))\n", + "logger.log_attribute('i1', vs.attr('i_intf'))\n", "\n", "sim = dpsimpy.Simulation(sim_name)\n", "sim.set_system(sys)\n", @@ -171,8 +171,8 @@ "sys = dpsimpy.SystemTopology(50, [n1], [sl, load])\n", "\n", "logger = dpsimpy.Logger(sim_name)\n", - "logger.log_attribute('v1', 'v', n1)\n", - "logger.log_attribute('i1', 'i_intf', sl)\n", + "logger.log_attribute('v1', n1.attr('v'))\n", + "logger.log_attribute('i1', sl.attr('i_intf'))\n", "\n", "sim = dpsimpy.Simulation(sim_name)\n", "sim.set_system(sys)\n", @@ -209,8 +209,8 @@ "sys = dpsimpy.SystemTopology(50, [n1], [vs, load])\n", "\n", "logger = dpsimpy.Logger(sim_name)\n", - "logger.log_attribute('v1', 'v', n1)\n", - "logger.log_attribute('i1', 'i_intf', vs)\n", + "logger.log_attribute('v1', n1.attr('v'))\n", + "logger.log_attribute('i1', vs.attr('i_intf'))\n", "\n", "sim = dpsimpy.Simulation(sim_name)\n", "sim.set_system(sys)\n", @@ -248,8 +248,8 @@ "sys = dpsimpy.SystemTopology(50, [n1], [sl, load])\n", "\n", "logger = dpsimpy.Logger(sim_name)\n", - "logger.log_attribute('v1', 'v', n1)\n", - "logger.log_attribute('i1', 'i_intf', sl)\n", + "logger.log_attribute('v1', n1.attr('v'))\n", + "logger.log_attribute('i1', sl.attr('i_intf'))\n", "\n", "sim = dpsimpy.Simulation(sim_name)\n", "sim.set_system(sys)\n", diff --git a/examples/Notebooks/Components/SynGenDq7od.ipynb b/examples/Notebooks/Components/SynGenDq7od.ipynb index 76fb4ca3a4..c707c44223 100644 --- a/examples/Notebooks/Components/SynGenDq7od.ipynb +++ b/examples/Notebooks/Components/SynGenDq7od.ipynb @@ -94,8 +94,8 @@ "\n", "# Logging\n", "logger = dpsimpy.Logger(sim_name)\n", - "logger.log_attribute('v1', 'v', n1)\n", - "logger.log_attribute('i_load', 'i_intf', res)\n", + "logger.log_attribute('v1', n1.attr('v'))\n", + "logger.log_attribute('i_load', res.attr('i_intf'))\n", "\n", "# Simulation\n", "sim = dpsimpy.Simulation(sim_name, dpsimpy.LogLevel.info)\n", @@ -351,10 +351,10 @@ "\n", "# Logging\n", "logger = dpsimpy.Logger(sim_name)\n", - "logger.log_attribute('v1', 'v', n1)\n", - "logger.log_attribute('i_load', 'i_intf', res)\n", - "logger.log_attribute('i_gen', 'i_intf', gen)\n", - "logger.log_attribute('wr_gen', 'w_r', gen)\n", + "logger.log_attribute('v1', n1.attr('v'))\n", + "logger.log_attribute('i_load', res.attr('i_intf'))\n", + "logger.log_attribute('i_gen', gen.attr('i_intf'))\n", + "logger.log_attribute('wr_gen', gen.attr('w_r'))\n", "\n", "# System\n", "sys = dpsimpy.SystemTopology(60, [n1], [gen, res, fault])\n", @@ -573,8 +573,8 @@ "\n", "# Logging\n", "logger = dpsimpy.Logger(sim_name)\n", - "logger.log_attribute('v1', 'v', n1)\n", - "logger.log_attribute('i_gen', 'i_intf', gen)\n", + "logger.log_attribute('v1', n1.attr('v'))\n", + "logger.log_attribute('i_gen', gen.attr('i_intf'))\n", "\n", "# System\n", "sys = dpsimpy.SystemTopology(60, [n1], [gen, res, fault])\n", diff --git a/examples/Notebooks/Components/SynGenDq7od_ParameterStudy.ipynb b/examples/Notebooks/Components/SynGenDq7od_ParameterStudy.ipynb index 5253b860cd..6e430adfb4 100644 --- a/examples/Notebooks/Components/SynGenDq7od_ParameterStudy.ipynb +++ b/examples/Notebooks/Components/SynGenDq7od_ParameterStudy.ipynb @@ -104,10 +104,10 @@ "\n", "# Logging\n", "logger = dpsimpy.Logger(sim_name)\n", - "logger.log_attribute('v1', 'v', n1)\n", - "logger.log_attribute('i_load', 'i_intf', res)\n", - "logger.log_attribute('i_gen', 'i_intf', gen)\n", - "logger.log_attribute('wr_gen', 'w_r', gen)\n", + "logger.log_attribute('v1', n1.attr('v'))\n", + "logger.log_attribute('i_load', res.attr('i_intf'))\n", + "logger.log_attribute('i_gen', gen.attr('i_intf'))\n", + "logger.log_attribute('wr_gen', gen.attr('w_r'))\n", "\n", "# System\n", "sys = dpsimpy.SystemTopology(60, [n1], [gen, res, fault])\n", @@ -208,10 +208,10 @@ "\n", "# Logging\n", "logger = dpsimpy.Logger(sim_name)\n", - "logger.log_attribute('v1', 'v', n1)\n", - "logger.log_attribute('i_load', 'i_intf', res)\n", - "logger.log_attribute('i_gen', 'i_intf', gen)\n", - "logger.log_attribute('wr_gen', 'w_r', gen)\n", + "logger.log_attribute('v1', n1.attr('v'))\n", + "logger.log_attribute('i_load', res.attr('i_intf'))\n", + "logger.log_attribute('i_gen', gen.attr('i_intf'))\n", + "logger.log_attribute('wr_gen', gen.attr('w_r'))\n", "\n", "# System\n", "sys = dpsimpy.SystemTopology(60, [n1], [gen, res, fault])\n", @@ -311,8 +311,8 @@ "\n", "# Logging\n", "logger = dpsimpy.Logger(sim_name)\n", - "logger.log_attribute('v1', 'v', n1)\n", - "logger.log_attribute('i_gen', 'i_intf', gen)\n", + "logger.log_attribute('v1', n1.attr('v'))\n", + "logger.log_attribute('i_gen', gen.attr('i_intf'))\n", "\n", "# System\n", "sys = dpsimpy.SystemTopology(60, [n1], [gen, res, fault])\n", @@ -413,10 +413,10 @@ "\n", "# Logging\n", "logger = dpsimpy.Logger(sim_name)\n", - "logger.log_attribute('v1', 'v', n1)\n", - "logger.log_attribute('i_load', 'i_intf', res)\n", - "logger.log_attribute('i_gen', 'i_intf', gen)\n", - "logger.log_attribute('wr_gen', 'w_r', gen)\n", + "logger.log_attribute('v1', n1.attr('v'))\n", + "logger.log_attribute('i_load', res.attr('i_intf'))\n", + "logger.log_attribute('i_gen', gen.attr('i_intf'))\n", + "logger.log_attribute('wr_gen', gen.attr('w_r'))\n", "\n", "# System\n", "sys = dpsimpy.SystemTopology(60, [n1], [gen, res, fault])\n", @@ -904,4 +904,4 @@ }, "nbformat": 4, "nbformat_minor": 4 -} \ No newline at end of file +} diff --git a/examples/Notebooks/Components/SynGenDq7od_SteadyState_DP_EMT.ipynb b/examples/Notebooks/Components/SynGenDq7od_SteadyState_DP_EMT.ipynb index d100b71b0d..a69a86cc24 100644 --- a/examples/Notebooks/Components/SynGenDq7od_SteadyState_DP_EMT.ipynb +++ b/examples/Notebooks/Components/SynGenDq7od_SteadyState_DP_EMT.ipynb @@ -104,10 +104,10 @@ "\n", "# Logging\n", "logger = dpsimpy.Logger(sim_name)\n", - "logger.log_attribute('v1', 'v', n1)\n", - "logger.log_attribute('i_load', 'i_intf', res)\n", - "logger.log_attribute('i_gen', 'i_intf', gen)\n", - "logger.log_attribute('wr_gen', 'w_r', gen)\n", + "logger.log_attribute('v1', n1.attr('v'))\n", + "logger.log_attribute('i_load', res.attr('i_intf'))\n", + "logger.log_attribute('i_gen', gen.attr('i_intf'))\n", + "logger.log_attribute('wr_gen', gen.attr('w_r'))\n", "\n", "# System\n", "sys = dpsimpy.SystemTopology(60, [n1], [gen, res, fault])\n", @@ -201,10 +201,10 @@ "\n", "# Logging\n", "logger = dpsimpy.Logger(sim_name)\n", - "logger.log_attribute('v1', 'v', n1)\n", - "logger.log_attribute('i_load', 'i_intf', res)\n", - "logger.log_attribute('i_gen', 'i_intf', gen)\n", - "logger.log_attribute('wr_gen', 'w_r', gen)\n", + "logger.log_attribute('v1', n1.attr('v'))\n", + "logger.log_attribute('i_load', res.attr('i_intf'))\n", + "logger.log_attribute('i_gen', gen.attr('i_intf'))\n", + "logger.log_attribute('wr_gen', gen.attr('w_r'))\n", "\n", "# System\n", "sys = dpsimpy.SystemTopology(60, [n1], [gen, res, fault])\n", @@ -298,8 +298,8 @@ "\n", "# Logging\n", "logger = dpsimpy.Logger(sim_name)\n", - "logger.log_attribute('v1', 'v', n1)\n", - "logger.log_attribute('i_gen', 'i_intf', gen)\n", + "logger.log_attribute('v1', n1.attr('v'))\n", + "logger.log_attribute('i_gen', gen.attr('i_intf'))\n", "\n", "# System\n", "sys = dpsimpy.SystemTopology(60, [n1], [gen, res, fault])\n", @@ -393,10 +393,10 @@ "\n", "# Logging\n", "logger = dpsimpy.Logger(sim_name)\n", - "logger.log_attribute('v1', 'v', n1)\n", - "logger.log_attribute('i_load', 'i_intf', res)\n", - "logger.log_attribute('i_gen', 'i_intf', gen)\n", - "logger.log_attribute('wr_gen', 'w_r', gen)\n", + "logger.log_attribute('v1', n1.attr('v'))\n", + "logger.log_attribute('i_load', res.attr('i_intf'))\n", + "logger.log_attribute('i_gen', gen.attr('i_intf'))\n", + "logger.log_attribute('wr_gen', gen.attr('w_r'))\n", "\n", "# System\n", "sys = dpsimpy.SystemTopology(60, [n1], [gen, res, fault])\n", diff --git a/examples/Notebooks/Components/SynGenDq7od_ThreePhFault_DP_EMT.ipynb b/examples/Notebooks/Components/SynGenDq7od_ThreePhFault_DP_EMT.ipynb index b435dc8e71..9c3d70a61b 100644 --- a/examples/Notebooks/Components/SynGenDq7od_ThreePhFault_DP_EMT.ipynb +++ b/examples/Notebooks/Components/SynGenDq7od_ThreePhFault_DP_EMT.ipynb @@ -104,10 +104,10 @@ "\n", "# Logging\n", "logger = dpsimpy.Logger(sim_name)\n", - "logger.log_attribute('v1', 'v', n1)\n", - "logger.log_attribute('i_load', 'i_intf', res)\n", - "logger.log_attribute('i_gen', 'i_intf', gen)\n", - "logger.log_attribute('wr_gen', 'w_r', gen)\n", + "logger.log_attribute('v1', n1.attr('v'))\n", + "logger.log_attribute('i_load', res.attr('i_intf'))\n", + "logger.log_attribute('i_gen', gen.attr('i_intf'))\n", + "logger.log_attribute('wr_gen', gen.attr('w_r'))\n", "\n", "# System\n", "sys = dpsimpy.SystemTopology(60, [n1], [gen, res, fault])\n", @@ -207,10 +207,10 @@ "\n", "# Logging\n", "logger = dpsimpy.Logger(sim_name)\n", - "logger.log_attribute('v1', 'v', n1)\n", - "logger.log_attribute('i_load', 'i_intf', res)\n", - "logger.log_attribute('i_gen', 'i_intf', gen)\n", - "logger.log_attribute('wr_gen', 'w_r', gen)\n", + "logger.log_attribute('v1', n1.attr('v'))\n", + "logger.log_attribute('i_load', res.attr('i_intf'))\n", + "logger.log_attribute('i_gen', gen.attr('i_intf'))\n", + "logger.log_attribute('wr_gen', gen.attr('w_r'))\n", "\n", "# System\n", "sys = dpsimpy.SystemTopology(60, [n1], [gen, res, fault])\n", @@ -310,8 +310,8 @@ "\n", "# Logging\n", "logger = dpsimpy.Logger(sim_name)\n", - "logger.log_attribute('v1', 'v', n1)\n", - "logger.log_attribute('i_gen', 'i_intf', gen)\n", + "logger.log_attribute('v1', n1.attr('v'))\n", + "logger.log_attribute('i_gen', gen.attr('i_intf'))\n", "\n", "# System\n", "sys = dpsimpy.SystemTopology(60, [n1], [gen, res, fault])\n", @@ -411,10 +411,10 @@ "\n", "# Logging\n", "logger = dpsimpy.Logger(sim_name)\n", - "logger.log_attribute('v1', 'v', n1)\n", - "logger.log_attribute('i_load', 'i_intf', res)\n", - "logger.log_attribute('i_gen', 'i_intf', gen)\n", - "logger.log_attribute('wr_gen', 'w_r', gen)\n", + "logger.log_attribute('v1', n1.attr('v'))\n", + "logger.log_attribute('i_load', res.attr('i_intf'))\n", + "logger.log_attribute('i_gen', gen.attr('i_intf'))\n", + "logger.log_attribute('wr_gen', gen.attr('w_r'))\n", "\n", "# System\n", "sys = dpsimpy.SystemTopology(60, [n1], [gen, res, fault])\n", diff --git a/examples/Notebooks/Components/SynGen_trStab.ipynb b/examples/Notebooks/Components/SynGen_trStab.ipynb index 4ec8b63b7e..3cf070ff9e 100644 --- a/examples/Notebooks/Components/SynGen_trStab.ipynb +++ b/examples/Notebooks/Components/SynGen_trStab.ipynb @@ -79,10 +79,10 @@ "\n", " # Logging\n", " logger = dpsimpy.Logger(sim_name)\n", - " logger.log_attribute('v1', 'v', n1)\n", - " logger.log_attribute('i_gen', 'i_intf', gen)\n", - " logger.log_attribute('i_load', 'i_intf', res)\n", - " logger.log_attribute('wr_gen', 'w_r', gen)\n", + " logger.log_attribute('v1', n1.attr('v'))\n", + " logger.log_attribute('i_gen', gen.attr('i_intf'))\n", + " logger.log_attribute('i_load', res.attr('i_intf'))\n", + " logger.log_attribute('wr_gen', gen.attr('w_r'))\n", "\n", " # Simulation\n", " sim = dpsimpy.Simulation(sim_name, dpsimpy.LogLevel.trace)\n", @@ -241,10 +241,10 @@ "\n", "# Logging\n", "logger = dpsimpy.Logger(sim_name)\n", - "logger.log_attribute('v1', 'v', n1)\n", - "logger.log_attribute('i_gen', 'i_intf', gen)\n", - "logger.log_attribute('i_load', 'i_intf', load)\n", - "logger.log_attribute('wr_gen', 'w_r', gen)\n", + "logger.log_attribute('v1', n1.attr('v'))\n", + "logger.log_attribute('i_gen', gen.attr('i_intf'))\n", + "logger.log_attribute('i_load', load.attr('i_intf'))\n", + "logger.log_attribute('wr_gen', gen.attr('w_r'))\n", "\n", "# Simulation\n", "sim = dpsimpy.Simulation(sim_name, dpsimpy.LogLevel.info)\n", diff --git a/examples/Notebooks/Components/Trafo.ipynb b/examples/Notebooks/Components/Trafo.ipynb index 8ca3d82bfa..fe9d21909f 100644 --- a/examples/Notebooks/Components/Trafo.ipynb +++ b/examples/Notebooks/Components/Trafo.ipynb @@ -91,9 +91,9 @@ "sys = dpsimpy.SystemTopology(50, [n1, n2, vn1], [vs, trafo_res, trafo_ind, trafo_snubber_res_hv_side, trafo_snubber_res_mv_side, trafo_snubber_cap_mv_side, load_res])\n", "\n", "logger = dpsimpy.Logger(sim_name)\n", - "logger.log_attribute('v1', 'v', n1)\n", - "logger.log_attribute('v2', 'v', n2)\n", - "logger.log_attribute('itrafo', 'i_intf', trafo_ind)\n", + "logger.log_attribute('v1', n1.attr('v'))\n", + "logger.log_attribute('v2', n2.attr('v'))\n", + "logger.log_attribute('itrafo', trafo_ind.attr('i_intf'))\n", "\n", "sim = dpsimpy.Simulation(sim_name)\n", "sim.set_system(sys)\n", @@ -151,9 +151,9 @@ "sys = dpsimpy.SystemTopology(50, [n1, n2], [vs, trafo, load_res])\n", "\n", "logger = dpsimpy.Logger(sim_name)\n", - "logger.log_attribute('v1', 'v', n1)\n", - "logger.log_attribute('v2', 'v', n2)\n", - "logger.log_attribute('itrafo', 'i_intf', trafo)\n", + "logger.log_attribute('v1', n1.attr('v'))\n", + "logger.log_attribute('v2', n2.attr('v'))\n", + "logger.log_attribute('itrafo', trafo.attr('i_intf'))\n", "\n", "sim = dpsimpy.Simulation(sim_name)\n", "sim.set_system(sys)\n", @@ -230,9 +230,9 @@ "sys = dpsimpy.SystemTopology(50, [n1, n2, vn1], [vs, trafo_res, trafo_ind, trafo_snubber_res_hv_side, trafo_snubber_res_mv_side, trafo_snubber_cap_mv_side, load_res])\n", "\n", "logger = dpsimpy.Logger(sim_name)\n", - "logger.log_attribute('v1', 'v', n1)\n", - "logger.log_attribute('v2', 'v', n2)\n", - "logger.log_attribute('itrafo', 'i_intf', trafo_ind)\n", + "logger.log_attribute('v1', n1.attr('v'))\n", + "logger.log_attribute('v2', n2.attr('v'))\n", + "logger.log_attribute('itrafo', trafo_ind.attr('i_intf'))\n", "\n", "sim = dpsimpy.Simulation(sim_name)\n", "sim.set_system(sys)\n", @@ -290,9 +290,9 @@ "sys = dpsimpy.SystemTopology(50, [n1, n2], [vs, trafo, load_res])\n", "\n", "logger = dpsimpy.Logger(sim_name)\n", - "logger.log_attribute('v1', 'v', n1)\n", - "logger.log_attribute('v2', 'v', n2)\n", - "logger.log_attribute('itrafo', 'i_intf', trafo)\n", + "logger.log_attribute('v1', n1.attr('v'))\n", + "logger.log_attribute('v2', n2.attr('v'))\n", + "logger.log_attribute('itrafo', trafo.attr('i_intf'))\n", "\n", "sim = dpsimpy.Simulation(sim_name)\n", "sim.set_system(sys)\n", @@ -370,9 +370,9 @@ "sys = dpsimpy.SystemTopology(50, [n1, n2, vn1], [vs, trafo_res, trafo_ind, trafo_snubber_res_hv_side, trafo_snubber_res_mv_side, trafo_snubber_cap_mv_side, load_res])\n", "\n", "logger = dpsimpy.Logger(sim_name)\n", - "logger.log_attribute('v1', 'v', n1)\n", - "logger.log_attribute('v2', 'v', n2)\n", - "logger.log_attribute('itrafo', 'i_intf', trafo_ind)\n", + "logger.log_attribute('v1', n1.attr('v'))\n", + "logger.log_attribute('v2', n2.attr('v'))\n", + "logger.log_attribute('itrafo', trafo_ind.attr('i_intf'))\n", "\n", "sim = dpsimpy.Simulation(sim_name)\n", "sim.set_system(sys)\n", @@ -431,9 +431,9 @@ "sys = dpsimpy.SystemTopology(50, [n1, n2], [vs, trafo, load_res])\n", "\n", "logger = dpsimpy.Logger(sim_name)\n", - "logger.log_attribute('v1', 'v', n1)\n", - "logger.log_attribute('v2', 'v', n2)\n", - "logger.log_attribute('itrafo', 'i_intf', trafo)\n", + "logger.log_attribute('v1', n1.attr('v'))\n", + "logger.log_attribute('v2', n2.attr('v'))\n", + "logger.log_attribute('itrafo', trafo.attr('i_intf'))\n", "\n", "sim = dpsimpy.Simulation(sim_name)\n", "sim.set_system(sys)\n", diff --git a/examples/Notebooks/Grids/CIGRE_MV_pf-interactive-dpsimpy.ipynb b/examples/Notebooks/Grids/CIGRE_MV_pf-interactive-dpsimpy.ipynb index b8394811f0..83389fdb4b 100644 --- a/examples/Notebooks/Grids/CIGRE_MV_pf-interactive-dpsimpy.ipynb +++ b/examples/Notebooks/Grids/CIGRE_MV_pf-interactive-dpsimpy.ipynb @@ -83,7 +83,7 @@ "\n", "logger = dpsimpy.Logger(name)\n", "for node in system.nodes:\n", - " logger.log_attribute(node.name()+'.V', 'v', node)\n", + " logger.log_attribute(node.name()+'.V', node.attr('v'))\n", "sim.add_logger(logger)" ] }, diff --git a/examples/Notebooks/Grids/CIGRE_MV_powerflow-dpsimpy.ipynb b/examples/Notebooks/Grids/CIGRE_MV_powerflow-dpsimpy.ipynb index 9acfc41577..e1429ac70e 100644 --- a/examples/Notebooks/Grids/CIGRE_MV_powerflow-dpsimpy.ipynb +++ b/examples/Notebooks/Grids/CIGRE_MV_powerflow-dpsimpy.ipynb @@ -75,7 +75,7 @@ "\n", "logger = dpsimpy.Logger(name)\n", "for node in system.nodes:\n", - " logger.log_attribute(node.name()+'.V', 'v', node);\n", + " logger.log_attribute(node.name()+'.V', node.attr('v'));\n", "sim.add_logger(logger)" ] }, diff --git a/examples/Notebooks/Grids/CIGRE_MV_powerflow_profiles-dpsimpy.ipynb b/examples/Notebooks/Grids/CIGRE_MV_powerflow_profiles-dpsimpy.ipynb index 6ad63d1bef..f3343b422f 100644 --- a/examples/Notebooks/Grids/CIGRE_MV_powerflow_profiles-dpsimpy.ipynb +++ b/examples/Notebooks/Grids/CIGRE_MV_powerflow_profiles-dpsimpy.ipynb @@ -154,7 +154,7 @@ "\n", "logger = dpsimpy.Logger(name)\n", "for node in system.nodes:\n", - " logger.log_attribute(node.name()+'.V', 'v', node);\n", + " logger.log_attribute(node.name()+'.V', node.attr('v'));\n", "sim.add_logger(logger)" ] }, diff --git a/examples/Notebooks/Grids/DP_CIGRE_MV_withDG.ipynb b/examples/Notebooks/Grids/DP_CIGRE_MV_withDG.ipynb index 6aa2381fa0..c0d0ace8a7 100644 --- a/examples/Notebooks/Grids/DP_CIGRE_MV_withDG.ipynb +++ b/examples/Notebooks/Grids/DP_CIGRE_MV_withDG.ipynb @@ -102,7 +102,7 @@ "\n", "logger_pf = dpsimpy.Logger(sim_name_pf)\n", "for node in system_pf.nodes:\n", - " logger_pf.log_attribute(node.name() + '.V', 'v', node)\n", + " logger_pf.log_attribute(node.name() + '.V', node.attr('v'))\n", "\n", "sim_pf = dpsimpy.Simulation(sim_name_pf, dpsimpy.LogLevel.debug)\n", "sim_pf.set_system(system_pf)\n", @@ -157,14 +157,14 @@ "# log node voltages\n", "logger_dp= dpsimpy.Logger(sim_name)\n", "for node in system_dp.nodes:\n", - " logger_dp.log_attribute(node.name() + '.V', 'v', node)\n", + " logger_dp.log_attribute(node.name() + '.V', node.attr('v'))\n", "\n", "# log line and load currents\n", "for comp in system_dp.components:\n", " if isinstance(comp, dpsimpy.dp.ph1.PiLine):\n", - " logger_dp.log_attribute(comp.name() + '.I', 'i_intf', comp)\n", + " logger_dp.log_attribute(comp.name() + '.I', comp.attr('i_intf'))\n", " if isinstance(comp, dpsimpy.dp.ph1.RXLoad):\n", - " logger_dp.log_attribute(comp.name() + '.I', 'i_intf', comp)\n", + " logger_dp.log_attribute(comp.name() + '.I', comp.attr('i_intf'))\n", "\n", "# log output of PV connected at N11\n", "pv_name = 'pv_N11'\n", @@ -173,25 +173,25 @@ " \"pv_powerctrl_input_pref\", \"pv_powerctrl_input_qref\", \"pv_powerctrl_input_vcd\",\n", " \"pv_powerctrl_input_vcq\", \"pv_powerctrl_input_ircd\", \"pv_powerctrl_input_ircq\"\n", "]\n", - "logger_dp.log_attribute(input_names, 'powerctrl_inputs', pv)\n", + "logger_dp.log_attribute(input_names, pv.attr('powerctrl_inputs'))\n", "\n", "state_names = [\n", " \"pv_powerctrl_state_p\", \"pv_powerctrl_state_q\", \"pv_powerctrl_state_phid\",\n", " \"pv_powerctrl_state_phiq\", \"pv_powerctrl_state_gammad\", \"pv_powerctrl_state_gammaq\"\n", "]\n", - "logger_dp.log_attribute(state_names, 'powerctrl_states', pv)\n", + "logger_dp.log_attribute(state_names, pv.attr('powerctrl_states'))\n", "\n", "output_names = [\n", " \"pv_powerctrl_output_vsd\", \"pv_powerctrl_output_vsq\"\n", "]\n", "\n", - "logger_dp.log_attribute(output_names, 'powerctrl_outputs', pv)\n", + "logger_dp.log_attribute(output_names, pv.attr('powerctrl_outputs'))\n", "\n", - "logger_dp.log_attribute(pv_name + '_v_intf', 'v_intf', pv)\n", - "logger_dp.log_attribute(pv_name + '_i_intf', 'i_intf', pv)\n", - "logger_dp.log_attribute(pv_name + '_pll_output', 'pll_output', pv)\n", - "logger_dp.log_attribute(pv_name + '_vsref', 'Vsref', pv)\n", - "logger_dp.log_attribute(pv_name + '_vs', 'Vs', pv)\n", + "logger_dp.log_attribute(pv_name + '_v_intf', pv.attr('v_intf'))\n", + "logger_dp.log_attribute(pv_name + '_i_intf', pv.attr('i_intf'))\n", + "logger_dp.log_attribute(pv_name + '_pll_output', pv.attr('pll_output'))\n", + "logger_dp.log_attribute(pv_name + '_vsref', pv.attr('Vsref'))\n", + "logger_dp.log_attribute(pv_name + '_vs', pv.attr('Vs'))\n", "\n", "sim_dp = dpsimpy.Simulation(sim_name, dpsimpy.LogLevel.debug)\n", "sim_dp.set_system(system_dp)\n", diff --git a/examples/Notebooks/Grids/DP_CIGRE_MV_withDG_withLoadStep.ipynb b/examples/Notebooks/Grids/DP_CIGRE_MV_withDG_withLoadStep.ipynb index 41b0ef2dbf..e89b913288 100644 --- a/examples/Notebooks/Grids/DP_CIGRE_MV_withDG_withLoadStep.ipynb +++ b/examples/Notebooks/Grids/DP_CIGRE_MV_withDG_withLoadStep.ipynb @@ -93,7 +93,7 @@ "\n", "logger_pf = dpsimpy.Logger(sim_name_pf)\n", "for node in system_pf.nodes:\n", - " logger_pf.log_attribute(node.name() + '.V', 'v', node)\n", + " logger_pf.log_attribute(node.name() + '.V', node.attr('v'))\n", "\n", "sim_pf = dpsimpy.Simulation(sim_name_pf, dpsimpy.LogLevel.debug)\n", "sim_pf.set_system(system_pf)\n", @@ -148,14 +148,14 @@ "# log node voltages\n", "logger_dp= dpsimpy.Logger(sim_name)\n", "for node in system_dp.nodes:\n", - " logger_dp.log_attribute(node.name() + '.V', 'v', node)\n", + " logger_dp.log_attribute(node.name() + '.V', node.attr('v'))\n", "\n", "# log line and load currents\n", "for comp in system_dp.components:\n", " if isinstance(comp, dpsimpy.dp.ph1.PiLine):\n", - " logger_dp.log_attribute(comp.name() + '.I', 'i_intf', comp)\n", + " logger_dp.log_attribute(comp.name() + '.I', comp.attr('i_intf'))\n", " if isinstance(comp, dpsimpy.dp.ph1.RXLoad):\n", - " logger_dp.log_attribute(comp.name() + '.I', 'i_intf', comp)\n", + " logger_dp.log_attribute(comp.name() + '.I', comp.attr('i_intf'))\n", "\n", "# log output of PV connected at N11\n", "pv_name = 'pv_N11'\n", @@ -164,25 +164,25 @@ " \"pv_powerctrl_input_pref\", \"pv_powerctrl_input_qref\", \"pv_powerctrl_input_vcd\",\n", " \"pv_powerctrl_input_vcq\", \"pv_powerctrl_input_ircd\", \"pv_powerctrl_input_ircq\"\n", "]\n", - "logger_dp.log_attribute(input_names, 'powerctrl_inputs', pv)\n", + "logger_dp.log_attribute(input_names, pv.attr('powerctrl_inputs'))\n", "\n", "state_names = [\n", " \"pv_powerctrl_state_p\", \"pv_powerctrl_state_q\", \"pv_powerctrl_state_phid\",\n", " \"pv_powerctrl_state_phiq\", \"pv_powerctrl_state_gammad\", \"pv_powerctrl_state_gammaq\"\n", "]\n", - "logger_dp.log_attribute(state_names, 'powerctrl_states', pv)\n", + "logger_dp.log_attribute(state_names, pv.attr('powerctrl_states'))\n", "\n", "output_names = [\n", " \"pv_powerctrl_output_vsd\", \"pv_powerctrl_output_vsq\"\n", "]\n", "\n", - "logger_dp.log_attribute(output_names, 'powerctrl_outputs', pv)\n", + "logger_dp.log_attribute(output_names, pv.attr('powerctrl_outputs'))\n", "\n", - "logger_dp.log_attribute(pv_name + '_v_intf', 'v_intf', pv)\n", - "logger_dp.log_attribute(pv_name + '_i_intf', 'i_intf', pv)\n", - "logger_dp.log_attribute(pv_name + '_pll_output', 'pll_output', pv)\n", - "logger_dp.log_attribute(pv_name + '_vsref', 'Vsref', pv)\n", - "logger_dp.log_attribute(pv_name + '_vs', 'Vs', pv)\n", + "logger_dp.log_attribute(pv_name + '_v_intf', pv.attr('v_intf'))\n", + "logger_dp.log_attribute(pv_name + '_i_intf', pv.attr('i_intf'))\n", + "logger_dp.log_attribute(pv_name + '_pll_output', pv.attr('pll_output'))\n", + "logger_dp.log_attribute(pv_name + '_vsref', pv.attr('Vsref'))\n", + "logger_dp.log_attribute(pv_name + '_vs', pv.attr('Vs'))\n", "\n", "# load step sized in absolute terms\n", "load_switch = dpsimpy.dp.ph1.Switch(\"Load_Add_Switch_N11\", dpsimpy.LogLevel.debug)\n", @@ -192,7 +192,7 @@ "load_switch.open()\n", "system_dp.add(load_switch)\n", "system_dp.connect_component(load_switch, [dpsimpy.dp.SimNode.gnd, system_dp.node('N11')])\n", - "logger_dp.log_attribute('switchedload_i', 'i_intf', load_switch)\n", + "logger_dp.log_attribute('switchedload_i', load_switch.attr('i_intf'))\n", "load_step_event = dpsimpy.event.SwitchEvent(2 - time_step, load_switch, True)\n", "\n", "\n", diff --git a/examples/Notebooks/Grids/DP_CIGRE_MV_withoutDG.ipynb b/examples/Notebooks/Grids/DP_CIGRE_MV_withoutDG.ipynb index c0f90eaca6..611146517f 100644 --- a/examples/Notebooks/Grids/DP_CIGRE_MV_withoutDG.ipynb +++ b/examples/Notebooks/Grids/DP_CIGRE_MV_withoutDG.ipynb @@ -93,7 +93,7 @@ "\n", "logger_pf = dpsimpy.Logger(sim_name_pf)\n", "for node in system_pf.nodes:\n", - " logger_pf.log_attribute(node.name() + '.V', 'v', node)\n", + " logger_pf.log_attribute(node.name() + '.V', node.attr('v'))\n", "\n", "sim_pf = dpsimpy.Simulation(sim_name_pf, dpsimpy.LogLevel.debug)\n", "sim_pf.set_system(system_pf)\n", @@ -130,14 +130,14 @@ "# log node voltages\n", "logger_dp= dpsimpy.Logger(sim_name)\n", "for node in system_dp.nodes:\n", - " logger_dp.log_attribute(node.name() + '.V', 'v', node)\n", + " logger_dp.log_attribute(node.name() + '.V', node.attr('v'))\n", "\n", "# log line and load currents\n", "for comp in system_dp.components:\n", " if isinstance(comp, dpsimpy.dp.ph1.PiLine):\n", - " logger_dp.log_attribute(comp.name() + '.I', 'i_intf', comp)\n", + " logger_dp.log_attribute(comp.name() + '.I', comp.attr('i_intf'))\n", " if isinstance(comp, dpsimpy.dp.ph1.RXLoad):\n", - " logger_dp.log_attribute(comp.name() + '.I', 'i_intf', comp)\n", + " logger_dp.log_attribute(comp.name() + '.I', comp.attr('i_intf'))\n", "\n", "sim_dp = dpsimpy.Simulation(sim_name, dpsimpy.LogLevel.debug)\n", "sim_dp.set_system(system_dp)\n", diff --git a/examples/Notebooks/Grids/DP_WSCC9bus_SGTrStab.ipynb b/examples/Notebooks/Grids/DP_WSCC9bus_SGTrStab.ipynb index 695f9a164d..fe326b8f88 100644 --- a/examples/Notebooks/Grids/DP_WSCC9bus_SGTrStab.ipynb +++ b/examples/Notebooks/Grids/DP_WSCC9bus_SGTrStab.ipynb @@ -76,10 +76,10 @@ "logger = dpsimpy.Logger(sim_name)\n", "\n", "for i in range(1, 10):\n", - " logger.log_attribute('v' + str(i), 'v', system.node('BUS' + str(i)))\n", + " logger.log_attribute('v' + str(i), system.node('BUS' + str(i)).attr('v'))\n", "\n", "for i in range(1, 4):\n", - " logger.log_attribute('wr_' + str(i), 'w_r', system.component('GEN' + str(i)))\n", + " logger.log_attribute('wr_' + str(i), system.component('GEN' + str(i)).attr('w_r'))\n", "\n", "sim = dpsimpy.Simulation(sim_name, dpsimpy.LogLevel.info)\n", "sim.set_system(system)\n", diff --git a/examples/Notebooks/Grids/DP_WSCC9bus_SGTrStab_Switch.ipynb b/examples/Notebooks/Grids/DP_WSCC9bus_SGTrStab_Switch.ipynb index 085ee0f08c..6b7ede97ab 100644 --- a/examples/Notebooks/Grids/DP_WSCC9bus_SGTrStab_Switch.ipynb +++ b/examples/Notebooks/Grids/DP_WSCC9bus_SGTrStab_Switch.ipynb @@ -88,13 +88,13 @@ "logger = dpsimpy.Logger(sim_name)\n", "\n", "for i in range(1, 10):\n", - " logger.log_attribute('v' + str(i), 'v', system.node('BUS' + str(i)))\n", + " logger.log_attribute('v' + str(i), system.node('BUS' + str(i)).attr('v'))\n", "\n", "for i in range(1, 4):\n", - " logger.log_attribute('wr_' + str(i), 'w_r', system.component('GEN' + str(i)))\n", - " logger.log_attribute('delta_r_' + str(i), 'delta_r', system.component('GEN' + str(i)))\n", - " logger.log_attribute('P_elec_' + str(i), 'P_elec', system.component('GEN' + str(i)))\n", - " logger.log_attribute('P_mech_' + str(i), 'P_mech', system.component('GEN' + str(i)))\n", + " logger.log_attribute('wr_' + str(i), system.component('GEN' + str(i)).attr('w_r'))\n", + " logger.log_attribute('delta_r_' + str(i), system.component('GEN' + str(i)).attr('delta_r'))\n", + " logger.log_attribute('P_elec_' + str(i), system.component('GEN' + str(i)).attr('P_elec'))\n", + " logger.log_attribute('P_mech_' + str(i), system.component('GEN' + str(i)).attr('P_mech'))\n", "\n", "\n", "sim = dpsimpy.Simulation(sim_name, dpsimpy.LogLevel.debug)\n", @@ -305,7 +305,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.13" + "version": "3.10.11" }, "vscode": { "interpreter": { diff --git a/examples/Notebooks/Grids/DP_WSCC9bus_SGVoltageSource.ipynb b/examples/Notebooks/Grids/DP_WSCC9bus_SGVoltageSource.ipynb index 84ae03665e..5973bde035 100644 --- a/examples/Notebooks/Grids/DP_WSCC9bus_SGVoltageSource.ipynb +++ b/examples/Notebooks/Grids/DP_WSCC9bus_SGVoltageSource.ipynb @@ -84,7 +84,7 @@ "logger = dpsimpy.Logger(sim_name)\n", "\n", "for i in range(1, 10):\n", - " logger.log_attribute('v' + str(i), 'v', system.node('BUS' + str(i)))\n", + " logger.log_attribute('v' + str(i), system.node('BUS' + str(i)).attr('v'))\n", "\n", "sim = dpsimpy.Simulation(sim_name, dpsimpy.LogLevel.info)\n", "sim.set_system(system)\n", @@ -325,7 +325,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.13" + "version": "3.10.11" } }, "nbformat": 4, diff --git a/examples/Notebooks/Grids/EMT_CIGRE_MV_withDG.ipynb b/examples/Notebooks/Grids/EMT_CIGRE_MV_withDG.ipynb index 9cc49564db..767acbcb7d 100644 --- a/examples/Notebooks/Grids/EMT_CIGRE_MV_withDG.ipynb +++ b/examples/Notebooks/Grids/EMT_CIGRE_MV_withDG.ipynb @@ -109,7 +109,7 @@ "\n", "logger_pf = dpsimpy.Logger(sim_name_pf)\n", "for node in system_pf.nodes:\n", - " logger_pf.log_attribute(node.name() + '.V', 'v', node)\n", + " logger_pf.log_attribute(node.name() + '.V', node.attr('v'))\n", "\n", "sim_pf = dpsimpy.Simulation(sim_name_pf, dpsimpy.LogLevel.debug)\n", "sim_pf.set_system(system_pf)\n", @@ -164,14 +164,14 @@ "# log node voltages\n", "logger_emt= dpsimpy.Logger(sim_name)\n", "for node in system_emt.nodes:\n", - " logger_emt.log_attribute(node.name() + '.V', 'v', node)\n", + " logger_emt.log_attribute(node.name() + '.V', node.attr('v'))\n", "\n", "# log line and load currents\n", "for comp in system_emt.components:\n", " if isinstance(comp, dpsimpy.emt.ph3.PiLine):\n", - " logger_emt.log_attribute(comp.name() + '.I', 'i_intf', comp)\n", + " logger_emt.log_attribute(comp.name() + '.I', comp.attr('i_intf'))\n", " if isinstance(comp, dpsimpy.emt.ph3.RXLoad):\n", - " logger_emt.log_attribute(comp.name() + '.I', 'i_intf', comp)\n", + " logger_emt.log_attribute(comp.name() + '.I', comp.attr('i_intf'))\n", "\n", "# log output of PV connected at N11\n", "pv_name = 'pv_N11'\n", @@ -180,25 +180,25 @@ " \"pv_powerctrl_input_pref\", \"pv_powerctrl_input_qref\", \"pv_powerctrl_input_vcd\",\n", " \"pv_powerctrl_input_vcq\", \"pv_powerctrl_input_ircd\", \"pv_powerctrl_input_ircq\"\n", "]\n", - "logger_emt.log_attribute(input_names, 'powerctrl_inputs', pv)\n", + "logger_emt.log_attribute(input_names, pv.attr('powerctrl_inputs'))\n", "\n", "state_names = [\n", " \"pv_powerctrl_state_p\", \"pv_powerctrl_state_q\", \"pv_powerctrl_state_phid\",\n", " \"pv_powerctrl_state_phiq\", \"pv_powerctrl_state_gammad\", \"pv_powerctrl_state_gammaq\"\n", "]\n", - "logger_emt.log_attribute(state_names, 'powerctrl_states', pv)\n", + "logger_emt.log_attribute(state_names, pv.attr('powerctrl_states'))\n", "\n", "output_names = [\n", " \"pv_powerctrl_output_vsd\", \"pv_powerctrl_output_vsq\"\n", "]\n", "\n", - "logger_emt.log_attribute(output_names, 'powerctrl_outputs', pv)\n", + "logger_emt.log_attribute(output_names, pv.attr('powerctrl_outputs'))\n", "\n", - "logger_emt.log_attribute(pv_name + '_v_intf', 'v_intf', pv)\n", - "logger_emt.log_attribute(pv_name + '_i_intf', 'i_intf', pv)\n", - "logger_emt.log_attribute(pv_name + '_pll_output', 'pll_output', pv)\n", - "logger_emt.log_attribute(pv_name + '_vsref', 'Vsref', pv)\n", - "logger_emt.log_attribute(pv_name + '_vs', 'Vs', pv)\n", + "logger_emt.log_attribute(pv_name + '_v_intf', pv.attr('v_intf'))\n", + "logger_emt.log_attribute(pv_name + '_i_intf', pv.attr('i_intf'))\n", + "logger_emt.log_attribute(pv_name + '_pll_output', pv.attr('pll_output'))\n", + "logger_emt.log_attribute(pv_name + '_vsref', pv.attr('Vsref'))\n", + "logger_emt.log_attribute(pv_name + '_vs', pv.attr('Vs'))\n", "\n", "sim_emt = dpsimpy.Simulation(sim_name, dpsimpy.LogLevel.debug)\n", "sim_emt.set_system(system_emt)\n", diff --git a/examples/Notebooks/Grids/EMT_CIGRE_MV_withDG_withLoadStep.ipynb b/examples/Notebooks/Grids/EMT_CIGRE_MV_withDG_withLoadStep.ipynb index 26846f16bb..8955c9c7b8 100644 --- a/examples/Notebooks/Grids/EMT_CIGRE_MV_withDG_withLoadStep.ipynb +++ b/examples/Notebooks/Grids/EMT_CIGRE_MV_withDG_withLoadStep.ipynb @@ -109,7 +109,7 @@ "\n", "logger_pf = dpsimpy.Logger(sim_name_pf)\n", "for node in system_pf.nodes:\n", - " logger_pf.log_attribute(node.name() + '.V', 'v', node)\n", + " logger_pf.log_attribute(node.name() + '.V', node.attr('v'))\n", "\n", "sim_pf = dpsimpy.Simulation(sim_name_pf, dpsimpy.LogLevel.debug)\n", "sim_pf.set_system(system_pf)\n", @@ -164,14 +164,14 @@ "# log node voltages\n", "logger_emt= dpsimpy.Logger(sim_name)\n", "for node in system_emt.nodes:\n", - " logger_emt.log_attribute(node.name() + '.V', 'v', node)\n", + " logger_emt.log_attribute(node.name() + '.V', node.attr('v'))\n", "\n", "# log line and load currents\n", "for comp in system_emt.components:\n", " if isinstance(comp, dpsimpy.emt.ph3.PiLine):\n", - " logger_emt.log_attribute(comp.name() + '.I', 'i_intf', comp)\n", + " logger_emt.log_attribute(comp.name() + '.I', comp.attr('i_intf'))\n", " if isinstance(comp, dpsimpy.emt.ph3.RXLoad):\n", - " logger_emt.log_attribute(comp.name() + '.I', 'i_intf', comp)\n", + " logger_emt.log_attribute(comp.name() + '.I', comp.attr('i_intf'))\n", "\n", "# log output of PV connected at N11\n", "pv_name = 'pv_N11'\n", @@ -180,25 +180,25 @@ " \"pv_powerctrl_input_pref\", \"pv_powerctrl_input_qref\", \"pv_powerctrl_input_vcd\",\n", " \"pv_powerctrl_input_vcq\", \"pv_powerctrl_input_ircd\", \"pv_powerctrl_input_ircq\"\n", "]\n", - "logger_emt.log_attribute(input_names, 'powerctrl_inputs', pv)\n", + "logger_emt.log_attribute(input_names, pv.attr('powerctrl_inputs'))\n", "\n", "state_names = [\n", " \"pv_powerctrl_state_p\", \"pv_powerctrl_state_q\", \"pv_powerctrl_state_phid\",\n", " \"pv_powerctrl_state_phiq\", \"pv_powerctrl_state_gammad\", \"pv_powerctrl_state_gammaq\"\n", "]\n", - "logger_emt.log_attribute(state_names, 'powerctrl_states', pv)\n", + "logger_emt.log_attribute(state_names, pv.attr('powerctrl_states'))\n", "\n", "output_names = [\n", " \"pv_powerctrl_output_vsd\", \"pv_powerctrl_output_vsq\"\n", "]\n", "\n", - "logger_emt.log_attribute(output_names, 'powerctrl_outputs', pv)\n", + "logger_emt.log_attribute(output_names, pv.attr('powerctrl_outputs'))\n", "\n", - "logger_emt.log_attribute(pv_name + '_v_intf', 'v_intf', pv)\n", - "logger_emt.log_attribute(pv_name + '_i_intf', 'i_intf', pv)\n", - "logger_emt.log_attribute(pv_name + '_pll_output', 'pll_output', pv)\n", - "logger_emt.log_attribute(pv_name + '_vsref', 'Vsref', pv)\n", - "logger_emt.log_attribute(pv_name + '_vs', 'Vs', pv)\n", + "logger_emt.log_attribute(pv_name + '_v_intf', pv.attr('v_intf'))\n", + "logger_emt.log_attribute(pv_name + '_i_intf', pv.attr('i_intf'))\n", + "logger_emt.log_attribute(pv_name + '_pll_output', pv.attr('pll_output'))\n", + "logger_emt.log_attribute(pv_name + '_vsref', pv.attr('Vsref'))\n", + "logger_emt.log_attribute(pv_name + '_vs', pv.attr('Vs'))\n", "\n", "# load step sized in absolute terms\n", "load_switch = dpsimpy.emt.ph3.Switch(\"Load_Add_Switch_N11\", dpsimpy.LogLevel.debug)\n", @@ -208,7 +208,7 @@ "load_switch.open()\n", "system_emt.add(load_switch)\n", "system_emt.connect_component(load_switch, [dpsimpy.emt.SimNode.gnd, system_emt.node('N11')])\n", - "logger_emt.log_attribute('switchedload_i', 'i_intf', load_switch)\n", + "logger_emt.log_attribute('switchedload_i', load_switch.attr('i_intf'))\n", "load_step_event = dpsimpy.event.SwitchEvent3Ph(2 - time_step, load_switch, True)\n", "\n", "\n", diff --git a/examples/Notebooks/Grids/EMT_CIGRE_MV_withoutDG.ipynb b/examples/Notebooks/Grids/EMT_CIGRE_MV_withoutDG.ipynb index 39ae46ed57..01d1d49451 100644 --- a/examples/Notebooks/Grids/EMT_CIGRE_MV_withoutDG.ipynb +++ b/examples/Notebooks/Grids/EMT_CIGRE_MV_withoutDG.ipynb @@ -92,7 +92,7 @@ "\n", "logger_pf = dpsimpy.Logger(sim_name_pf)\n", "for node in system_pf.nodes:\n", - " logger_pf.log_attribute(node.name() + '.V', 'v', node)\n", + " logger_pf.log_attribute(node.name() + '.V', node.attr('v'))\n", "\n", "sim_pf = dpsimpy.Simulation(sim_name_pf, dpsimpy.LogLevel.debug)\n", "sim_pf.set_system(system_pf)\n", @@ -130,14 +130,14 @@ "# log node voltages\n", "logger_emt= dpsimpy.Logger(sim_name)\n", "for node in system_emt.nodes:\n", - " logger_emt.log_attribute(node.name() + '.V', 'v', node)\n", + " logger_emt.log_attribute(node.name() + '.V', node.attr('v'))\n", "\n", "# log line and load currents\n", "for comp in system_emt.components:\n", " if isinstance(comp, dpsimpy.emt.ph3.PiLine):\n", - " logger_emt.log_attribute(comp.name() + '.I', 'i_intf', comp)\n", + " logger_emt.log_attribute(comp.name() + '.I', comp.attr('i_intf'))\n", " if isinstance(comp, dpsimpy.emt.ph3.RXLoad):\n", - " logger_emt.log_attribute(comp.name() + '.I', 'i_intf', comp)\n", + " logger_emt.log_attribute(comp.name() + '.I', comp.attr('i_intf'))\n", "\n", "sim_emt = dpsimpy.Simulation(sim_name, dpsimpy.LogLevel.debug)\n", "sim_emt.set_system(system_emt)\n", diff --git a/examples/Notebooks/Grids/IEEE_LV_powerflow.ipynb b/examples/Notebooks/Grids/IEEE_LV_powerflow.ipynb index f24343ccf6..0df6bdfe4e 100644 --- a/examples/Notebooks/Grids/IEEE_LV_powerflow.ipynb +++ b/examples/Notebooks/Grids/IEEE_LV_powerflow.ipynb @@ -80,7 +80,7 @@ "\n", "logger = dpsimpy.Logger(sim_name)\n", "for node in system.nodes:\n", - " logger.log_attribute(node.name() + '.V', 'v', node)\n", + " logger.log_attribute(node.name() + '.V', node.attr('v'))\n", "\n", "sim = dpsimpy.Simulation(sim_name, dpsimpy.LogLevel.debug)\n", "sim.set_system(system)\n", diff --git a/examples/Notebooks/Grids/PF_CIGRE_MV_withDG.ipynb b/examples/Notebooks/Grids/PF_CIGRE_MV_withDG.ipynb index 319ddf28e0..9931eb1d69 100644 --- a/examples/Notebooks/Grids/PF_CIGRE_MV_withDG.ipynb +++ b/examples/Notebooks/Grids/PF_CIGRE_MV_withDG.ipynb @@ -106,7 +106,7 @@ "\n", "logger = dpsimpy.Logger(sim_name)\n", "for node in system.nodes:\n", - " logger.log_attribute(node.name() + '.V', 'v', node)\n", + " logger.log_attribute(node.name() + '.V', node.attr('v'))\n", "\n", "sim = dpsimpy.Simulation(sim_name, dpsimpy.LogLevel.debug)\n", "sim.set_system(system)\n", diff --git a/examples/Notebooks/Grids/SP_WSCC9bus_SGTrStab_Switch_PSAT_Validation.ipynb b/examples/Notebooks/Grids/SP_WSCC9bus_SGTrStab_Switch_PSAT_Validation.ipynb index c7ec3b37bc..a3b05ebfc7 100644 --- a/examples/Notebooks/Grids/SP_WSCC9bus_SGTrStab_Switch_PSAT_Validation.ipynb +++ b/examples/Notebooks/Grids/SP_WSCC9bus_SGTrStab_Switch_PSAT_Validation.ipynb @@ -88,13 +88,13 @@ "logger = dpsimpy.Logger(sim_name)\n", "\n", "for i in range(1, 10):\n", - " logger.log_attribute('v' + str(i), 'v', system.node('BUS' + str(i)))\n", + " logger.log_attribute('v' + str(i),system.node('BUS' + str(i)).attr('v'))\n", "\n", "for i in range(1, 4):\n", - " logger.log_attribute('wr_' + str(i), 'w_r', system.component('GEN' + str(i)))\n", - " logger.log_attribute('delta_r_' + str(i), 'delta_r', system.component('GEN' + str(i)))\n", - " logger.log_attribute('P_elec_' + str(i), 'P_elec', system.component('GEN' + str(i)))\n", - " logger.log_attribute('P_mech_' + str(i), 'P_mech', system.component('GEN' + str(i)))\n", + " logger.log_attribute('wr_' + str(i), system.component('GEN' + str(i)).attr( 'w_r'))\n", + " logger.log_attribute('delta_r_' + str(i), system.component('GEN' + str(i)).attr('delta_r'))\n", + " logger.log_attribute('P_elec_' + str(i), system.component('GEN' + str(i)).attr('P_elec'))\n", + " logger.log_attribute('P_mech_' + str(i), system.component('GEN' + str(i)).attr('P_mech'))\n", "\n", "\n", "sim = dpsimpy.Simulation(sim_name, dpsimpy.LogLevel.debug)\n", diff --git a/examples/Notebooks/Grids/case14.ipynb b/examples/Notebooks/Grids/case14.ipynb index 3f09383910..0de6e9d0ef 100644 --- a/examples/Notebooks/Grids/case14.ipynb +++ b/examples/Notebooks/Grids/case14.ipynb @@ -66,7 +66,7 @@ "logger = dpsimpy.Logger(name)\n", "sim.add_logger(logger)\n", "for node in system.nodes:\n", - " logger.log_attribute(node.name()+'.V', 'v', node);" + " logger.log_attribute(node.name()+'.V', node.attr('v'));" ] }, { diff --git a/examples/Notebooks/Grids/case145.ipynb b/examples/Notebooks/Grids/case145.ipynb index 4ba622bad6..682861974c 100644 --- a/examples/Notebooks/Grids/case145.ipynb +++ b/examples/Notebooks/Grids/case145.ipynb @@ -66,7 +66,7 @@ "logger = dpsimpy.Logger(name)\n", "sim.add_logger(logger)\n", "for node in system.nodes:\n", - " logger.log_attribute(node.name()+'.V', 'v', node);" + " logger.log_attribute(node.name()+'.V', node.attr('v'));" ] }, { diff --git a/examples/Notebooks/Grids/case300.ipynb b/examples/Notebooks/Grids/case300.ipynb index 7e9f8d0b65..a0397eb21d 100644 --- a/examples/Notebooks/Grids/case300.ipynb +++ b/examples/Notebooks/Grids/case300.ipynb @@ -66,7 +66,7 @@ "logger = dpsimpy.Logger(name)\n", "sim.add_logger(logger)\n", "for node in system.nodes:\n", - " logger.log_attribute(node.name()+'.V', 'v', node);" + " logger.log_attribute(node.name()+'.V', node.attr('v'));" ] }, { diff --git a/examples/Notebooks/Grids/case9.ipynb b/examples/Notebooks/Grids/case9.ipynb index 2bc8528d26..eb3c22d686 100644 --- a/examples/Notebooks/Grids/case9.ipynb +++ b/examples/Notebooks/Grids/case9.ipynb @@ -68,7 +68,7 @@ "logger = dpsimpy.Logger(name)\n", "sim.add_logger(logger)\n", "for node in system.nodes:\n", - " logger.log_attribute(node.name()+'.V', 'v', node);" + " logger.log_attribute(node.name()+'.V', node.attr('v'));" ] }, { diff --git a/examples/Notebooks/Quickstart Guide.ipynb b/examples/Notebooks/Quickstart Guide.ipynb index bd10f81080..1844b6dc0b 100644 --- a/examples/Notebooks/Quickstart Guide.ipynb +++ b/examples/Notebooks/Quickstart Guide.ipynb @@ -127,11 +127,11 @@ "sim.set_final_time(0.03)\n", "\n", "log = dpsimpy.Logger(\"Example1\")\n", - "for i in range(0, len(sys.nodes)):\n", - " log.log_attribute(\"v\" + str(i), \"v\", sys.nodes[i])\n", "\n", - "sim.add_logger(log)\n", + "for i in range(0, len(sys.nodes)):\n", + " log.log_attribute(\"v\" + str(i), sys.nodes[i].attr(\"v\"))\n", " \n", + "sim.add_logger(log)\n", "sim.run()" ] }, @@ -172,7 +172,7 @@ "metadata": {}, "outputs": [], "source": [ - "!cat logs/Example1_Solver.log" + "!cat logs/simulation.log" ] } ], @@ -194,7 +194,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.7" + "version": "3.10.11" } }, "nbformat": 4, diff --git a/examples/Notebooks/matpower-case9.ipynb b/examples/Notebooks/matpower-case9.ipynb index c90df4fba9..4da832064c 100644 --- a/examples/Notebooks/matpower-case9.ipynb +++ b/examples/Notebooks/matpower-case9.ipynb @@ -59,8 +59,8 @@ "logger = dpsim.Logger(sim_name)\n", "\n", "for node in system.nodes:\n", - " logger.log_attribute(node.name()+'.V', 'v', node)\n", - " logger.log_attribute(node.name()+'.S', 's', node)\n", + " logger.log_attribute(node.name()+'.V', node.attr('v'))\n", + " logger.log_attribute(node.name()+'.S', node.attr('s'))\n", " \n", "# Parametrize and run simulation\n", "sim = dpsim.Simulation(sim_name, dpsim.LogLevel.info)\n", diff --git a/examples/villas-deprecated/cigre-mv-pf-profiles-shmem.ipynb b/examples/villas-deprecated/cigre-mv-pf-profiles-shmem.ipynb index 866de306ea..ebb5927094 100644 --- a/examples/villas-deprecated/cigre-mv-pf-profiles-shmem.ipynb +++ b/examples/villas-deprecated/cigre-mv-pf-profiles-shmem.ipynb @@ -185,7 +185,7 @@ "outputs": [], "source": [ "for node in system.nodes:\n", - " logger.log_attribute(node.name()+'.V', 'v', node)" + " logger.log_attribute(node.name()+'.V', node.attr('v'))" ] }, { diff --git a/examples/villas-deprecated/shmem-distributed-villas.py b/examples/villas-deprecated/shmem-distributed-villas.py index 5cee187cda..9844728ea6 100644 --- a/examples/villas-deprecated/shmem-distributed-villas.py +++ b/examples/villas-deprecated/shmem-distributed-villas.py @@ -89,11 +89,11 @@ def dpsim0(): dpsimpy.Logger.set_log_dir('logs/' + sim_name) logger = dpsimpy.Logger(sim_name) - logger.log_attribute('v1', 'v', n1) - logger.log_attribute('v2', 'v', n2) - logger.log_attribute('r12', 'i_intf', r12) - logger.log_attribute('ievs', 'i_intf', evs) - logger.log_attribute('vevs', 'v_intf', evs) + logger.log_attribute('v1', n1.attr('v')) + logger.log_attribute('v2', n2.attr('v')) + logger.log_attribute('r12', r12.attr('i_intf')) + logger.log_attribute('ievs', evs.attr('i_intf')) + logger.log_attribute('vevs', evs.attr('v_intf')) sim = dpsimpy.RealTimeSimulation(sim_name) sim.set_system(sys) @@ -132,10 +132,10 @@ def dpsim1(): dpsimpy.Logger.set_log_dir('logs/' + sim_name) logger = dpsimpy.Logger(sim_name) - logger.log_attribute('v2', 'v', n2) - logger.log_attribute('r02', 'i_intf', r02) - logger.log_attribute('vecs', 'v_intf', ecs) - logger.log_attribute('iecs', 'i_intf', ecs) + logger.log_attribute('v2', n2.attr('v')) + logger.log_attribute('r02', r02.attr('i_intf')) + logger.log_attribute('vecs', ecs.attr('v_intf')) + logger.log_attribute('iecs', ecs.attr('i_intf')) sim = dpsimpy.RealTimeSimulation(sim_name) sim.set_system(sys) diff --git a/examples/villas-deprecated/test_shmem_cigre_mv_pf_profiles.py b/examples/villas-deprecated/test_shmem_cigre_mv_pf_profiles.py index 7ecf89ad58..80c152d75d 100644 --- a/examples/villas-deprecated/test_shmem_cigre_mv_pf_profiles.py +++ b/examples/villas-deprecated/test_shmem_cigre_mv_pf_profiles.py @@ -137,7 +137,7 @@ def dpsim(): .derive_phase(), (i*2)+1) for node in system.nodes: - logger.log_attribute(node.name()+'.V', 'v', node) + logger.log_attribute(node.name()+'.V', node.attr('v')) return sim, intf diff --git a/examples/villas/dpsim-file.py b/examples/villas/dpsim-file.py index cf7b157d6e..81fffb2fe9 100644 --- a/examples/villas/dpsim-file.py +++ b/examples/villas/dpsim-file.py @@ -28,11 +28,11 @@ dpsimpy.Logger.set_log_dir('logs/' + sim_name) logger = dpsimpy.Logger(sim_name) -logger.log_attribute('v1', 'v', n1) -logger.log_attribute('v2', 'v', n2) -logger.log_attribute('r12', 'i_intf', r12) -logger.log_attribute('ievs', 'i_intf', evs) -logger.log_attribute('vevs', 'v_intf', evs) +logger.log_attribute('v1', n1.attr('v')) +logger.log_attribute('v2', n2.attr('v')) +logger.log_attribute('r12', r12.attr('i_intf')) +logger.log_attribute('ievs', evs.attr('i_intf')) +logger.log_attribute('vevs', evs.attr('v_intf')) sim = dpsimpy.RealTimeSimulation(sim_name) sim.set_system(sys) @@ -58,4 +58,4 @@ evs.set_intf_current([[complex(5, 0)]]) -sim.run(1) \ No newline at end of file +sim.run(1) diff --git a/examples/villas/dpsim-mqtt.py b/examples/villas/dpsim-mqtt.py index f50007efe2..4d8b7681fa 100644 --- a/examples/villas/dpsim-mqtt.py +++ b/examples/villas/dpsim-mqtt.py @@ -1,5 +1,5 @@ # This example demonstrates the export of values calculated by dpsim to a MQTT broker using the VILLASnode interface -# Note, that dpsim also expects to read a (complex) reference voltage from MQTT, so the simulation will block on every timestep until this value is provided +# Note, that dpsim also expects to read a (complex) reference voltage from MQTT, so the simulation will block on every timestep until this value is provided import dpsimpy import dpsimpyvillas @@ -29,11 +29,11 @@ dpsimpy.Logger.set_log_dir('logs/' + sim_name) logger = dpsimpy.Logger(sim_name) -logger.log_attribute('v1', 'v', n1) -logger.log_attribute('v2', 'v', n2) -logger.log_attribute('r12', 'i_intf', r12) -logger.log_attribute('ievs', 'i_intf', evs) -logger.log_attribute('vevs', 'v_intf', evs) +logger.log_attribute('v1', n1.attr('v')) +logger.log_attribute('v2', n2.attr('v')) +logger.log_attribute('r12', r12.attr('i_intf')) +logger.log_attribute('ievs', evs.attr('i_intf')) +logger.log_attribute('vevs', evs.attr('v_intf')) sim = dpsimpy.RealTimeSimulation(sim_name) sim.set_system(sys) @@ -60,4 +60,4 @@ sim.add_logger(logger) -sim.run(1) \ No newline at end of file +sim.run(1) diff --git a/examples/villas/shmem-distributed-reference.py b/examples/villas/shmem-distributed-reference.py index f364a9619e..c92717260d 100644 --- a/examples/villas/shmem-distributed-reference.py +++ b/examples/villas/shmem-distributed-reference.py @@ -33,10 +33,10 @@ dpsimpy.Logger.set_log_dir('logs/' + sim_name) logger = dpsimpy.Logger(sim_name) - logger.log_attribute('v1', 'v', n1) - logger.log_attribute('v2', 'v', n2) - logger.log_attribute('r12', 'i_intf', r12) - logger.log_attribute('r02', 'i_intf', r02) + logger.log_attribute('v1', n1.attr('v')) + logger.log_attribute('v2', n2.attr('v')) + logger.log_attribute('r12', r12.attr('i_intf')) + logger.log_attribute('r02', r02.attr('i_intf')) sim = dpsimpy.RealTimeSimulation(sim_name) sim.set_system(sys) From 0181cb078a9a067329ca4aa84797333feb7b308e Mon Sep 17 00:00:00 2001 From: Jonas Schroeder Date: Wed, 26 Jul 2023 10:04:39 +0000 Subject: [PATCH 25/31] allow overwriting the simulation default logger Signed-off-by: Jonas Schroeder --- dpsim/include/dpsim/DataLogger.h | 4 ++++ dpsim/include/dpsim/Simulation.h | 13 ++++++------- dpsim/src/DataLogger.cpp | 4 +--- dpsim/src/RealTimeSimulation.cpp | 4 ++-- dpsim/src/Simulation.cpp | 20 +++++++++++--------- 5 files changed, 24 insertions(+), 21 deletions(-) diff --git a/dpsim/include/dpsim/DataLogger.h b/dpsim/include/dpsim/DataLogger.h index 05bcd00efa..7d08b24f77 100644 --- a/dpsim/include/dpsim/DataLogger.h +++ b/dpsim/include/dpsim/DataLogger.h @@ -51,6 +51,10 @@ namespace DPsim { open(); } + const String& name() const { + return mName; + } + void logPhasorNodeValues(Real time, const Matrix& data, Int freqNum = 1); void logEMTNodeValues(Real time, const Matrix& data); diff --git a/dpsim/include/dpsim/Simulation.h b/dpsim/include/dpsim/Simulation.h index cebbf1190c..d8a78a2a27 100644 --- a/dpsim/include/dpsim/Simulation.h +++ b/dpsim/include/dpsim/Simulation.h @@ -79,10 +79,8 @@ namespace DPsim { CPS::Logger::Level mCliLevel; /// (Real) time needed for the timesteps std::vector mStepTimes; - /// List of data loggers. mLoggers[0] corresponds to the default simulation logger - DataLogger::List mDataLoggers; - /// Default simulation logger - DataLogger::Ptr mInternalDataLogger; + /// Map of data loggers. mLoggers[**mName] corresponds to the default simulation logger + std::map> mDataLoggers; // #### Solver Settings #### /// @@ -232,9 +230,10 @@ namespace DPsim { void addEvent(Event::Ptr e) { mEvents.addEvent(e); } - /// Add a new data logger + /// Add a new data logger. + /// When the name of the new logger matches the simulation name, the default simulation logger will be replaced! void addLogger(DataLogger::Ptr logger) { - mDataLoggers.push_back(logger); + mDataLoggers[logger->name()] = logger; } /// Write step time measurements to log file @@ -259,7 +258,7 @@ namespace DPsim { Real finalTime() const { return **mFinalTime; } Int timeStepCount() const { return mTimeStepCount; } Real timeStep() const { return **mTimeStep; } - DataLogger::List& loggers() { return mDataLoggers; } + std::map> loggers() const { return mDataLoggers; } std::shared_ptr scheduler() const { return mScheduler; } std::vector& stepTimes() { return mStepTimes; } diff --git a/dpsim/src/DataLogger.cpp b/dpsim/src/DataLogger.cpp index aaa0434059..618f13aca5 100644 --- a/dpsim/src/DataLogger.cpp +++ b/dpsim/src/DataLogger.cpp @@ -31,8 +31,6 @@ DataLogger::DataLogger(String name, Bool enabled, UInt downsampling) : if (mFilename.has_parent_path() && !fs::exists(mFilename.parent_path())) fs::create_directory(mFilename.parent_path()); - - open(); } void DataLogger::open() { @@ -189,7 +187,7 @@ void DataLogger::logAttribute(const std::vector &name, CPS::AttributeBas } } } - } + } } void DataLogger::logAttribute(const String &name, CPS::AttributeBase::Ptr attr, UInt rowsMax, UInt colsMax) { diff --git a/dpsim/src/RealTimeSimulation.cpp b/dpsim/src/RealTimeSimulation.cpp index 4040f5e346..1be8e81aea 100644 --- a/dpsim/src/RealTimeSimulation.cpp +++ b/dpsim/src/RealTimeSimulation.cpp @@ -61,8 +61,8 @@ void RealTimeSimulation::run(const Timer::StartClock::time_point &startAt) { for (auto intf : mInterfaces) intf->close(); - for (auto lg : mDataLoggers) - lg->close(); + for (const auto& [_path, logger] : mDataLoggers) + logger->close(); mTimer.stop(); } diff --git a/dpsim/src/Simulation.cpp b/dpsim/src/Simulation.cpp index c55174050e..0023b671d4 100644 --- a/dpsim/src/Simulation.cpp +++ b/dpsim/src/Simulation.cpp @@ -55,9 +55,8 @@ void Simulation::create() { // Logging mLog = Logger::get(Logger::LoggerType::SIMULATION, **mName, mLogLevel, mCliLevel); - // Default data logger - mInternalDataLogger = DataLogger::make(**mName + "_data"); - mDataLoggers.push_back(mInternalDataLogger); + // Create default Data Logger + mDataLoggers[**mName] = DataLogger::make(**mName); Eigen::setNbThreads(1); @@ -68,6 +67,9 @@ void Simulation::initialize() { if (mInitialized) return; + for (const auto& [_path, logger] : mDataLoggers) + logger->open(); + mSolvers.clear(); switch (mDomain) { @@ -176,10 +178,10 @@ void Simulation::createMNASolver() { // Log solver iteration numbers if (mLogLevel < Logger::Level::info) { if (auto mnaSolverDirect = std::dynamic_pointer_cast>(solver)) { - mInternalDataLogger->logAttribute("iters" + copySuffix, mnaSolverDirect->mIter); + mDataLoggers[**mName]->logAttribute("iters" + copySuffix, mnaSolverDirect->mIter); } else if (auto mnaSolverDirect = std::dynamic_pointer_cast>(solver)) { - mInternalDataLogger->logAttribute("iters" + copySuffix, mnaSolverDirect->mIter); + mDataLoggers[**mName]->logAttribute("iters" + copySuffix, mnaSolverDirect->mIter); } } } @@ -215,7 +217,7 @@ void Simulation::prepSchedule() { } } - for (auto logger : mDataLoggers) { + for (const auto& [_path, logger] : mDataLoggers) { mTasks.push_back(logger->getTask()); } if (!mScheduler) { @@ -380,8 +382,8 @@ void Simulation::stop() { for (auto intf : mInterfaces) intf->close(); - for (auto lg : mDataLoggers) - lg->close(); + for (const auto& [_path, logger] : mDataLoggers) + logger->close(); SPDLOG_LOGGER_INFO(mLog, "Simulation finished."); mLog->flush(); @@ -469,5 +471,5 @@ void Simulation::logIdObjAttribute(const String &comp, const String &attr) { } void Simulation::logAttribute(const String &name, CPS::AttributeBase::Ptr attr) { - mInternalDataLogger->logAttribute(name, attr); + mDataLoggers[**mName]->logAttribute(name, attr); } From 5772700b76d3019cb42faa12831163ab58f0d9b8 Mon Sep 17 00:00:00 2001 From: Jonas Schroeder Date: Wed, 26 Jul 2023 10:12:48 +0000 Subject: [PATCH 26/31] only create left/right-vector logs on trace level Signed-off-by: Jonas Schroeder --- dpsim/include/dpsim/DataLogger.h | 2 ++ dpsim/include/dpsim/Solver.h | 4 +++- dpsim/src/DiakopticsSolver.cpp | 4 ++-- dpsim/src/MNASolver.cpp | 5 ++--- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/dpsim/include/dpsim/DataLogger.h b/dpsim/include/dpsim/DataLogger.h index 7d08b24f77..e8c7d82de9 100644 --- a/dpsim/include/dpsim/DataLogger.h +++ b/dpsim/include/dpsim/DataLogger.h @@ -27,6 +27,8 @@ namespace DPsim { protected: std::ofstream mLogFile; String mName; + /// FIXME: The enabled-parameter cannot be changed midway through the simulation + /// Instead of setting this to false, the logger should not be created at all to reduce function call overhead Bool mEnabled; UInt mDownsampling; fs::path mFilename; diff --git a/dpsim/include/dpsim/Solver.h b/dpsim/include/dpsim/Solver.h index 6e559b9469..a1791a4356 100644 --- a/dpsim/include/dpsim/Solver.h +++ b/dpsim/include/dpsim/Solver.h @@ -37,6 +37,7 @@ namespace DPsim { protected: /// Logger CPS::Logger::Log mSLog; + CPS::Logger::Level mLogLevel; /// Time step for fixed step solvers Real mTimeStep; /// Activates parallelized computation of frequencies @@ -63,7 +64,8 @@ namespace DPsim { public: Solver(CPS::Logger::Level logLevel, CPS::Logger::Level cliLevel = CPS::Logger::Level::warn) : - mSLog(CPS::Logger::get(CPS::Logger::LoggerType::SIMULATION, "Solver", logLevel, cliLevel)) { + mSLog(CPS::Logger::get(CPS::Logger::LoggerType::SIMULATION, "Solver", logLevel, cliLevel)), + mLogLevel(logLevel) { } virtual ~Solver() { } diff --git a/dpsim/src/DiakopticsSolver.cpp b/dpsim/src/DiakopticsSolver.cpp index 2a92fb12ac..08e053fa06 100644 --- a/dpsim/src/DiakopticsSolver.cpp +++ b/dpsim/src/DiakopticsSolver.cpp @@ -29,8 +29,8 @@ DiakopticsSolver::DiakopticsSolver(String name, mTimeStep = timeStep; // Raw source and solution vector logging - mLeftVectorLog = std::make_shared(name + "_LeftVector", logLevel != CPS::Logger::Level::off); - mRightVectorLog = std::make_shared(name + "_RightVector", logLevel != CPS::Logger::Level::off); + mLeftVectorLog = std::make_shared(name + "_LeftVector", logLevel == CPS::Logger::Level::trace); + mRightVectorLog = std::make_shared(name + "_RightVector", logLevel == CPS::Logger::Level::trace); for (auto comp : tearComponents) { auto pcomp = std::dynamic_pointer_cast>(comp); diff --git a/dpsim/src/MNASolver.cpp b/dpsim/src/MNASolver.cpp index 4a4df74dbf..39c0fa31bc 100644 --- a/dpsim/src/MNASolver.cpp +++ b/dpsim/src/MNASolver.cpp @@ -447,9 +447,8 @@ template void MnaSolver::steadyStateInitialization() { SPDLOG_LOGGER_DEBUG(mSLog, "--- Run steady-state initialization ---"); - //TODO: Update condition for enabled, see below - DataLogger initLeftVectorLog("InitLeftVector", true); - DataLogger initRightVectorLog("InitRightVector", true); + DataLogger initLeftVectorLog("InitLeftVector", mLogLevel == CPS::Logger::Level::trace); + DataLogger initRightVectorLog("InitRightVector", mLogLevel == CPS::Logger::Level::trace); TopologicalPowerComp::Behaviour initBehaviourPowerComps = TopologicalPowerComp::Behaviour::Initialization; SimSignalComp::Behaviour initBehaviourSignalComps = SimSignalComp::Behaviour::Initialization; From 22ce8b993aaa7adb8477703368f490c96d58acd7 Mon Sep 17 00:00:00 2001 From: Jonas Schroeder Date: Wed, 26 Jul 2023 13:25:04 +0000 Subject: [PATCH 27/31] manually open / close non-simulation data loggers Signed-off-by: Jonas Schroeder --- dpsim/include/dpsim/MNASolver.h | 3 +++ dpsim/src/DiakopticsSolver.cpp | 3 +++ dpsim/src/MNASolver.cpp | 15 +++++++++++---- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/dpsim/include/dpsim/MNASolver.h b/dpsim/include/dpsim/MNASolver.h index c50c682edc..fa6d430944 100644 --- a/dpsim/include/dpsim/MNASolver.h +++ b/dpsim/include/dpsim/MNASolver.h @@ -198,6 +198,9 @@ namespace DPsim { virtual ~MnaSolver() { if (mSystemMatrixRecomputation) SPDLOG_LOGGER_DEBUG(mSLog, "Number of system matrix recomputations: {:}", mNumRecomputations); + + mLeftVectorLog->close(); + mRightVectorLog->close(); }; /// Calls subroutines to set up everything that is required before simulation diff --git a/dpsim/src/DiakopticsSolver.cpp b/dpsim/src/DiakopticsSolver.cpp index 08e053fa06..fc4ec0342a 100644 --- a/dpsim/src/DiakopticsSolver.cpp +++ b/dpsim/src/DiakopticsSolver.cpp @@ -32,6 +32,9 @@ DiakopticsSolver::DiakopticsSolver(String name, mLeftVectorLog = std::make_shared(name + "_LeftVector", logLevel == CPS::Logger::Level::trace); mRightVectorLog = std::make_shared(name + "_RightVector", logLevel == CPS::Logger::Level::trace); + mLeftVectorLog->open(); + mRightVectorLog->open(); + for (auto comp : tearComponents) { auto pcomp = std::dynamic_pointer_cast>(comp); if (pcomp) diff --git a/dpsim/src/MNASolver.cpp b/dpsim/src/MNASolver.cpp index 39c0fa31bc..e7a1cf60ce 100644 --- a/dpsim/src/MNASolver.cpp +++ b/dpsim/src/MNASolver.cpp @@ -24,6 +24,9 @@ MnaSolver::MnaSolver(String name, CPS::Domain domain, CPS::Logger::Leve // Raw source and solution vector logging mLeftVectorLog = std::make_shared(name + "_LeftVector", logLevel == CPS::Logger::Level::trace); mRightVectorLog = std::make_shared(name + "_RightVector", logLevel == CPS::Logger::Level::trace); + + mLeftVectorLog->open(); + mRightVectorLog->open(); } template @@ -246,8 +249,7 @@ void MnaSolver::initializeSystemWithPrecomputedMatrices() { auto idObj = std::dynamic_pointer_cast(comp); SPDLOG_LOGGER_DEBUG(mSLog, "Stamping {:s} {:s} into source vector", idObj->type(), idObj->name()); - if (mSLog->should_log(spdlog::level::trace)) - mSLog->trace("\n{:s}", Logger::matrixToString(mRightSideVector)); + SPDLOG_LOGGER_TRACE(mSLog, "\n{:s}", Logger::matrixToString(mRightSideVector)); } } @@ -275,8 +277,7 @@ void MnaSolver::initializeSystemWithVariableMatrix() { auto idObj = std::dynamic_pointer_cast(comp); SPDLOG_LOGGER_DEBUG(mSLog, "Stamping {:s} {:s} into source vector", idObj->type(), idObj->name()); - if (mSLog->should_log(spdlog::level::trace)) - mSLog->trace("\n{:s}", Logger::matrixToString(mRightSideVector)); + SPDLOG_LOGGER_TRACE(mSLog, "\n{:s}", Logger::matrixToString(mRightSideVector)); } } @@ -450,6 +451,9 @@ void MnaSolver::steadyStateInitialization() { DataLogger initLeftVectorLog("InitLeftVector", mLogLevel == CPS::Logger::Level::trace); DataLogger initRightVectorLog("InitRightVector", mLogLevel == CPS::Logger::Level::trace); + initLeftVectorLog.open(); + initRightVectorLog.open(); + TopologicalPowerComp::Behaviour initBehaviourPowerComps = TopologicalPowerComp::Behaviour::Initialization; SimSignalComp::Behaviour initBehaviourSignalComps = SimSignalComp::Behaviour::Initialization; @@ -535,6 +539,9 @@ void MnaSolver::steadyStateInitialization() { // Reset system for actual simulation mRightSideVector.setZero(); + initLeftVectorLog.close(); + initRightVectorLog.close(); + SPDLOG_LOGGER_DEBUG(mSLog, "--- Finished steady-state initialization ---"); } From d3e84dee3b9bf089821f5968c74109b60620d0d1 Mon Sep 17 00:00:00 2001 From: Jonas Schroeder Date: Wed, 26 Jul 2023 13:34:07 +0000 Subject: [PATCH 28/31] change log level in notebooks using LeftVector log Signed-off-by: Jonas Schroeder --- examples/Notebooks/Components/SynGen_trStab_logger_test.ipynb | 2 +- examples/Notebooks/Grids/DP_WSCC9bus_SGTrStab.ipynb | 2 +- examples/Notebooks/Grids/DP_WSCC9bus_SGVoltageSource.ipynb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/Notebooks/Components/SynGen_trStab_logger_test.ipynb b/examples/Notebooks/Components/SynGen_trStab_logger_test.ipynb index 1a1d341bb5..fb3c3cf71e 100644 --- a/examples/Notebooks/Components/SynGen_trStab_logger_test.ipynb +++ b/examples/Notebooks/Components/SynGen_trStab_logger_test.ipynb @@ -143,7 +143,7 @@ "sys = dpsimpy.SystemTopology(60, [n1], [gen, res])\n", "\n", "# Simulation\n", - "sim1 = dpsimpy.Simulation(sim_name, dpsimpy.LogLevel.info)\n", + "sim1 = dpsimpy.Simulation(sim_name, dpsimpy.LogLevel.trace)\n", "sim1.set_time_step(time_step)\n", "sim1.set_final_time(final_time)\n", "sim1.set_domain(dpsimpy.Domain.DP)\n", diff --git a/examples/Notebooks/Grids/DP_WSCC9bus_SGTrStab.ipynb b/examples/Notebooks/Grids/DP_WSCC9bus_SGTrStab.ipynb index fe326b8f88..a18aeb3b38 100644 --- a/examples/Notebooks/Grids/DP_WSCC9bus_SGTrStab.ipynb +++ b/examples/Notebooks/Grids/DP_WSCC9bus_SGTrStab.ipynb @@ -81,7 +81,7 @@ "for i in range(1, 4):\n", " logger.log_attribute('wr_' + str(i), system.component('GEN' + str(i)).attr('w_r'))\n", "\n", - "sim = dpsimpy.Simulation(sim_name, dpsimpy.LogLevel.info)\n", + "sim = dpsimpy.Simulation(sim_name, dpsimpy.LogLevel.trace)\n", "sim.set_system(system)\n", "sim.set_time_step(0.0001)\n", "sim.set_final_time(2.0)\n", diff --git a/examples/Notebooks/Grids/DP_WSCC9bus_SGVoltageSource.ipynb b/examples/Notebooks/Grids/DP_WSCC9bus_SGVoltageSource.ipynb index 5973bde035..fcdcff2aad 100644 --- a/examples/Notebooks/Grids/DP_WSCC9bus_SGVoltageSource.ipynb +++ b/examples/Notebooks/Grids/DP_WSCC9bus_SGVoltageSource.ipynb @@ -86,7 +86,7 @@ "for i in range(1, 10):\n", " logger.log_attribute('v' + str(i), system.node('BUS' + str(i)).attr('v'))\n", "\n", - "sim = dpsimpy.Simulation(sim_name, dpsimpy.LogLevel.info)\n", + "sim = dpsimpy.Simulation(sim_name, dpsimpy.LogLevel.trace)\n", "sim.set_system(system)\n", "sim.set_time_step(0.0001)\n", "sim.set_final_time(0.1)\n", From d5d61835ff5b87dca17fe762161fc5ba72da6485 Mon Sep 17 00:00:00 2001 From: Jonas Schroeder Date: Thu, 27 Jul 2023 16:23:35 +0000 Subject: [PATCH 29/31] update some log levels Signed-off-by: Jonas Schroeder --- dpsim-models/src/SP/SP_Ph1_Switch.cpp | 20 ++++++++++---------- dpsim/src/MNASolverDirect.cpp | 9 ++++----- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/dpsim-models/src/SP/SP_Ph1_Switch.cpp b/dpsim-models/src/SP/SP_Ph1_Switch.cpp index 4528e23ba3..9278c1ecbe 100644 --- a/dpsim-models/src/SP/SP_Ph1_Switch.cpp +++ b/dpsim-models/src/SP/SP_Ph1_Switch.cpp @@ -64,14 +64,14 @@ void SP::Ph1::Switch::mnaCompApplySystemMatrixStamp(SparseMatrixRow& systemMatri Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1), matrixNodeIndex(0), -conductance); } - SPDLOG_LOGGER_TRACE(mSLog, "-- Stamp ---"); + SPDLOG_LOGGER_DEBUG(mSLog, "-- Stamp ---"); if (terminalNotGrounded(0)) - SPDLOG_LOGGER_TRACE(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(conductance), matrixNodeIndex(0), matrixNodeIndex(0)); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(conductance), matrixNodeIndex(0), matrixNodeIndex(0)); if (terminalNotGrounded(1)) - SPDLOG_LOGGER_TRACE(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(conductance), matrixNodeIndex(1), matrixNodeIndex(1)); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(conductance), matrixNodeIndex(1), matrixNodeIndex(1)); if (terminalNotGrounded(0) && terminalNotGrounded(1)) { - SPDLOG_LOGGER_TRACE(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(-conductance), matrixNodeIndex(0), matrixNodeIndex(1)); - SPDLOG_LOGGER_TRACE(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(-conductance), matrixNodeIndex(1), matrixNodeIndex(0)); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(-conductance), matrixNodeIndex(0), matrixNodeIndex(1)); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(-conductance), matrixNodeIndex(1), matrixNodeIndex(0)); } } @@ -92,14 +92,14 @@ void SP::Ph1::Switch::mnaCompApplySwitchSystemMatrixStamp(Bool closed, SparseMat Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1), matrixNodeIndex(0), -conductance); } - SPDLOG_LOGGER_TRACE(mSLog, "-- Stamp ---"); + SPDLOG_LOGGER_DEBUG(mSLog, "-- Stamp ---"); if (terminalNotGrounded(0)) - SPDLOG_LOGGER_TRACE(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(conductance), matrixNodeIndex(0), matrixNodeIndex(0)); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(conductance), matrixNodeIndex(0), matrixNodeIndex(0)); if (terminalNotGrounded(1)) - SPDLOG_LOGGER_TRACE(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(conductance), matrixNodeIndex(1), matrixNodeIndex(1)); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(conductance), matrixNodeIndex(1), matrixNodeIndex(1)); if (terminalNotGrounded(0) && terminalNotGrounded(1)) { - SPDLOG_LOGGER_TRACE(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(-conductance), matrixNodeIndex(0), matrixNodeIndex(1)); - SPDLOG_LOGGER_TRACE(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(-conductance), matrixNodeIndex(1), matrixNodeIndex(0)); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(-conductance), matrixNodeIndex(0), matrixNodeIndex(1)); + SPDLOG_LOGGER_DEBUG(mSLog, "Add {:s} to system at ({:d},{:d})", Logger::complexToString(-conductance), matrixNodeIndex(1), matrixNodeIndex(0)); } } diff --git a/dpsim/src/MNASolverDirect.cpp b/dpsim/src/MNASolverDirect.cpp index 6c6ccc52d4..eaff3a3141 100644 --- a/dpsim/src/MNASolverDirect.cpp +++ b/dpsim/src/MNASolverDirect.cpp @@ -328,11 +328,10 @@ void MnaSolverDirect::logSystemMatrices() { } else { SPDLOG_LOGGER_DEBUG(mSLog, "Initial switch status: {:s}", mCurrentSwitchStatus.to_string()); - - for (auto sys : mSwitchedMatrices) { - SPDLOG_LOGGER_TRACE(mSLog, "Switching System matrix {:s} \n{:s}", - sys.first.to_string(), Logger::matrixToString(sys.second[0])); - } + // for (auto sys : mSwitchedMatrices) { + // SPDLOG_LOGGER_DEBUG(mSLog, "Switching System matrix {:s} \n{:s}", + // sys.first.to_string(), Logger::matrixToString(sys.second[0])); + // } } SPDLOG_LOGGER_DEBUG(mSLog, "Right side vector: \n{}", mRightSideVector); } From 88be7bdc88a2944f8a8a28a8e00e0c787fbac25f Mon Sep 17 00:00:00 2001 From: Jonas Schroeder Date: Fri, 28 Jul 2023 14:37:15 +0000 Subject: [PATCH 30/31] update logging guidelines in documentation Signed-off-by: Jonas Schroeder --- .../content/en/docs/Development/Guidelines.md | 38 +++++++++++++++++-- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/docs/hugo/content/en/docs/Development/Guidelines.md b/docs/hugo/content/en/docs/Development/Guidelines.md index a2d3a20e1d..d74ff8cba1 100644 --- a/docs/hugo/content/en/docs/Development/Guidelines.md +++ b/docs/hugo/content/en/docs/Development/Guidelines.md @@ -7,9 +7,39 @@ This is a summary of general guidelines for the development of DPsim. ## Logging -Debug or trace should be the default log level for information that might be nice to have but not necessary for every simulation case. - -Calls to the logger that might occur during simulation must use spdlog macros, like SPDLOG_LOGGER_INFO. +There are two ways to log information in DPsim: The `CPS::Logger` (called the **Text Logger**), which can write to `.log` files and to the CLI, as well as the `DPsim::DataLogger` (called the **Data Logger**), which can write to `.csv` files. + +### Log Levels +The log levels that can be used with the Text Logger are as follows: +- `off` - no Text Logger output at all, recommended to use e.g. when running case studies where exclusively the simulation results should be logged +- `error` - all errors +- `warn` - all warnings +- `info` - logging of information that is basic and that is logged only once before/after the simulation +- `debug` - logging of information for debugging (extended static information, e.g. initialization values, matrix stamps, subcomponents) +- `trace` - logging of information in each simulation step + +While the Data Logger does not have any log levels (just a boolean flag to enable or disable the logger), +there are some Data Loggers that are only activated when the object owning the Data Logger is also configured to use a certain log level. +E.g., the `_LeftVector.csv` and `_RightVector.csv` will only be generated when the Simulation Text Logger is set to `trace` level. + +Logging with the Text Logger should always happen using the `SPDLOG_LOGGER_` macros. + +### Examples +The Text Loggers in DPsim are grouped into three categories: +- `Simulation`: All the Text Loggers logging into `Simulation.log` +- `Component`: All the Text Loggers logging into `Components.log` +- `Debug`: Text Loggers used for debugging purposes, each creating their own log files + +The following table provides an overview on what output is produced in each category on different log levels: + +| Log Level | `Simulation` Text Logger | `Component` Text Logger | `Debug` Text Loggers | Data Loggers | +|--------------|---------------------------|-------------------------|----------------------|--------------| +| `off` | - | - | - |Only log that is explicitly requested by the user, e.g. through `DataLogger::log_attribute` or `Simulation::logStepTimes`| +| `error` | Errors that will lead to a program crash or invalidate the simulation results | Errors that will lead to a program crash or invalidate the simulation results | Errors that will lead to a program crash or invalidate the simulation results | Only log that is explicitly requested by the user, e.g. through `DataLogger::log_attribute` or `Simulation::logStepTimes`| +| `warn` | Problems that might lead to invalid results, but will likely not lead to a crash | Problems that might lead to invalid results, but will likely not lead to a crash | Problems that might lead to invalid results, but will likely not lead to a crash | Only log that is explicitly requested by the user, e.g. through `DataLogger::log_attribute` or `Simulation::logStepTimes`| +| `info` | e.g. Summary of number of network and virtual nodes, Simulation configuration / domain| e.g. Parameters set through `setParameters`, connections to network nodes | e.g. `CSVReader.log`, whenever a `CSVReader` is used | Only log that is explicitly requested by the user, e.g. through `DataLogger::log_attribute` or `Simulation::logStepTimes`| +| `debug` | e.g. System matrices, Scheduler log, More details about the used solver | e.g. Component initialization, subcomponents, snubber components | e.g. `CIMReader.log`, whenever a `CIMReader` is used| e.g. iteration count for iterative solvers in `.csv`| +| `trace` | Information that changes on each simulation step | e.g. voltages / currents calculated in `mnaUpdateCurrent`/`mnaUpdateVoltage`|-|e.g. `_LeftVector.csv`, `_RightVector.csv`, `_InitLeftVector.csv`, `_InitRightVector.csv`| ## Creating New Releases @@ -23,4 +53,4 @@ A new version of DPsim has to be indicated as follows: - Update sonar-project.properties Due to the creation of a new tag, a new PyPi package will be deployed automatically. -To release an updated Docker image, the container workflow needs to be triggered manually. \ No newline at end of file +To release an updated Docker image, the container workflow needs to be triggered manually. From f66fe17d1f26c84e62bbb9f3b6e80acb4e6a9ff4 Mon Sep 17 00:00:00 2001 From: Jonas Schroeder Date: Fri, 28 Jul 2023 15:04:21 +0000 Subject: [PATCH 31/31] use the DataLogger for trace logging in DP_Ph1_Capacitor Signed-off-by: Jonas Schroeder --- .../content/en/docs/Development/Guidelines.md | 2 +- .../en/docs/Overview/Attributes/index.md | 14 +++++----- .../include/dpsim-models}/DataLogger.h | 15 +++++------ .../include/dpsim-models/MNASimPowerComp.h | 3 +++ .../dpsim-models/TopologicalPowerComp.h | 16 +++++++++--- dpsim-models/src/CMakeLists.txt | 1 + dpsim-models/src/DP/DP_Ph1_Capacitor.cpp | 26 ++++++++++++++++++- {dpsim => dpsim-models}/src/DataLogger.cpp | 21 ++++++++++++--- dpsim-models/src/MNASimPowerComp.cpp | 1 + dpsim-villas/examples/cxx/FileExample.cpp | 4 +-- dpsim-villas/examples/cxx/MqttExample.cpp | 4 +-- .../examples/cxx/SharedMemExample.cpp | 4 +-- .../examples/cxx/ShmemDistributedDirect.cpp | 4 +-- .../cxx/ShmemDistributedReference.cpp | 2 +- dpsim-villas/examples/cxx/ShmemExample.cpp | 2 +- .../examples/cxx/Shmem_WSCC-9bus_Ctrl.cpp | 2 +- .../cxx/CIM/CIGRE_MV_PowerFlowTest.cpp | 2 +- .../CIGRE_MV_PowerFlowTest_LoadProfiles.cpp | 2 +- dpsim/examples/cxx/CIM/DP_CIGRE_MV_withDG.cpp | 4 +-- .../CIM/DP_CIGRE_MV_withDG_withLoadStep.cpp | 4 +-- .../cxx/CIM/DP_CIGRE_MV_withoutDG.cpp | 4 +-- .../examples/cxx/CIM/DP_WSCC-9bus_IdealVS.cpp | 4 +-- .../CIM/DP_WSCC9bus_SGReducedOrderIter.cpp | 4 +-- .../cxx/CIM/DP_WSCC9bus_SGReducedOrderVBR.cpp | 4 +-- .../examples/cxx/CIM/EMT_CIGRE_MV_withDG.cpp | 4 +-- .../CIM/EMT_CIGRE_MV_withDG_withLoadStep.cpp | 4 +-- .../cxx/CIM/EMT_CIGRE_MV_withoutDG.cpp | 4 +-- .../cxx/CIM/EMT_WSCC-9bus_FullOrderSG.cpp | 4 +-- .../cxx/CIM/EMT_WSCC-9bus_IdealCS.cpp | 4 +-- .../cxx/CIM/EMT_WSCC-9bus_IdealVS.cpp | 4 +-- dpsim/examples/cxx/CIM/EMT_WSCC-9bus_VBR.cpp | 4 +-- .../CIM/EMT_WSCC9bus_SGReducedOrderVBR.cpp | 4 +-- .../cxx/CIM/IEEE_LV_PowerFlowTest.cpp | 2 +- dpsim/examples/cxx/CIM/PF_CIGRE_MV_withDG.cpp | 2 +- .../cxx/CIM/SP_WSCC-9bus_CIM_Dyn_Switch.cpp | 2 +- .../cxx/CIM/SP_WSCC9bus_SGReducedOrderVBR.cpp | 4 +-- .../cxx/CIM/Slack_TrafoTapChanger_Load.cpp | 2 +- dpsim/examples/cxx/CIM/Slack_Trafo_Load.cpp | 2 +- dpsim/examples/cxx/CIM/WSCC-9bus_CIM.cpp | 4 +-- dpsim/examples/cxx/CIM/WSCC-9bus_CIM_Dyn.cpp | 2 +- .../cxx/CIM/WSCC-9bus_CIM_Dyn_Switch.cpp | 2 +- .../cxx/CIM/WSCC_9bus_mult_coupled.cpp | 2 +- .../cxx/CIM/WSCC_9bus_mult_decoupled.cpp | 2 +- .../cxx/CIM/WSCC_9bus_mult_diakoptics.cpp | 2 +- .../cxx/Circuits/DP_Basics_DP_Sims.cpp | 12 ++++----- .../cxx/Circuits/DP_Basics_EMT_Sims.cpp | 6 ++--- dpsim/examples/cxx/Circuits/DP_Circuits.cpp | 18 ++++++------- .../cxx/Circuits/DP_DecouplingLine.cpp | 6 ++--- dpsim/examples/cxx/Circuits/DP_Diakoptics.cpp | 8 +++--- .../cxx/Circuits/DP_EMT_RL_SourceStep.cpp | 4 +-- dpsim/examples/cxx/Circuits/DP_PiLine.cpp | 6 ++--- .../Circuits/DP_ReducedOrderSG_SMIB_Fault.cpp | 4 +-- .../DP_ReducedOrderSG_VBR_Load_Fault.cpp | 2 +- ..._SMIB_ReducedOrderSGIterative_LoadStep.cpp | 4 +-- .../DP_SMIB_ReducedOrderSG_LoadStep.cpp | 4 +-- .../DP_Slack_PiLine_PQLoad_with_PF_Init.cpp | 4 +-- .../DP_Slack_PiLine_VSI_Ramp_with_PF_Init.cpp | 4 +-- .../DP_Slack_PiLine_VSI_with_PF_Init.cpp | 4 +-- .../Circuits/DP_SynGenTrStab_3Bus_Fault.cpp | 4 +-- .../DP_SynGenTrStab_3Bus_SteadyState.cpp | 4 +-- .../Circuits/DP_SynGenTrStab_SMIB_Fault.cpp | 4 +-- .../DP_SynGenTrStab_SMIB_SteadyState.cpp | 4 +-- dpsim/examples/cxx/Circuits/DP_VSI.cpp | 2 +- dpsim/examples/cxx/Circuits/DP_VS_RL1.cpp | 2 +- dpsim/examples/cxx/Circuits/EMT_CS_RL1.cpp | 2 +- dpsim/examples/cxx/Circuits/EMT_Circuits.cpp | 18 ++++++------- .../examples/cxx/Circuits/EMT_DP_SP_Slack.cpp | 12 ++++----- .../EMT_DP_SP_Slack_PiLine_PQLoad_FM.cpp | 8 +++--- ...k_PiLine_PQLoad_FrequencyRamp_CosineFM.cpp | 8 +++--- .../examples/cxx/Circuits/EMT_DP_SP_Trafo.cpp | 12 ++++----- .../cxx/Circuits/EMT_DP_SP_VS_Init.cpp | 18 ++++++------- .../cxx/Circuits/EMT_DP_SP_VS_RLC.cpp | 18 ++++++------- dpsim/examples/cxx/Circuits/EMT_PiLine.cpp | 4 +-- .../EMT_ReducedOrderSG_SMIB_Fault.cpp | 4 +-- .../EMT_ReducedOrderSG_VBR_Load_Fault.cpp | 2 +- ..._SMIB_ReducedOrderSGIterative_LoadStep.cpp | 4 +-- .../EMT_SMIB_ReducedOrderSG_LoadStep.cpp | 4 +-- .../EMT_Slack_PiLine_PQLoad_with_PF_Init.cpp | 4 +-- ...EMT_Slack_PiLine_VSI_Ramp_with_PF_Init.cpp | 4 +-- .../EMT_Slack_PiLine_VSI_with_PF_Init.cpp | 4 +-- .../EMT_SynGen4OrderIter_SMIB_Fault.cpp | 4 +-- ...DQ7odTrapez_DP_SynGenTrStab_SMIB_Fault.cpp | 12 ++++----- ...7odTrapez_OperationalParams_SMIB_Fault.cpp | 4 +-- ...onalParams_SMIB_Fault_JsonSyngenParams.cpp | 4 +-- .../EMT_SynGenDQ7odTrapez_SMIB_Fault.cpp | 4 +-- .../Circuits/EMT_SynGenTrStab_SMIB_Fault.cpp | 4 +-- .../EMT_SynGenTrStab_SMIB_SteadyState.cpp | 4 +-- ...SynGenVBR_OperationalParams_SMIB_Fault.cpp | 10 +++---- .../cxx/Circuits/EMT_SynGenVBR_SMIB_Fault.cpp | 4 +-- dpsim/examples/cxx/Circuits/EMT_VSI.cpp | 6 ++--- dpsim/examples/cxx/Circuits/EMT_VS_RL1.cpp | 2 +- .../cxx/Circuits/PF_Slack_PiLine_PQLoad.cpp | 2 +- dpsim/examples/cxx/Circuits/SP_Circuits.cpp | 4 +-- dpsim/examples/cxx/Circuits/SP_PiLine.cpp | 4 +-- .../Circuits/SP_ReducedOrderSG_SMIB_Fault.cpp | 4 +-- .../SP_ReducedOrderSG_VBR_Load_Fault.cpp | 2 +- .../SP_SMIB_ReducedOrderSG_LoadStep.cpp | 4 +-- .../SP_Slack_PiLine_PQLoad_with_PF_Init.cpp | 4 +-- .../SP_Slack_PiLine_VSI_Ramp_with_PF_Init.cpp | 4 +-- .../SP_Slack_PiLine_VSI_with_PF_Init.cpp | 4 +-- .../Circuits/SP_SynGenTrStab_3Bus_Fault.cpp | 4 +-- .../SP_SynGenTrStab_3Bus_SteadyState.cpp | 4 +-- .../Circuits/SP_SynGenTrStab_SMIB_Fault.cpp | 4 +-- ...SynGenTrStab_SMIB_Fault_KundurExample1.cpp | 4 +-- .../SP_SynGenTrStab_SMIB_SteadyState.cpp | 4 +-- .../DP_EMT_SynGenDq7odODE_LoadStep.cpp | 4 +-- .../DP_EMT_SynGenDq7odODE_SteadyState.cpp | 4 +-- .../DP_EMT_SynGenDq7odODE_ThreePhFault.cpp | 4 +-- .../DP_EMT_SynGenDq7odTrapez_LoadStep.cpp | 4 +-- .../DP_EMT_SynGenDq7odTrapez_SteadyState.cpp | 4 +-- .../DP_EMT_SynGenDq7odTrapez_ThreePhFault.cpp | 4 +-- .../cxx/Components/DP_Inverter_Grid.cpp | 2 +- .../DP_Multimachine_DQ_Parallel.cpp | 2 +- .../DP_SP_SynGenTrStab_testModels.cpp | 8 +++--- ..._SP_SynGenTrStab_testModels_doubleLine.cpp | 8 +++--- .../DP_SynGenDq7odODE_SteadyState.cpp | 2 +- .../DP_SynGenDq7odODE_ThreePhFault.cpp | 2 +- .../DP_SynGenDq7odTrapez_ThreePhFault.cpp | 2 +- .../Components/DP_SynGenTrStab_LoadStep.cpp | 2 +- .../DP_SynGenTrStab_SteadyState.cpp | 2 +- ...rDCIM_LoadStep_TurbineGovernor_Exciter.cpp | 10 +++---- ...erVBR_LoadStep_TurbineGovernor_Exciter.cpp | 8 +++--- dpsim/examples/cxx/Examples.h | 22 ++++++++-------- .../RealTime/RT_CIGRE_MV_PowerFlowTest.cpp | 2 +- dpsim/include/dpsim/DiakopticsSolver.h | 6 ++--- dpsim/include/dpsim/MNASolver.h | 6 ++--- dpsim/include/dpsim/MNASolverDirect.h | 2 +- dpsim/include/dpsim/MNASolverFactory.h | 2 +- dpsim/include/dpsim/Simulation.h | 10 +++---- dpsim/include/dpsim/Solver.h | 1 + dpsim/src/CMakeLists.txt | 1 - dpsim/src/MNASolver.cpp | 4 +-- dpsim/src/Simulation.cpp | 2 +- dpsim/src/pybind/main.cpp | 6 ++--- 134 files changed, 370 insertions(+), 317 deletions(-) rename {dpsim/include/dpsim => dpsim-models/include/dpsim-models}/DataLogger.h (92%) rename {dpsim => dpsim-models}/src/DataLogger.cpp (95%) diff --git a/docs/hugo/content/en/docs/Development/Guidelines.md b/docs/hugo/content/en/docs/Development/Guidelines.md index d74ff8cba1..7c9d8afeeb 100644 --- a/docs/hugo/content/en/docs/Development/Guidelines.md +++ b/docs/hugo/content/en/docs/Development/Guidelines.md @@ -7,7 +7,7 @@ This is a summary of general guidelines for the development of DPsim. ## Logging -There are two ways to log information in DPsim: The `CPS::Logger` (called the **Text Logger**), which can write to `.log` files and to the CLI, as well as the `DPsim::DataLogger` (called the **Data Logger**), which can write to `.csv` files. +There are two ways to log information in DPsim: The `CPS::Logger` (called the **Text Logger**), which can write to `.log` files and to the CLI, as well as the `CPS::DataLogger` (called the **Data Logger**), which can write to `.csv` files. ### Log Levels The log levels that can be used with the Text Logger are as follows: diff --git a/docs/hugo/content/en/docs/Overview/Attributes/index.md b/docs/hugo/content/en/docs/Overview/Attributes/index.md index cf36222e54..794f144f97 100644 --- a/docs/hugo/content/en/docs/Overview/Attributes/index.md +++ b/docs/hugo/content/en/docs/Overview/Attributes/index.md @@ -12,11 +12,11 @@ In general, attributes are instances of the `Attribute` class, but they are u Through the template parameter `T` of the `Attribute` class, attributes can have different value types, most commonly `Real`, `Complex`, `Matrix`, or `MatrixComp`. Additionally, attributes can fall into one of two categories: **Static** attributes have a fixed value which can only be changed explicitly through the attribute's `set`-method or through a mutable reference obtained through `get`. -**Dynamic** attributes on the other hand can dynamically re-compute their value from other attributes every time they are read. This can for example be used to create a scalar attribute of type `Real` whose value always contains the magnitude of another, different attribute of type `Complex`. +**Dynamic** attributes on the other hand can dynamically re-compute their value from other attributes every time they are read. This can for example be used to create a scalar attribute of type `Real` whose value always contains the magnitude of another, different attribute of type `Complex`. Any simulation component or class which inherits from `IdentifiedObject` contains an instance of an `AttributeList`. This list can be used to store all the attributes present in this component and later access them via a `String` instead of having to use the member variable directly. -For reasons of code clarity and runtime safety, the member variables should still be used whenever possible. +For reasons of code clarity and runtime safety, the member variables should still be used whenever possible. ## Creating and Storing Attributes Normally, a new attribute is created by using the `create` or `createDynamic` method of an `AttributeList` object. @@ -24,7 +24,7 @@ These two methods will create a new attribute of the given type and insert it in Afterwards, a pointer to the attribute is returned which can then be stored in a component's member variable. Usually this is done in the component's constructor in an initialization list: -```cpp +```cpp /// Component class Base::Ph1::PiLine public: @@ -53,7 +53,7 @@ Simulation::Simulation(String name, Logger::Level logLevel) : mTimeStep(AttributeStatic::make(0.001)), mSplitSubnets(AttributeStatic::make(true)), mSteadyStateInit(AttributeStatic::make(false)), - //... + //... { // ... } @@ -83,7 +83,7 @@ Real read3 = **attr; //read3 = 0.003 ``` ## Working with Dynamic Attributes -In general, dynamic attributes can be accessed via the same `get` and `set`-methods described above for static attributes. However, +In general, dynamic attributes can be accessed via the same `get` and `set`-methods described above for static attributes. However, dynamic attributes can additionally have **dependencies** on other attributes which affect the behavior of these methods. Usually, this is used to dynamically compute the attribute's value from the value of another attribute. In the simplest case, a dynamic attribute can be set to **reference** another (static or dynamic) attribute using the `setReference`-method. After this method has been called, @@ -150,7 +150,7 @@ required attribute pointer, one can either directly access the public member var auto r1 = DP::Ph1::Resistor::make("r_1"); r1->setParameters(5); -auto logger = DataLogger::make("simName"); +auto logger = CPS::DataLogger::make("simName"); // Access the attribute through the member variable logger->logAttribute("i12", r1->mIntfCurrent); @@ -187,4 +187,4 @@ void DP::Ph1::Inductor::mnaAddPostStepDependencies( } ``` Here, the MNA post step depends on the solution vector of the system, `leftVector`, and modifies `mIntfVoltage` and `mIntfCurrent`. -Therefore, this task needs to be scheduled after the system solution that computes `leftVector` and before tasks that require the voltage and current interface vectors of the inductance, e.g. the task logging these values. \ No newline at end of file +Therefore, this task needs to be scheduled after the system solution that computes `leftVector` and before tasks that require the voltage and current interface vectors of the inductance, e.g. the task logging these values. diff --git a/dpsim/include/dpsim/DataLogger.h b/dpsim-models/include/dpsim-models/DataLogger.h similarity index 92% rename from dpsim/include/dpsim/DataLogger.h rename to dpsim-models/include/dpsim-models/DataLogger.h index e8c7d82de9..5f03ed458c 100644 --- a/dpsim/include/dpsim/DataLogger.h +++ b/dpsim-models/include/dpsim-models/DataLogger.h @@ -12,15 +12,13 @@ #include #include -#include -#include #include #include #include #include #include -namespace DPsim { +namespace CPS { class DataLogger : public SharedFactory { @@ -35,10 +33,6 @@ namespace DPsim { std::map mAttributes; - void logDataLine(Real time, Real data); - void logDataLine(Real time, const Matrix& data); - void logDataLine(Real time, const MatrixComp& data); - public: typedef std::shared_ptr Ptr; typedef std::vector List; @@ -46,6 +40,11 @@ namespace DPsim { DataLogger(Bool enabled = true); DataLogger(String name, Bool enabled = true, UInt downsampling = 1); + void logDataLine(Real time, Real data); + void logDataLine(Real time, std::vector data); + void logDataLine(Real time, const Matrix& data); + void logDataLine(Real time, const MatrixComp& data); + void open(); void close(); void reopen() { @@ -78,7 +77,7 @@ namespace DPsim { for (auto attr : logger.mAttributes) { mAttributeDependencies.push_back(attr.second); } - mModifiedAttributes.push_back(Scheduler::external); + mModifiedAttributes.push_back(nullptr); //nullptr = Scheduler::external, but this cannot be used because the scheduler is not linked yet. } void execute(Real time, Int timeStepCount); diff --git a/dpsim-models/include/dpsim-models/MNASimPowerComp.h b/dpsim-models/include/dpsim-models/MNASimPowerComp.h index 00b9618548..7131f24edb 100644 --- a/dpsim-models/include/dpsim-models/MNASimPowerComp.h +++ b/dpsim-models/include/dpsim-models/MNASimPowerComp.h @@ -15,6 +15,9 @@ namespace CPS { Bool mHasPreStep; Bool mHasPostStep; + protected: + Real mSimulationTime; + public: using Type = VarType; using Ptr = std::shared_ptr>; diff --git a/dpsim-models/include/dpsim-models/TopologicalPowerComp.h b/dpsim-models/include/dpsim-models/TopologicalPowerComp.h index dc0de5bb4f..eda8231776 100644 --- a/dpsim-models/include/dpsim-models/TopologicalPowerComp.h +++ b/dpsim-models/include/dpsim-models/TopologicalPowerComp.h @@ -14,6 +14,7 @@ #include #include +#include #include #include #include @@ -33,6 +34,9 @@ namespace CPS { Logger::Log mSLog; /// Component logger control for internal variables Logger::Level mLogLevel; + // Data logger + DataLogger::Ptr mDataLogger; + /// Determine state of the simulation, e.g. to implement /// special behavior for components during initialization Behaviour mBehaviour = Behaviour::MNASimulation; @@ -50,13 +54,19 @@ namespace CPS { * std::max(Logger::Level::info, logLevel). But because of excessive * logging to Level::info that is currently infeasible. */ mSLog(Logger::get(Logger::LoggerType::COMPONENT, name, logLevel, std::max(Logger::Level::warn, logLevel))), - mLogLevel(logLevel) { } + mLogLevel(logLevel) { + mDataLogger = DataLogger::make(name + "_trace", logLevel == Logger::Level::trace); + } /// Basic constructor that takes name and log level and sets the UID to name as well TopologicalPowerComp(String name, Logger::Level logLevel = Logger::Level::off) : TopologicalPowerComp(name, name, logLevel) { } - /// Destructor - does not do anything - virtual ~TopologicalPowerComp() { } + /// Destructor + virtual ~TopologicalPowerComp() { + if (mDataLogger) { + mDataLogger->close(); + } + } /// Returns nodes connected to this component virtual TopologicalNode::List topologicalNodes() = 0; diff --git a/dpsim-models/src/CMakeLists.txt b/dpsim-models/src/CMakeLists.txt index 79334c602c..efea638215 100644 --- a/dpsim-models/src/CMakeLists.txt +++ b/dpsim-models/src/CMakeLists.txt @@ -1,5 +1,6 @@ add_library(dpsim-models STATIC Logger.cpp + DataLogger.cpp MathUtils.cpp Attribute.cpp TopologicalNode.cpp diff --git a/dpsim-models/src/DP/DP_Ph1_Capacitor.cpp b/dpsim-models/src/DP/DP_Ph1_Capacitor.cpp index 3ed716a2c2..460bbd7519 100644 --- a/dpsim-models/src/DP/DP_Ph1_Capacitor.cpp +++ b/dpsim-models/src/DP/DP_Ph1_Capacitor.cpp @@ -73,6 +73,18 @@ void DP::Ph1::Capacitor::mnaCompInitialize(Real omega, Real timeStep, Attribute< (**mIntfCurrent)(0, freq) = mEquivCond(freq,0) * (**mIntfVoltage)(0,freq) + mEquivCurrent(freq,0); } + #if defined(DEBUG_BUILD) + std::vector columns; + + for (UInt freq = 0; freq < mNumFreqs; freq++) { + columns.push_back("voltage_abs_" + freq); + columns.push_back("voltage_angle_" + freq); + } + + mDataLogger->open(); + mDataLogger->setColumnNames(columns); + #endif + SPDLOG_LOGGER_DEBUG(mSLog, "\n--- MNA initialization ---" "\nInitial voltage {:s}" @@ -240,6 +252,10 @@ void DP::Ph1::Capacitor::MnaPostStepHarm::execute(Real time, Int timeStepCount) void DP::Ph1::Capacitor::mnaCompUpdateVoltage(const Matrix& leftVector) { // v1 - v0 + #if defined(DEBUG_BUILD) + std::vector logData; + #endif + for (UInt freq = 0; freq < mNumFreqs; freq++) { (**mIntfVoltage)(0,freq) = 0; if (terminalNotGrounded(1)) @@ -247,8 +263,16 @@ void DP::Ph1::Capacitor::mnaCompUpdateVoltage(const Matrix& leftVector) { if (terminalNotGrounded(0)) (**mIntfVoltage)(0,freq) = (**mIntfVoltage)(0,freq) - Math::complexFromVectorElement(leftVector, matrixNodeIndex(0), mNumFreqs, freq); - SPDLOG_LOGGER_TRACE(mSLog, "Voltage {:e}<{:e}", std::abs((**mIntfVoltage)(0,freq)), std::arg((**mIntfVoltage)(0,freq))); + #if defined(DEBUG_BUILD) + logData.push_back(std::abs((**mIntfVoltage)(0,freq))); + logData.push_back(std::arg((**mIntfVoltage)(0,freq))); + #endif } + + #if defined(DEBUG_BUILD) + mDataLogger->logDataLine(mSimulationTime, logData); + #endif + } void DP::Ph1::Capacitor::mnaCompUpdateVoltageHarm(const Matrix& leftVector, Int freqIdx) { diff --git a/dpsim/src/DataLogger.cpp b/dpsim-models/src/DataLogger.cpp similarity index 95% rename from dpsim/src/DataLogger.cpp rename to dpsim-models/src/DataLogger.cpp index 618f13aca5..6286d3aa5d 100644 --- a/dpsim/src/DataLogger.cpp +++ b/dpsim-models/src/DataLogger.cpp @@ -8,10 +8,10 @@ #include -#include +#include #include -using namespace DPsim; +using namespace CPS; DataLogger::DataLogger(Bool enabled) : mLogFile(), @@ -34,6 +34,9 @@ DataLogger::DataLogger(String name, Bool enabled, UInt downsampling) : } void DataLogger::open() { + if (!mEnabled) { + return; + } mLogFile = std::ofstream(mFilename, std::ios_base::out|std::ios_base::trunc); if (!mLogFile.is_open()) { // TODO: replace by exception @@ -43,7 +46,9 @@ void DataLogger::open() { } void DataLogger::close() { - mLogFile.close(); + if (mLogFile) { + mLogFile.close(); + } } void DataLogger::setColumnNames(std::vector names) { @@ -65,6 +70,16 @@ void DataLogger::logDataLine(Real time, Real data) { mLogFile << '\n'; } +void DataLogger::logDataLine(Real time, std::vector data) { + if (!mEnabled) + return; + + mLogFile << std::scientific << std::right << std::setw(14) << time; + for (const auto& it : data) + mLogFile << ", " << std::right << std::setw(13) << it; + mLogFile << '\n'; +} + void DataLogger::logDataLine(Real time, const Matrix& data) { if (!mEnabled) return; diff --git a/dpsim-models/src/MNASimPowerComp.cpp b/dpsim-models/src/MNASimPowerComp.cpp index 680cb66e5a..de11fb3e7a 100644 --- a/dpsim-models/src/MNASimPowerComp.cpp +++ b/dpsim-models/src/MNASimPowerComp.cpp @@ -63,6 +63,7 @@ void MNASimPowerComp::mnaUpdateCurrent(const Matrix& leftVector) { template void MNASimPowerComp::mnaPreStep(Real time, Int timeStepCount) { + mSimulationTime = time; this->mnaCompPreStep(time, timeStepCount); }; diff --git a/dpsim-villas/examples/cxx/FileExample.cpp b/dpsim-villas/examples/cxx/FileExample.cpp index 51376ec5d8..35e6f75f53 100644 --- a/dpsim-villas/examples/cxx/FileExample.cpp +++ b/dpsim-villas/examples/cxx/FileExample.cpp @@ -49,7 +49,7 @@ int main(int argc, char* argv[]) { sim.setSystem(sys); sim.setTimeStep(timeStep); sim.setFinalTime(10.0); - + std::string fileConfig = R"STRING({ "type": "file", "uri": "logs/output.csv", @@ -67,7 +67,7 @@ int main(int argc, char* argv[]) { sim.addInterface(intf); // Logger - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->mVoltage); logger->logAttribute("v2", n2->mVoltage); logger->logAttribute("v3", n3->mVoltage); diff --git a/dpsim-villas/examples/cxx/MqttExample.cpp b/dpsim-villas/examples/cxx/MqttExample.cpp index 1d259d483f..0c8be5ec79 100644 --- a/dpsim-villas/examples/cxx/MqttExample.cpp +++ b/dpsim-villas/examples/cxx/MqttExample.cpp @@ -49,7 +49,7 @@ int main(int argc, char* argv[]) { sim.setSystem(sys); sim.setTimeStep(timeStep); sim.setFinalTime(10.0); - + std::string mqttConfig = R"STRING({ "type": "mqtt", "format": "json", @@ -71,7 +71,7 @@ int main(int argc, char* argv[]) { intf->exportAttribute(ll->mIntfCurrent->deriveCoeff(0, 0), 1, true, "v_load"); // Logger - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->mVoltage); logger->logAttribute("v2", n2->mVoltage); logger->logAttribute("v3", n3->mVoltage); diff --git a/dpsim-villas/examples/cxx/SharedMemExample.cpp b/dpsim-villas/examples/cxx/SharedMemExample.cpp index c7330b4839..f23172ed39 100644 --- a/dpsim-villas/examples/cxx/SharedMemExample.cpp +++ b/dpsim-villas/examples/cxx/SharedMemExample.cpp @@ -49,7 +49,7 @@ int main(int argc, char* argv[]) { sim.setSystem(sys); sim.setTimeStep(timeStep); sim.setFinalTime(2.0); - + std::string shmemConfig = R"STRING( { "type": "shmem", @@ -71,7 +71,7 @@ int main(int argc, char* argv[]) { sim.addInterface(intf); // Logger - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->mVoltage); logger->logAttribute("v2", n2->mVoltage); logger->logAttribute("v3", n3->mVoltage); diff --git a/dpsim-villas/examples/cxx/ShmemDistributedDirect.cpp b/dpsim-villas/examples/cxx/ShmemDistributedDirect.cpp index 1bbf58441d..4be7d708af 100644 --- a/dpsim-villas/examples/cxx/ShmemDistributedDirect.cpp +++ b/dpsim-villas/examples/cxx/ShmemDistributedDirect.cpp @@ -69,7 +69,7 @@ int main(int argc, char *argv[]) { sim.setFinalTime(finalTime); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->mVoltage); logger->logAttribute("v2", n2->mVoltage); logger->logAttribute("r12", r12->mIntfCurrent); @@ -117,7 +117,7 @@ int main(int argc, char *argv[]) { sim.setFinalTime(finalTime); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v2", n2->mVoltage); logger->logAttribute("r02", r02->mIntfCurrent); logger->logAttribute("vecs", ecs->mIntfVoltage); diff --git a/dpsim-villas/examples/cxx/ShmemDistributedReference.cpp b/dpsim-villas/examples/cxx/ShmemDistributedReference.cpp index 284dcb82cd..329b3e0490 100644 --- a/dpsim-villas/examples/cxx/ShmemDistributedReference.cpp +++ b/dpsim-villas/examples/cxx/ShmemDistributedReference.cpp @@ -34,7 +34,7 @@ int main(int argc, char* argv[]) { SystemComponentList{ vs1, r12, r02 }); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->mVoltage); logger->logAttribute("v2", n2->mVoltage); logger->logAttribute("r12", r12->mIntfCurrent); diff --git a/dpsim-villas/examples/cxx/ShmemExample.cpp b/dpsim-villas/examples/cxx/ShmemExample.cpp index c26affb4c3..90c1b9e8cb 100644 --- a/dpsim-villas/examples/cxx/ShmemExample.cpp +++ b/dpsim-villas/examples/cxx/ShmemExample.cpp @@ -65,7 +65,7 @@ int main(int argc, char* argv[]) { sim.addInterface(std::shared_ptr(&intf)); // Logger - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->mVoltage); logger->logAttribute("v2", n2->mVoltage); logger->logAttribute("v3", n3->mVoltage); diff --git a/dpsim-villas/examples/cxx/Shmem_WSCC-9bus_Ctrl.cpp b/dpsim-villas/examples/cxx/Shmem_WSCC-9bus_Ctrl.cpp index ff961e7ecf..b6b35331be 100644 --- a/dpsim-villas/examples/cxx/Shmem_WSCC-9bus_Ctrl.cpp +++ b/dpsim-villas/examples/cxx/Shmem_WSCC-9bus_Ctrl.cpp @@ -69,7 +69,7 @@ int main(int argc, char *argv[]) { InterfaceShmem intf("/dpsim1-villas", "/villas-dpsim1", nullptr, false); - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); // Register exportable node voltages UInt o = 0; diff --git a/dpsim/examples/cxx/CIM/CIGRE_MV_PowerFlowTest.cpp b/dpsim/examples/cxx/CIM/CIGRE_MV_PowerFlowTest.cpp index 93f77d7609..88f394f4e3 100644 --- a/dpsim/examples/cxx/CIM/CIGRE_MV_PowerFlowTest.cpp +++ b/dpsim/examples/cxx/CIM/CIGRE_MV_PowerFlowTest.cpp @@ -40,7 +40,7 @@ int main(int argc, char** argv){ CIM::Reader reader(Logger::Level::info, Logger::Level::off, Logger::Level::info); SystemTopology system = reader.loadCIM(system_freq, filenames, CPS::Domain::SP); - auto logger = DPsim::DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); for (auto node : system.mNodes) { logger->logAttribute(node->name() + ".V", node->attribute("v")); diff --git a/dpsim/examples/cxx/CIM/CIGRE_MV_PowerFlowTest_LoadProfiles.cpp b/dpsim/examples/cxx/CIM/CIGRE_MV_PowerFlowTest_LoadProfiles.cpp index 9e1f395bc3..6c35e27ea6 100644 --- a/dpsim/examples/cxx/CIM/CIGRE_MV_PowerFlowTest_LoadProfiles.cpp +++ b/dpsim/examples/cxx/CIM/CIGRE_MV_PowerFlowTest_LoadProfiles.cpp @@ -76,7 +76,7 @@ int main(int argc, char** argv){ CSVReader csvreader(loadProfilePath, assignList, Logger::Level::info); csvreader.assignLoadProfile(system, time_begin, time_step, time_end, CSVReader::Mode::MANUAL); - auto logger = DPsim::DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); for (auto node : system.mNodes) { logger->logAttribute(node->name(), node->attribute("v")); diff --git a/dpsim/examples/cxx/CIM/DP_CIGRE_MV_withDG.cpp b/dpsim/examples/cxx/CIM/DP_CIGRE_MV_withDG.cpp index d67b426781..26092523cc 100644 --- a/dpsim/examples/cxx/CIM/DP_CIGRE_MV_withDG.cpp +++ b/dpsim/examples/cxx/CIM/DP_CIGRE_MV_withDG.cpp @@ -54,7 +54,7 @@ int main(int argc, char** argv){ Examples::Grids::CIGREMV::addInvertersToCIGREMV(systemPF, scenario, Domain::SP); // define logging - auto loggerPF = DPsim::DataLogger::make(simNamePF); + auto loggerPF = CPS::DataLogger::make(simNamePF); for (auto node : systemPF.mNodes) { loggerPF->logAttribute(node->name() + ".V", node->attribute("v")); @@ -80,7 +80,7 @@ int main(int argc, char** argv){ Examples::Grids::CIGREMV::addInvertersToCIGREMV(systemDP, scenario, Domain::DP); systemDP.initWithPowerflow(systemPF); - auto logger = DPsim::DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); // log node voltages for (auto node : systemDP.mNodes) diff --git a/dpsim/examples/cxx/CIM/DP_CIGRE_MV_withDG_withLoadStep.cpp b/dpsim/examples/cxx/CIM/DP_CIGRE_MV_withDG_withLoadStep.cpp index 1d330f1c6c..356ff7d105 100644 --- a/dpsim/examples/cxx/CIM/DP_CIGRE_MV_withDG_withLoadStep.cpp +++ b/dpsim/examples/cxx/CIM/DP_CIGRE_MV_withDG_withLoadStep.cpp @@ -51,7 +51,7 @@ int main(int argc, char** argv){ Examples::Grids::CIGREMV::addInvertersToCIGREMV(systemPF, scenario, Domain::SP); // define logging - auto loggerPF = DPsim::DataLogger::make(simNamePF); + auto loggerPF = CPS::DataLogger::make(simNamePF); for (auto node : systemPF.mNodes) { loggerPF->logAttribute(node->name() + ".V", node->attribute("v")); } @@ -76,7 +76,7 @@ int main(int argc, char** argv){ Examples::Grids::CIGREMV::addInvertersToCIGREMV(systemDP, scenario, Domain::DP); systemDP.initWithPowerflow(systemPF); - auto logger = DPsim::DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); // log node voltages for (auto node : systemDP.mNodes) diff --git a/dpsim/examples/cxx/CIM/DP_CIGRE_MV_withoutDG.cpp b/dpsim/examples/cxx/CIM/DP_CIGRE_MV_withoutDG.cpp index 21b8a948fd..a1c6807e91 100644 --- a/dpsim/examples/cxx/CIM/DP_CIGRE_MV_withoutDG.cpp +++ b/dpsim/examples/cxx/CIM/DP_CIGRE_MV_withoutDG.cpp @@ -50,7 +50,7 @@ int main(int argc, char** argv){ CIM::Reader reader(Logger::Level::debug, Logger::Level::off, Logger::Level::debug); SystemTopology systemPF = reader.loadCIM(systemFrequency, filenames, CPS::Domain::SP); - auto loggerPF = DPsim::DataLogger::make(simNamePF); + auto loggerPF = CPS::DataLogger::make(simNamePF); for (auto node : systemPF.mNodes) { loggerPF->logAttribute(node->name() + ".V", node->attribute("v")); @@ -72,7 +72,7 @@ int main(int argc, char** argv){ SystemTopology systemDP = reader2.loadCIM(systemFrequency, filenames, CPS::Domain::DP); systemDP.initWithPowerflow(systemPF); - auto logger = DPsim::DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); // log node voltages for (auto node : systemDP.mNodes) diff --git a/dpsim/examples/cxx/CIM/DP_WSCC-9bus_IdealVS.cpp b/dpsim/examples/cxx/CIM/DP_WSCC-9bus_IdealVS.cpp index 1e4ad5e525..bf053c1e02 100644 --- a/dpsim/examples/cxx/CIM/DP_WSCC-9bus_IdealVS.cpp +++ b/dpsim/examples/cxx/CIM/DP_WSCC-9bus_IdealVS.cpp @@ -49,7 +49,7 @@ int main(int argc, char *argv[]) { systemPF.component("GEN1")->modifyPowerFlowBusType(CPS::PowerflowBusType::VD); // define logging - auto loggerPF = DPsim::DataLogger::make(simNamePF); + auto loggerPF = CPS::DataLogger::make(simNamePF); for (auto node : systemPF.mNodes) { loggerPF->logAttribute(node->name() + ".V", node->attribute("v")); @@ -75,7 +75,7 @@ int main(int argc, char *argv[]) { sys.initWithPowerflow(systemPF); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", sys.node("BUS1")->attribute("v")); logger->logAttribute("v2", sys.node("BUS2")->attribute("v")); logger->logAttribute("v3", sys.node("BUS3")->attribute("v")); diff --git a/dpsim/examples/cxx/CIM/DP_WSCC9bus_SGReducedOrderIter.cpp b/dpsim/examples/cxx/CIM/DP_WSCC9bus_SGReducedOrderIter.cpp index 25326c661b..fac623392f 100644 --- a/dpsim/examples/cxx/CIM/DP_WSCC9bus_SGReducedOrderIter.cpp +++ b/dpsim/examples/cxx/CIM/DP_WSCC9bus_SGReducedOrderIter.cpp @@ -93,7 +93,7 @@ int main(int argc, char *argv[]) { systemPF.component("GEN1")->modifyPowerFlowBusType(CPS::PowerflowBusType::VD); // define logging - auto loggerPF = DPsim::DataLogger::make(simNamePF); + auto loggerPF = CPS::DataLogger::make(simNamePF); for (auto node : systemPF.mNodes) loggerPF->logAttribute(node->name() + ".V", node->attribute("v")); @@ -150,7 +150,7 @@ int main(int argc, char *argv[]) { // Logging // log node voltage - auto logger = DataLogger::make(simName, true, logDownSampling); + auto logger = CPS::DataLogger::make(simName, true, logDownSampling); for (auto node : sys.mNodes) logger->logAttribute(node->name() + ".V", node->attribute("v")); diff --git a/dpsim/examples/cxx/CIM/DP_WSCC9bus_SGReducedOrderVBR.cpp b/dpsim/examples/cxx/CIM/DP_WSCC9bus_SGReducedOrderVBR.cpp index 34fdc24be4..45fd56994b 100644 --- a/dpsim/examples/cxx/CIM/DP_WSCC9bus_SGReducedOrderVBR.cpp +++ b/dpsim/examples/cxx/CIM/DP_WSCC9bus_SGReducedOrderVBR.cpp @@ -96,7 +96,7 @@ int main(int argc, char *argv[]) { systemPF.component("GEN1")->modifyPowerFlowBusType(CPS::PowerflowBusType::VD); // define logging - auto loggerPF = DPsim::DataLogger::make(simNamePF); + auto loggerPF = CPS::DataLogger::make(simNamePF); for (auto node : systemPF.mNodes) loggerPF->logAttribute(node->name() + ".V", node->attribute("v")); @@ -147,7 +147,7 @@ int main(int argc, char *argv[]) { // Logging // log node voltage - auto logger = DataLogger::make(simName, true, logDownSampling); + auto logger = CPS::DataLogger::make(simName, true, logDownSampling); for (auto node : sys.mNodes) logger->logAttribute(node->name() + ".V", node->attribute("v")); diff --git a/dpsim/examples/cxx/CIM/EMT_CIGRE_MV_withDG.cpp b/dpsim/examples/cxx/CIM/EMT_CIGRE_MV_withDG.cpp index d1cd584b5d..c371de2b7c 100644 --- a/dpsim/examples/cxx/CIM/EMT_CIGRE_MV_withDG.cpp +++ b/dpsim/examples/cxx/CIM/EMT_CIGRE_MV_withDG.cpp @@ -51,7 +51,7 @@ int main(int argc, char** argv){ Examples::Grids::CIGREMV::addInvertersToCIGREMV(systemPF, scenario, Domain::SP); // define logging - auto loggerPF = DPsim::DataLogger::make(simNamePF); + auto loggerPF = CPS::DataLogger::make(simNamePF); for (auto node : systemPF.mNodes) { loggerPF->logAttribute(node->name() + ".V", node->attribute("v")); @@ -77,7 +77,7 @@ int main(int argc, char** argv){ Examples::Grids::CIGREMV::addInvertersToCIGREMV(systemEMT, scenario, Domain::EMT); systemEMT.initWithPowerflow(systemPF); - auto logger = DPsim::DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); // log node voltages for (auto node : systemEMT.mNodes) diff --git a/dpsim/examples/cxx/CIM/EMT_CIGRE_MV_withDG_withLoadStep.cpp b/dpsim/examples/cxx/CIM/EMT_CIGRE_MV_withDG_withLoadStep.cpp index 971856ec10..3d7b91c136 100644 --- a/dpsim/examples/cxx/CIM/EMT_CIGRE_MV_withDG_withLoadStep.cpp +++ b/dpsim/examples/cxx/CIM/EMT_CIGRE_MV_withDG_withLoadStep.cpp @@ -51,7 +51,7 @@ int main(int argc, char** argv){ Examples::Grids::CIGREMV::addInvertersToCIGREMV(systemPF, scenario, Domain::SP); // define logging - auto loggerPF = DPsim::DataLogger::make(simNamePF); + auto loggerPF = CPS::DataLogger::make(simNamePF); for (auto node : systemPF.mNodes) { loggerPF->logAttribute(node->name() + ".V", node->attribute("v")); @@ -77,7 +77,7 @@ int main(int argc, char** argv){ Examples::Grids::CIGREMV::addInvertersToCIGREMV(systemEMT, scenario, Domain::EMT); systemEMT.initWithPowerflow(systemPF); - auto logger = DPsim::DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); // log node voltages for (auto node : systemEMT.mNodes) diff --git a/dpsim/examples/cxx/CIM/EMT_CIGRE_MV_withoutDG.cpp b/dpsim/examples/cxx/CIM/EMT_CIGRE_MV_withoutDG.cpp index 8d1e3d5cb0..b3c142a49a 100644 --- a/dpsim/examples/cxx/CIM/EMT_CIGRE_MV_withoutDG.cpp +++ b/dpsim/examples/cxx/CIM/EMT_CIGRE_MV_withoutDG.cpp @@ -47,7 +47,7 @@ int main(int argc, char** argv){ CIM::Reader reader(Logger::Level::debug, Logger::Level::off, Logger::Level::debug); SystemTopology systemPF = reader.loadCIM(systemFrequency, filenames, CPS::Domain::SP); - auto loggerPF = DPsim::DataLogger::make(simNamePF); + auto loggerPF = CPS::DataLogger::make(simNamePF); for (auto node : systemPF.mNodes) { loggerPF->logAttribute(node->name() + ".V", node->attribute("v")); @@ -70,7 +70,7 @@ int main(int argc, char** argv){ SystemTopology systemEMT = reader2.loadCIM(systemFrequency, filenames, CPS::Domain::EMT, PhaseType::ABC); systemEMT.initWithPowerflow(systemPF); - auto logger = DPsim::DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); // log node voltages for (auto node : systemEMT.mNodes) diff --git a/dpsim/examples/cxx/CIM/EMT_WSCC-9bus_FullOrderSG.cpp b/dpsim/examples/cxx/CIM/EMT_WSCC-9bus_FullOrderSG.cpp index 45b12f3543..c71d16ea9e 100644 --- a/dpsim/examples/cxx/CIM/EMT_WSCC-9bus_FullOrderSG.cpp +++ b/dpsim/examples/cxx/CIM/EMT_WSCC-9bus_FullOrderSG.cpp @@ -49,7 +49,7 @@ int main(int argc, char *argv[]) { systemPF.component("GEN1")->modifyPowerFlowBusType(CPS::PowerflowBusType::VD); // define logging - auto loggerPF = DPsim::DataLogger::make(simNamePF); + auto loggerPF = CPS::DataLogger::make(simNamePF); for (auto node : systemPF.mNodes) { loggerPF->logAttribute(node->name() + ".V", node->attribute("v")); @@ -82,7 +82,7 @@ int main(int argc, char *argv[]) { } // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", sys.node("BUS1")->attribute("v")); logger->logAttribute("v2", sys.node("BUS2")->attribute("v")); logger->logAttribute("v3", sys.node("BUS3")->attribute("v")); diff --git a/dpsim/examples/cxx/CIM/EMT_WSCC-9bus_IdealCS.cpp b/dpsim/examples/cxx/CIM/EMT_WSCC-9bus_IdealCS.cpp index 91ec37dd4f..6802213821 100644 --- a/dpsim/examples/cxx/CIM/EMT_WSCC-9bus_IdealCS.cpp +++ b/dpsim/examples/cxx/CIM/EMT_WSCC-9bus_IdealCS.cpp @@ -49,7 +49,7 @@ int main(int argc, char *argv[]) { systemPF.component("GEN1")->modifyPowerFlowBusType(CPS::PowerflowBusType::VD); // define logging - auto loggerPF = DPsim::DataLogger::make(simNamePF); + auto loggerPF = CPS::DataLogger::make(simNamePF); for (auto node : systemPF.mNodes) { loggerPF->logAttribute(node->name() + ".V", node->attribute("v")); @@ -82,7 +82,7 @@ int main(int argc, char *argv[]) { } // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", sys.node("BUS1")->attribute("v")); logger->logAttribute("v2", sys.node("BUS2")->attribute("v")); logger->logAttribute("v3", sys.node("BUS3")->attribute("v")); diff --git a/dpsim/examples/cxx/CIM/EMT_WSCC-9bus_IdealVS.cpp b/dpsim/examples/cxx/CIM/EMT_WSCC-9bus_IdealVS.cpp index e508657ec8..cfab96b017 100644 --- a/dpsim/examples/cxx/CIM/EMT_WSCC-9bus_IdealVS.cpp +++ b/dpsim/examples/cxx/CIM/EMT_WSCC-9bus_IdealVS.cpp @@ -49,7 +49,7 @@ int main(int argc, char *argv[]) { systemPF.component("GEN1")->modifyPowerFlowBusType(CPS::PowerflowBusType::VD); // define logging - auto loggerPF = DPsim::DataLogger::make(simNamePF); + auto loggerPF = CPS::DataLogger::make(simNamePF); for (auto node : systemPF.mNodes) { loggerPF->logAttribute(node->name() + ".V", node->attribute("v")); @@ -75,7 +75,7 @@ int main(int argc, char *argv[]) { sys.initWithPowerflow(systemPF); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", sys.node("BUS1")->attribute("v")); logger->logAttribute("v2", sys.node("BUS2")->attribute("v")); logger->logAttribute("v3", sys.node("BUS3")->attribute("v")); diff --git a/dpsim/examples/cxx/CIM/EMT_WSCC-9bus_VBR.cpp b/dpsim/examples/cxx/CIM/EMT_WSCC-9bus_VBR.cpp index 90e1a5a1ed..33b51cc75a 100644 --- a/dpsim/examples/cxx/CIM/EMT_WSCC-9bus_VBR.cpp +++ b/dpsim/examples/cxx/CIM/EMT_WSCC-9bus_VBR.cpp @@ -52,7 +52,7 @@ int main(int argc, char *argv[]) { systemPF.component("GEN1")->modifyPowerFlowBusType(CPS::PowerflowBusType::VD); // define logging - auto loggerPF = DPsim::DataLogger::make(simNamePF); + auto loggerPF = CPS::DataLogger::make(simNamePF); for (auto node : systemPF.mNodes) { loggerPF->logAttribute(node->name() + ".V", node->attribute("v")); @@ -85,7 +85,7 @@ int main(int argc, char *argv[]) { } // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", sys.node("BUS1")->attribute("v")); logger->logAttribute("v2", sys.node("BUS2")->attribute("v")); logger->logAttribute("v3", sys.node("BUS3")->attribute("v")); diff --git a/dpsim/examples/cxx/CIM/EMT_WSCC9bus_SGReducedOrderVBR.cpp b/dpsim/examples/cxx/CIM/EMT_WSCC9bus_SGReducedOrderVBR.cpp index 490ea50bcf..20d46d12c5 100644 --- a/dpsim/examples/cxx/CIM/EMT_WSCC9bus_SGReducedOrderVBR.cpp +++ b/dpsim/examples/cxx/CIM/EMT_WSCC9bus_SGReducedOrderVBR.cpp @@ -93,7 +93,7 @@ int main(int argc, char *argv[]) { systemPF.component("GEN1")->modifyPowerFlowBusType(CPS::PowerflowBusType::VD); // // define logging - auto loggerPF = DPsim::DataLogger::make(simNamePF); + auto loggerPF = CPS::DataLogger::make(simNamePF); for (auto node : systemPF.mNodes) loggerPF->logAttribute(node->name() + ".V", node->attribute("v")); @@ -144,7 +144,7 @@ int main(int argc, char *argv[]) { // Logging // log node voltage - auto logger = DataLogger::make(simName, true, logDownSampling); + auto logger = CPS::DataLogger::make(simName, true, logDownSampling); for (auto node : sys.mNodes) logger->logAttribute(node->name() + ".V", node->attribute("v")); diff --git a/dpsim/examples/cxx/CIM/IEEE_LV_PowerFlowTest.cpp b/dpsim/examples/cxx/CIM/IEEE_LV_PowerFlowTest.cpp index 922ca05d23..22f1bcfd4b 100644 --- a/dpsim/examples/cxx/CIM/IEEE_LV_PowerFlowTest.cpp +++ b/dpsim/examples/cxx/CIM/IEEE_LV_PowerFlowTest.cpp @@ -40,7 +40,7 @@ int main(int argc, char** argv){ CIM::Reader reader(Logger::Level::info, Logger::Level::off, Logger::Level::off); SystemTopology system = reader.loadCIM(system_freq, filenames, CPS::Domain::SP); - auto logger = DPsim::DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); for (auto node : system.mNodes) { logger->logAttribute(node->name() + ".V", node->attribute("v")); diff --git a/dpsim/examples/cxx/CIM/PF_CIGRE_MV_withDG.cpp b/dpsim/examples/cxx/CIM/PF_CIGRE_MV_withDG.cpp index a9071a7a6c..095a4aad61 100644 --- a/dpsim/examples/cxx/CIM/PF_CIGRE_MV_withDG.cpp +++ b/dpsim/examples/cxx/CIM/PF_CIGRE_MV_withDG.cpp @@ -43,7 +43,7 @@ int main(int argc, char** argv){ SystemTopology system = reader.loadCIM(scenario.systemFrequency, filenames, Domain::SP); Examples::Grids::CIGREMV::addInvertersToCIGREMV(system, scenario, Domain::SP); - auto loggerPF = DPsim::DataLogger::make(simName); + auto loggerPF = CPS::DataLogger::make(simName); for (auto node : system.mNodes) { loggerPF->logAttribute(node->name() + ".V", node->attribute("v")); diff --git a/dpsim/examples/cxx/CIM/SP_WSCC-9bus_CIM_Dyn_Switch.cpp b/dpsim/examples/cxx/CIM/SP_WSCC-9bus_CIM_Dyn_Switch.cpp index 78565c2e0c..553fb8cb03 100644 --- a/dpsim/examples/cxx/CIM/SP_WSCC-9bus_CIM_Dyn_Switch.cpp +++ b/dpsim/examples/cxx/CIM/SP_WSCC-9bus_CIM_Dyn_Switch.cpp @@ -49,7 +49,7 @@ int main(int argc, char *argv[]) { sys.component("GEN3")->setModelFlags(false); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", sys.node("BUS1")->attribute("v")); logger->logAttribute("v2", sys.node("BUS2")->attribute("v")); logger->logAttribute("v3", sys.node("BUS3")->attribute("v")); diff --git a/dpsim/examples/cxx/CIM/SP_WSCC9bus_SGReducedOrderVBR.cpp b/dpsim/examples/cxx/CIM/SP_WSCC9bus_SGReducedOrderVBR.cpp index 25ab577cff..b5bb0ff3f1 100644 --- a/dpsim/examples/cxx/CIM/SP_WSCC9bus_SGReducedOrderVBR.cpp +++ b/dpsim/examples/cxx/CIM/SP_WSCC9bus_SGReducedOrderVBR.cpp @@ -90,7 +90,7 @@ int main(int argc, char *argv[]) { systemPF.component("GEN1")->modifyPowerFlowBusType(CPS::PowerflowBusType::VD); // define logging - auto loggerPF = DPsim::DataLogger::make(simNamePF); + auto loggerPF = CPS::DataLogger::make(simNamePF); for (auto node : systemPF.mNodes) loggerPF->logAttribute(node->name() + ".V", node->attribute("v")); @@ -140,7 +140,7 @@ int main(int argc, char *argv[]) { // Logging // log node voltage - auto logger = DataLogger::make(simName, true, logDownSampling); + auto logger = CPS::DataLogger::make(simName, true, logDownSampling); for (auto node : sys.mNodes) logger->logAttribute(node->name() + ".V", node->attribute("v")); diff --git a/dpsim/examples/cxx/CIM/Slack_TrafoTapChanger_Load.cpp b/dpsim/examples/cxx/CIM/Slack_TrafoTapChanger_Load.cpp index 4a818f2e3f..9357307f4f 100644 --- a/dpsim/examples/cxx/CIM/Slack_TrafoTapChanger_Load.cpp +++ b/dpsim/examples/cxx/CIM/Slack_TrafoTapChanger_Load.cpp @@ -40,7 +40,7 @@ int main(int argc, char** argv){ CIM::Reader reader(Logger::Level::info, Logger::Level::off, Logger::Level::debug); SystemTopology system = reader.loadCIM(system_freq, filenames, CPS::Domain::SP); - auto logger = DPsim::DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); for (auto node : system.mNodes) { logger->logAttribute(node->name() + ".V", node->attribute("v")); diff --git a/dpsim/examples/cxx/CIM/Slack_Trafo_Load.cpp b/dpsim/examples/cxx/CIM/Slack_Trafo_Load.cpp index e1fb67fc93..b023b0890c 100644 --- a/dpsim/examples/cxx/CIM/Slack_Trafo_Load.cpp +++ b/dpsim/examples/cxx/CIM/Slack_Trafo_Load.cpp @@ -40,7 +40,7 @@ int main(int argc, char** argv){ CIM::Reader reader(Logger::Level::info, Logger::Level::off, Logger::Level::debug); SystemTopology system = reader.loadCIM(system_freq, filenames, CPS::Domain::SP); - auto logger = DPsim::DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); for (auto node : system.mNodes) { logger->logAttribute(node->name() + ".V", node->attribute("v")); diff --git a/dpsim/examples/cxx/CIM/WSCC-9bus_CIM.cpp b/dpsim/examples/cxx/CIM/WSCC-9bus_CIM.cpp index cf988d3f73..23268edb11 100644 --- a/dpsim/examples/cxx/CIM/WSCC-9bus_CIM.cpp +++ b/dpsim/examples/cxx/CIM/WSCC-9bus_CIM.cpp @@ -49,7 +49,7 @@ int main(int argc, char *argv[]) { systemPF.component("GEN1")->modifyPowerFlowBusType(CPS::PowerflowBusType::VD); // define logging - auto loggerPF = DPsim::DataLogger::make(simNamePF); + auto loggerPF = CPS::DataLogger::make(simNamePF); for (auto node : systemPF.mNodes) { loggerPF->logAttribute(node->name() + ".V", node->attribute("v")); @@ -75,7 +75,7 @@ int main(int argc, char *argv[]) { sys.initWithPowerflow(systemPF); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", sys.node("BUS1")->attribute("v")); logger->logAttribute("v2", sys.node("BUS2")->attribute("v")); logger->logAttribute("v3", sys.node("BUS3")->attribute("v")); diff --git a/dpsim/examples/cxx/CIM/WSCC-9bus_CIM_Dyn.cpp b/dpsim/examples/cxx/CIM/WSCC-9bus_CIM_Dyn.cpp index e9792441c1..777399f64c 100644 --- a/dpsim/examples/cxx/CIM/WSCC-9bus_CIM_Dyn.cpp +++ b/dpsim/examples/cxx/CIM/WSCC-9bus_CIM_Dyn.cpp @@ -37,7 +37,7 @@ int main(int argc, char *argv[]) { SystemTopology sys = reader.loadCIM(60, filenames, Domain::DP, PhaseType::Single, CPS::GeneratorType::TransientStability); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", sys.node("BUS1")->attribute("v")); logger->logAttribute("v2", sys.node("BUS2")->attribute("v")); logger->logAttribute("v3", sys.node("BUS3")->attribute("v")); diff --git a/dpsim/examples/cxx/CIM/WSCC-9bus_CIM_Dyn_Switch.cpp b/dpsim/examples/cxx/CIM/WSCC-9bus_CIM_Dyn_Switch.cpp index e544c804e0..5da2201145 100644 --- a/dpsim/examples/cxx/CIM/WSCC-9bus_CIM_Dyn_Switch.cpp +++ b/dpsim/examples/cxx/CIM/WSCC-9bus_CIM_Dyn_Switch.cpp @@ -44,7 +44,7 @@ int main(int argc, char *argv[]) { sys.addComponent(sw); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", sys.node("BUS1")->attribute("v")); logger->logAttribute("v2", sys.node("BUS2")->attribute("v")); logger->logAttribute("v3", sys.node("BUS3")->attribute("v")); diff --git a/dpsim/examples/cxx/CIM/WSCC_9bus_mult_coupled.cpp b/dpsim/examples/cxx/CIM/WSCC_9bus_mult_coupled.cpp index 8697cc118b..d9533fd484 100644 --- a/dpsim/examples/cxx/CIM/WSCC_9bus_mult_coupled.cpp +++ b/dpsim/examples/cxx/CIM/WSCC_9bus_mult_coupled.cpp @@ -82,7 +82,7 @@ void simulateCoupled(std::list filenames, CommandLineArgs& args, Int c sim.setScheduler(std::make_shared(threads)); // Logging - //auto logger = DataLogger::make(simName); + //auto logger = CPS::DataLogger::make(simName); //for (Int cop = 1; cop <= copies; cop++) { // for (Int bus = 1; bus <= 9; bus++) { // String attrName = "v" + std::to_string(bus) + "_" + std::to_string(cop); diff --git a/dpsim/examples/cxx/CIM/WSCC_9bus_mult_decoupled.cpp b/dpsim/examples/cxx/CIM/WSCC_9bus_mult_decoupled.cpp index c1a4053852..4da1987e08 100644 --- a/dpsim/examples/cxx/CIM/WSCC_9bus_mult_decoupled.cpp +++ b/dpsim/examples/cxx/CIM/WSCC_9bus_mult_decoupled.cpp @@ -66,7 +66,7 @@ void simulateDecoupled(std::list filenames, Int copies, Int threads, I sim.setScheduler(std::make_shared(threads)); // Logging - //auto logger = DataLogger::make(simName); + //auto logger = CPS::DataLogger::make(simName); //for (Int cop = 1; cop <= copies; cop++) { // for (Int bus = 1; bus <= 9; bus++) { // String attrName = "v" + std::to_string(bus) + "_" + std::to_string(cop); diff --git a/dpsim/examples/cxx/CIM/WSCC_9bus_mult_diakoptics.cpp b/dpsim/examples/cxx/CIM/WSCC_9bus_mult_diakoptics.cpp index af6da12d0b..3880f8d4a6 100644 --- a/dpsim/examples/cxx/CIM/WSCC_9bus_mult_diakoptics.cpp +++ b/dpsim/examples/cxx/CIM/WSCC_9bus_mult_diakoptics.cpp @@ -84,7 +84,7 @@ void simulateDiakoptics(std::list filenames, sim.setTearingComponents(sys.mTearComponents); // Logging - //auto logger = DataLogger::make(simName); + //auto logger = CPS::DataLogger::make(simName); //for (Int cop = 1; cop <= copies; cop++) { // for (Int bus = 1; bus <= 9; bus++) { // String attrName = "v" + std::to_string(bus) + "_" + std::to_string(cop); diff --git a/dpsim/examples/cxx/Circuits/DP_Basics_DP_Sims.cpp b/dpsim/examples/cxx/Circuits/DP_Basics_DP_Sims.cpp index 0a1c06058b..4ac58690d2 100644 --- a/dpsim/examples/cxx/Circuits/DP_Basics_DP_Sims.cpp +++ b/dpsim/examples/cxx/Circuits/DP_Basics_DP_Sims.cpp @@ -61,7 +61,7 @@ void DP_VS_RL_f60_largeTs() { SystemComponentList{vs, rline, lline, rload}); // Logger - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("v2", n2->attribute("v")); logger->logAttribute("v3", n3->attribute("v")); @@ -111,7 +111,7 @@ void DP_VS_RL_f60_vlargeTs() { SystemComponentList{vs, rline, lline, rload}); // Logger - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("v2", n2->attribute("v")); logger->logAttribute("v3", n3->attribute("v")); @@ -161,7 +161,7 @@ void DP_VS_RL_f60() { SystemComponentList{vs, rline, lline, rload}); // Logger - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("v2", n2->attribute("v")); logger->logAttribute("v3", n3->attribute("v")); @@ -211,7 +211,7 @@ void DP_VS_RL_f500_largeTs() { SystemComponentList{vs, rline, lline, rload}); // Logger - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("v2", n2->attribute("v")); logger->logAttribute("v3", n3->attribute("v")); @@ -261,7 +261,7 @@ void DP_VS_RL_f500_ph500() { SystemComponentList{vs, rline, lline, rload}); // Logger - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("v2", n2->attribute("v")); logger->logAttribute("v3", n3->attribute("v")); @@ -311,7 +311,7 @@ void DP_VS_RL_f500() { SystemComponentList{vs, rline, lline, rload}); // Logger - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("v2", n2->attribute("v")); logger->logAttribute("v3", n3->attribute("v")); diff --git a/dpsim/examples/cxx/Circuits/DP_Basics_EMT_Sims.cpp b/dpsim/examples/cxx/Circuits/DP_Basics_EMT_Sims.cpp index bed049f5fc..0763602d8c 100644 --- a/dpsim/examples/cxx/Circuits/DP_Basics_EMT_Sims.cpp +++ b/dpsim/examples/cxx/Circuits/DP_Basics_EMT_Sims.cpp @@ -55,7 +55,7 @@ void EMT_VS_RL_f60_largeTs() { SystemComponentList{vs, rline, lline, rload}); // Logger - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("v2", n2->attribute("v")); logger->logAttribute("v3", n3->attribute("v")); @@ -106,7 +106,7 @@ void EMT_VS_RL_f60() { SystemComponentList{vs, rline, lline, rload}); // Logger - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("v2", n2->attribute("v")); logger->logAttribute("v3", n3->attribute("v")); @@ -157,7 +157,7 @@ void EMT_VS_RL_f500() { SystemComponentList{vs, rline, lline, rload}); // Logger - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("v2", n2->attribute("v")); logger->logAttribute("v3", n3->attribute("v")); diff --git a/dpsim/examples/cxx/Circuits/DP_Circuits.cpp b/dpsim/examples/cxx/Circuits/DP_Circuits.cpp index d19bf9bc4f..f6ce3d5682 100644 --- a/dpsim/examples/cxx/Circuits/DP_Circuits.cpp +++ b/dpsim/examples/cxx/Circuits/DP_Circuits.cpp @@ -32,7 +32,7 @@ void DP_CS_R1(CommandLineArgs& args) { auto sys = SystemTopology(50, SystemNodeList{n1}, SystemComponentList{cs, r1}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("i10", r1->attribute("i_intf")); @@ -63,7 +63,7 @@ void DP_VS_R1(CommandLineArgs& args) { auto sys = SystemTopology(50, SystemNodeList{n1}, SystemComponentList{vs, r}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); Simulation sim(simName, args); @@ -103,7 +103,7 @@ void DP_CS_R2CL(CommandLineArgs& args) { auto sys = SystemTopology(50, SystemNodeList{n1, n2}, SystemComponentList{cs, r1, c1, l1, r2}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("v2", n2->attribute("v")); logger->logAttribute("i12", cs->attribute("i_intf")); @@ -151,7 +151,7 @@ void DP_VS_CS_R4(CommandLineArgs& args) { auto sys = SystemTopology(50, SystemNodeList{n1, n2, n3}, SystemComponentList{vs, r1, r2, r3, r4, cs}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("v2", n2->attribute("v")); logger->logAttribute("v3", n3->attribute("v")); @@ -200,7 +200,7 @@ void DP_VS_R2L3(CommandLineArgs& args) { auto sys = SystemTopology(50, SystemNodeList{n1, n2, n3, n4}, SystemComponentList{vs, r1, l1, l2, l3, r2}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("v2", n2->attribute("v")); logger->logAttribute("v3", n3->attribute("v")); @@ -239,7 +239,7 @@ void DP_VS_RC1(CommandLineArgs& args) { auto sys = SystemTopology(50, SystemNodeList{n1, n2}, SystemComponentList{vs, r1, c1}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("v2", n2->attribute("v")); logger->logAttribute("i12", r1->attribute("i_intf")); @@ -280,7 +280,7 @@ void DP_VS_RL2(CommandLineArgs& args) { auto sys = SystemTopology(50, SystemNodeList{n1, n2, n3}, SystemComponentList{vs, rl, ll, rL}); // Logger - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("v2", n2->attribute("v")); logger->logAttribute("i12", rL->attribute("i_intf")); @@ -338,7 +338,7 @@ void DP_Ph3_VS_R2L3(CommandLineArgs& args) { auto sys = SystemTopology(50, SystemNodeList{n1, n2, n3, n4}, SystemComponentList{vs, r1, l1, l2, l3, r2}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("v2", n2->attribute("v")); logger->logAttribute("v3", n3->attribute("v")); @@ -388,7 +388,7 @@ void DP_Ph3_VS_RC1(CommandLineArgs& args) { auto sys = SystemTopology(50, SystemNodeList{n1, n2}, SystemComponentList{vs, r1, c1}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("v2", n2->attribute("v")); logger->logAttribute("i12", r1->attribute("i_intf")); diff --git a/dpsim/examples/cxx/Circuits/DP_DecouplingLine.cpp b/dpsim/examples/cxx/Circuits/DP_DecouplingLine.cpp index 617ed7573a..f1d3d217bb 100644 --- a/dpsim/examples/cxx/Circuits/DP_DecouplingLine.cpp +++ b/dpsim/examples/cxx/Circuits/DP_DecouplingLine.cpp @@ -55,7 +55,7 @@ void simElements() { //SystemComponentList{vs, res, ind, load}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("v2", n2->attribute("v")); @@ -101,7 +101,7 @@ void simDecoupling() { sys.addComponents(dline->getLineComponents()); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("v2", n2->attribute("v")); logger->logAttribute("i1", vs->attribute("i_intf")); @@ -151,7 +151,7 @@ void simDecouplingEMT() { sys.addComponents(dline->getLineComponents()); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("v2", n2->attribute("v")); logger->logAttribute("i1", vs->attribute("i_intf")); diff --git a/dpsim/examples/cxx/Circuits/DP_Diakoptics.cpp b/dpsim/examples/cxx/Circuits/DP_Diakoptics.cpp index 452655cc10..c979688aed 100644 --- a/dpsim/examples/cxx/Circuits/DP_Diakoptics.cpp +++ b/dpsim/examples/cxx/Circuits/DP_Diakoptics.cpp @@ -51,7 +51,7 @@ void DP_VS_CS_R4() { SystemComponentList{vs, r1, r2, r3, r4, cs}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("v2", n2->attribute("v")); logger->logAttribute("v3", n3->attribute("v")); @@ -108,7 +108,7 @@ void DP_VS_CS_R4_Diakoptics() { sys.addTearComponent(r3); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("v2", n2->attribute("v")); logger->logAttribute("v3", n3->attribute("v")); @@ -164,7 +164,7 @@ void DP_VS_R2L3() { SystemComponentList{vs, r1, l1, l2, l3, r2}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("v2", n2->attribute("v")); logger->logAttribute("v3", n3->attribute("v")); @@ -221,7 +221,7 @@ void DP_VS_R2L3_Diakoptics() { sys.addTearComponent(l1); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("v2", n2->attribute("v")); logger->logAttribute("v3", n3->attribute("v")); diff --git a/dpsim/examples/cxx/Circuits/DP_EMT_RL_SourceStep.cpp b/dpsim/examples/cxx/Circuits/DP_EMT_RL_SourceStep.cpp index 34214dd333..3a57ae5b0f 100644 --- a/dpsim/examples/cxx/Circuits/DP_EMT_RL_SourceStep.cpp +++ b/dpsim/examples/cxx/Circuits/DP_EMT_RL_SourceStep.cpp @@ -38,7 +38,7 @@ static void DP_RL_SourceStep(Real timeStep, Real finalTime, SystemNodeList{ n1, n2, n3 }, SystemComponentList{ vs, r, l, sw }); - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("v2", n2->attribute("v")); logger->logAttribute("v3", n3->attribute("v")); @@ -80,7 +80,7 @@ static void EMT_RL_SourceStep(Real timeStep, Real finalTime, SystemNodeList{ n1, n2, n3 }, SystemComponentList{ vs, r, l, sw }); - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("v2", n2->attribute("v")); logger->logAttribute("v3", n3->attribute("v")); diff --git a/dpsim/examples/cxx/Circuits/DP_PiLine.cpp b/dpsim/examples/cxx/Circuits/DP_PiLine.cpp index 1231a6598e..5029641b40 100644 --- a/dpsim/examples/cxx/Circuits/DP_PiLine.cpp +++ b/dpsim/examples/cxx/Circuits/DP_PiLine.cpp @@ -65,7 +65,7 @@ void simElements() { //SystemComponentList{vs, res, ind, load}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("v2", n2->attribute("v")); logger->logAttribute("iline", ind->attribute("i_intf")); @@ -115,7 +115,7 @@ void simPiLine() { SystemComponentList{vs, line, load}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("v2", n2->attribute("v")); logger->logAttribute("iline", line->attribute("i_intf")); @@ -161,7 +161,7 @@ void simPiLineDiakoptics() { sys.addTearComponent(line); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("v2", n2->attribute("v")); diff --git a/dpsim/examples/cxx/Circuits/DP_ReducedOrderSG_SMIB_Fault.cpp b/dpsim/examples/cxx/Circuits/DP_ReducedOrderSG_SMIB_Fault.cpp index 93188b502a..3c5e7df804 100644 --- a/dpsim/examples/cxx/Circuits/DP_ReducedOrderSG_SMIB_Fault.cpp +++ b/dpsim/examples/cxx/Circuits/DP_ReducedOrderSG_SMIB_Fault.cpp @@ -88,7 +88,7 @@ int main(int argc, char* argv[]) { SystemComponentList{genPF, linePF, extnetPF}); // Logging - auto loggerPF = DataLogger::make(simNamePF); + auto loggerPF = CPS::DataLogger::make(simNamePF); loggerPF->logAttribute("v1", n1PF->attribute("v")); loggerPF->logAttribute("v2", n2PF->attribute("v")); @@ -155,7 +155,7 @@ int main(int argc, char* argv[]) { SystemComponentList{genDP, lineDP, extnetDP, fault}); // Logging - auto loggerDP = DataLogger::make(simNameDP, true, logDownSampling); + auto loggerDP = CPS::DataLogger::make(simNameDP, true, logDownSampling); loggerDP->logAttribute("v_gen", genDP->attribute("v_intf")); loggerDP->logAttribute("i_gen", genDP->attribute("i_intf")); loggerDP->logAttribute("Te", genDP->attribute("Te")); diff --git a/dpsim/examples/cxx/Circuits/DP_ReducedOrderSG_VBR_Load_Fault.cpp b/dpsim/examples/cxx/Circuits/DP_ReducedOrderSG_VBR_Load_Fault.cpp index 47fa7d7cd3..daed16ea5d 100644 --- a/dpsim/examples/cxx/Circuits/DP_ReducedOrderSG_VBR_Load_Fault.cpp +++ b/dpsim/examples/cxx/Circuits/DP_ReducedOrderSG_VBR_Load_Fault.cpp @@ -126,7 +126,7 @@ int main(int argc, char* argv[]) { SystemComponentList{genDP, load, fault}); // Logging - auto loggerDP = DataLogger::make(simNameDP, true, logDownSampling); + auto loggerDP = CPS::DataLogger::make(simNameDP, true, logDownSampling); loggerDP->logAttribute("v_gen", genDP->attribute("v_intf")); loggerDP->logAttribute("i_gen", genDP->attribute("i_intf")); loggerDP->logAttribute("Te", genDP->attribute("Te")); diff --git a/dpsim/examples/cxx/Circuits/DP_SMIB_ReducedOrderSGIterative_LoadStep.cpp b/dpsim/examples/cxx/Circuits/DP_SMIB_ReducedOrderSGIterative_LoadStep.cpp index b969105100..944c3a0a75 100644 --- a/dpsim/examples/cxx/Circuits/DP_SMIB_ReducedOrderSGIterative_LoadStep.cpp +++ b/dpsim/examples/cxx/Circuits/DP_SMIB_ReducedOrderSGIterative_LoadStep.cpp @@ -106,7 +106,7 @@ int main(int argc, char* argv[]) { SystemComponentList{genPF, linePF, extnetPF}); // Logging - auto loggerPF = DataLogger::make(simNamePF); + auto loggerPF = CPS::DataLogger::make(simNamePF); loggerPF->logAttribute("v1", n1PF->attribute("v")); loggerPF->logAttribute("v2", n2PF->attribute("v")); @@ -172,7 +172,7 @@ int main(int argc, char* argv[]) { SystemComponentList{genDP, lineDP, extnetDP}); // Logging - auto logger = DataLogger::make(simName, true, logDownSampling); + auto logger = CPS::DataLogger::make(simName, true, logDownSampling); // log node voltage for (auto node : systemDP.mNodes) diff --git a/dpsim/examples/cxx/Circuits/DP_SMIB_ReducedOrderSG_LoadStep.cpp b/dpsim/examples/cxx/Circuits/DP_SMIB_ReducedOrderSG_LoadStep.cpp index 94f604c0d3..03c1ce814a 100644 --- a/dpsim/examples/cxx/Circuits/DP_SMIB_ReducedOrderSG_LoadStep.cpp +++ b/dpsim/examples/cxx/Circuits/DP_SMIB_ReducedOrderSG_LoadStep.cpp @@ -94,7 +94,7 @@ int main(int argc, char* argv[]) { SystemComponentList{genPF, linePF, extnetPF}); // Logging - auto loggerPF = DataLogger::make(simNamePF); + auto loggerPF = CPS::DataLogger::make(simNamePF); loggerPF->logAttribute("v1", n1PF->attribute("v")); loggerPF->logAttribute("v2", n2PF->attribute("v")); @@ -157,7 +157,7 @@ int main(int argc, char* argv[]) { // Logging // log node voltage - auto logger = DataLogger::make(simName, true, logDownSampling); + auto logger = CPS::DataLogger::make(simName, true, logDownSampling); for (auto node : systemDP.mNodes) logger->logAttribute(node->name() + ".V", node->attribute("v")); diff --git a/dpsim/examples/cxx/Circuits/DP_Slack_PiLine_PQLoad_with_PF_Init.cpp b/dpsim/examples/cxx/Circuits/DP_Slack_PiLine_PQLoad_with_PF_Init.cpp index 9a13838376..de402d7af8 100644 --- a/dpsim/examples/cxx/Circuits/DP_Slack_PiLine_PQLoad_with_PF_Init.cpp +++ b/dpsim/examples/cxx/Circuits/DP_Slack_PiLine_PQLoad_with_PF_Init.cpp @@ -67,7 +67,7 @@ int main(int argc, char* argv[]) { SystemComponentList{extnetPF, linePF, loadPF}); // Logging - auto loggerPF = DataLogger::make(simNamePF); + auto loggerPF = CPS::DataLogger::make(simNamePF); loggerPF->logAttribute("v1", n1PF->attribute("v")); loggerPF->logAttribute("v2", n2PF->attribute("v")); @@ -114,7 +114,7 @@ int main(int argc, char* argv[]) { systemDP.initWithPowerflow(systemPF); // Logging - auto loggerDP = DataLogger::make(simNameDP); + auto loggerDP = CPS::DataLogger::make(simNameDP); loggerDP->logAttribute("v1", n1DP->attribute("v")); loggerDP->logAttribute("v2", n2DP->attribute("v")); loggerDP->logAttribute("isrc", extnetDP->attribute("i_intf")); diff --git a/dpsim/examples/cxx/Circuits/DP_Slack_PiLine_VSI_Ramp_with_PF_Init.cpp b/dpsim/examples/cxx/Circuits/DP_Slack_PiLine_VSI_Ramp_with_PF_Init.cpp index ba4a886269..bbb7b6d6f2 100644 --- a/dpsim/examples/cxx/Circuits/DP_Slack_PiLine_VSI_Ramp_with_PF_Init.cpp +++ b/dpsim/examples/cxx/Circuits/DP_Slack_PiLine_VSI_Ramp_with_PF_Init.cpp @@ -83,7 +83,7 @@ int main(int argc, char* argv[]) { SystemComponentList{extnetPF, linePF, loadPF}); // Logging - auto loggerPF = DataLogger::make(simNamePF); + auto loggerPF = CPS::DataLogger::make(simNamePF); loggerPF->logAttribute("v1", n1PF->attribute("v")); loggerPF->logAttribute("v2", n2PF->attribute("v")); @@ -135,7 +135,7 @@ int main(int argc, char* argv[]) { systemDP.initWithPowerflow(systemPF); // Logging - auto loggerDP = DataLogger::make(simName); + auto loggerDP = CPS::DataLogger::make(simName); loggerDP->logAttribute("v1", n1DP->attribute("v")); loggerDP->logAttribute("v2", n2DP->attribute("v")); loggerDP->logAttribute("i12", lineDP->attribute("i_intf")); diff --git a/dpsim/examples/cxx/Circuits/DP_Slack_PiLine_VSI_with_PF_Init.cpp b/dpsim/examples/cxx/Circuits/DP_Slack_PiLine_VSI_with_PF_Init.cpp index dd3ff4d82e..a1754e725c 100644 --- a/dpsim/examples/cxx/Circuits/DP_Slack_PiLine_VSI_with_PF_Init.cpp +++ b/dpsim/examples/cxx/Circuits/DP_Slack_PiLine_VSI_with_PF_Init.cpp @@ -70,7 +70,7 @@ int main(int argc, char* argv[]) { SystemComponentList{extnetPF, linePF, loadPF}); // Logging - auto loggerPF = DataLogger::make(simNamePF); + auto loggerPF = CPS::DataLogger::make(simNamePF); loggerPF->logAttribute("v1", n1PF->attribute("v")); loggerPF->logAttribute("v2", n2PF->attribute("v")); @@ -123,7 +123,7 @@ int main(int argc, char* argv[]) { systemDP.initWithPowerflow(systemPF); // Logging - auto loggerDP = DataLogger::make(simNameDP); + auto loggerDP = CPS::DataLogger::make(simNameDP); loggerDP->logAttribute("v1", n1DP->attribute("v")); loggerDP->logAttribute("v2", n2DP->attribute("v")); loggerDP->logAttribute("i12", lineDP->attribute("i_intf")); diff --git a/dpsim/examples/cxx/Circuits/DP_SynGenTrStab_3Bus_Fault.cpp b/dpsim/examples/cxx/Circuits/DP_SynGenTrStab_3Bus_Fault.cpp index 0cb3fcbc10..b702b7f970 100644 --- a/dpsim/examples/cxx/Circuits/DP_SynGenTrStab_3Bus_Fault.cpp +++ b/dpsim/examples/cxx/Circuits/DP_SynGenTrStab_3Bus_Fault.cpp @@ -80,7 +80,7 @@ void DP_SynGenTrStab_3Bus_Fault(String simName, Real timeStep, Real finalTime, b SystemComponentList{gen1PF, gen2PF, loadPF, line12PF, line13PF, line23PF, faultPF}); // Logging - auto loggerPF = DataLogger::make(simNamePF); + auto loggerPF = CPS::DataLogger::make(simNamePF); loggerPF->logAttribute("v_bus1", n1PF->attribute("v")); loggerPF->logAttribute("v_bus2", n2PF->attribute("v")); loggerPF->logAttribute("v_bus3", n3PF->attribute("v")); @@ -169,7 +169,7 @@ void DP_SynGenTrStab_3Bus_Fault(String simName, Real timeStep, Real finalTime, b systemDP.initWithPowerflow(systemPF); // Logging - auto loggerDP = DataLogger::make(simNameDP); + auto loggerDP = CPS::DataLogger::make(simNameDP); loggerDP->logAttribute("v1", n1DP->attribute("v")); loggerDP->logAttribute("v2", n2DP->attribute("v")); loggerDP->logAttribute("v3", n3DP->attribute("v")); diff --git a/dpsim/examples/cxx/Circuits/DP_SynGenTrStab_3Bus_SteadyState.cpp b/dpsim/examples/cxx/Circuits/DP_SynGenTrStab_3Bus_SteadyState.cpp index eb68eb086c..ab04eb4354 100644 --- a/dpsim/examples/cxx/Circuits/DP_SynGenTrStab_3Bus_SteadyState.cpp +++ b/dpsim/examples/cxx/Circuits/DP_SynGenTrStab_3Bus_SteadyState.cpp @@ -69,7 +69,7 @@ void DP_SynGenTrStab_3Bus_SteadyState(String simName, Real timeStep, Real finalT SystemComponentList{gen1PF, gen2PF, loadPF, line12PF, line13PF, line23PF}); // Logging - auto loggerPF = DataLogger::make(simNamePF); + auto loggerPF = CPS::DataLogger::make(simNamePF); loggerPF->logAttribute("v_bus1", n1PF->attribute("v")); loggerPF->logAttribute("v_bus2", n2PF->attribute("v")); loggerPF->logAttribute("v_bus3", n3PF->attribute("v")); @@ -141,7 +141,7 @@ void DP_SynGenTrStab_3Bus_SteadyState(String simName, Real timeStep, Real finalT systemDP.initWithPowerflow(systemPF); // Logging - auto loggerDP = DataLogger::make(simNameDP); + auto loggerDP = CPS::DataLogger::make(simNameDP); loggerDP->logAttribute("v1", n1DP->attribute("v")); loggerDP->logAttribute("v2", n2DP->attribute("v")); loggerDP->logAttribute("v3", n3DP->attribute("v")); diff --git a/dpsim/examples/cxx/Circuits/DP_SynGenTrStab_SMIB_Fault.cpp b/dpsim/examples/cxx/Circuits/DP_SynGenTrStab_SMIB_Fault.cpp index 1e140642ed..5904885575 100644 --- a/dpsim/examples/cxx/Circuits/DP_SynGenTrStab_SMIB_Fault.cpp +++ b/dpsim/examples/cxx/Circuits/DP_SynGenTrStab_SMIB_Fault.cpp @@ -63,7 +63,7 @@ void DP_1ph_SynGenTrStab_Fault(String simName, Real timeStep, Real finalTime, bo SystemComponentList{genPF, linePF, extnetPF, faultPF}); // Logging - auto loggerPF = DataLogger::make(simNamePF); + auto loggerPF = CPS::DataLogger::make(simNamePF); loggerPF->logAttribute("v1", n1PF->attribute("v")); loggerPF->logAttribute("v2", n2PF->attribute("v")); @@ -127,7 +127,7 @@ void DP_1ph_SynGenTrStab_Fault(String simName, Real timeStep, Real finalTime, bo // Logging - auto loggerDP = DataLogger::make(simNameDP); + auto loggerDP = CPS::DataLogger::make(simNameDP); loggerDP->logAttribute("v1", n1DP->attribute("v")); loggerDP->logAttribute("v2", n2DP->attribute("v")); //gen diff --git a/dpsim/examples/cxx/Circuits/DP_SynGenTrStab_SMIB_SteadyState.cpp b/dpsim/examples/cxx/Circuits/DP_SynGenTrStab_SMIB_SteadyState.cpp index d432c908fc..489944e85d 100644 --- a/dpsim/examples/cxx/Circuits/DP_SynGenTrStab_SMIB_SteadyState.cpp +++ b/dpsim/examples/cxx/Circuits/DP_SynGenTrStab_SMIB_SteadyState.cpp @@ -53,7 +53,7 @@ void DP_1ph_SynGenTrStab_SteadyState(String simName, Real timeStep, Real finalTi SystemComponentList{genPF, linePF, extnetPF}); // Logging - auto loggerPF = DataLogger::make(simNamePF); + auto loggerPF = CPS::DataLogger::make(simNamePF); loggerPF->logAttribute("v1", n1PF->attribute("v")); loggerPF->logAttribute("v2", n2PF->attribute("v")); @@ -105,7 +105,7 @@ void DP_1ph_SynGenTrStab_SteadyState(String simName, Real timeStep, Real finalTi // Logging - auto loggerDP = DataLogger::make(simNameDP); + auto loggerDP = CPS::DataLogger::make(simNameDP); loggerDP->logAttribute("v1", n1DP->attribute("v")); loggerDP->logAttribute("v2", n2DP->attribute("v")); //gen diff --git a/dpsim/examples/cxx/Circuits/DP_VSI.cpp b/dpsim/examples/cxx/Circuits/DP_VSI.cpp index 7b62e36049..53d3ced77d 100644 --- a/dpsim/examples/cxx/Circuits/DP_VSI.cpp +++ b/dpsim/examples/cxx/Circuits/DP_VSI.cpp @@ -108,7 +108,7 @@ void DP_Ph1_VSI2_4bus_SampleGrid() { node->setInitialVoltage(Complex(Vnom, 0)); } // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); // currents /*logger->logAttribute("i_vs", vs->attribute("i_intf")); logger->logAttribute("i_vsi", vsi->attribute("i_intf")); diff --git a/dpsim/examples/cxx/Circuits/DP_VS_RL1.cpp b/dpsim/examples/cxx/Circuits/DP_VS_RL1.cpp index c6dee917b8..c3911b3c4f 100644 --- a/dpsim/examples/cxx/Circuits/DP_VS_RL1.cpp +++ b/dpsim/examples/cxx/Circuits/DP_VS_RL1.cpp @@ -41,7 +41,7 @@ int main(int argc, char* argv[]) { SystemComponentList{vs, r1, l1}); // Logger - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("v2", n2->attribute("v")); logger->logAttribute("i12", r1->attribute("i_intf")); diff --git a/dpsim/examples/cxx/Circuits/EMT_CS_RL1.cpp b/dpsim/examples/cxx/Circuits/EMT_CS_RL1.cpp index a83fc348bf..3273ef8c69 100644 --- a/dpsim/examples/cxx/Circuits/EMT_CS_RL1.cpp +++ b/dpsim/examples/cxx/Circuits/EMT_CS_RL1.cpp @@ -39,7 +39,7 @@ int main(int argc, char* argv[]) { auto sys = SystemTopology(50, SystemNodeList{n1}, SystemComponentList{cs, r1, l1}); // Logger - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("iR1", r1->attribute("i_intf")); logger->logAttribute("iL1", l1->attribute("i_intf")); diff --git a/dpsim/examples/cxx/Circuits/EMT_Circuits.cpp b/dpsim/examples/cxx/Circuits/EMT_Circuits.cpp index 5035e3c14d..4221ca58bf 100644 --- a/dpsim/examples/cxx/Circuits/EMT_Circuits.cpp +++ b/dpsim/examples/cxx/Circuits/EMT_Circuits.cpp @@ -31,7 +31,7 @@ void EMT_CS_R1() { auto sys = SystemTopology(50, SystemNodeList{n1}, SystemComponentList{cs, r1}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); Simulation sim(simName); @@ -66,7 +66,7 @@ void EMT_VS_R1() { auto sys = SystemTopology(50, SystemNodeList{n1}, SystemComponentList{vs, r}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); Simulation sim(simName); @@ -109,7 +109,7 @@ void EMT_CS_R2CL() { auto sys = SystemTopology(50, SystemNodeList{n1, n2}, SystemComponentList{cs, r1, c1, l1, r2}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("v2", n2->attribute("v")); logger->logAttribute("i12", cs->attribute("i_intf")); @@ -161,7 +161,7 @@ void EMT_VS_CS_R4_AC() { auto sys = SystemTopology(50, SystemNodeList{n1, n2, n3}, SystemComponentList{vs, r1, r2, r3, r4, cs}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("v2", n2->attribute("v")); logger->logAttribute("v3", n3->attribute("v")); @@ -214,7 +214,7 @@ void EMT_VS_CS_R4_DC() { auto sys = SystemTopology(50, SystemNodeList{n1, n2, n3}, SystemComponentList{vs, r1, r2, r3, r4, cs}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("v2", n2->attribute("v")); logger->logAttribute("v3", n3->attribute("v")); @@ -266,7 +266,7 @@ void EMT_VS_R2L3() { auto sys = SystemTopology(50, SystemNodeList{n1, n2, n3, n4}, SystemComponentList{vs, r1, l1, l2, l3, r2}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("v2", n2->attribute("v")); logger->logAttribute("v3", n3->attribute("v")); @@ -310,7 +310,7 @@ void EMT_VS_RC1() { auto sys = SystemTopology(50, SystemNodeList{n1, n2}, SystemComponentList{vs, r1, c1}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("v2", n2->attribute("v")); logger->logAttribute("i12", r1->attribute("i_intf")); @@ -379,7 +379,7 @@ void EMT_Ph3_VS_R2L3() { auto sys = SystemTopology(50, SystemNodeList{n1, n2, n3, n4}, SystemComponentList{vs, r1, l1, l2, l3, r2}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("v2", n2->attribute("v")); logger->logAttribute("v3", n3->attribute("v")); @@ -436,7 +436,7 @@ void EMT_Ph3_VS_RC1() { auto sys = SystemTopology(50, SystemNodeList{n1, n2}, SystemComponentList{vs, r1, c1}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("v2", n2->attribute("v")); logger->logAttribute("i12", r1->attribute("i_intf")); diff --git a/dpsim/examples/cxx/Circuits/EMT_DP_SP_Slack.cpp b/dpsim/examples/cxx/Circuits/EMT_DP_SP_Slack.cpp index ea43659880..31426a2adc 100644 --- a/dpsim/examples/cxx/Circuits/EMT_DP_SP_Slack.cpp +++ b/dpsim/examples/cxx/Circuits/EMT_DP_SP_Slack.cpp @@ -36,7 +36,7 @@ void simElementsSP1ph() { SystemComponentList{vs, load}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("i1", vs->attribute("i_intf")); @@ -74,7 +74,7 @@ void simComponentSP1ph() { SystemComponentList{sl, load}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("i1", sl->attribute("i_intf")); @@ -112,7 +112,7 @@ void simElementsDP1ph() { SystemComponentList{vs, load}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("i1", vs->attribute("i_intf")); @@ -150,7 +150,7 @@ void simComponentDP1ph() { SystemComponentList{sl, load}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("i1", sl->attribute("i_intf")); @@ -188,7 +188,7 @@ void simElementsEMT3ph() { SystemComponentList{vs, load}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("i1", vs->attribute("i_intf")); @@ -227,7 +227,7 @@ void simComponentEMT3ph() { SystemComponentList{vs, load}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("i1", vs->attribute("i_intf")); diff --git a/dpsim/examples/cxx/Circuits/EMT_DP_SP_Slack_PiLine_PQLoad_FM.cpp b/dpsim/examples/cxx/Circuits/EMT_DP_SP_Slack_PiLine_PQLoad_FM.cpp index d8280e0fe1..61991c8cc6 100644 --- a/dpsim/examples/cxx/Circuits/EMT_DP_SP_Slack_PiLine_PQLoad_FM.cpp +++ b/dpsim/examples/cxx/Circuits/EMT_DP_SP_Slack_PiLine_PQLoad_FM.cpp @@ -59,7 +59,7 @@ void powerFlow(SystemTopology& systemPF) { SystemComponentList{extnetPF, linePF, loadPF}); // Logging - auto loggerPF = DataLogger::make(simNamePF); + auto loggerPF = CPS::DataLogger::make(simNamePF); loggerPF->logAttribute("v1", n1PF->attribute("v")); loggerPF->logAttribute("v2", n2PF->attribute("v")); @@ -111,7 +111,7 @@ void simulateDP(SystemTopology& systemPF, String waveform) { systemDP.initWithPowerflow(systemPF); // Logging - auto loggerDP = DataLogger::make(simNameDP); + auto loggerDP = CPS::DataLogger::make(simNameDP); loggerDP->logAttribute("v1", n1DP->attribute("v")); loggerDP->logAttribute("v2", n2DP->attribute("v")); loggerDP->logAttribute("isrc", extnetDP->attribute("i_intf")); @@ -166,7 +166,7 @@ void simulateSP(SystemTopology& systemPF, String waveform) { systemSP.initWithPowerflow(systemPF); // Logging - auto loggerSP = DataLogger::make(simNameSP); + auto loggerSP = CPS::DataLogger::make(simNameSP); loggerSP->logAttribute("v1", n1SP->attribute("v")); loggerSP->logAttribute("v2", n2SP->attribute("v")); loggerSP->logAttribute("i12", lineSP->attribute("i_intf")); @@ -220,7 +220,7 @@ void simulateEMT(SystemTopology& systemPF, String waveform) { systemEMT.initWithPowerflow(systemPF); // Logging - auto loggerEMT = DataLogger::make(simNameEMT); + auto loggerEMT = CPS::DataLogger::make(simNameEMT); loggerEMT->logAttribute("v1", n1EMT->attribute("v")); loggerEMT->logAttribute("v2", n2EMT->attribute("v")); loggerEMT->logAttribute("i12", lineEMT->attribute("i_intf")); diff --git a/dpsim/examples/cxx/Circuits/EMT_DP_SP_Slack_PiLine_PQLoad_FrequencyRamp_CosineFM.cpp b/dpsim/examples/cxx/Circuits/EMT_DP_SP_Slack_PiLine_PQLoad_FrequencyRamp_CosineFM.cpp index 6fa561ad6a..573b1404e1 100644 --- a/dpsim/examples/cxx/Circuits/EMT_DP_SP_Slack_PiLine_PQLoad_FrequencyRamp_CosineFM.cpp +++ b/dpsim/examples/cxx/Circuits/EMT_DP_SP_Slack_PiLine_PQLoad_FrequencyRamp_CosineFM.cpp @@ -59,7 +59,7 @@ void powerFlow(SystemTopology& systemPF) { SystemComponentList{extnetPF, linePF, loadPF}); // Logging - auto loggerPF = DataLogger::make(simNamePF); + auto loggerPF = CPS::DataLogger::make(simNamePF); loggerPF->logAttribute("v1", n1PF->attribute("v")); loggerPF->logAttribute("v2", n2PF->attribute("v")); @@ -111,7 +111,7 @@ void simulateDP(SystemTopology& systemPF, String waveform) { systemDP.initWithPowerflow(systemPF); // Logging - auto loggerDP = DataLogger::make(simNameDP); + auto loggerDP = CPS::DataLogger::make(simNameDP); loggerDP->logAttribute("v1", n1DP->attribute("v")); loggerDP->logAttribute("v2", n2DP->attribute("v")); loggerDP->logAttribute("isrc", extnetDP->attribute("i_intf")); @@ -166,7 +166,7 @@ void simulateSP(SystemTopology& systemPF, String waveform) { systemSP.initWithPowerflow(systemPF); // Logging - auto loggerSP = DataLogger::make(simNameSP); + auto loggerSP = CPS::DataLogger::make(simNameSP); loggerSP->logAttribute("v1", n1SP->attribute("v")); loggerSP->logAttribute("v2", n2SP->attribute("v")); loggerSP->logAttribute("i12", lineSP->attribute("i_intf")); @@ -219,7 +219,7 @@ void simulateEMT(SystemTopology& systemPF, String waveform) { systemEMT.initWithPowerflow(systemPF); // Logging - auto loggerEMT = DataLogger::make(simNameEMT); + auto loggerEMT = CPS::DataLogger::make(simNameEMT); loggerEMT->logAttribute("v1", n1EMT->attribute("v")); loggerEMT->logAttribute("v2", n2EMT->attribute("v")); loggerEMT->logAttribute("i12", lineEMT->attribute("i_intf")); diff --git a/dpsim/examples/cxx/Circuits/EMT_DP_SP_Trafo.cpp b/dpsim/examples/cxx/Circuits/EMT_DP_SP_Trafo.cpp index 14808c9d38..46aafe3968 100644 --- a/dpsim/examples/cxx/Circuits/EMT_DP_SP_Trafo.cpp +++ b/dpsim/examples/cxx/Circuits/EMT_DP_SP_Trafo.cpp @@ -69,7 +69,7 @@ void simTrafoElementsSP1ph() { SystemTopology sys(frequency, SystemNodeList{n1, n2, vn1 }, SystemComponentList{vs, trafoRes, trafoInd, trafoSnubberResHVSide, trafoSnubberResMVSide, trafoSnubberCapMVSide, loadRes}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("v2", n2->attribute("v")); logger->logAttribute("itrafo", trafoInd->attribute("i_intf")); @@ -122,7 +122,7 @@ void simTrafoSP1ph() { SystemTopology sys(50, SystemNodeList{n1, n2 }, SystemComponentList{vs, trafo, loadRes}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("v2", n2->attribute("v")); logger->logAttribute("itrafo", trafo->attribute("i_intf")); @@ -194,7 +194,7 @@ void simTrafoElementsDP1ph() { SystemTopology sys(frequency, SystemNodeList{n1, n2, vn1 }, SystemComponentList{vs, trafoRes, trafoInd, trafoSnubberResHVSide, trafoSnubberResMVSide, trafoSnubberCapMVSide, loadRes}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("v2", n2->attribute("v")); logger->logAttribute("itrafo", trafoInd->attribute("i_intf")); @@ -247,7 +247,7 @@ void simTrafoDP1ph() { SystemTopology sys(50, SystemNodeList{n1, n2 }, SystemComponentList{vs, trafo, loadRes}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("v2", n2->attribute("v")); logger->logAttribute("itrafo", trafo->attribute("i_intf")); @@ -319,7 +319,7 @@ void simTrafoElementsEMT3ph() { SystemTopology sys(frequency, SystemNodeList{n1, n2, vn1 }, SystemComponentList{vs, trafoRes, trafoInd, trafoSnubberResHVSide, trafoSnubberResMVSide, trafoSnubberCapMVSide, loadRes}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("v2", n2->attribute("v")); logger->logAttribute("itrafo", trafoInd->attribute("i_intf")); @@ -372,7 +372,7 @@ void simTrafoEMT3ph() { SystemTopology sys(50, SystemNodeList{n1, n2 }, SystemComponentList{vs, trafo, loadRes}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("v2", n2->attribute("v")); logger->logAttribute("itrafo", trafo->attribute("i_intf")); diff --git a/dpsim/examples/cxx/Circuits/EMT_DP_SP_VS_Init.cpp b/dpsim/examples/cxx/Circuits/EMT_DP_SP_VS_Init.cpp index 54b97b057c..70ead85340 100644 --- a/dpsim/examples/cxx/Circuits/EMT_DP_SP_VS_Init.cpp +++ b/dpsim/examples/cxx/Circuits/EMT_DP_SP_VS_Init.cpp @@ -32,7 +32,7 @@ void vsSetParamsDP1ph() { SystemComponentList{vs}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); // Simulation @@ -66,7 +66,7 @@ void vsSetParamsSP1ph() { SystemComponentList{vs}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); // Simulation @@ -100,7 +100,7 @@ void vsSetParamsEMT3ph() { SystemComponentList{vs}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); // Simulation @@ -136,7 +136,7 @@ void vsSetAttrDP1ph() { SystemComponentList{vs}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); // Simulation @@ -172,7 +172,7 @@ void vsSetAttrSP1ph() { SystemComponentList{vs}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); // Simulation @@ -208,7 +208,7 @@ void vsSetAttrEMT3ph() { SystemComponentList{vs}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); // Simulation @@ -244,7 +244,7 @@ void vsSetFromNodeDP1ph() { SystemComponentList{vs}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); // Simulation @@ -280,7 +280,7 @@ void vsSetFromNodeSP1ph() { SystemComponentList{vs}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); // Simulation @@ -316,7 +316,7 @@ void vsSetFromNodeEMT3ph() { SystemComponentList{vs}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); // Simulation diff --git a/dpsim/examples/cxx/Circuits/EMT_DP_SP_VS_RLC.cpp b/dpsim/examples/cxx/Circuits/EMT_DP_SP_VS_RLC.cpp index 4a2993b3b9..1547b402f8 100644 --- a/dpsim/examples/cxx/Circuits/EMT_DP_SP_VS_RLC.cpp +++ b/dpsim/examples/cxx/Circuits/EMT_DP_SP_VS_RLC.cpp @@ -36,7 +36,7 @@ void voltageSourceResistorEMT3ph() { SystemComponentList{vs, res}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("iR", res->attribute("i_intf")); @@ -75,7 +75,7 @@ void voltageSourceResistorDP1ph() { SystemComponentList{vs, res}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("iR", res->attribute("i_intf")); @@ -114,7 +114,7 @@ void voltageSourceResistorSP1ph() { SystemComponentList{vs, res}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("iR", res->attribute("i_intf")); @@ -158,7 +158,7 @@ void voltageSourceInductorEMT3ph() { SystemComponentList{vs, res, ind}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("v2", n2->attribute("v")); logger->logAttribute("iR", res->attribute("i_intf")); @@ -204,7 +204,7 @@ void voltageSourceInductorDP1ph() { SystemComponentList{vs, res, ind}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("v2", n2->attribute("v")); logger->logAttribute("iR", res->attribute("i_intf")); @@ -250,7 +250,7 @@ void voltageSourceInductorSP1ph() { SystemComponentList{vs, res, ind}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("v2", n2->attribute("v")); logger->logAttribute("iR", res->attribute("i_intf")); @@ -296,7 +296,7 @@ void voltageSourceCapacitorEMT3ph() { SystemComponentList{vs, res, cap}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("v2", n2->attribute("v")); logger->logAttribute("iR", res->attribute("i_intf")); @@ -342,7 +342,7 @@ void voltageSourceCapacitorDP1ph() { SystemComponentList{vs, res, cap}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("v2", n2->attribute("v")); logger->logAttribute("iR", res->attribute("i_intf")); @@ -388,7 +388,7 @@ void voltageSourceCapacitorSP1ph() { SystemComponentList{vs, res, cap}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("v2", n2->attribute("v")); logger->logAttribute("iR", res->attribute("i_intf")); diff --git a/dpsim/examples/cxx/Circuits/EMT_PiLine.cpp b/dpsim/examples/cxx/Circuits/EMT_PiLine.cpp index 43d76fb2c5..b63973de86 100644 --- a/dpsim/examples/cxx/Circuits/EMT_PiLine.cpp +++ b/dpsim/examples/cxx/Circuits/EMT_PiLine.cpp @@ -66,7 +66,7 @@ void simElements() { //SystemComponentList{vs, res, ind, load}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("v2", n2->attribute("v")); logger->logAttribute("iline", ind->attribute("i_intf")); @@ -118,7 +118,7 @@ void simPiLine() { SystemComponentList{vs, line, load}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("v2", n2->attribute("v")); logger->logAttribute("iline", line->attribute("i_intf")); diff --git a/dpsim/examples/cxx/Circuits/EMT_ReducedOrderSG_SMIB_Fault.cpp b/dpsim/examples/cxx/Circuits/EMT_ReducedOrderSG_SMIB_Fault.cpp index 697fd0914d..b93391cd50 100644 --- a/dpsim/examples/cxx/Circuits/EMT_ReducedOrderSG_SMIB_Fault.cpp +++ b/dpsim/examples/cxx/Circuits/EMT_ReducedOrderSG_SMIB_Fault.cpp @@ -89,7 +89,7 @@ int main(int argc, char* argv[]) { SystemComponentList{genPF, linePF, extnetPF}); // Logging - auto loggerPF = DataLogger::make(simNamePF); + auto loggerPF = CPS::DataLogger::make(simNamePF); loggerPF->logAttribute("v1", n1PF->attribute("v")); loggerPF->logAttribute("v2", n2PF->attribute("v")); @@ -166,7 +166,7 @@ int main(int argc, char* argv[]) { SystemComponentList{genEMT, lineEMT, fault, extnetEMT}); // Logging - auto loggerEMT = DataLogger::make(simNameEMT, true, logDownSampling); + auto loggerEMT = CPS::DataLogger::make(simNameEMT, true, logDownSampling); loggerEMT->logAttribute("v_gen", genEMT->attribute("v_intf")); loggerEMT->logAttribute("i_gen", genEMT->attribute("i_intf")); loggerEMT->logAttribute("Te", genEMT->attribute("Te")); diff --git a/dpsim/examples/cxx/Circuits/EMT_ReducedOrderSG_VBR_Load_Fault.cpp b/dpsim/examples/cxx/Circuits/EMT_ReducedOrderSG_VBR_Load_Fault.cpp index c6e90b5af6..4546e574ea 100644 --- a/dpsim/examples/cxx/Circuits/EMT_ReducedOrderSG_VBR_Load_Fault.cpp +++ b/dpsim/examples/cxx/Circuits/EMT_ReducedOrderSG_VBR_Load_Fault.cpp @@ -129,7 +129,7 @@ int main(int argc, char* argv[]) { SystemComponentList{genEMT, load, fault}); // Logging - auto loggerEMT = DataLogger::make(simNameEMT, true, logDownSampling); + auto loggerEMT = CPS::DataLogger::make(simNameEMT, true, logDownSampling); loggerEMT->logAttribute("v_gen", genEMT->attribute("v_intf")); loggerEMT->logAttribute("i_gen", genEMT->attribute("i_intf")); loggerEMT->logAttribute("Te", genEMT->attribute("Te")); diff --git a/dpsim/examples/cxx/Circuits/EMT_SMIB_ReducedOrderSGIterative_LoadStep.cpp b/dpsim/examples/cxx/Circuits/EMT_SMIB_ReducedOrderSGIterative_LoadStep.cpp index d1f97617b9..ad19a18cf9 100644 --- a/dpsim/examples/cxx/Circuits/EMT_SMIB_ReducedOrderSGIterative_LoadStep.cpp +++ b/dpsim/examples/cxx/Circuits/EMT_SMIB_ReducedOrderSGIterative_LoadStep.cpp @@ -102,7 +102,7 @@ int main(int argc, char* argv[]) { SystemComponentList{genPF, linePF, extnetPF}); // Logging - auto loggerPF = DataLogger::make(simNamePF); + auto loggerPF = CPS::DataLogger::make(simNamePF); loggerPF->logAttribute("v1", n1PF->attribute("v")); loggerPF->logAttribute("v2", n2PF->attribute("v")); @@ -172,7 +172,7 @@ int main(int argc, char* argv[]) { // Logging // log node voltage - auto logger = DataLogger::make(simName, true, logDownSampling); + auto logger = CPS::DataLogger::make(simName, true, logDownSampling); for (auto node : systemEMT.mNodes) logger->logAttribute(node->name() + ".V", node->attribute("v")); diff --git a/dpsim/examples/cxx/Circuits/EMT_SMIB_ReducedOrderSG_LoadStep.cpp b/dpsim/examples/cxx/Circuits/EMT_SMIB_ReducedOrderSG_LoadStep.cpp index 57f86ab872..a70778a2ab 100644 --- a/dpsim/examples/cxx/Circuits/EMT_SMIB_ReducedOrderSG_LoadStep.cpp +++ b/dpsim/examples/cxx/Circuits/EMT_SMIB_ReducedOrderSG_LoadStep.cpp @@ -90,7 +90,7 @@ int main(int argc, char* argv[]) { SystemComponentList{genPF, linePF, extnetPF}); // Logging - auto loggerPF = DataLogger::make(simNamePF); + auto loggerPF = CPS::DataLogger::make(simNamePF); loggerPF->logAttribute("v1", n1PF->attribute("v")); loggerPF->logAttribute("v2", n2PF->attribute("v")); @@ -160,7 +160,7 @@ int main(int argc, char* argv[]) { // Logging // log node voltage - auto logger = DataLogger::make(simName, true, logDownSampling); + auto logger = CPS::DataLogger::make(simName, true, logDownSampling); for (auto node : systemEMT.mNodes) logger->logAttribute(node->name() + ".V", node->attribute("v")); diff --git a/dpsim/examples/cxx/Circuits/EMT_Slack_PiLine_PQLoad_with_PF_Init.cpp b/dpsim/examples/cxx/Circuits/EMT_Slack_PiLine_PQLoad_with_PF_Init.cpp index 649cdfb0a4..41bf138857 100644 --- a/dpsim/examples/cxx/Circuits/EMT_Slack_PiLine_PQLoad_with_PF_Init.cpp +++ b/dpsim/examples/cxx/Circuits/EMT_Slack_PiLine_PQLoad_with_PF_Init.cpp @@ -67,7 +67,7 @@ int main(int argc, char* argv[]) { SystemComponentList{extnetPF, linePF, loadPF}); // Logging - auto loggerPF = DataLogger::make(simNamePF); + auto loggerPF = CPS::DataLogger::make(simNamePF); loggerPF->logAttribute("v1", n1PF->attribute("v")); loggerPF->logAttribute("v2", n2PF->attribute("v")); loggerPF->logAttribute("i12", linePF->attribute("i_intf")); @@ -115,7 +115,7 @@ int main(int argc, char* argv[]) { systemEMT.initWithPowerflow(systemPF); // Logging - auto loggerEMT = DataLogger::make(simNameEMT); + auto loggerEMT = CPS::DataLogger::make(simNameEMT); loggerEMT->logAttribute("v1", n1EMT->attribute("v")); loggerEMT->logAttribute("v2", n2EMT->attribute("v")); loggerEMT->logAttribute("isrc", extnetEMT->attribute("i_intf")); diff --git a/dpsim/examples/cxx/Circuits/EMT_Slack_PiLine_VSI_Ramp_with_PF_Init.cpp b/dpsim/examples/cxx/Circuits/EMT_Slack_PiLine_VSI_Ramp_with_PF_Init.cpp index f3d674a35f..a3f23ae279 100644 --- a/dpsim/examples/cxx/Circuits/EMT_Slack_PiLine_VSI_Ramp_with_PF_Init.cpp +++ b/dpsim/examples/cxx/Circuits/EMT_Slack_PiLine_VSI_Ramp_with_PF_Init.cpp @@ -83,7 +83,7 @@ int main(int argc, char* argv[]) { SystemComponentList{extnetPF, linePF, loadPF}); // Logging - auto loggerPF = DataLogger::make(simNamePF); + auto loggerPF = CPS::DataLogger::make(simNamePF); loggerPF->logAttribute("v1", n1PF->attribute("v")); loggerPF->logAttribute("v2", n2PF->attribute("v")); @@ -134,7 +134,7 @@ int main(int argc, char* argv[]) { systemEMT.initWithPowerflow(systemPF); // Logging - auto loggerEMT = DataLogger::make(simName); + auto loggerEMT = CPS::DataLogger::make(simName); loggerEMT->logAttribute("v1", n1EMT->attribute("v")); loggerEMT->logAttribute("v2", n2EMT->attribute("v")); loggerEMT->logAttribute("i12", lineEMT->attribute("i_intf")); diff --git a/dpsim/examples/cxx/Circuits/EMT_Slack_PiLine_VSI_with_PF_Init.cpp b/dpsim/examples/cxx/Circuits/EMT_Slack_PiLine_VSI_with_PF_Init.cpp index b70927eb5b..328d2a230f 100644 --- a/dpsim/examples/cxx/Circuits/EMT_Slack_PiLine_VSI_with_PF_Init.cpp +++ b/dpsim/examples/cxx/Circuits/EMT_Slack_PiLine_VSI_with_PF_Init.cpp @@ -70,7 +70,7 @@ int main(int argc, char* argv[]) { SystemComponentList{extnetPF, linePF, loadPF}); // Logging - auto loggerPF = DataLogger::make(simNamePF); + auto loggerPF = CPS::DataLogger::make(simNamePF); loggerPF->logAttribute("v1", n1PF->attribute("v")); loggerPF->logAttribute("v2", n2PF->attribute("v")); @@ -121,7 +121,7 @@ int main(int argc, char* argv[]) { systemEMT.initWithPowerflow(systemPF); // Logging - auto loggerEMT = DataLogger::make(simNameEMT); + auto loggerEMT = CPS::DataLogger::make(simNameEMT); loggerEMT->logAttribute("v1", n1EMT->attribute("v")); loggerEMT->logAttribute("v2", n2EMT->attribute("v")); loggerEMT->logAttribute("i12", lineEMT->attribute("i_intf")); diff --git a/dpsim/examples/cxx/Circuits/EMT_SynGen4OrderIter_SMIB_Fault.cpp b/dpsim/examples/cxx/Circuits/EMT_SynGen4OrderIter_SMIB_Fault.cpp index 609741218e..ab3df0c5f3 100644 --- a/dpsim/examples/cxx/Circuits/EMT_SynGen4OrderIter_SMIB_Fault.cpp +++ b/dpsim/examples/cxx/Circuits/EMT_SynGen4OrderIter_SMIB_Fault.cpp @@ -65,7 +65,7 @@ void EMT_3ph_4OrderSynGenIter(String simName, Real timeStep, Real finalTime, Rea SystemComponentList{genPF, linePF, extnetPF}); // Logging - auto loggerPF = DataLogger::make(simNamePF); + auto loggerPF = CPS::DataLogger::make(simNamePF); loggerPF->logAttribute("v1", n1PF->attribute("v")); loggerPF->logAttribute("v2", n2PF->attribute("v")); @@ -143,7 +143,7 @@ void EMT_3ph_4OrderSynGenIter(String simName, Real timeStep, Real finalTime, Rea SystemComponentList{genEMT, lineEMT, fault, extnetEMT}); // Logging - auto loggerEMT = DataLogger::make(simNameEMT, true, logDownSampling); + auto loggerEMT = CPS::DataLogger::make(simNameEMT, true, logDownSampling); //loggerEMT->logAttribute("v2", n2EMT->attribute("v")); //loggerEMT->logAttribute("v_gen", genEMT->attribute("v_intf")); //loggerEMT->logAttribute("i_gen", genEMT->attribute("i_intf")); diff --git a/dpsim/examples/cxx/Circuits/EMT_SynGenDQ7odTrapez_DP_SynGenTrStab_SMIB_Fault.cpp b/dpsim/examples/cxx/Circuits/EMT_SynGenDQ7odTrapez_DP_SynGenTrStab_SMIB_Fault.cpp index 718836a460..0128776ff0 100644 --- a/dpsim/examples/cxx/Circuits/EMT_SynGenDQ7odTrapez_DP_SynGenTrStab_SMIB_Fault.cpp +++ b/dpsim/examples/cxx/Circuits/EMT_SynGenDQ7odTrapez_DP_SynGenTrStab_SMIB_Fault.cpp @@ -86,7 +86,7 @@ void EMT_3ph_SynGenDQ7odTrapez_ThreePhFault(Real timeStep, Real finalTime, bool SystemComponentList{genPF, linePF, extnetPF}); // Logging - auto loggerPF = DataLogger::make(simNamePF); + auto loggerPF = CPS::DataLogger::make(simNamePF); loggerPF->logAttribute("v1", n1PF->attribute("v")); loggerPF->logAttribute("v2", n2PF->attribute("v")); loggerPF->logAttribute("v_line", linePF->attribute("v_intf")); @@ -159,7 +159,7 @@ void EMT_3ph_SynGenDQ7odTrapez_ThreePhFault(Real timeStep, Real finalTime, bool system.initWithPowerflow(systemPF); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("v2", n2->attribute("v")); logger->logAttribute("v_line", line->attribute("v_intf")); @@ -229,7 +229,7 @@ void DP_1ph_SynGenTrStab_Fault(Real timeStep, Real finalTime, bool startFaultEve SystemComponentList{genPF, linePF, extnetPF}); // Logging - auto loggerPF = DataLogger::make(simNamePF); + auto loggerPF = CPS::DataLogger::make(simNamePF); loggerPF->logAttribute("v1", n1PF->attribute("v")); loggerPF->logAttribute("v2", n2PF->attribute("v")); loggerPF->logAttribute("v_line", linePF->attribute("v_intf")); @@ -299,7 +299,7 @@ void DP_1ph_SynGenTrStab_Fault(Real timeStep, Real finalTime, bool startFaultEve // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("v2", n2->attribute("v")); logger->logAttribute("v_line", line->attribute("v_intf")); @@ -371,7 +371,7 @@ void SP_1ph_SynGenTrStab_Fault(Real timeStep, Real finalTime, bool startFaultEve SystemComponentList{genPF, linePF, extnetPF}); // Logging - auto loggerPF = DataLogger::make(simNamePF); + auto loggerPF = CPS::DataLogger::make(simNamePF); loggerPF->logAttribute("v1", n1PF->attribute("v")); loggerPF->logAttribute("v2", n2PF->attribute("v")); loggerPF->logAttribute("v_line", linePF->attribute("v_intf")); @@ -441,7 +441,7 @@ void SP_1ph_SynGenTrStab_Fault(Real timeStep, Real finalTime, bool startFaultEve // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("v2", n2->attribute("v")); logger->logAttribute("v_line", line->attribute("v_intf")); diff --git a/dpsim/examples/cxx/Circuits/EMT_SynGenDQ7odTrapez_OperationalParams_SMIB_Fault.cpp b/dpsim/examples/cxx/Circuits/EMT_SynGenDQ7odTrapez_OperationalParams_SMIB_Fault.cpp index 066ee67328..5fbd753c2b 100644 --- a/dpsim/examples/cxx/Circuits/EMT_SynGenDQ7odTrapez_OperationalParams_SMIB_Fault.cpp +++ b/dpsim/examples/cxx/Circuits/EMT_SynGenDQ7odTrapez_OperationalParams_SMIB_Fault.cpp @@ -135,7 +135,7 @@ int main(int argc, char* argv[]) { SystemComponentList{genPF, linePF, extnetPF}); // Logging - auto loggerPF = DataLogger::make(simNamePF); + auto loggerPF = CPS::DataLogger::make(simNamePF); loggerPF->logAttribute("v1", n1PF->attribute("v")); loggerPF->logAttribute("v2", n2PF->attribute("v")); loggerPF->logAttribute("v_line", linePF->attribute("v_intf")); @@ -200,7 +200,7 @@ int main(int argc, char* argv[]) { gen->terminal(0)->setPower(-genPF->getApparentPower()); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("v2", n2->attribute("v")); logger->logAttribute("v_line", line->attribute("v_intf")); diff --git a/dpsim/examples/cxx/Circuits/EMT_SynGenDQ7odTrapez_OperationalParams_SMIB_Fault_JsonSyngenParams.cpp b/dpsim/examples/cxx/Circuits/EMT_SynGenDQ7odTrapez_OperationalParams_SMIB_Fault_JsonSyngenParams.cpp index 368b2e0ce9..021ba4b094 100644 --- a/dpsim/examples/cxx/Circuits/EMT_SynGenDQ7odTrapez_OperationalParams_SMIB_Fault_JsonSyngenParams.cpp +++ b/dpsim/examples/cxx/Circuits/EMT_SynGenDQ7odTrapez_OperationalParams_SMIB_Fault_JsonSyngenParams.cpp @@ -99,7 +99,7 @@ int main(int argc, char* argv[]) { SystemComponentList{genPF, linePF, extnetPF}); // Logging - auto loggerPF = DataLogger::make(simNamePF); + auto loggerPF = CPS::DataLogger::make(simNamePF); loggerPF->logAttribute("v1", n1PF->attribute("v")); loggerPF->logAttribute("v2", n2PF->attribute("v")); loggerPF->logAttribute("v_line", linePF->attribute("v_intf")); @@ -172,7 +172,7 @@ int main(int argc, char* argv[]) { system.initWithPowerflow(systemPF); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("v2", n2->attribute("v")); logger->logAttribute("v_line", line->attribute("v_intf")); diff --git a/dpsim/examples/cxx/Circuits/EMT_SynGenDQ7odTrapez_SMIB_Fault.cpp b/dpsim/examples/cxx/Circuits/EMT_SynGenDQ7odTrapez_SMIB_Fault.cpp index 18b1c52454..5d7b73a758 100644 --- a/dpsim/examples/cxx/Circuits/EMT_SynGenDQ7odTrapez_SMIB_Fault.cpp +++ b/dpsim/examples/cxx/Circuits/EMT_SynGenDQ7odTrapez_SMIB_Fault.cpp @@ -89,7 +89,7 @@ int main(int argc, char* argv[]) { SystemComponentList{genPF, linePF, extnetPF}); // Logging - auto loggerPF = DataLogger::make(simNamePF); + auto loggerPF = CPS::DataLogger::make(simNamePF); loggerPF->logAttribute("v1", n1PF->attribute("v")); loggerPF->logAttribute("v2", n2PF->attribute("v")); loggerPF->logAttribute("v_line", linePF->attribute("v_intf")); @@ -161,7 +161,7 @@ int main(int argc, char* argv[]) { system.initWithPowerflow(systemPF); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("v2", n2->attribute("v")); logger->logAttribute("v_line", line->attribute("v_intf")); diff --git a/dpsim/examples/cxx/Circuits/EMT_SynGenTrStab_SMIB_Fault.cpp b/dpsim/examples/cxx/Circuits/EMT_SynGenTrStab_SMIB_Fault.cpp index 228bdee887..a95feb03bd 100644 --- a/dpsim/examples/cxx/Circuits/EMT_SynGenTrStab_SMIB_Fault.cpp +++ b/dpsim/examples/cxx/Circuits/EMT_SynGenTrStab_SMIB_Fault.cpp @@ -85,7 +85,7 @@ void EMT_1ph_SynGenTrStab_Fault(String simName, Real timeStep, Real finalTime, b SystemComponentList{genPF, linePF, extnetPF}); // Logging - auto loggerPF = DataLogger::make(simNamePF); + auto loggerPF = CPS::DataLogger::make(simNamePF); loggerPF->logAttribute("v1", n1PF->attribute("v")); loggerPF->logAttribute("v2", n2PF->attribute("v")); @@ -148,7 +148,7 @@ void EMT_1ph_SynGenTrStab_Fault(String simName, Real timeStep, Real finalTime, b // Logging - auto loggerEMT = DataLogger::make(simNameEMT); + auto loggerEMT = CPS::DataLogger::make(simNameEMT); loggerEMT->logAttribute("v1", n1EMT->attribute("v")); loggerEMT->logAttribute("v2", n2EMT->attribute("v")); //gen diff --git a/dpsim/examples/cxx/Circuits/EMT_SynGenTrStab_SMIB_SteadyState.cpp b/dpsim/examples/cxx/Circuits/EMT_SynGenTrStab_SMIB_SteadyState.cpp index 2f5714e8b7..ef48ea3874 100644 --- a/dpsim/examples/cxx/Circuits/EMT_SynGenTrStab_SMIB_SteadyState.cpp +++ b/dpsim/examples/cxx/Circuits/EMT_SynGenTrStab_SMIB_SteadyState.cpp @@ -81,7 +81,7 @@ void EMT_1ph_SynGenTrStab_SteadyState(String simName, Real timeStep, Real finalT SystemComponentList{genPF, linePF, extnetPF}); // Logging - auto loggerPF = DataLogger::make(simNamePF); + auto loggerPF = CPS::DataLogger::make(simNamePF); loggerPF->logAttribute("v1", n1PF->attribute("v")); loggerPF->logAttribute("v2", n2PF->attribute("v")); @@ -137,7 +137,7 @@ void EMT_1ph_SynGenTrStab_SteadyState(String simName, Real timeStep, Real finalT // Logging - auto loggerEMT = DataLogger::make(simNameEMT); + auto loggerEMT = CPS::DataLogger::make(simNameEMT); loggerEMT->logAttribute("v1", n1EMT->attribute("v")); loggerEMT->logAttribute("v2", n2EMT->attribute("v")); //gen diff --git a/dpsim/examples/cxx/Circuits/EMT_SynGenVBR_OperationalParams_SMIB_Fault.cpp b/dpsim/examples/cxx/Circuits/EMT_SynGenVBR_OperationalParams_SMIB_Fault.cpp index 500de213e7..ed7b35b49e 100644 --- a/dpsim/examples/cxx/Circuits/EMT_SynGenVBR_OperationalParams_SMIB_Fault.cpp +++ b/dpsim/examples/cxx/Circuits/EMT_SynGenVBR_OperationalParams_SMIB_Fault.cpp @@ -38,7 +38,7 @@ Real finalTime = 1.0; Real timeStep = 10e-6; Real startTimeFault=0.2; -int main(int argc, char* argv[]) { +int main(int argc, char* argv[]) { if (argc > 1) { CommandLineArgs args(argc, argv); @@ -68,7 +68,7 @@ int main(int argc, char* argv[]) { extnetPF->setParameters(VnomMV); extnetPF->setBaseVoltage(VnomMV); extnetPF->modifyPowerFlowBusType(PowerflowBusType::VD); - + //Line auto linePF = SP::Ph1::PiLine::make("PiLine", Logger::Level::debug); linePF->setParameters(lineResistance, lineInductance, lineCapacitance, lineConductance); @@ -83,7 +83,7 @@ int main(int argc, char* argv[]) { SystemComponentList{genPF, linePF, extnetPF}); // Logging - auto loggerPF = DataLogger::make(simNamePF); + auto loggerPF = CPS::DataLogger::make(simNamePF); loggerPF->logAttribute("v1", n1PF->attribute("v")); loggerPF->logAttribute("v2", n2PF->attribute("v")); loggerPF->logAttribute("v_line", linePF->attribute("v_intf")); @@ -117,7 +117,7 @@ int main(int argc, char* argv[]) { syngenKundur.nomPower, syngenKundur.nomVoltage, syngenKundur.nomFreq, syngenKundur.poleNum, syngenKundur.nomFieldCurr, syngenKundur.Rs, syngenKundur.Ld, syngenKundur.Lq, syngenKundur.Ld_t, syngenKundur.Lq_t, syngenKundur.Ld_s, syngenKundur.Lq_s, syngenKundur.Ll, syngenKundur.Td0_t, syngenKundur.Tq0_t, syngenKundur.Td0_s, syngenKundur.Tq0_s, syngenKundur.H); - + //Grid bus as Slack auto extnet = EMT::Ph3::NetworkInjection::make("Slack", Logger::Level::debug); @@ -148,7 +148,7 @@ int main(int argc, char* argv[]) { gen->terminal(0)->setPower(-genPF->getApparentPower()); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("v2", n2->attribute("v")); logger->logAttribute("v_line", line->attribute("v_intf")); diff --git a/dpsim/examples/cxx/Circuits/EMT_SynGenVBR_SMIB_Fault.cpp b/dpsim/examples/cxx/Circuits/EMT_SynGenVBR_SMIB_Fault.cpp index b293db6bcb..2ebadfb506 100644 --- a/dpsim/examples/cxx/Circuits/EMT_SynGenVBR_SMIB_Fault.cpp +++ b/dpsim/examples/cxx/Circuits/EMT_SynGenVBR_SMIB_Fault.cpp @@ -83,7 +83,7 @@ int main(int argc, char* argv[]) { SystemComponentList{genPF, linePF, extnetPF}); // Logging - auto loggerPF = DataLogger::make(simNamePF); + auto loggerPF = CPS::DataLogger::make(simNamePF); loggerPF->logAttribute("v1", n1PF->attribute("v")); loggerPF->logAttribute("v2", n2PF->attribute("v")); loggerPF->logAttribute("v_line", linePF->attribute("v_intf")); @@ -148,7 +148,7 @@ int main(int argc, char* argv[]) { gen->terminal(0)->setPower(-genPF->getApparentPower()); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("v2", n2->attribute("v")); logger->logAttribute("v_line", line->attribute("v_intf")); diff --git a/dpsim/examples/cxx/Circuits/EMT_VSI.cpp b/dpsim/examples/cxx/Circuits/EMT_VSI.cpp index 0c39ee48a5..33f06c38b0 100644 --- a/dpsim/examples/cxx/Circuits/EMT_VSI.cpp +++ b/dpsim/examples/cxx/Circuits/EMT_VSI.cpp @@ -156,9 +156,9 @@ void EMT_Ph3_VSI2_4bus_SampleGrid() { //nrpSolver.writePFResultsToDynamicTopology(sysPF, sys); // Logging - //auto logger = DataLogger::make(simName); - auto logger_vsi = DataLogger::make(simName+"_pv1"); - auto logger_vsi2 = DataLogger::make(simName + "_pv2"); + //auto logger = CPS::DataLogger::make(simName); + auto logger_vsi = CPS::DataLogger::make(simName+"_pv1"); + auto logger_vsi2 = CPS::DataLogger::make(simName + "_pv2"); //// currents //logger->logAttribute("i_vs", vs->attribute("i_intf")); //logger->logAttribute("i_vsi", vsi->attribute("i_intf")); diff --git a/dpsim/examples/cxx/Circuits/EMT_VS_RL1.cpp b/dpsim/examples/cxx/Circuits/EMT_VS_RL1.cpp index 7c4574dbd2..85a95b4c8f 100644 --- a/dpsim/examples/cxx/Circuits/EMT_VS_RL1.cpp +++ b/dpsim/examples/cxx/Circuits/EMT_VS_RL1.cpp @@ -40,7 +40,7 @@ int main(int argc, char* argv[]) { auto sys = SystemTopology(50, SystemNodeList{n1, n2}, SystemComponentList{vs, r1, l1}); // Logger - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("v2", n2->attribute("v")); logger->logAttribute("i12", r1->attribute("i_intf")); diff --git a/dpsim/examples/cxx/Circuits/PF_Slack_PiLine_PQLoad.cpp b/dpsim/examples/cxx/Circuits/PF_Slack_PiLine_PQLoad.cpp index 9f4d8615d4..eb81a041d5 100644 --- a/dpsim/examples/cxx/Circuits/PF_Slack_PiLine_PQLoad.cpp +++ b/dpsim/examples/cxx/Circuits/PF_Slack_PiLine_PQLoad.cpp @@ -52,7 +52,7 @@ int main(int argc, char* argv[]) { SystemComponentList{extnetPF, linePF, loadPF}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("v2", n2->attribute("v")); diff --git a/dpsim/examples/cxx/Circuits/SP_Circuits.cpp b/dpsim/examples/cxx/Circuits/SP_Circuits.cpp index fe8547d081..c41aaab7c8 100644 --- a/dpsim/examples/cxx/Circuits/SP_Circuits.cpp +++ b/dpsim/examples/cxx/Circuits/SP_Circuits.cpp @@ -60,7 +60,7 @@ void SP_Ph3_VS_R2L3() { auto sys = SystemTopology(50, SystemNodeList{ n1, n2, n3, n4 }, SystemComponentList{ vs, r1, l1, l2, l3, r2 }); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("v2", n2->attribute("v")); logger->logAttribute("v3", n3->attribute("v")); @@ -115,7 +115,7 @@ void SP_Ph3_VS_RC1() { auto sys = SystemTopology(50, SystemNodeList{ n1, n2 }, SystemComponentList{ vs, r1, c1 }); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("v2", n2->attribute("v")); logger->logAttribute("i12", r1->attribute("i_intf")); diff --git a/dpsim/examples/cxx/Circuits/SP_PiLine.cpp b/dpsim/examples/cxx/Circuits/SP_PiLine.cpp index 7671db1993..13a9ce3e28 100644 --- a/dpsim/examples/cxx/Circuits/SP_PiLine.cpp +++ b/dpsim/examples/cxx/Circuits/SP_PiLine.cpp @@ -67,7 +67,7 @@ void simElements() { // SystemComponentList{vs, res, load}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("v2", n2->attribute("v")); logger->logAttribute("iline", ind->attribute("i_intf")); @@ -119,7 +119,7 @@ void simPiLine() { SystemComponentList{vs, line, load}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("v2", n2->attribute("v")); logger->logAttribute("iline", line->attribute("i_intf")); diff --git a/dpsim/examples/cxx/Circuits/SP_ReducedOrderSG_SMIB_Fault.cpp b/dpsim/examples/cxx/Circuits/SP_ReducedOrderSG_SMIB_Fault.cpp index 966675f796..4178267a30 100644 --- a/dpsim/examples/cxx/Circuits/SP_ReducedOrderSG_SMIB_Fault.cpp +++ b/dpsim/examples/cxx/Circuits/SP_ReducedOrderSG_SMIB_Fault.cpp @@ -105,7 +105,7 @@ int main(int argc, char* argv[]) { SystemComponentList{genPF, linePF, extnetPF}); // Logging - auto loggerPF = DataLogger::make(simNamePF); + auto loggerPF = CPS::DataLogger::make(simNamePF); loggerPF->logAttribute("v1", n1PF->attribute("v")); loggerPF->logAttribute("v2", n2PF->attribute("v")); @@ -194,7 +194,7 @@ int main(int argc, char* argv[]) { SystemComponentList{genSP, lineSP, extnetSP, fault}); // Logging - auto loggerSP = DataLogger::make(simNameSP, true, logDownSampling); + auto loggerSP = CPS::DataLogger::make(simNameSP, true, logDownSampling); loggerSP->logAttribute("v_gen", genSP->attribute("v_intf")); loggerSP->logAttribute("i_gen", genSP->attribute("i_intf")); loggerSP->logAttribute("Te", genSP->attribute("Te")); diff --git a/dpsim/examples/cxx/Circuits/SP_ReducedOrderSG_VBR_Load_Fault.cpp b/dpsim/examples/cxx/Circuits/SP_ReducedOrderSG_VBR_Load_Fault.cpp index fbbdb3751c..2d460aea7d 100644 --- a/dpsim/examples/cxx/Circuits/SP_ReducedOrderSG_VBR_Load_Fault.cpp +++ b/dpsim/examples/cxx/Circuits/SP_ReducedOrderSG_VBR_Load_Fault.cpp @@ -125,7 +125,7 @@ int main(int argc, char* argv[]) { SystemComponentList{genSP, load, fault}); // Logging - auto loggerSP = DataLogger::make(simNameSP, true, logDownSampling); + auto loggerSP = CPS::DataLogger::make(simNameSP, true, logDownSampling); loggerSP->logAttribute("v_gen", genSP->attribute("v_intf")); loggerSP->logAttribute("i_gen", genSP->attribute("i_intf")); loggerSP->logAttribute("Te", genSP->attribute("Te")); diff --git a/dpsim/examples/cxx/Circuits/SP_SMIB_ReducedOrderSG_LoadStep.cpp b/dpsim/examples/cxx/Circuits/SP_SMIB_ReducedOrderSG_LoadStep.cpp index f0647d65ab..697d35c444 100644 --- a/dpsim/examples/cxx/Circuits/SP_SMIB_ReducedOrderSG_LoadStep.cpp +++ b/dpsim/examples/cxx/Circuits/SP_SMIB_ReducedOrderSG_LoadStep.cpp @@ -89,7 +89,7 @@ int main(int argc, char* argv[]) { SystemComponentList{genPF, linePF, extnetPF}); // Logging - auto loggerPF = DataLogger::make(simNamePF); + auto loggerPF = CPS::DataLogger::make(simNamePF); loggerPF->logAttribute("v1", n1PF->attribute("v")); loggerPF->logAttribute("v2", n2PF->attribute("v")); @@ -152,7 +152,7 @@ int main(int argc, char* argv[]) { // Logging // log node voltage - auto logger = DataLogger::make(simName, true, logDownSampling); + auto logger = CPS::DataLogger::make(simName, true, logDownSampling); for (auto node : systemSP.mNodes) logger->logAttribute(node->name() + ".V", node->attribute("v")); diff --git a/dpsim/examples/cxx/Circuits/SP_Slack_PiLine_PQLoad_with_PF_Init.cpp b/dpsim/examples/cxx/Circuits/SP_Slack_PiLine_PQLoad_with_PF_Init.cpp index d49a10b5f2..a1314f20a1 100644 --- a/dpsim/examples/cxx/Circuits/SP_Slack_PiLine_PQLoad_with_PF_Init.cpp +++ b/dpsim/examples/cxx/Circuits/SP_Slack_PiLine_PQLoad_with_PF_Init.cpp @@ -66,7 +66,7 @@ int main(int argc, char* argv[]) { SystemComponentList{extnetPF, linePF, loadPF}); // Logging - auto loggerPF = DataLogger::make(simNamePF); + auto loggerPF = CPS::DataLogger::make(simNamePF); loggerPF->logAttribute("v1", n1PF->attribute("v")); loggerPF->logAttribute("v2", n2PF->attribute("v")); @@ -113,7 +113,7 @@ int main(int argc, char* argv[]) { systemSP.initWithPowerflow(systemPF); // Logging - auto loggerSP = DataLogger::make(simNameSP); + auto loggerSP = CPS::DataLogger::make(simNameSP); loggerSP->logAttribute("v1", n1SP->attribute("v")); loggerSP->logAttribute("v2", n2SP->attribute("v")); loggerSP->logAttribute("i12", lineSP->attribute("i_intf")); diff --git a/dpsim/examples/cxx/Circuits/SP_Slack_PiLine_VSI_Ramp_with_PF_Init.cpp b/dpsim/examples/cxx/Circuits/SP_Slack_PiLine_VSI_Ramp_with_PF_Init.cpp index b78827c072..6fdb42855d 100644 --- a/dpsim/examples/cxx/Circuits/SP_Slack_PiLine_VSI_Ramp_with_PF_Init.cpp +++ b/dpsim/examples/cxx/Circuits/SP_Slack_PiLine_VSI_Ramp_with_PF_Init.cpp @@ -83,7 +83,7 @@ int main(int argc, char* argv[]) { SystemComponentList{extnetPF, linePF, loadPF}); // Logging - auto loggerPF = DataLogger::make(simNamePF); + auto loggerPF = CPS::DataLogger::make(simNamePF); loggerPF->logAttribute("v1", n1PF->attribute("v")); loggerPF->logAttribute("v2", n2PF->attribute("v")); @@ -134,7 +134,7 @@ int main(int argc, char* argv[]) { systemSP.initWithPowerflow(systemPF); // Logging - auto loggerSP = DataLogger::make(simName); + auto loggerSP = CPS::DataLogger::make(simName); loggerSP->logAttribute("v1", n1SP->attribute("v")); loggerSP->logAttribute("v2", n2SP->attribute("v")); loggerSP->logAttribute("i12", lineSP->attribute("i_intf")); diff --git a/dpsim/examples/cxx/Circuits/SP_Slack_PiLine_VSI_with_PF_Init.cpp b/dpsim/examples/cxx/Circuits/SP_Slack_PiLine_VSI_with_PF_Init.cpp index e3b47c855e..1bc1b8b413 100644 --- a/dpsim/examples/cxx/Circuits/SP_Slack_PiLine_VSI_with_PF_Init.cpp +++ b/dpsim/examples/cxx/Circuits/SP_Slack_PiLine_VSI_with_PF_Init.cpp @@ -70,7 +70,7 @@ int main(int argc, char* argv[]) { SystemComponentList{extnetPF, linePF, loadPF}); // Logging - auto loggerPF = DataLogger::make(simNamePF); + auto loggerPF = CPS::DataLogger::make(simNamePF); loggerPF->logAttribute("v1", n1PF->attribute("v")); loggerPF->logAttribute("v2", n2PF->attribute("v")); @@ -123,7 +123,7 @@ int main(int argc, char* argv[]) { systemSP.initWithPowerflow(systemPF); // Logging - auto loggerSP = DataLogger::make(simNameSP); + auto loggerSP = CPS::DataLogger::make(simNameSP); loggerSP->logAttribute("v1", n1SP->attribute("v")); loggerSP->logAttribute("v2", n2SP->attribute("v")); loggerSP->logAttribute("i12", lineSP->attribute("i_intf")); diff --git a/dpsim/examples/cxx/Circuits/SP_SynGenTrStab_3Bus_Fault.cpp b/dpsim/examples/cxx/Circuits/SP_SynGenTrStab_3Bus_Fault.cpp index b16c3611aa..a6eca28f22 100644 --- a/dpsim/examples/cxx/Circuits/SP_SynGenTrStab_3Bus_Fault.cpp +++ b/dpsim/examples/cxx/Circuits/SP_SynGenTrStab_3Bus_Fault.cpp @@ -80,7 +80,7 @@ void SP_SynGenTrStab_3Bus_Fault(String simName, Real timeStep, Real finalTime, b SystemComponentList{gen1PF, gen2PF, loadPF, line12PF, line13PF, line23PF, faultPF}); // Logging - auto loggerPF = DataLogger::make(simNamePF); + auto loggerPF = CPS::DataLogger::make(simNamePF); loggerPF->logAttribute("v_bus1", n1PF->attribute("v")); loggerPF->logAttribute("v_bus2", n2PF->attribute("v")); loggerPF->logAttribute("v_bus3", n3PF->attribute("v")); @@ -169,7 +169,7 @@ void SP_SynGenTrStab_3Bus_Fault(String simName, Real timeStep, Real finalTime, b systemSP.initWithPowerflow(systemPF); // Logging - auto loggerSP = DataLogger::make(simNameSP); + auto loggerSP = CPS::DataLogger::make(simNameSP); loggerSP->logAttribute("v1", n1SP->attribute("v")); loggerSP->logAttribute("v2", n2SP->attribute("v")); loggerSP->logAttribute("v3", n3SP->attribute("v")); diff --git a/dpsim/examples/cxx/Circuits/SP_SynGenTrStab_3Bus_SteadyState.cpp b/dpsim/examples/cxx/Circuits/SP_SynGenTrStab_3Bus_SteadyState.cpp index 941f7337ac..fdfc91eaaf 100644 --- a/dpsim/examples/cxx/Circuits/SP_SynGenTrStab_3Bus_SteadyState.cpp +++ b/dpsim/examples/cxx/Circuits/SP_SynGenTrStab_3Bus_SteadyState.cpp @@ -69,7 +69,7 @@ void SP_SynGenTrStab_3Bus_SteadyState(String simName, Real timeStep, Real finalT SystemComponentList{gen1PF, gen2PF, loadPF, line12PF, line13PF, line23PF}); // Logging - auto loggerPF = DataLogger::make(simNamePF); + auto loggerPF = CPS::DataLogger::make(simNamePF); loggerPF->logAttribute("v_bus1", n1PF->attribute("v")); loggerPF->logAttribute("v_bus2", n2PF->attribute("v")); loggerPF->logAttribute("v_bus3", n3PF->attribute("v")); @@ -141,7 +141,7 @@ void SP_SynGenTrStab_3Bus_SteadyState(String simName, Real timeStep, Real finalT systemSP.initWithPowerflow(systemPF); // Logging - auto loggerSP = DataLogger::make(simNameSP); + auto loggerSP = CPS::DataLogger::make(simNameSP); loggerSP->logAttribute("v1", n1SP->attribute("v")); loggerSP->logAttribute("v2", n2SP->attribute("v")); loggerSP->logAttribute("v3", n3SP->attribute("v")); diff --git a/dpsim/examples/cxx/Circuits/SP_SynGenTrStab_SMIB_Fault.cpp b/dpsim/examples/cxx/Circuits/SP_SynGenTrStab_SMIB_Fault.cpp index 22a5e40f5f..1544648996 100644 --- a/dpsim/examples/cxx/Circuits/SP_SynGenTrStab_SMIB_Fault.cpp +++ b/dpsim/examples/cxx/Circuits/SP_SynGenTrStab_SMIB_Fault.cpp @@ -63,7 +63,7 @@ void SP_1ph_SynGenTrStab_Fault(String simName, Real timeStep, Real finalTime, bo SystemComponentList{genPF, linePF, extnetPF, faultPF}); // Logging - auto loggerPF = DataLogger::make(simNamePF); + auto loggerPF = CPS::DataLogger::make(simNamePF); loggerPF->logAttribute("v1", n1PF->attribute("v")); loggerPF->logAttribute("v2", n2PF->attribute("v")); @@ -127,7 +127,7 @@ void SP_1ph_SynGenTrStab_Fault(String simName, Real timeStep, Real finalTime, bo // Logging - auto loggerSP = DataLogger::make(simNameSP); + auto loggerSP = CPS::DataLogger::make(simNameSP); loggerSP->logAttribute("v1", n1SP->attribute("v")); loggerSP->logAttribute("v2", n2SP->attribute("v")); //gen diff --git a/dpsim/examples/cxx/Circuits/SP_SynGenTrStab_SMIB_Fault_KundurExample1.cpp b/dpsim/examples/cxx/Circuits/SP_SynGenTrStab_SMIB_Fault_KundurExample1.cpp index 4cb7f1a3b3..28b13e3989 100644 --- a/dpsim/examples/cxx/Circuits/SP_SynGenTrStab_SMIB_Fault_KundurExample1.cpp +++ b/dpsim/examples/cxx/Circuits/SP_SynGenTrStab_SMIB_Fault_KundurExample1.cpp @@ -110,7 +110,7 @@ void SP_1ph_SynGenTrStab_Fault(String simName, Real timeStep, Real finalTime, Re SystemComponentList{genPF, trafoPF, linePF, extnetPF, faultPF}); // Logging - auto loggerPF = DataLogger::make(simNamePF); + auto loggerPF = CPS::DataLogger::make(simNamePF); loggerPF->logAttribute("v1", n1PF->attribute("v")); loggerPF->logAttribute("v2", n2PF->attribute("v")); loggerPF->logAttribute("v3", n3PF->attribute("v")); @@ -180,7 +180,7 @@ void SP_1ph_SynGenTrStab_Fault(String simName, Real timeStep, Real finalTime, Re // Logging - auto loggerSP = DataLogger::make(simNameSP); + auto loggerSP = CPS::DataLogger::make(simNameSP); loggerSP->logAttribute("v1", n1SP->attribute("v")); loggerSP->logAttribute("v2", n2SP->attribute("v")); loggerSP->logAttribute("v3", n3SP->attribute("v")); diff --git a/dpsim/examples/cxx/Circuits/SP_SynGenTrStab_SMIB_SteadyState.cpp b/dpsim/examples/cxx/Circuits/SP_SynGenTrStab_SMIB_SteadyState.cpp index 738af2d60c..301c6e4282 100644 --- a/dpsim/examples/cxx/Circuits/SP_SynGenTrStab_SMIB_SteadyState.cpp +++ b/dpsim/examples/cxx/Circuits/SP_SynGenTrStab_SMIB_SteadyState.cpp @@ -53,7 +53,7 @@ void SP_1ph_SynGenTrStab_SteadyState(String simName, Real timeStep, Real finalTi SystemComponentList{genPF, linePF, extnetPF}); // Logging - auto loggerPF = DataLogger::make(simNamePF); + auto loggerPF = CPS::DataLogger::make(simNamePF); loggerPF->logAttribute("v1", n1PF->attribute("v")); loggerPF->logAttribute("v2", n2PF->attribute("v")); @@ -105,7 +105,7 @@ void SP_1ph_SynGenTrStab_SteadyState(String simName, Real timeStep, Real finalTi // Logging - auto loggerSP = DataLogger::make(simNameSP); + auto loggerSP = CPS::DataLogger::make(simNameSP); loggerSP->logAttribute("v1", n1SP->attribute("v")); loggerSP->logAttribute("v2", n2SP->attribute("v")); //gen diff --git a/dpsim/examples/cxx/Components/DP_EMT_SynGenDq7odODE_LoadStep.cpp b/dpsim/examples/cxx/Components/DP_EMT_SynGenDq7odODE_LoadStep.cpp index cb45219851..5f355309ae 100644 --- a/dpsim/examples/cxx/Components/DP_EMT_SynGenDq7odODE_LoadStep.cpp +++ b/dpsim/examples/cxx/Components/DP_EMT_SynGenDq7odODE_LoadStep.cpp @@ -81,7 +81,7 @@ void DP_SynGenDq7odODE_LoadStep(Real timeStep, Real finalTime, Real breakerClose auto sys = SystemTopology(60, SystemNodeList{n1}, SystemComponentList{gen, res, fault}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("i_gen", gen->attribute("i_intf")); logger->logAttribute("wr_gen", gen->attribute("w_r")); @@ -134,7 +134,7 @@ void EMT_SynGenDq7odODE_LoadStep(Real timeStep, Real finalTime, Real breakerClos auto sys = SystemTopology(60, SystemNodeList{n1}, SystemComponentList{gen, res, fault}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("i_gen", gen->attribute("i_intf")); logger->logAttribute("wr_gen", gen->attribute("w_r")); diff --git a/dpsim/examples/cxx/Components/DP_EMT_SynGenDq7odODE_SteadyState.cpp b/dpsim/examples/cxx/Components/DP_EMT_SynGenDq7odODE_SteadyState.cpp index 65fdee8fe0..2157620a14 100644 --- a/dpsim/examples/cxx/Components/DP_EMT_SynGenDq7odODE_SteadyState.cpp +++ b/dpsim/examples/cxx/Components/DP_EMT_SynGenDq7odODE_SteadyState.cpp @@ -75,7 +75,7 @@ void DP_SynGenDq7odODE_SteadyState(Real timeStep, Real finalTime) { auto sys = SystemTopology(60, SystemNodeList{n1}, SystemComponentList{gen, res}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("i_load", res->attribute("i_intf")); @@ -114,7 +114,7 @@ void EMT_SynGenDq7odODE_SteadyState(Real timeStep, Real finalTime) { auto sys = SystemTopology(60, SystemNodeList{n1}, SystemComponentList{gen, res}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("i_load", res->attribute("i_intf")); diff --git a/dpsim/examples/cxx/Components/DP_EMT_SynGenDq7odODE_ThreePhFault.cpp b/dpsim/examples/cxx/Components/DP_EMT_SynGenDq7odODE_ThreePhFault.cpp index 8e403a9978..59d64d5d87 100644 --- a/dpsim/examples/cxx/Components/DP_EMT_SynGenDq7odODE_ThreePhFault.cpp +++ b/dpsim/examples/cxx/Components/DP_EMT_SynGenDq7odODE_ThreePhFault.cpp @@ -81,7 +81,7 @@ void DP_SynGenDq7odODE_ThreePhFault(Real timeStep, Real finalTime, String extens auto sys = SystemTopology(60, SystemNodeList{n1}, SystemComponentList{gen, res, fault}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("i_gen", gen->attribute("i_intf")); logger->logAttribute("wr_gen", gen->attribute("w_r")); @@ -132,7 +132,7 @@ void EMT_SynGenDq7odODE_ThreePhFault(Real timeStep, Real finalTime, String exten auto sys = SystemTopology(60, SystemNodeList{n1}, SystemComponentList{gen, res, fault}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("i_gen", gen->attribute("i_intf")); logger->logAttribute("wr_gen", gen->attribute("w_r")); diff --git a/dpsim/examples/cxx/Components/DP_EMT_SynGenDq7odTrapez_LoadStep.cpp b/dpsim/examples/cxx/Components/DP_EMT_SynGenDq7odTrapez_LoadStep.cpp index 144eb109c2..1539fd54fe 100644 --- a/dpsim/examples/cxx/Components/DP_EMT_SynGenDq7odTrapez_LoadStep.cpp +++ b/dpsim/examples/cxx/Components/DP_EMT_SynGenDq7odTrapez_LoadStep.cpp @@ -82,7 +82,7 @@ void DP_SynGenDq7odTrapez_LoadStep(Real timeStep, Real finalTime, Real breakerCl auto sys = SystemTopology(60, SystemNodeList{n1}, SystemComponentList{gen, res, fault}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("i_gen", gen->attribute("i_intf")); logger->logAttribute("wr_gen", gen->attribute("w_r")); @@ -134,7 +134,7 @@ void EMT_SynGenDq7odTrapez_LoadStep(Real timeStep, Real finalTime, Real breakerC auto sys = SystemTopology(60, SystemNodeList{n1}, SystemComponentList{gen, res, fault}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("i_gen", gen->attribute("i_intf")); logger->logAttribute("wr_gen", gen->attribute("w_r")); diff --git a/dpsim/examples/cxx/Components/DP_EMT_SynGenDq7odTrapez_SteadyState.cpp b/dpsim/examples/cxx/Components/DP_EMT_SynGenDq7odTrapez_SteadyState.cpp index fba608b702..51128b4b74 100644 --- a/dpsim/examples/cxx/Components/DP_EMT_SynGenDq7odTrapez_SteadyState.cpp +++ b/dpsim/examples/cxx/Components/DP_EMT_SynGenDq7odTrapez_SteadyState.cpp @@ -72,7 +72,7 @@ void DP_SynGenDq7odTrapez_SteadyState(Real timeStep, Real finalTime) { auto sys = SystemTopology(60, SystemNodeList{n1}, SystemComponentList{gen, res}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("i_load", res->attribute("i_intf")); @@ -109,7 +109,7 @@ void EMT_SynGenDq7odTrapez_SteadyState(Real timeStep, Real finalTime) { auto sys = SystemTopology(60, SystemNodeList{n1}, SystemComponentList{gen, res}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("i_load", res->attribute("i_intf")); diff --git a/dpsim/examples/cxx/Components/DP_EMT_SynGenDq7odTrapez_ThreePhFault.cpp b/dpsim/examples/cxx/Components/DP_EMT_SynGenDq7odTrapez_ThreePhFault.cpp index 31ea4c508a..6bf811cfd3 100644 --- a/dpsim/examples/cxx/Components/DP_EMT_SynGenDq7odTrapez_ThreePhFault.cpp +++ b/dpsim/examples/cxx/Components/DP_EMT_SynGenDq7odTrapez_ThreePhFault.cpp @@ -81,7 +81,7 @@ void DP_SynGenDq7odTrapez_ThreePhFault(Real timeStep, Real finalTime) { auto sys = SystemTopology(60, SystemNodeList{n1}, SystemComponentList{gen, res, fault}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("i_gen", gen->attribute("i_intf")); logger->logAttribute("wr_gen", gen->attribute("w_r")); @@ -131,7 +131,7 @@ void EMT_SynGenDq7odTrapez_ThreePhFault(Real timeStep, Real finalTime) { auto sys = SystemTopology(60, SystemNodeList{n1}, SystemComponentList{gen, res, fault}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("i_gen", gen->attribute("i_intf")); logger->logAttribute("wr_gen", gen->attribute("w_r")); diff --git a/dpsim/examples/cxx/Components/DP_Inverter_Grid.cpp b/dpsim/examples/cxx/Components/DP_Inverter_Grid.cpp index 25bc40a055..11e4ea8aaf 100644 --- a/dpsim/examples/cxx/Components/DP_Inverter_Grid.cpp +++ b/dpsim/examples/cxx/Components/DP_Inverter_Grid.cpp @@ -84,7 +84,7 @@ int main(int argc, char* argv[]) { sim.doFrequencyParallelization(false); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v"), 1, 9); logger->logAttribute("v2", n2->attribute("v"), 1, 1); logger->logAttribute("v3", n3->attribute("v"), 1, 9); diff --git a/dpsim/examples/cxx/Components/DP_Multimachine_DQ_Parallel.cpp b/dpsim/examples/cxx/Components/DP_Multimachine_DQ_Parallel.cpp index a5d7e65c3f..7420fcac5e 100644 --- a/dpsim/examples/cxx/Components/DP_Multimachine_DQ_Parallel.cpp +++ b/dpsim/examples/cxx/Components/DP_Multimachine_DQ_Parallel.cpp @@ -101,7 +101,7 @@ void doSim(int threads, int generators, int repNumber) { auto sys = SystemTopology(60, nodes, components); // Logging - //auto logger = DataLogger::make(name); + //auto logger = CPS::DataLogger::make(name); //logger->logAttribute("v1", n1->attribute("v")); //logger->logAttribute("i_load", res->attribute("i_intf")); diff --git a/dpsim/examples/cxx/Components/DP_SP_SynGenTrStab_testModels.cpp b/dpsim/examples/cxx/Components/DP_SP_SynGenTrStab_testModels.cpp index 7efbdec358..30c4b8cb57 100644 --- a/dpsim/examples/cxx/Components/DP_SP_SynGenTrStab_testModels.cpp +++ b/dpsim/examples/cxx/Components/DP_SP_SynGenTrStab_testModels.cpp @@ -109,7 +109,7 @@ void SP_1ph_SynGenTrStab_Fault(Real timeStep, Real finalTime, bool startFaultEve SystemComponentList{genPF, linePF, extnetPF}); // Logging - auto loggerPF = DataLogger::make(simNamePF); + auto loggerPF = CPS::DataLogger::make(simNamePF); loggerPF->logAttribute("v1", n1PF->attribute("v")); loggerPF->logAttribute("v2", n2PF->attribute("v")); loggerPF->logAttribute("v_line", linePF->attribute("v_intf")); @@ -168,7 +168,7 @@ void SP_1ph_SynGenTrStab_Fault(Real timeStep, Real finalTime, bool startFaultEve // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("v2", n2->attribute("v")); logger->logAttribute("v_line", line->attribute("v_intf")); @@ -238,7 +238,7 @@ void DP_1ph_SynGenTrStab_Fault(Real timeStep, Real finalTime, bool startFaultEve SystemComponentList{genPF, linePF, extnetPF}); // Logging - auto loggerPF = DataLogger::make(simNamePF); + auto loggerPF = CPS::DataLogger::make(simNamePF); loggerPF->logAttribute("v1", n1PF->attribute("v")); loggerPF->logAttribute("v2", n2PF->attribute("v")); loggerPF->logAttribute("v_line", linePF->attribute("v_intf")); @@ -297,7 +297,7 @@ void DP_1ph_SynGenTrStab_Fault(Real timeStep, Real finalTime, bool startFaultEve // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("v2", n2->attribute("v")); logger->logAttribute("v_line", line->attribute("v_intf")); diff --git a/dpsim/examples/cxx/Components/DP_SP_SynGenTrStab_testModels_doubleLine.cpp b/dpsim/examples/cxx/Components/DP_SP_SynGenTrStab_testModels_doubleLine.cpp index bad77ce355..0c7685f080 100644 --- a/dpsim/examples/cxx/Components/DP_SP_SynGenTrStab_testModels_doubleLine.cpp +++ b/dpsim/examples/cxx/Components/DP_SP_SynGenTrStab_testModels_doubleLine.cpp @@ -117,7 +117,7 @@ void SP_1ph_SynGenTrStab_Fault(Real timeStep, Real finalTime, bool startFaultEve SystemComponentList{genPF, linePF1, linePF21, linePF22, extnetPF}); // Logging - auto loggerPF = DataLogger::make(simNamePF); + auto loggerPF = CPS::DataLogger::make(simNamePF); loggerPF->logAttribute("v1", n1PF->attribute("v")); loggerPF->logAttribute("v2", n2PF->attribute("v")); loggerPF->logAttribute("v_line1", linePF1->attribute("v_intf")); @@ -195,7 +195,7 @@ void SP_1ph_SynGenTrStab_Fault(Real timeStep, Real finalTime, bool startFaultEve // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("v2", n2->attribute("v")); logger->logAttribute("v_line1", line1->attribute("v_intf")); @@ -280,7 +280,7 @@ void DP_1ph_SynGenTrStab_Fault(Real timeStep, Real finalTime, bool startFaultEve SystemComponentList{genPF, linePF1, linePF21, linePF22, extnetPF}); // Logging - auto loggerPF = DataLogger::make(simNamePF); + auto loggerPF = CPS::DataLogger::make(simNamePF); loggerPF->logAttribute("v1", n1PF->attribute("v")); loggerPF->logAttribute("v2", n2PF->attribute("v")); loggerPF->logAttribute("v_line1", linePF1->attribute("v_intf")); @@ -352,7 +352,7 @@ void DP_1ph_SynGenTrStab_Fault(Real timeStep, Real finalTime, bool startFaultEve // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("v2", n2->attribute("v")); logger->logAttribute("v_line1", line1->attribute("v_intf")); diff --git a/dpsim/examples/cxx/Components/DP_SynGenDq7odODE_SteadyState.cpp b/dpsim/examples/cxx/Components/DP_SynGenDq7odODE_SteadyState.cpp index 8f6f5189ed..592c5c63e8 100644 --- a/dpsim/examples/cxx/Components/DP_SynGenDq7odODE_SteadyState.cpp +++ b/dpsim/examples/cxx/Components/DP_SynGenDq7odODE_SteadyState.cpp @@ -72,7 +72,7 @@ int main(int argc, char* argv[]) { auto sys = SystemTopology(60, SystemNodeList{n1}, SystemComponentList{gen, res}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("i_load", res->attribute("i_intf")); diff --git a/dpsim/examples/cxx/Components/DP_SynGenDq7odODE_ThreePhFault.cpp b/dpsim/examples/cxx/Components/DP_SynGenDq7odODE_ThreePhFault.cpp index 2f7e6bc97c..886f2d495f 100644 --- a/dpsim/examples/cxx/Components/DP_SynGenDq7odODE_ThreePhFault.cpp +++ b/dpsim/examples/cxx/Components/DP_SynGenDq7odODE_ThreePhFault.cpp @@ -76,7 +76,7 @@ int main(int argc, char* argv[]) { fault->connect({SimNode::GND, n1}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("i_gen", gen->attribute("i_intf")); logger->logAttribute("i_load", res->attribute("i_intf")); diff --git a/dpsim/examples/cxx/Components/DP_SynGenDq7odTrapez_ThreePhFault.cpp b/dpsim/examples/cxx/Components/DP_SynGenDq7odTrapez_ThreePhFault.cpp index 8cec3376d6..970b8e8431 100644 --- a/dpsim/examples/cxx/Components/DP_SynGenDq7odTrapez_ThreePhFault.cpp +++ b/dpsim/examples/cxx/Components/DP_SynGenDq7odTrapez_ThreePhFault.cpp @@ -75,7 +75,7 @@ int main(int argc, char* argv[]) { fault->connect({SimNode::GND, n1}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("i_gen", gen->attribute("i_intf")); diff --git a/dpsim/examples/cxx/Components/DP_SynGenTrStab_LoadStep.cpp b/dpsim/examples/cxx/Components/DP_SynGenTrStab_LoadStep.cpp index 16b4d2d4b9..d7e9892c27 100644 --- a/dpsim/examples/cxx/Components/DP_SynGenTrStab_LoadStep.cpp +++ b/dpsim/examples/cxx/Components/DP_SynGenTrStab_LoadStep.cpp @@ -55,7 +55,7 @@ int main(int argc, char* argv[]) { auto sys = SystemTopology(60, SystemNodeList{n1}, SystemComponentList{gen, load}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("i_gen", gen->attribute("i_intf")); logger->logAttribute("i_load", load->attribute("i_intf")); diff --git a/dpsim/examples/cxx/Components/DP_SynGenTrStab_SteadyState.cpp b/dpsim/examples/cxx/Components/DP_SynGenTrStab_SteadyState.cpp index 820ea3adad..5724301a8c 100644 --- a/dpsim/examples/cxx/Components/DP_SynGenTrStab_SteadyState.cpp +++ b/dpsim/examples/cxx/Components/DP_SynGenTrStab_SteadyState.cpp @@ -50,7 +50,7 @@ int main(int argc, char* argv[]) { res->connect({SimNode::GND, n1}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("i_gen", gen->attribute("i_intf")); logger->logAttribute("i_load", res->attribute("i_intf")); diff --git a/dpsim/examples/cxx/Components/EMT_SynchronGenerator9OrderDCIM_LoadStep_TurbineGovernor_Exciter.cpp b/dpsim/examples/cxx/Components/EMT_SynchronGenerator9OrderDCIM_LoadStep_TurbineGovernor_Exciter.cpp index 0c618c2c46..66b15fdb99 100644 --- a/dpsim/examples/cxx/Components/EMT_SynchronGenerator9OrderDCIM_LoadStep_TurbineGovernor_Exciter.cpp +++ b/dpsim/examples/cxx/Components/EMT_SynchronGenerator9OrderDCIM_LoadStep_TurbineGovernor_Exciter.cpp @@ -41,7 +41,7 @@ int main(int argc, char* argv[]) { Bool withExciter = false; Real timeStepEvent = 30.0; Real cmdLoadFactor = 1.5; - + CommandLineArgs args(argc, argv); if (argc > 1) { @@ -78,14 +78,14 @@ int main(int argc, char* argv[]) { initActivePower, initReactivePower, initTerminalVoltageMagnitude, initTerminalVoltageAngle, initMechPower); - if (withGovernor) + if (withGovernor) gen->addGovernor(govKundur.Ta_t, govKundur.Tb, govKundur.Tc, govKundur.Fa, govKundur.Fb, govKundur.Fc, govKundur.Kg, govKundur.Tsr, govKundur.Tsm, initActivePower / syngenKundur.nomPower, initMechPower / syngenKundur.nomPower); - + if (withExciter) gen->addExciter(excEremia.Ta, excEremia.Ka, excEremia.Te, excEremia.Ke, excEremia.Tf, excEremia.Kf, excEremia.Tr); auto fault = CPS::EMT::Ph3::Switch::make("Br_fault", CPS::Logger::Level::info); - fault->setParameters(Math::singlePhaseParameterToThreePhase(RloadOriginal), + fault->setParameters(Math::singlePhaseParameterToThreePhase(RloadOriginal), Math::singlePhaseParameterToThreePhase(RloadNew)); fault->openSwitch(); @@ -97,7 +97,7 @@ int main(int argc, char* argv[]) { auto sys = SystemTopology(60, SystemNodeList{n1}, SystemComponentList{gen, fault}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("i_gen", gen->attribute("i_intf")); logger->logAttribute("wr_gen", gen->attribute("w_r")); diff --git a/dpsim/examples/cxx/Components/EMT_SynchronGenerator9OrderVBR_LoadStep_TurbineGovernor_Exciter.cpp b/dpsim/examples/cxx/Components/EMT_SynchronGenerator9OrderVBR_LoadStep_TurbineGovernor_Exciter.cpp index 4657a87644..f7a700b097 100644 --- a/dpsim/examples/cxx/Components/EMT_SynchronGenerator9OrderVBR_LoadStep_TurbineGovernor_Exciter.cpp +++ b/dpsim/examples/cxx/Components/EMT_SynchronGenerator9OrderVBR_LoadStep_TurbineGovernor_Exciter.cpp @@ -41,7 +41,7 @@ int main(int argc, char* argv[]) { Bool withExciter = false; Real timeStepEvent = 30.0; Real cmdLoadFactor = 1.5; - + CommandLineArgs args(argc, argv); if (argc > 1) { @@ -79,14 +79,14 @@ int main(int argc, char* argv[]) { gen->setInitialValues(initActivePower, initReactivePower, initTerminalVoltageMagnitude, initTerminalVoltageAngle, initMechPower); - if (withGovernor) + if (withGovernor) gen->addGovernor(govKundur.Ta_t, govKundur.Tb, govKundur.Tc, govKundur.Fa, govKundur.Fb, govKundur.Fc, govKundur.Kg, govKundur.Tsr, govKundur.Tsm, initActivePower / syngenKundur.nomPower, initMechPower / syngenKundur.nomPower); if (withExciter) gen->addExciter(excEremia.Ta, excEremia.Ka, excEremia.Te, excEremia.Ke, excEremia.Tf, excEremia.Kf, excEremia.Tr); auto fault = CPS::EMT::Ph3::Switch::make("Br_fault", CPS::Logger::Level::info); - fault->setParameters(Math::singlePhaseParameterToThreePhase(RloadOriginal), + fault->setParameters(Math::singlePhaseParameterToThreePhase(RloadOriginal), Math::singlePhaseParameterToThreePhase(RloadNew)); fault->openSwitch(); @@ -98,7 +98,7 @@ int main(int argc, char* argv[]) { auto sys = SystemTopology(60, SystemNodeList{n1}, SystemComponentList{gen, fault}); // Logging - auto logger = DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); logger->logAttribute("v1", n1->attribute("v")); logger->logAttribute("i_gen", gen->attribute("i_intf")); logger->logAttribute("wr_gen", gen->attribute("w_r")); diff --git a/dpsim/examples/cxx/Examples.h b/dpsim/examples/cxx/Examples.h index ed7af6ae35..49883b4af7 100644 --- a/dpsim/examples/cxx/Examples.h +++ b/dpsim/examples/cxx/Examples.h @@ -99,9 +99,9 @@ namespace ExcitationSystemEremia { namespace TurbineGovernor { struct TurbineGovernorPSAT1 { - // Turbine Governor type 1 - // Taken from from PSAT - example d_014_pss_l14 - + // Turbine Governor type 1 + // Taken from from PSAT - example d_014_pss_l14 + // Reference speed (p.u.) Real OmegaRef = 1.0; // Pilot valve droop (p.u.) @@ -123,9 +123,9 @@ namespace TurbineGovernor { }; struct TurbineGovernorPSAT2 { - // Turbine Governor type 1 + // Turbine Governor type 1 // Taken from PSAT - example d_anderson_farmer - + // Reference speed (p.u.) Real OmegaRef = 1.0; // Pilot valve droop (p.u.) @@ -279,7 +279,7 @@ namespace SMIB { Complex initComplexElectricalPower = Complex(initActivePower, initReactivePower); Complex initTerminalVolt = VnomMV * Complex(cos(initVoltAngle), sin(initVoltAngle)); - // + // Real SwitchClosed = 0.1; Real SwitchOpen = 1e6; }; @@ -368,7 +368,7 @@ namespace Scenario5 { } namespace Scenario6 { - // SMIB scenario with ideal trafo and load step as event + // SMIB scenario with ideal trafo and load step as event struct Config { // default configuration of scenario @@ -402,7 +402,7 @@ namespace Scenario6 { Real lineConductance = 0.0048; // Psnub 0.5% of 555MW // Load step - Real loadStepActivePower = 100e6; + Real loadStepActivePower = 100e6; }; } @@ -619,7 +619,7 @@ namespace CIGREMV { } } - void logPVAttributes(DPsim::DataLogger::Ptr logger, CPS::TopologicalPowerComp::Ptr pv) { + void logPVAttributes(CPS::DataLogger::Ptr logger, CPS::TopologicalPowerComp::Ptr pv) { // power controller std::vector inputNames = { pv->name() + "_powerctrl_input_pref", pv->name() + "_powerctrl_input_qref", @@ -647,7 +647,7 @@ namespace CIGREMV { } namespace Events { - std::shared_ptr createEventAddPowerConsumption(String nodeName, Real eventTime, Real additionalActivePower, SystemTopology& system, Domain domain, DPsim::DataLogger::Ptr logger) { + std::shared_ptr createEventAddPowerConsumption(String nodeName, Real eventTime, Real additionalActivePower, SystemTopology& system, Domain domain, CPS::DataLogger::Ptr logger) { // TODO: use base classes ph1 if (domain == CPS::Domain::DP) { @@ -675,7 +675,7 @@ namespace Events { } } - std::shared_ptr createEventAddPowerConsumption3Ph(String nodeName, Real eventTime, Real additionalActivePower, SystemTopology& system, Domain domain, DPsim::DataLogger::Ptr logger) { + std::shared_ptr createEventAddPowerConsumption3Ph(String nodeName, Real eventTime, Real additionalActivePower, SystemTopology& system, Domain domain, CPS::DataLogger::Ptr logger) { // TODO: use base classes ph3 if (domain == CPS::Domain::EMT) { diff --git a/dpsim/examples/cxx/RealTime/RT_CIGRE_MV_PowerFlowTest.cpp b/dpsim/examples/cxx/RealTime/RT_CIGRE_MV_PowerFlowTest.cpp index 07f4a1c8d3..7269752130 100644 --- a/dpsim/examples/cxx/RealTime/RT_CIGRE_MV_PowerFlowTest.cpp +++ b/dpsim/examples/cxx/RealTime/RT_CIGRE_MV_PowerFlowTest.cpp @@ -40,7 +40,7 @@ int main(int argc, char** argv){ CIM::Reader reader(Logger::Level::debug, Logger::Level::off, Logger::Level::off); SystemTopology system = reader.loadCIM(system_freq, filenames, CPS::Domain::SP); - auto logger = DPsim::DataLogger::make(simName); + auto logger = CPS::DataLogger::make(simName); for (auto node : system.mNodes) { logger->logAttribute(node->name(), node->attribute("v")); diff --git a/dpsim/include/dpsim/DiakopticsSolver.h b/dpsim/include/dpsim/DiakopticsSolver.h index a976c4c002..e3eb651722 100644 --- a/dpsim/include/dpsim/DiakopticsSolver.h +++ b/dpsim/include/dpsim/DiakopticsSolver.h @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include #include @@ -49,9 +49,9 @@ namespace DPsim { CPS::SystemTopology mSystem; /// Left side vector logger - std::shared_ptr mLeftVectorLog; + std::shared_ptr mLeftVectorLog; /// Right side vector logger - std::shared_ptr mRightVectorLog; + std::shared_ptr mRightVectorLog; std::vector mSubnets; std::unordered_map::Ptr, Subnet*> mNodeSubnetMap; diff --git a/dpsim/include/dpsim/MNASolver.h b/dpsim/include/dpsim/MNASolver.h index fa6d430944..af5b6874da 100644 --- a/dpsim/include/dpsim/MNASolver.h +++ b/dpsim/include/dpsim/MNASolver.h @@ -16,7 +16,7 @@ #include #include -#include +#include #include #include #include @@ -109,9 +109,9 @@ namespace DPsim { /// Last simulation time step when log was updated Int mLastLogTimeStep = 0; /// Left side vector logger - std::shared_ptr mLeftVectorLog; + std::shared_ptr mLeftVectorLog; /// Right side vector logger - std::shared_ptr mRightVectorLog; + std::shared_ptr mRightVectorLog; /// LU factorization measurements std::vector mFactorizeTimes; diff --git a/dpsim/include/dpsim/MNASolverDirect.h b/dpsim/include/dpsim/MNASolverDirect.h index 4a3e93f0da..4262ee364a 100644 --- a/dpsim/include/dpsim/MNASolverDirect.h +++ b/dpsim/include/dpsim/MNASolverDirect.h @@ -17,7 +17,7 @@ #include #include -#include +#include #include #include #include diff --git a/dpsim/include/dpsim/MNASolverFactory.h b/dpsim/include/dpsim/MNASolverFactory.h index 64875010ab..e24bafb92c 100644 --- a/dpsim/include/dpsim/MNASolverFactory.h +++ b/dpsim/include/dpsim/MNASolverFactory.h @@ -9,7 +9,7 @@ #pragma once #include -#include +#include #include #include #include diff --git a/dpsim/include/dpsim/Simulation.h b/dpsim/include/dpsim/Simulation.h index d8a78a2a27..6712dcc1bd 100644 --- a/dpsim/include/dpsim/Simulation.h +++ b/dpsim/include/dpsim/Simulation.h @@ -6,7 +6,7 @@ #include #include -#include +#include #include #include #include @@ -80,7 +80,7 @@ namespace DPsim { /// (Real) time needed for the timesteps std::vector mStepTimes; /// Map of data loggers. mLoggers[**mName] corresponds to the default simulation logger - std::map> mDataLoggers; + std::map> mDataLoggers; // #### Solver Settings #### /// @@ -132,7 +132,7 @@ namespace DPsim { struct LoggerMapping { /// Simulation data logger - DataLogger::Ptr logger; + CPS::DataLogger::Ptr logger; /// Downsampling UInt downsampling; }; @@ -232,7 +232,7 @@ namespace DPsim { } /// Add a new data logger. /// When the name of the new logger matches the simulation name, the default simulation logger will be replaced! - void addLogger(DataLogger::Ptr logger) { + void addLogger(CPS::DataLogger::Ptr logger) { mDataLoggers[logger->name()] = logger; } @@ -258,7 +258,7 @@ namespace DPsim { Real finalTime() const { return **mFinalTime; } Int timeStepCount() const { return mTimeStepCount; } Real timeStep() const { return **mTimeStep; } - std::map> loggers() const { return mDataLoggers; } + std::map> loggers() const { return mDataLoggers; } std::shared_ptr scheduler() const { return mScheduler; } std::vector& stepTimes() { return mStepTimes; } diff --git a/dpsim/include/dpsim/Solver.h b/dpsim/include/dpsim/Solver.h index a1791a4356..c4c17c9f6a 100644 --- a/dpsim/include/dpsim/Solver.h +++ b/dpsim/include/dpsim/Solver.h @@ -13,6 +13,7 @@ #include #include +#include #include #include #include diff --git a/dpsim/src/CMakeLists.txt b/dpsim/src/CMakeLists.txt index 0f0460a280..e88a73e1a6 100644 --- a/dpsim/src/CMakeLists.txt +++ b/dpsim/src/CMakeLists.txt @@ -11,7 +11,6 @@ set(DPSIM_SOURCES Utils.cpp Timer.cpp Event.cpp - DataLogger.cpp Scheduler.cpp SequentialScheduler.cpp ThreadScheduler.cpp diff --git a/dpsim/src/MNASolver.cpp b/dpsim/src/MNASolver.cpp index e7a1cf60ce..e44b071b13 100644 --- a/dpsim/src/MNASolver.cpp +++ b/dpsim/src/MNASolver.cpp @@ -249,7 +249,7 @@ void MnaSolver::initializeSystemWithPrecomputedMatrices() { auto idObj = std::dynamic_pointer_cast(comp); SPDLOG_LOGGER_DEBUG(mSLog, "Stamping {:s} {:s} into source vector", idObj->type(), idObj->name()); - SPDLOG_LOGGER_TRACE(mSLog, "\n{:s}", Logger::matrixToString(mRightSideVector)); + SPDLOG_LOGGER_DEBUG(mSLog, "\n{:s}", Logger::matrixToString(mRightSideVector)); } } @@ -277,7 +277,7 @@ void MnaSolver::initializeSystemWithVariableMatrix() { auto idObj = std::dynamic_pointer_cast(comp); SPDLOG_LOGGER_DEBUG(mSLog, "Stamping {:s} {:s} into source vector", idObj->type(), idObj->name()); - SPDLOG_LOGGER_TRACE(mSLog, "\n{:s}", Logger::matrixToString(mRightSideVector)); + SPDLOG_LOGGER_DEBUG(mSLog, "\n{:s}", Logger::matrixToString(mRightSideVector)); } } diff --git a/dpsim/src/Simulation.cpp b/dpsim/src/Simulation.cpp index 0023b671d4..ea53fbb8ee 100644 --- a/dpsim/src/Simulation.cpp +++ b/dpsim/src/Simulation.cpp @@ -56,7 +56,7 @@ void Simulation::create() { mLog = Logger::get(Logger::LoggerType::SIMULATION, **mName, mLogLevel, mCliLevel); // Create default Data Logger - mDataLoggers[**mName] = DataLogger::make(**mName); + mDataLoggers[**mName] = CPS::DataLogger::make(**mName); Eigen::setNbThreads(1); diff --git a/dpsim/src/pybind/main.cpp b/dpsim/src/pybind/main.cpp index e42b7a4792..ce6655ccab 100644 --- a/dpsim/src/pybind/main.cpp +++ b/dpsim/src/pybind/main.cpp @@ -138,13 +138,13 @@ PYBIND11_MODULE(dpsimpy, m) { py::class_>(m, "Interface"); - py::class_>(m, "Logger") + py::class_>(m, "Logger") .def(py::init()) .def_static("set_log_dir", &CPS::Logger::setLogDir) .def_static("get_log_dir", &CPS::Logger::logDir) - .def("log_attribute", py::overload_cast(&DPsim::DataLogger::logAttribute), "name"_a, "attr"_a, "max_rows"_a = 0, "max_cols"_a = 0) + .def("log_attribute", py::overload_cast(&CPS::DataLogger::logAttribute), "name"_a, "attr"_a, "max_rows"_a = 0, "max_cols"_a = 0) /// Compatibility method. Might be removed later when the python examples have been fully adapted. - .def("log_attribute", py::overload_cast&, CPS::AttributeBase::Ptr>(&DPsim::DataLogger::logAttribute), "names"_a, "attr"_a); + .def("log_attribute", py::overload_cast&, CPS::AttributeBase::Ptr>(&CPS::DataLogger::logAttribute), "names"_a, "attr"_a); py::class_>(m, "IdentifiedObject") .def("name", &CPS::IdentifiedObject::name)