1.重新组织了文件。
2.准备试试把所有元素都读入内存中。 Signed-off-by: facat@lab.com <facat@lab.com>
This commit is contained in:
240
core/Interface.cpp
Normal file
240
core/Interface.cpp
Normal file
@@ -0,0 +1,240 @@
|
||||
#include "head.h"
|
||||
#include "transformerparser.h"
|
||||
#include "linetypeparser.h"
|
||||
#include "qt_readxml.h"
|
||||
void Qt_readxml::XmlReaderInterface()
|
||||
{
|
||||
int subNo = substation.size();
|
||||
for (int i=0;i<subNo;i++)
|
||||
{
|
||||
DisSubstation S;
|
||||
S.CIMID = substation[i].ID;
|
||||
S.Description = substation[i].description;
|
||||
S.Name = substation[i].name;
|
||||
dis_substation.push_back(S);
|
||||
}
|
||||
|
||||
DisLine L;
|
||||
QString b = acline_segment[0].MemberOf_EquipmentContainer_res[0];
|
||||
int a = b.length();
|
||||
std::vector<List>::iterator it = find_if(list1.begin(), list1.end(), vector_finder(b.right(a-1)));
|
||||
L.CIMID = circuit[it->no].ID;
|
||||
L.MemberOf = circuit[it->no].Substations_res[0];
|
||||
dis_line.push_back(L);
|
||||
|
||||
//确定头结点
|
||||
// int breakerNo = breaker.size();
|
||||
// int headBus;
|
||||
// for (int i=0;i<breakerNo;i++)
|
||||
// {
|
||||
|
||||
// if (breaker[i].MemberOf_EquipmentContainer_res.size())
|
||||
// {
|
||||
// headBus = breaker[i].flag;
|
||||
// }
|
||||
// }
|
||||
int headBus;
|
||||
for (int i=0;i<subNo;i++)
|
||||
{
|
||||
if (substation[i].GIS_type == "1001")
|
||||
{
|
||||
int nodeNo=connectivity_node.size();
|
||||
for (int j=0;j<nodeNo;j++)
|
||||
{
|
||||
if (connectivity_node[j].MemberOf_EquipmentContainer_res.size() && connectivity_node[j].flag)
|
||||
{
|
||||
QString a=connectivity_node[j].MemberOf_EquipmentContainer_res[0];
|
||||
int b = a.length();
|
||||
if (a.right(b-1)==substation[i].ID)
|
||||
{
|
||||
headBus = connectivity_node[j].flag;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//重新安排节点序列
|
||||
int lineNo = acline_segment.size();
|
||||
int k = 1;
|
||||
busContainer.clear();
|
||||
busContainer.push_back(headBus);
|
||||
busbar_section[headBus-1].busSequence = k;
|
||||
k++;
|
||||
while (busContainer.size())
|
||||
{
|
||||
int containNo=busContainer.size();
|
||||
for (int i=0;i<containNo;i++)
|
||||
{
|
||||
int bus1 = busContainer[0];
|
||||
busContainer.erase(busContainer.begin());
|
||||
for (int j=0;j<lineNo;j++)
|
||||
{
|
||||
if (acline_segment[j].link_from == bus1)
|
||||
{
|
||||
int bus2 = acline_segment[j].link_to;
|
||||
if (!busbar_section[bus2-1].busSequence)
|
||||
{
|
||||
busContainer.push_back(bus2);
|
||||
busbar_section[bus2-1].busSequence = k;
|
||||
}
|
||||
}
|
||||
else if (acline_segment[j].link_to == bus1)
|
||||
{
|
||||
int bus2 = acline_segment[j].link_from;
|
||||
if (!busbar_section[bus2-1].busSequence)
|
||||
{
|
||||
busContainer.push_back(bus2);
|
||||
busbar_section[bus2-1].busSequence = k;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
k++;
|
||||
}
|
||||
|
||||
//找到上一段线路
|
||||
int smallNo;
|
||||
int smallSequence;
|
||||
int bus1;
|
||||
int bus2;
|
||||
int bus3;
|
||||
int sequence1;
|
||||
int sequence2;
|
||||
int sequence3;
|
||||
for (int i=0;i<lineNo;i++)
|
||||
{
|
||||
bus1 = acline_segment[i].link_from;
|
||||
bus2 = acline_segment[i].link_to;
|
||||
sequence1 = busbar_section[bus1-1].busSequence;
|
||||
sequence2 = busbar_section[bus2-1].busSequence;
|
||||
if (sequence1<sequence2 && sequence1!=0)
|
||||
{
|
||||
smallNo = bus1;
|
||||
smallSequence = sequence1;
|
||||
}
|
||||
else if (sequence2<sequence1 && sequence2!=0)
|
||||
{
|
||||
smallNo = bus2;
|
||||
smallSequence = sequence2;
|
||||
}
|
||||
for (int j=0;j<lineNo;j++)
|
||||
{
|
||||
|
||||
if (acline_segment[j].link_from == smallNo)
|
||||
{
|
||||
bus3 = acline_segment[j].link_to;
|
||||
sequence3 = busbar_section[bus3-1].busSequence;
|
||||
if (sequence3 < smallSequence && sequence3!=0)
|
||||
{
|
||||
acline_segment[i].foreheadLine = acline_segment[j].ID;
|
||||
acline_segment[i].foreheadI = j;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (acline_segment[j].link_to == smallNo)
|
||||
{
|
||||
bus3 = acline_segment[j].link_from;
|
||||
sequence3 = busbar_section[bus3-1].busSequence;
|
||||
if (sequence3 < smallSequence && sequence3!=0)
|
||||
{
|
||||
acline_segment[i].foreheadLine = acline_segment[j].ID;
|
||||
acline_segment[i].foreheadI = j;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//求线段深度
|
||||
for (int i=0;i<lineNo;i++)
|
||||
{
|
||||
double depth = acline_segment[i].secLength;
|
||||
int j = acline_segment[i].foreheadI;
|
||||
while (j>=0)
|
||||
{
|
||||
depth = depth + acline_segment[j].secLength;
|
||||
j = acline_segment[j].foreheadI;
|
||||
}
|
||||
acline_segment[i].depth = depth;
|
||||
}
|
||||
|
||||
//找变压器的连接节段
|
||||
int transNo = power_transformer.size();
|
||||
for (int i=0;i<transNo;i++)
|
||||
{
|
||||
bus1 = power_transformer[i].link_1;
|
||||
bus2 = power_transformer[i].link_2;
|
||||
sequence1 = busbar_section[bus1-1].busSequence;
|
||||
sequence2 = busbar_section[bus2-1].busSequence;
|
||||
if(sequence1 == 0 )
|
||||
{
|
||||
smallSequence = sequence2;
|
||||
smallNo = bus2;
|
||||
}
|
||||
else
|
||||
{
|
||||
smallSequence = sequence1;
|
||||
smallNo = bus1;
|
||||
}
|
||||
for (int j=0;j<lineNo;j++)
|
||||
{
|
||||
|
||||
if (acline_segment[j].link_from == smallNo)
|
||||
{
|
||||
bus3 = acline_segment[j].link_to;
|
||||
sequence3 = busbar_section[bus3-1].busSequence;
|
||||
if (sequence3 < smallSequence && sequence3!=0)
|
||||
{
|
||||
power_transformer[i].foreheadLine = acline_segment[j].ID;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (acline_segment[j].link_to == smallNo)
|
||||
{
|
||||
bus3 = acline_segment[j].link_from;
|
||||
sequence3 = busbar_section[bus3-1].busSequence;
|
||||
if (sequence3 < smallSequence && sequence3!=0)
|
||||
{
|
||||
power_transformer[i].foreheadLine = acline_segment[j].ID;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (int i=0;i<lineNo;i++)
|
||||
{
|
||||
DisSecNode S;
|
||||
S.ID = acline_segment[i].ID;
|
||||
S.Name = acline_segment[i].name;
|
||||
S.FatherID = acline_segment[i].foreheadLine;
|
||||
S.LineType = acline_segment[i].Model;
|
||||
S.UnitR = acline_segment[i].r;
|
||||
S.B = acline_segment[i].x;
|
||||
S.G = 0;
|
||||
S.SecLong = acline_segment[i].secLength;
|
||||
S.Depth = acline_segment[i].depth;
|
||||
dis_sec_node.push_back(S);
|
||||
}
|
||||
|
||||
|
||||
for (int i=0;i<transNo;i++)
|
||||
{
|
||||
DisTrans T;
|
||||
T.ID = power_transformer[i].ID;
|
||||
T.Name = power_transformer[i].name;
|
||||
T.SecNode = power_transformer[i].foreheadLine;
|
||||
T.Ps = power_transformer[i].Pk;
|
||||
T.P0 = power_transformer[i].P0;
|
||||
T.Up = 0;
|
||||
T.Ip = power_transformer[i].I0;
|
||||
T.RunRate = 0;
|
||||
T.Type = power_transformer[i].Model;
|
||||
T.LineID = dis_line[0].CIMID;
|
||||
T.S = power_transformer[i].ratedMVA;
|
||||
dis_trans.push_back(T);
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user