17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-17 20:19:20 +02:00
Files
maszyna/world/TractionPower.cppm
maj00r b8f040e6fd propagate template headers transitively, import Console where used
AnimModel.cpp reaches cParser through the simulation core, not a direct
import, so the previous pass missed it; the propagation now follows the
whole import closure. Train.cpp, drivermode.cpp and Globals.cpp call
Console:: inside _WIN32 guards without importing eu07.console - invisible
on Linux, where those blocks are skipped.
2026-09-10 01:41:24 +02:00

105 lines
2.9 KiB
C++

/*
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
http://mozilla.org/MPL/2.0/.
*/
module;
#include <array>
#include <chrono>
#include <limits>
#include <mutex>
#include <type_traits>
#include <utility>
#include <vector>
#include <cstddef>
#include <deque>
#include <sstream>
#include <string>
#include <unordered_map>
#include <istream>
#include <ostream>
export module eu07.simcore:tractionpower;
import :fwd;
import :scenenode;
import eu07.utilities.parser;
import eu07.utilities.classes;
import eu07.utilities.names;
export {
class TTractionPowerSource : public scene::basic_node {
public:
// constructor
TTractionPowerSource( scene::node_data const &Nodedata );
// methods
void Init(double const u, double const i);
bool Load(cParser *parser);
bool Update(double dt);
double CurrentGet(double res);
void VoltageSet(double const v) {
NominalVoltage = v; };
void PowerSet(TTractionPowerSource *ps);
bool Fuse() const {
return FastFuse || SlowFuse; }
// members
TTractionPowerSource *psNode[ 2 ] = { nullptr, nullptr }; // zasilanie na końcach dla sekcji
bool bSection = false; // czy jest sekcją
bool IsAutogenerated { false }; // indicates autogenerated source for individual traction piece
public:
// Read by the debug panel, which is no longer a friend: a friend declaration
// would make this module the first declarer of a class defined elsewhere,
// which C++20 modules reject.
double NominalVoltage = 0.0;
double TotalCurrent = 0.0;
double OutputVoltage = 0.0;
bool FastFuse = false;
bool SlowFuse = false;
double FuseTimer = 0.0;
int FuseCounter = 0;
private:
// methods
// serialize() subclass details, sends content of the subclass to provided stream
void serialize_( std::ostream &Output ) const;
// deserialize() subclass details, restores content of the subclass from provided stream
void deserialize_( std::istream &Input );
// export() subclass details, sends basic content of the class in legacy (text) format to provided stream
void export_as_text_( std::ostream &Output ) const;
// members
double VoltageFrequency = 0.0;
double InternalRes = 0.2;
double MaxOutputCurrent = 0.0;
double FastFuseTimeOut = 1.0;
int FastFuseRepetition = 3;
double SlowFuseTimeOut = 60.0;
bool Recuperation = false;
double TotalAdmitance = 1e-10; // 10Mom - jakaś tam upływność
double TotalPreviousAdmitance = 1e-10; // zero jest szkodliwe
};
// collection of generators for power grid present in the scene
class powergridsource_table : public basic_table<TTractionPowerSource> {
public:
// legacy method, calculates changes in simulation state over specified time
void
update( double const Deltatime );
};
//---------------------------------------------------------------------------
} // export