22 #include <qfileinfo.h>
29 Description = QObject::tr(
"equation defined device");
36 QObject::tr(
"type of equations")+
" [explicit, implicit]"));
38 QObject::tr(
"number of branches")));
42 QObject::tr(
"current equation") +
" 1"));
44 QObject::tr(
"charge equation") +
" 1"));
62 Name = QObject::tr(
"Equation Defined Device");
63 BitmapFile = (
char *)
"edd";
67 p->
Props.at(0)->Value =
"explicit";
68 p->
Props.at(1)->Value =
"1";
83 s +=
" "+p1->Connection->Name;
88 s +=
" "+p2->Name+
"=\""+Name+
"."+p2->Name+
"\"";
89 e +=
" Eqn:Eqn"+Name+p2->Name+
" "+
90 Name+
"."+p2->Name+
"=\""+p2->Value+
"\" Export=\"no\"\n";
100 int i, PortDistance = 60;
103 int Num =
Props.at(1)->Value.toInt();
109 Props.at(1)->Value = QString::number(Num);
112 int NumProps = (
Props.count() - 2) / 2;
113 if (NumProps < Num) {
114 for(i = NumProps; i < Num; i++) {
115 Props.append(
new Property(
"I"+QString::number(i+1),
"0",
false,
116 QObject::tr(
"current equation") +
" " +QString::number(i+1)));
117 Props.append(
new Property(
"Q"+QString::number(i+1),
"0",
false,
118 QObject::tr(
"charge equation") +
" " +QString::number(i+1)));
121 for(i = Num; i < NumProps; i++) {
129 for(i = 1; i <= Num; i++) {
130 p1->
Name =
"I"+QString::number(i);
132 p1->
Name =
"Q"+QString::number(i);
137 int h = (PortDistance/2)*((Num-1)) + PortDistance/2;
138 Lines.append(
new Line(-15, -h, 15, -h,QPen(QPen::darkBlue,2)));
139 Lines.append(
new Line( 15, -h, 15, h,QPen(QPen::darkBlue,2)));
140 Lines.append(
new Line(-15, h, 15, h,QPen(QPen::darkBlue,2)));
141 Lines.append(
new Line(-15, -h,-15, h,QPen(QPen::darkBlue,2)));
145 int y = PortDistance/2-h, yh;
148 Lines.append(
new Line(-30, y,-15, y,QPen(QPen::darkBlue,2)));
151 Lines.append(
new Line( 7,y-3, 10, y,QPen(QPen::black,1)));
152 Lines.append(
new Line( 7,y+3, 10, y,QPen(QPen::black,1)));
153 Lines.append(
new Line(-10, y, 10, y,QPen(QPen::black,1)));
156 yh = y-PortDistance/2;
157 Lines.append(
new Line(-15, yh, 15, yh, QPen(QPen::darkBlue,2)));
160 Lines.append(
new Line( 15, y, 30, y,QPen(QPen::darkBlue,2)));
162 Texts.append(
new Text( 19,y-14,QString::number(i)));
171 ty =
y1 - 2*metrics.lineSpacing() - 4;