#include "pch.h" #include "YN_NodeDef.h" #include "PublicEqpmtID.h" DcYNodeBase::DcYNodeBase() { p_DcYNodesMap = nullptr; m_pCritilSecNodesMap = nullptr; } DcYNodeBase::~DcYNodeBase() { } double DcYNodeBase::GetSelfYValue() //获取节点自导纳 { double SelfY = 0; m_CritilSecRelaNodesMap.lock(); DcRelaNodeMap::iterator iter = m_RelaNodeRsMap.begin(); for (; iter != m_RelaNodeRsMap.end(); iter++) { if (iter->second + double_Zero_Offszie != double_Zero_Offszie) { SelfY += 1 / iter->second;//自导纳的计算 } } m_CritilSecRelaNodesMap.unlock(); return SelfY; } double DcYNodeBase::GetRelaNodeYValue(int RelationNodeID)//获取节点导纳值,互导纳值的计算 { double RelaYValue = 0; m_CritilSecRelaNodesMap.lock(); DcRelaNodeMap::iterator iter = m_RelaNodeRsMap.find(RelationNodeID); if (iter != m_RelaNodeRsMap.end()) { if (iter->second + double_Zero_Offszie != double_Zero_Offszie) { RelaYValue = -1 / iter->second;//互导纳的计算 } } m_CritilSecRelaNodesMap.unlock(); return RelaYValue; } inline int DcYNodeBase::GetRelaNodeRectIndex(int RelationNodeID)//获取关系节点矩阵索引 { if (p_DcYNodesMap != nullptr) { DcNodeMap::iterator iter = p_DcYNodesMap->find(RelationNodeID); if (iter != p_DcYNodesMap->end()) { return iter->second->GetRectIndex(); } } return 0; } void DcYNodeBase::SetDcNodeMap(DcNodeMap* pNodeMap, std::mutex* pCritilSec)//设置直流节点 { p_DcYNodesMap = pNodeMap; m_pCritilSecNodesMap = pCritilSec; m_pCritilSecNodesMap->lock(); p_DcYNodesMap->insert(make_pair(m_NodeID, this)); m_pCritilSecNodesMap->unlock(); } void DcYNodeBase::SetNodeID(int ID) { m_NodeID = ID; } int DcYNodeBase::GetNodeID() { return m_NodeID; } void DcYNodeBase::SetRectIndex(int index) { m_RectIndex = index; } int DcYNodeBase::GetRectIndex() { return m_RectIndex; } int DcYNodeBase::GetNodeCategory() { return m_NodeCategory; } void DcYNodeBase::UpdateRelaNode(int oldid, int newid, double r)//更新关系节点 { m_CritilSecRelaNodesMap.lock(); DcRelaNodeMap::iterator iter = m_RelaNodeRsMap.find(oldid); if (iter != m_RelaNodeRsMap.end()) { m_RelaNodeRsMap.erase(oldid); } m_RelaNodeRsMap.insert(make_pair(newid, r)); m_CritilSecRelaNodesMap.unlock(); } YN_RectierToTouchNet::YN_RectierToTouchNet() { Len_UpPreNode = 0; Len_DownPreNode = 0; Len_UpNextNode = 0; Len_DownNextNode = 0; } YN_RectierToTouchNet::~YN_RectierToTouchNet() {} void YN_RectierToTouchNet::SetStationID(int id) { StationID = id; } int YN_RectierToTouchNet::GetStationID() { return StationID; } bool YN_RectierToTouchNet::SetTouchLineLen(double lenUpPre, double lenDownPre, double lenUpNext, double lenDownNext) { if (lenUpPre < 0 || lenDownPre < 0 || lenUpNext < 0 || lenDownNext < 0) { return false; } Len_UpPreLine = lenUpPre; Len_DownPreLine = lenDownPre; Len_UpNextLine = lenUpNext; Len_DownNextLine = lenDownNext; return true; } bool YN_RectierToTouchNet::SetUpPreNode(int id, double len) //设置前一个节点的电阻,ID,长度 { if (len < 0) return false; double r = (len + Len_UpPreLine) * R_Rate_ContactLine;//接触网线电阻的计算 UpdateRelaNode(UpPreNodeID, id, r); UpPreNodeID = id; Len_UpPreNode = len; return true; } bool YN_RectierToTouchNet::SetDownPreNode(int id, double len)//设置下个节点 { if (len < 0) return false; double r = (len + Len_DownPreLine) * R_Rate_ContactLine; UpdateRelaNode(DownPreNodeID, id, r); DownPreNodeID = id; Len_DownPreNode = len; return true; } bool YN_RectierToTouchNet::SetUpNextNode(int id, double len)// { if (len < 0) return false; double r = (len + Len_UpNextLine) * R_Rate_ContactLine; UpdateRelaNode(DownPreNodeID, id, r); UpNextNodeID = id; Len_UpNextNode = len; return true; } bool YN_RectierToTouchNet::SetDownNextNode(int id, double len) { if (len < 0) return false; double r = (len + Len_DownNextLine) * R_Rate_ContactLine; UpdateRelaNode(DownNextNodeID, id, r); DownNextNodeID = id; Len_DownNextNode = len; return true; } void YN_RectierToTouchNet::SetInnerNode(int id, double r) //设置整流器的内节点解 工区节点的ID,电阻 { UpdateRelaNode(InnerNodeID, id, r); InnerNodeID = id; } int YN_RectierToTouchNet::GetUpPreNodeID() { return UpPreNodeID; } int YN_RectierToTouchNet::GetDownPreNodeID() { return DownPreNodeID; } int YN_RectierToTouchNet::GetUpNextNodeID() { return UpNextNodeID; } int YN_RectierToTouchNet::GetDownNextNodeID() { return DownNextNodeID; } int YN_RectierToTouchNet::GetInnerNodeID() { return InnerNodeID; } double YN_RectierToTouchNet::GetUpPreNodeLen() { return Len_UpPreNode; } double YN_RectierToTouchNet::GetDownPreNodeLen() { return Len_DownPreNode; } double YN_RectierToTouchNet::GetUpNextNodeLen() { return Len_UpNextNode; } double YN_RectierToTouchNet::GetDownNextNodeLen() { return Len_DownNextNode; } YN_RectierToRailway::YN_RectierToRailway() { Len_PreFeedBackLine = 0.0; //前一节点回流线的长度 Len_NextFeedBackLine = 0.0; //下一节点回流线的长度 UpNodeID = 0; //上行节点ID DownNodeID = 0; //下行节点ID InnerNodeID = 0; //内节点ID StationID = -1; //车站ID } YN_RectierToRailway::~YN_RectierToRailway() { } void YN_RectierToRailway::SetStationID(int id) { StationID = id; } int YN_RectierToRailway::GetStationID() { return StationID; } bool YN_RectierToRailway::SetFeedBackLineLen(double lenPre, double lenNext)//馈线的长度 { if (lenPre <= 0 || lenNext <= 0) { return false; } Len_PreFeedBackLine = lenPre; Len_NextFeedBackLine = lenNext; return true; } bool YN_RectierToRailway::SetUpNode(int id, double len) { if (len <= 0) { return false; } double r = len * R_Rate_FeedBack;//电阻的计算 Len_PreFeedBackLine = len; UpdateRelaNode(UpNodeID, id, r); UpNodeID = id; return true; } bool YN_RectierToRailway::SetDownNode(int id, double len) { if (len <= 0) { return false; } double r = len * R_Rate_FeedBack; Len_NextFeedBackLine = len; UpdateRelaNode(DownNodeID, id, r); DownNodeID = id; return true; } void YN_RectierToRailway::SetInnerNode(int id, double r) { UpdateRelaNode(InnerNodeID, id, r); InnerNodeID = id; } int YN_RectierToRailway::GetDownNode() { return DownNodeID; } int YN_RectierToRailway::GetUpNode() { return UpNodeID; } YN_Railway::YN_Railway() { Len_RectierFeedBackLine = 0.0; //整流器回流线的长度 PreY = 0.0; //前一个导纳值 NextY = 0.0; //下一个导纳值 PreNodeID = 0; //前一个节点ID NextNodeID = 0; //下一个节点ID RectierNodeID = 0; //整流器节点ID StationID = -1; } YN_Railway::~YN_Railway() { } void YN_Railway::SetStationID(int id) { StationID = id; } int YN_Railway::GetStationID() { return StationID; } double YN_Railway::GetSelfYValue() { double SelfY = 0; m_CritilSecRelaNodesMap.lock(); DcRelaNodeMap::iterator iter = m_RelaNodeRsMap.begin(); for (; iter != m_RelaNodeRsMap.end(); iter++) { if (iter->second + double_Zero_Offszie != double_Zero_Offszie) { SelfY += 1 / iter->second; } } m_CritilSecRelaNodesMap.unlock(); SelfY += PreY; SelfY += NextY; return SelfY; } bool YN_Railway::SetFeedBackLineLen(double len) { if (len <= 0) { return false; } Len_RectierFeedBackLine = len; return true; } bool YN_Railway::SetPreNode(int id, double len) { if (len <= 0) { return false; } double r = len * R_Rate_RailWay; UpdateRelaNode(PreNodeID, id, r); PreNodeID = id; PreY = 1 / len * R_Rate_RailToEarth; return true; } bool YN_Railway::SetNextNode(int id, double len) { if (len <= 0) { return false; } double r = len * R_Rate_RailWay; UpdateRelaNode(NextNodeID, id, r); NextNodeID = id; NextY = 1 / len * R_Rate_RailToEarth; return true; } bool YN_Railway::SetRectierNode(int id, double len) { if (len <= 0) { return false; } Len_RectierFeedBackLine = len; double r = len * R_Rate_FeedBack; UpdateRelaNode(RectierNodeID, id, r); RectierNodeID = id; return true; } YN_HeadTail::YN_HeadTail() { DownY = 0.0; //下行导纳值 UpNodeID = 0; //上行节点ID DowntNodeID = 0; //下行节点ID } YN_HeadTail::~YN_HeadTail() { } double YN_HeadTail::GetSelfYValue() { double SelfY = 0; m_CritilSecRelaNodesMap.lock(); DcRelaNodeMap::iterator iter = m_RelaNodeRsMap.begin(); for (; iter != m_RelaNodeRsMap.end(); iter++) { if (iter->second + double_Zero_Offszie != double_Zero_Offszie) { SelfY += 1 / iter->second; } } m_CritilSecRelaNodesMap.unlock(); SelfY += DownY; return SelfY; } bool YN_HeadTail::SetUpNode(int id, double len) { if (len <= 0) { return false; } double r = len * R_Rate_ContactLine; UpdateRelaNode(UpNodeID, id, r); UpNodeID = id; return true; } bool YN_HeadTail::SetDownNode(int id, double len) { if (len <= 0) { return false; } double r = len * R_Rate_RailWay; UpdateRelaNode(DowntNodeID, id, r); DowntNodeID = id; DownY = 1 / len * R_Rate_RailToEarth; return true; } YN_TrianOnLine::YN_TrianOnLine() { PreNodeID = 0; NextNodeID = 0; RailwayNodeID = 0; } YN_TrianOnLine::~YN_TrianOnLine() { } bool YN_TrianOnLine::SetPreNode(int id, double len) { if (len <= 0) { return false; } double r = len * R_Rate_ContactLine; UpdateRelaNode(PreNodeID, id, r); PreNodeID = id; return true; } bool YN_TrianOnLine::SetNextNode(int id, double len) { if (len <= 0) { return false; } double r = len * R_Rate_ContactLine; UpdateRelaNode(NextNodeID, id, r); NextNodeID = id; return true; } void YN_TrianOnLine::SetRailwayNode(int id) { UpdateRelaNode(RailwayNodeID, id, 0); RailwayNodeID = id; } int YN_TrianOnLine::GetPreNodeID() { return PreNodeID; } int YN_TrianOnLine::GetNextNodeID() { return NextNodeID; } int YN_TrianOnLine::GetRailwayNodeID() { return RailwayNodeID; } YN_TrianOnRailway::YN_TrianOnRailway() { YPre = 0.0; YNext = 0.0; PreNodeID = 0; NextNodeID = 0; OnlineNodeID = 0; //列车与接触网ID } YN_TrianOnRailway::~YN_TrianOnRailway() { } bool YN_TrianOnRailway::SetPreNode(int id, double len) { if (len <= 0) { return false; } double r = len * R_Rate_RailWay; UpdateRelaNode(PreNodeID, id, r); YPre = 1 / R_Rate_RailToEarth * len; PreNodeID = id; return true; } bool YN_TrianOnRailway::SetNextNode(int id, double len) { if (len <= 0) { return false; } double r = len * R_Rate_RailWay; UpdateRelaNode(NextNodeID, id, r); YNext = 1 / R_Rate_RailToEarth * len; NextNodeID = id; return true; } void YN_TrianOnRailway::SetOnlineNode(int id) { UpdateRelaNode(OnlineNodeID, id, 0); OnlineNodeID = id; } void tgPowerNodeBase::Init(int rectindex, int id, int ncategory) { m_NodeID = id; RelationCount = 0; m_NodeCategory = ncategory; m_RectIndex = rectindex; for (int i = 0; i < Max_NodeRelationNums; i++) { RelaNodes[i].NodeID = -1; RelaNodes[i].R = -1; RelaNodes[i].m_IsPower = true; } } double tgPowerNodeBase::GetRelaNodeYValue(int RelationNodeID)//获取关系节点的导纳值(互导纳),Y代表导纳的意思 { double RelaYValue = 0; if (RelationNodeID >= 0) { for (int i = 0; i < Max_NodeRelationNums; i++) { if (RelaNodes[i].NodeID == RelationNodeID) { if (RelaNodes[i].R + double_Zero_Offszie != double_Zero_Offszie && RelaNodes[i].m_IsPower) { RelaYValue += -1 / RelaNodes[i].R;//计算导纳,为电阻的倒数 } } } } return RelaYValue; } int tgPowerNodeBase::GetRectIndex() { return m_RectIndex; } void tgPowerNodeBase::UpdateRelaNode(int oldid, int newid, double r, bool power)//更新关系节点 { bool HaveNode = false; for (int i = 0; i < RelationCount; i++) { if (RelaNodes[i].NodeID == oldid) { RelaNodes[i].NodeID = newid; RelaNodes[i].R = r; RelaNodes[i].m_IsPower = power; HaveNode = true; } } if (!HaveNode && RelationCount < Max_NodeRelationNums) { RelaNodes[RelationCount].NodeID = newid; RelaNodes[RelationCount].R = r; RelaNodes[RelationCount].m_IsPower = power; RelationCount++; } } int tgPowerNodeBase::GetNodeCategory()//获取节点类型 { return m_NodeCategory; } void tgPowerNodeBase::SetPower(bool power) { m_IsPower = power; } bool tgPowerNodeBase::GetPower() { return m_IsPower; } void tgRectierToTouchNet::UpdateRelaNodeByIndex(int index, int newid, double r, bool power)//通过索引更新关系节点 { if (index < Max_NodeRelationNums) { if (RelaNodes[index].NodeID != newid && RelaNodes[index].NodeID < 0) { RelationCount++; } RelaNodes[index].NodeID = newid; RelaNodes[index].R = r; RelaNodes[index].m_IsPower = power; } } double tgRectierToTouchNet::GetSelfYValue()//获取自导纳 { double SelfY = 0; for (int i = 0; i < Max_NodeRelationNums; i++) { if (RelaNodes[i].R + double_Zero_Offszie != double_Zero_Offszie) { if (RelaNodes[i].NodeID >= 0 && RelaNodes[i].m_IsPower) { SelfY += 1 / RelaNodes[i].R; } } } return SelfY; } bool tgRectierToTouchNet::SetTouchLineLen(double lenUpPre, double lenDownPre, double lenUpNext, double lenDownNext)//设置接触网线的长度 { if (lenUpPre < 0 || lenDownPre < 0 || lenUpNext < 0 || lenDownNext < 0) { return false; } Len_UpPreNode = Len_UpPreLine = lenUpPre; //将牵混所4条直流馈线长度赋给正极母线上的4个节点上馈线相应接触网长度 Len_DownPreNode = Len_DownPreLine = lenDownPre; Len_UpNextNode = Len_UpNextLine = lenUpNext; Len_DownNextNode = Len_DownNextLine = lenDownNext; return true; } bool tgRectierToTouchNet::SetUpPreNode(int id, double len, bool power) { if (len < 0) return false; double r = len * R_Rate_ContactLine; UpdateRelaNodeByIndex(4, id, r, power); UpPreNodeID = id; Len_UpPreNode = len + Len_UpPreLine; return true; } bool tgRectierToTouchNet::SetDownPreNode(int id, double len, bool power) { if (len < 0) return false; double r = len * R_Rate_ContactLine; UpdateRelaNodeByIndex(3, id, r, power); DownPreNodeID = id; Len_DownPreNode = len + Len_DownPreLine; return true; } bool tgRectierToTouchNet::SetUpNextNode(int id, double len, bool power) { if (len < 0) return false; double r = len * R_Rate_ContactLine; UpdateRelaNodeByIndex(1, id, r, power); UpNextNodeID = id; Len_UpNextNode = len + Len_UpNextLine; return true; } bool tgRectierToTouchNet::SetDownNextNode(int id, double len, bool power) { if (len < 0) return false; double r = len * R_Rate_ContactLine; UpdateRelaNodeByIndex(0, id, r, power); DownNextNodeID = id; Len_DownNextNode = len + Len_DownNextLine; return true; } void tgRectierToTouchNet::SetInnerNode(int id, double r, bool power)//设置内节点 { UpdateRelaNodeByIndex(2, id, r, power); //通过索引更新相关节点 InnerNodeID = id; } int tgRectierToTouchNet::GetUpPreNodeID() { return UpPreNodeID; } int tgRectierToTouchNet::GetDownPreNodeID() { return DownPreNodeID; } int tgRectierToTouchNet::GetUpNextNodeID() { return UpNextNodeID; } int tgRectierToTouchNet::GetDownNextNodeID() { return DownNextNodeID; } int tgRectierToTouchNet::GetInnerNodeID() { return InnerNodeID; } double tgRectierToTouchNet::GetUpPreNodeLen() { return Len_UpPreNode; } double tgRectierToTouchNet::GetDownPreNodeLen() { return Len_DownPreNode; } double tgRectierToTouchNet::GetUpNextNodeLen() { return Len_UpNextNode; } double tgRectierToTouchNet::GetDownNextNodeLen() { return Len_DownNextNode; } double tgRectierToRailway::GetSelfYValue() { double SelfY = 0; for (int i = 0; i < RelationCount; i++) { if (RelaNodes[i].R + double_Zero_Offszie != double_Zero_Offszie) { if (RelaNodes[i].NodeID >= 0 && RelaNodes[i].m_IsPower) { SelfY += 1 / RelaNodes[i].R; } //SelfY+=1/RelaNodes[i].R; } } return SelfY; } void tgRectierToRailway::SetStationID(int id) { StationID = id; } int tgRectierToRailway::GetStationID() { return StationID; } bool tgRectierToRailway::SetFeedBackLineLen(double lenPre, double lenNext)//设置馈线的长度 { if (lenPre <= 0 || lenNext <= 0) { return false; } Len_PreFeedBackLine = lenPre; Len_NextFeedBackLine = lenNext; return true; } bool tgRectierToRailway::SetUpNode(int id, double len, bool power) { if (len <= 0) { return false; } double r = len * R_Rate_FeedBack; Len_PreFeedBackLine = len; UpdateRelaNode(UpNodeID, id, r, power); UpNodeID = id; return true; } bool tgRectierToRailway::SetDownNode(int id, double len, bool power) { if (len < 0) { return false; } double r = len * R_Rate_FeedBack; Len_NextFeedBackLine = len; UpdateRelaNode(DownNodeID, id, r, power); DownNodeID = id; return true; } void tgRectierToRailway::SetInnerNode(int id, double r, bool power) { UpdateRelaNode(InnerNodeID, id, r, power); InnerNodeID = id; } int tgRectierToRailway::GetDownNode() { return DownNodeID; } int tgRectierToRailway::GetUpNode() { return UpNodeID; } double tgRailway::GetSelfYValue() { double SelfY = 0; for (int i = 0; i < RelationCount; i++) { if (RelaNodes[i].R + double_Zero_Offszie != double_Zero_Offszie) { SelfY += 1 / RelaNodes[i].R; } } SelfY += PreY; SelfY += NextY; //当前轨道节点自导=各关联支路导纳+前侧对地导纳+右后侧对地导纳 return SelfY; } void tgRailway::SetStationID(int id) { StationID = id; } int tgRailway::GetStationID() { return StationID; } bool tgRailway::SetFeedBackLineLen(double len) { if (len <= 0) { return false; } Len_FeBackLine = len; return true; } bool tgRailway::SetPreNode(int id, double len, bool power) { if (len <= 0) { return false; } double r = len * R_Rate_RailWay; UpdateRelaNode(PreNodeID, id, r, power); PreNodeID = id; PreY = len / R_Rate_RailToEarth; return true; } bool tgRailway::SetNextNode(int id, double len, bool power) { if (len <= 0) { return false; } double r = len * R_Rate_RailWay; UpdateRelaNode(NextNodeID, id, r, power); NextNodeID = id; NextY = len / R_Rate_RailToEarth; return true; } bool tgRailway::SetRectierNode(int id, double len, bool power) { if (len <= 0) { return false; } Len_FeBackLine = len; double r = len * R_Rate_FeedBack; UpdateRelaNode(RectierNodeID, id, r, power); RectierNodeID = id; return true; } double tgHeadTail::GetSelfYValue() { double SelfY = 0.0; for (int i = 0; i < RelationCount; i++) { if (RelaNodes[i].R + double_Zero_Offszie != double_Zero_Offszie) { SelfY += 1 / RelaNodes[i].R; } } SelfY += DownY; return SelfY; } bool tgHeadTail::SetDownNode(int id, double len, bool power)//设置轨道ID号与轨道长度 { if (len <= 0) { return false; } double r = len * R_Rate_RailWay;//R_Rate_RailWay轨道电阻率,求轨道电阻 UpdateRelaNode(DowntNodeID, id, r, power);//更新轨道关系节点 DowntNodeID = id; DownY = len / R_Rate_RailToEarth;//R_Rate_RailToEarth轨道到地的电阻率,求下行导纳 return true; } double tgTRIANONLINE::GetSelfYValue() { double SelfY = 0; for (int i = 0; i < RelationCount; i++) { if (RelaNodes[i].R + double_Zero_Offszie != double_Zero_Offszie) { SelfY += 1 / RelaNodes[i].R; } } return SelfY; } bool tgTRIANONLINE::SetPreNode(int id, double len, bool power) { if (len <= 0) { //TRACE(" tgTRIANONLINE::SetPreNode: len<=0\n"); return false; } double r = len * R_Rate_ContactLine; UpdateRelaNode(PreNodeID, id, r, power); PreNodeID = id; return true; } bool tgTRIANONLINE::SetNextNode(int id, double len, bool power) { if (len <= 0) { //TRACE(" tgTRIANONLINE::SetNextNode: len<=0\n"); return false; } double r = len * R_Rate_ContactLine; UpdateRelaNode(NextNodeID, id, r, power); NextNodeID = id; return true; } void tgTRIANONLINE::SetTrianInfo(int no, int lineno, double ex, int arrow) { TrianNO = no; LineSectionNo = lineno; excursion = ex; arrow = arrow; } void tgTRIANONLINE::SetRailwayNode(int id) { UpdateRelaNode(RailwayNodeID, id, 0, true); RailwayNodeID = id; } int tgTRIANONLINE::GetPreNodeID() { return PreNodeID; } int tgTRIANONLINE::GetNextNodeID() { return NextNodeID; } int tgTRIANONLINE::GetRailwayNodeID() { return RailwayNodeID; } double tgTrianOnRailway::GetSelfYValue() { double SelfY = 0; for (int i = 0; i < RelationCount; i++) { if (RelaNodes[i].R + double_Zero_Offszie != double_Zero_Offszie) { SelfY += 1 / RelaNodes[i].R; } } SelfY += YPre; SelfY += YNext; return SelfY; } bool tgTrianOnRailway::SetPreNode(int id, double len, bool power) { if (len <= 0) { //TRACE(" tgTrianOnRailway::SetPreNode: len<=0\n"); return false; } double r = len * R_Rate_RailWay; UpdateRelaNode(PreNodeID, id, r, power); YPre = len / R_Rate_RailToEarth; //R_Rate_RailToEarth电阻率,导纳为 PreNodeID = id; return true; } bool tgTrianOnRailway::SetNextNode(int id, double len, bool power) { if (len <= 0) { //TRACE(" tgTrianOnRailway::SetNextNode: len<=0\n"); return false; } double r = len * R_Rate_RailWay;//电阻与电阻率的关系 UpdateRelaNode(NextNodeID, id, r, power); YNext = len / R_Rate_RailToEarth; //与此公式( r = len*R_Rate_RailWay;),需检查 NextNodeID = id; return true; } void tgTrianOnRailway::SetOnlineNode(int id)//设置车与接触网的节点 { UpdateRelaNode(OnlineNodeID, id, 0, true); OnlineNodeID = id; } int tgTrianOnRailway::GetOnlineNodeID() { return OnlineNodeID; } tgPowerNode::tgPowerNode() { memset(this, 0, sizeof(tgPowerNode)); nodeType = NodeType::eDc_NodeKind_Unknow; m_NodeV = Voltage_Calculate_InitValueV; } int tgPowerNode::GetRectIndex() //获取矩阵的索引 { if (nodeType == NodeType::eDc_NodeKind_HeadTail) //节点类型:头尾节点 { return HeadTailNode.m_RectIndex; } else if (nodeType == NodeType::eDc_NodeKind_RectierToTouchNet) //节点类型:整流器到接触网 { return RectierToTouchNetNode.m_RectIndex; } else if (nodeType == NodeType::eDc_NodeKind_RectierToRailWay) //节点类型:整流器到轨道 { return RectierToRailwayNode.m_RectIndex; } else if (nodeType == NodeType::eDc_NodeKind_RailWay) //节点类型:轨道节点 { return RailWayNode.m_RectIndex; } else if (nodeType == NodeType::eDc_NodeKind_UpTrain) //节点类型:上行列车 //列车受电弓节点 xyx注释 { return TrianOnLineNode.m_RectIndex; } else if (nodeType == NodeType::eDc_NodeKind_DownTrain) //节点类型:下行列车 //列车轮对节点 xyx注释 { return TrianOnRailway.m_RectIndex; } return -1; } void tgPowerNode::setRectierToTouchNet(const RECTIERTOTOUCHNET* paraNode) { nodeType = NodeType::eDc_NodeKind_RectierToTouchNet; //直流正极母线节点 xyx注释 memcpy(&RectierToTouchNetNode, paraNode, sizeof(RECTIERTOTOUCHNET)); NodeID = paraNode->m_NodeID; } void tgPowerNode::setRectierToRailway(const RECTIERTORAILWAY* paraNode) { nodeType = NodeType::eDc_NodeKind_RectierToRailWay; //直流负极母线节点 xyx注释 memcpy(&RectierToRailwayNode, paraNode, sizeof(RECTIERTORAILWAY)); NodeID = paraNode->m_NodeID; //m_NodeV=0; //xyx新增 负极母线初始电压为0 } void tgPowerNode::setRailway(const RAILWAY* paraNode) { nodeType = NodeType::eDc_NodeKind_RailWay; //轨道节点 xyx注释 memcpy(&RailWayNode, paraNode, sizeof(RAILWAY)); NodeID = paraNode->m_NodeID; //m_NodeV=0; //xyx新增 轨道初始电压为0 } void tgPowerNode::setHeadTail(const HEADTAIL* paraNode) { nodeType = NodeType::eDc_NodeKind_HeadTail; //轨道头尾节点 xyx注释 memcpy(&HeadTailNode, paraNode, sizeof(HEADTAIL)); NodeID = paraNode->m_NodeID; } void tgPowerNode::setTrianOnLine(const TRIANONLINE* paraNode) { nodeType = NodeType::eDc_NodeKind_UpTrain;//上行列车 //列车受电弓节点 xyx注释 memcpy(&TrianOnLineNode, paraNode, sizeof(TRIANONLINE)); NodeID = paraNode->m_NodeID; } void tgPowerNode::setTrianOnRailway(const TRIANONRAILWAY* paraNode) { nodeType = NodeType::eDc_NodeKind_DownTrain;//下行列车 //列车轮对节点 xyx注释 memcpy(&TrianOnRailway, paraNode, sizeof(TRIANONRAILWAY)); NodeID = paraNode->m_NodeID; m_NodeV = 0; }