| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196 |
- #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;
- }
|