diff --git a/qucs-core/src/acsolver.cpp b/qucs-core/src/acsolver.cpp index bb6b289245..bc2e2a5fda 100644 --- a/qucs-core/src/acsolver.cpp +++ b/qucs-core/src/acsolver.cpp @@ -127,7 +127,7 @@ int acsolver::solve (void) { c->calcOperatingPoints (); //if it detects any voltage, the ohmmeter will not work if((c->getOperatingPoint ("R") != 0 || - c->getOperatingPoint ("Z") != 0)) c->setstate(0); + c->getOperatingPoint ("X") != 0)) c->setstate(0); } /*if the circuit analysis has finished and the ohmmeterdidn't detect any voltage, it will start the internal corrent source*/ diff --git a/qucs-core/src/components/CMakeLists.txt b/qucs-core/src/components/CMakeLists.txt index 66eff0880a..634978d44e 100644 --- a/qucs-core/src/components/CMakeLists.txt +++ b/qucs-core/src/components/CMakeLists.txt @@ -38,6 +38,7 @@ SET( COMPONENTS_SRC mutual.cpp mutual2.cpp mutualx.cpp + ohmmeter.cpp opamp.cpp open.cpp pac.cpp @@ -69,6 +70,7 @@ SET( COMPONENTS_SRC vpulse.cpp vrect.cpp vvnoise.cpp + wprobe.cpp ) SET(HEADERS diff --git a/qucs-core/src/components/ohmmeter.cpp b/qucs-core/src/components/ohmmeter.cpp index 8b0f43aa68..721ba126fd 100644 --- a/qucs-core/src/components/ohmmeter.cpp +++ b/qucs-core/src/components/ohmmeter.cpp @@ -68,15 +68,15 @@ void ohmmeter::calcOperatingPoints (void) { if(on>0)// Testing if the ohmmeter is already working or allowed to work { nr_double_t R = real (getV (NODE_1) - getV (NODE_2)); - nr_double_t Z = imag (getV (NODE_1) - getV (NODE_2)); + nr_double_t X = imag (getV (NODE_1) - getV (NODE_2)); setOperatingPoint ("R", R); - setOperatingPoint ("Z", Z); + setOperatingPoint ("X", X); } else // if it is connected to an external source, it will show as NAN { nr_double_t R=NAN; setOperatingPoint ("R", R); - setOperatingPoint ("Z", R); + setOperatingPoint ("X", R); } } diff --git a/qucs-core/src/nasolver.cpp b/qucs-core/src/nasolver.cpp index ae465c4747..4445ff06c5 100644 --- a/qucs-core/src/nasolver.cpp +++ b/qucs-core/src/nasolver.cpp @@ -1379,11 +1379,11 @@ void nasolver::saveResults (const std::string &volts, const std::stri continue; } //add ohmmeter data - if (strcmp(p.getName(), "Z") == 0) continue; + if (strcmp(p.getName(), "X") == 0) continue; if (strcmp(p.getName(), "R") == 0) {//create values for ohmmeter std::string n = createOP (c->getName (), "Ohm"); saveVariable (n, nr_complex_t (c->getOperatingPoint ("R"), - c->getOperatingPoint ("Z")), f); + c->getOperatingPoint ("X")), f); continue; } diff --git a/qucs/qucs/components/CMakeLists.txt b/qucs/qucs/components/CMakeLists.txt index 3c116d83a9..c260db0e3d 100644 --- a/qucs/qucs/components/CMakeLists.txt +++ b/qucs/qucs/components/CMakeLists.txt @@ -44,7 +44,7 @@ componentdialog.cpp inductor.cpp noise_vv.cpp vcvs.cpp iprobe.cpp opamp.cpp verilogfile.cpp vcresistor.cpp coplanar.cpp ipulse.cpp opt_sim.cpp vexp.cpp coupler.cpp irect.cpp optimizedialog.cpp vfile.cpp -cpwgap.cpp isolator.cpp vhdlfile.cpp +cpwgap.cpp isolator.cpp ohmmeter.cpp vhdlfile.cpp cpwopen.cpp jfet.cpp pad2bit.cpp volt_ac.cpp cpwshort.cpp jk_flipflop.cpp pad3bit.cpp volt_dc.cpp cpwstep.cpp jkff_SR.cpp pad4bit.cpp volt_noise.cpp @@ -171,6 +171,7 @@ nigbt.h noise_ii.h noise_iv.h noise_vv.h +ohmmeter.h opamp.h opt_sim.h optimizedialog.h diff --git a/qucs/qucs/components/ampere_ac.cpp b/qucs/qucs/components/ampere_ac.cpp index 4bf4a88eaf..d164c5949c 100644 --- a/qucs/qucs/components/ampere_ac.cpp +++ b/qucs/qucs/components/ampere_ac.cpp @@ -51,7 +51,7 @@ Ampere_ac::Ampere_ac() Props.append(new Property("Theta", "0", false, QObject::tr("damping factor (transient simulation only)"))); Props.append(new Property("Ri", "0 Ohm", false, - QObject::tr("Internal resistance, (0 : disable), ideal behavior"))); + QObject::tr("Internal resistance, (0 : disable)"))); rotate(); // fix historical flaw } diff --git a/qucs/qucs/components/ampere_dc.cpp b/qucs/qucs/components/ampere_dc.cpp index 2fef35a193..4b6a8acb3e 100644 --- a/qucs/qucs/components/ampere_dc.cpp +++ b/qucs/qucs/components/ampere_dc.cpp @@ -43,7 +43,7 @@ Ampere_dc::Ampere_dc() Props.append(new Property("I", "1 mA", true, QObject::tr("current in Ampere"))); Props.append(new Property("Ri", "0 Ohm", false, - QObject::tr("Internal resistance, (0 : disable), ideal behavior"))); + QObject::tr("Internal resistance, (0 : disable)"))); rotate(); // fix historical flaw } diff --git a/qucs/qucs/components/iprobe.cpp b/qucs/qucs/components/iprobe.cpp index 1f1f9825bd..9346c5373f 100644 --- a/qucs/qucs/components/iprobe.cpp +++ b/qucs/qucs/components/iprobe.cpp @@ -23,7 +23,7 @@ iProbe::iProbe() Description = QObject::tr("current probe"); Props.append(new Property("Ri", "0 Ohm", false, - QObject::tr("Internal resistance, (0 : disable), ideal behavior"))); + QObject::tr("Internal resistance, (0 : disable)"))); Lines.append(new Line(-30, 0,-20, 0,QPen(Qt::darkBlue,2))); Lines.append(new Line( 30, 0, 20, 0,QPen(Qt::darkBlue,2))); diff --git a/qucs/qucs/components/volt_ac.cpp b/qucs/qucs/components/volt_ac.cpp index 53c021624f..a7d819ff94 100644 --- a/qucs/qucs/components/volt_ac.cpp +++ b/qucs/qucs/components/volt_ac.cpp @@ -51,7 +51,7 @@ Volt_ac::Volt_ac() Props.append(new Property("Theta", "0", false, QObject::tr("damping factor (transient simulation only)"))); Props.append(new Property("Ri", "0 Ohm", false, - QObject::tr("Internal resistance, (0 : disable), ideal behavior"))); + QObject::tr("Internal resistance, (0 : disable)"))); rotate(); // fix historical flaw diff --git a/qucs/qucs/components/volt_dc.cpp b/qucs/qucs/components/volt_dc.cpp index ff361818da..7b3d530a2a 100644 --- a/qucs/qucs/components/volt_dc.cpp +++ b/qucs/qucs/components/volt_dc.cpp @@ -44,7 +44,7 @@ Volt_dc::Volt_dc() Props.append(new Property("U", "1 V", true, QObject::tr("voltage in Volts"))); Props.append(new Property("Ri", "0 Ohm", false, - QObject::tr("Internal resistance, (0 : disable), ideal behavior"))); + QObject::tr("Internal resistance, (0 : disable)"))); rotate(); // fix historical flaw } diff --git a/qucs/qucs/components/vprobe.cpp b/qucs/qucs/components/vprobe.cpp index 43fd99d2a9..751730f126 100644 --- a/qucs/qucs/components/vprobe.cpp +++ b/qucs/qucs/components/vprobe.cpp @@ -21,8 +21,9 @@ vProbe::vProbe() { Description = QObject::tr("voltage probe"); + Props.append(new Property("Ri", "0 Ohm", false, - QObject::tr("Internal resistance, (0 : disable), ideal behavior"))); + QObject::tr("Internal resistance, (0 : disable)"))); Lines.append(new Line(-20,-31, 20,-31,QPen(Qt::darkBlue,2))); Lines.append(new Line(-20, 9, 20, 9,QPen(Qt::darkBlue,2))); diff --git a/qucs/qucs/components/wprobe.cpp b/qucs/qucs/components/wprobe.cpp index 973088dd67..6a5cccb94f 100644 --- a/qucs/qucs/components/wprobe.cpp +++ b/qucs/qucs/components/wprobe.cpp @@ -29,9 +29,9 @@ wProbe::wProbe() Description = QObject::tr("power probe"); Props.append(new Property("Riv", "0 Ohm", false, - QObject::tr("Internal resistance, (0 : disable), ideal behavior"))); + QObject::tr("Voltage probe internal resistor, (0 : disable)"))); Props.append(new Property("Rii", "0 Ohm", false, - QObject::tr("Internal resistance, (0 : disable), ideal behavior"))); + QObject::tr("Current probe internal resistor, (0 : disable)"))); //Large box Lines.append(new Line(-20,-33, 20,-33,QPen(Qt::darkBlue,2))); diff --git a/qucs/qucs/diagrams/CMakeLists.txt b/qucs/qucs/diagrams/CMakeLists.txt index e260538db6..53e5219e19 100755 --- a/qucs/qucs/diagrams/CMakeLists.txt +++ b/qucs/qucs/diagrams/CMakeLists.txt @@ -13,6 +13,7 @@ diagrams.h graph.h marker.h markerdialog.h +phasor.h polardiagram.h psdiagram.h rect3ddiagram.h @@ -21,13 +22,14 @@ smithdiagram.h tabdiagram.h timingdiagram.h truthdiagram.h +waveac.h ) SET(DIAGRAMS_SRCS curvediagram.cpp graph.cpp polardiagram.cpp smithdiagram.cpp diagram.cpp marker.cpp psdiagram.cpp tabdiagram.cpp diagramdialog.cpp markerdialog.cpp rect3ddiagram.cpp timingdiagram.cpp -rectdiagram.cpp truthdiagram.cpp +rectdiagram.cpp phasor.cpp truthdiagram.cpp waveac.cpp ) SET(DIAGRAMS_MOC_HDRS diff --git a/qucs/qucs/diagrams/diagram.cpp b/qucs/qucs/diagrams/diagram.cpp index d9a9288959..c49f778aec 100644 --- a/qucs/qucs/diagrams/diagram.cpp +++ b/qucs/qucs/diagrams/diagram.cpp @@ -183,7 +183,7 @@ void Diagram::paintScheme(Schematic *p) */ void Diagram::createAxisLabels() { - int x, y, z, w, wmax = 0; + int x, y, w, wmax = 0; QString Str; // get size of text using the screen-compatible metric QFontMetrics metrics(QucsSettings.font, 0); @@ -687,7 +687,7 @@ void Diagram::getAxisLimits(Graph *pg) { // FIXME: Graph should know the limits. but it doesn't yet. // we should only copy here. better: just wrap, dont use {x,y,z}Axis - int z,i,m=0; + int z,i=0; double x, y, *p; QString var, find; DataX const *pD = pg->axis(0); @@ -2150,7 +2150,7 @@ bool Diagram::newcoordinate(Graph::iterator const& p,float* xn, float* yn) const float d; float b; - if(((f1 > f3 - 3) && (f1 < f3 + 3)) || (f2 > f4 - 3) && (f2 < f4 + 3)) + if(((f1 > f3 - 3) && (f1 < f3 + 3)) || ((f2 > f4 - 3) && (f2 < f4 + 3))) { d = 0.0; b = 0.0; @@ -2211,7 +2211,6 @@ void Diagram::phasorscale() void Diagram::findaxisA(Graph *g) { QString var = g->Var; - int n; xAxisA = &xAxis; yAxisA = &yAxis; @@ -2248,8 +2247,8 @@ bool Diagram::findmatch(Graph *g , int m) { double *px; double *pz = g->cPointsY + 2*m*g->axis(0)->count; - int i,z; - if(freq <= 0) + int z; + if(freq <= (double*) 0) { freq=0; sfreq = "0 Hz"; @@ -2323,7 +2322,7 @@ void Diagram::findfreq(Graph *g) a = value.indexOf("hz",0,Qt::CaseInsensitive); } - double *px,f=0,xa; + double *px,f=0; int i,z; double d,dmin=DBL_MAX; num = value.mid(0,a); diff --git a/qucs/qucs/diagrams/marker.cpp b/qucs/qucs/diagrams/marker.cpp index dac985822c..91af78df2d 100644 --- a/qucs/qucs/diagrams/marker.cpp +++ b/qucs/qucs/diagrams/marker.cpp @@ -177,7 +177,7 @@ void Marker::fix() } if(diag()->Name!="Waveac") return; - int nn,x,y,d,dmin = INT_MAX; + int nn,x,d,dmin = INT_MAX; Axis const *pa; if(pGraph->yAxisNo == 0) pa = &(diag()->yAxis); else pa = &(diag()->zAxis); @@ -230,7 +230,6 @@ void Marker::createText() double *pp; nVarPos = pGraph->numAxes(); DataX const *pD; - double n; if(diag()->Name!="Waveac") { auto p = pGraph->findSample(VarPos); @@ -648,7 +647,7 @@ bool Marker::getSelected(int x_, int y_) /*will find the y value of a point in time for waveac*/ double Marker::wavevalY(double xn,std::vector& VarPos) { - double *px,n; + double n; double af=0.0; //angles double A = 0.0; double yp[2]; diff --git a/qucs/qucs/diagrams/phasordiagram.cpp b/qucs/qucs/diagrams/phasordiagram.cpp index 0a0293cad1..214ea0ee4d 100644 --- a/qucs/qucs/diagrams/phasordiagram.cpp +++ b/qucs/qucs/diagrams/phasordiagram.cpp @@ -99,7 +99,7 @@ int PhasorDiagram::calcDiagram() Texts.clear(); Arcs.clear(); - double GridStep, corr, zD, zDstep, GridNum; + double GridStep, zD, zDstep, GridNum; // get size of text using the screen-compatible metric QFontMetrics metrics(QucsSettings.font, 0); y1 = QucsSettings.font.pointSize() + 6; @@ -107,8 +107,7 @@ int PhasorDiagram::calcDiagram() x1 = 10; // position of label text x3 = x2 + 7; QString tmp; - bool back = false; - int z, w, valid = 0; + int z, valid = 0; // ===== give "step" the right sign (if user made it wrong) ============== xAxis.step = fabs(xAxis.step); @@ -127,9 +126,6 @@ int PhasorDiagram::calcDiagram() // ==== x grid ======================================================= calcAxisScale(&xAxis, GridNum, zD, zDstep, GridStep, double(x2)); - double Expo; - if(xAxis.up == 0.0) Expo = log10(fabs(xAxis.up-xAxis.low)); - else Expo = log10(fabs(xAxis.up)); zD += 0.5; // perform rounding z = int(zD); // "int(...)" implies "floor(...)" @@ -160,7 +156,6 @@ int PhasorDiagram::calcDiagram() calcRestAxis(&xAxisP,&yAxisP,&zAxisP); calcRestAxis(&xAxisZ,&yAxisZ,&zAxisZ); -Frame: // outer frame Lines.append(new Line(0, y2, x2, y2, QPen(Qt::black,0))); Lines.append(new Line(x2, y2, x2, 0, QPen(Qt::black,0))); @@ -197,17 +192,13 @@ void PhasorDiagram::calcRestAxis(Axis *xA, Axis *yA , Axis *zA) void PhasorDiagram::calcData(Graph *g) { - double *px; double *pz = g->cPointsY; if(!pz) return; if(g->numAxes() < 1) return; - int z,sc,i; + int z, i; int Size = ((2*(g->count(0)) + 1)*nfreqt * g->countY) + 10; - double Dummy = 0.0; // not used - double *py; - g->resizeScrPoints(Size); auto p = g->begin(); auto p_end = g->begin(); @@ -291,7 +282,7 @@ Diagram* PhasorDiagram::newOne() // ------------------------------------------------------------ Element* PhasorDiagram::info(QString& Name, char* &BitmapFile, bool getNewOne) { - Name = QObject::tr("Phasor(AC)"); + Name = QObject::tr("AC Phasorial diagram"); BitmapFile = (char *) "phasor"; if(getNewOne) return new PhasorDiagram(); diff --git a/qucs/qucs/diagrams/waveac.cpp b/qucs/qucs/diagrams/waveac.cpp index 07027d6566..ab27e68ebc 100644 --- a/qucs/qucs/diagrams/waveac.cpp +++ b/qucs/qucs/diagrams/waveac.cpp @@ -217,7 +217,6 @@ else { // not logarithmical void Waveac::calcData(Graph *g) { - double *px; double *pz = g->cPointsY; if(!pz) return; if(g->numAxes() < 1) return; @@ -319,7 +318,7 @@ Diagram* Waveac::newOne() // ------------------------------------------------------------ Element* Waveac::info(QString& Name, char* &BitmapFile, bool getNewOne) { - Name = QObject::tr("Temporal Diagram(AC)"); + Name = QObject::tr("AC Temporal diagram"); BitmapFile = (char *) "wave"; if(getNewOne) return new Waveac(); diff --git a/qucs/qucs/mouseactions.cpp b/qucs/qucs/mouseactions.cpp index f9e07a70c2..30c77295b8 100644 --- a/qucs/qucs/mouseactions.cpp +++ b/qucs/qucs/mouseactions.cpp @@ -970,6 +970,8 @@ void MouseActions::MPressSelect(Schematic *Doc, QMouseEvent *Event, float fX, fl if(((Diagram*)focusElement)->Name.left(4) != "Rect") if(((Diagram*)focusElement)->Name.at(0) != 'T') if(((Diagram*)focusElement)->Name != "Curve") + if(((Diagram*)focusElement)->Name != "Waveac") + if(((Diagram*)focusElement)->Name != "Phasor") isMoveEqual = true; // diagram must be square focusElement->Type = isDiagram; diff --git a/qucs/qucs/viewpainter.cpp b/qucs/qucs/viewpainter.cpp index 8fd77a63cb..df72671d57 100644 --- a/qucs/qucs/viewpainter.cpp +++ b/qucs/qucs/viewpainter.cpp @@ -59,7 +59,7 @@ void ViewPainter::init(QPainter *p, float Scale_, int DX_, int DY_, p-> setMatrixEnabled(false); // we use our own coordinate transformation QPainter::RenderHints hints = 0; - // Ask to to antialias drawings if requested + // Ask to antialias drawings if requested if (QucsSettings.GraphAntiAliasing) hints |= QPainter::Antialiasing; // Ask to antialias text if requested if (QucsSettings.TextAntiAliasing) hints |= QPainter::TextAntialiasing; @@ -206,8 +206,7 @@ void Graph::drawvect(int x0, int y0, ViewPainter *p) const pp++; continue; } - if(pp->getScrX() != -1)//if true, draw the arrow head - { + phi = atan2(double(y2-y1), double(x2-x1)); beta = atan2(double(4), double(10)); double alfa = beta+phi; @@ -223,8 +222,6 @@ void Graph::drawvect(int x0, int y0, ViewPainter *p) const Painter->drawLine(QLineF(x4, y4, x2, y2)); - } - else pp++; } }