void control::event3() { setB(false); QTimer::singleShot(4000, this, SLOT(event1())); setB(true); setC(false); qDebug() << "Bottle Ready"; }
void opamp::initDC (void) { allocMatrixMNA (); setB (NODE_INP, VSRC_1, 0); setB (NODE_OUT, VSRC_1, 1); setB (NODE_INM, VSRC_1, 0); setC (VSRC_1, NODE_OUT, -1); setD (VSRC_1, VSRC_1, 0); setE (VSRC_1, 0); }
// RGBVec: private methods void RGBVec::normalise() { // simply clip the colour if (r() > 1.0) setR(1.0); if (g() > 1.0) setG(1.0); if (b() > 1.0) setB(1.0); if (r() < 0.0) setR(0.0); if (g() < 0.0) setG(0.0); if (b() < 0.0) setB(0.0); }
void vcvs::initDC (void) { nr_double_t g = getPropertyDouble ("G"); allocMatrixMNA (); setC (VSRC_1, NODE_1, +g); setC (VSRC_1, NODE_2, -1.0); setC (VSRC_1, NODE_3, +1.0); setC (VSRC_1, NODE_4, -g); setB (NODE_1, VSRC_1, +0); setB (NODE_2, VSRC_1, -1.0); setB (NODE_3, VSRC_1, +1.0); setB (NODE_4, VSRC_1, +0); setD (VSRC_1, VSRC_1, 0.0); setE (VSRC_1, 0.0); }
void cpwstep::initAC (void) { setVoltageSources (2); setInternalVoltageSource (true); allocMatrixMNA (); setB (NODE_1, VSRC_1, +1.0); setB (NODE_1, VSRC_2, +0.0); setB (NODE_2, VSRC_1, +0.0); setB (NODE_2, VSRC_2, +1.0); setC (VSRC_1, NODE_1, -1.0); setC (VSRC_1, NODE_2, +0.0); setC (VSRC_2, NODE_1, +0.0); setC (VSRC_2, NODE_2, -1.0); setE (VSRC_1, +0.0); setE (VSRC_2, +0.0); checkProperties (); }
void cccs::initDC (void) { setISource (false); allocMatrixMNA (); nr_double_t g = getPropertyDouble ("G"); setC (VSRC_1, NODE_1, +1.0); setC (VSRC_1, NODE_2, +0.0); setC (VSRC_1, NODE_3, +0.0); setC (VSRC_1, NODE_4, -1.0); setB (NODE_1, VSRC_1, +1/g); setB (NODE_2, VSRC_1, +1.0); setB (NODE_3, VSRC_1, -1.0); setB (NODE_4, VSRC_1, -1/g); setD (VSRC_1, VSRC_1, 0.0); setE (VSRC_1, 0.0); }
void cccs::initTR (void) { nr_double_t t = getPropertyDouble ("T"); initDC (); deleteHistory (); if (t > 0.0) { setISource (true); setHistory (true); initHistory (t); setB (NODE_1, VSRC_1, +1.0); setB (NODE_2, VSRC_1, +0.0); setB (NODE_3, VSRC_1, -0.0); setB (NODE_4, VSRC_1, -1.0); } }
bool EarthModel::setSlotB(const Number* const msg) { bool ok = false; if (msg != nullptr) { ok = setB( msg->getDouble() ); } return ok; }
bool EarthModel::setSlotB(const Distance* const msg) { bool ok = false; if (msg != nullptr) { ok = setB( Meters::convertStatic( *msg ) ); } return ok; }
// Initialize constant MNA entries for DC analysis. void digital::initDC (void) { initDigital (); allocMatrixMNA (); delay = false; setB (NODE_OUT, VSRC_1, +1); setC (VSRC_1, NODE_OUT, -1); setE (VSRC_1, 0); }
Quaternion::Quaternion() : Vector(4) { setA(1.0f); setB(0.0f); setC(0.0f); setD(0.0f); }
Quaternion::Quaternion(float a, float b, float c, float d) : Vector(4) { setA(a); setB(b); setC(c); setD(d); }
void tline::initTR (void) { nr_double_t l = getPropertyDouble ("L"); nr_double_t z = getPropertyDouble ("Z"); deleteHistory (); if (l > 0.0) { setVoltageSources (2); allocMatrixMNA (); setHistory (true); initHistory (l / C0); setB (NODE_1, VSRC_1, +1); setB (NODE_2, VSRC_2, +1); setC (VSRC_1, NODE_1, +1); setC (VSRC_2, NODE_2, +1); setD (VSRC_1, VSRC_1, -z); setD (VSRC_2, VSRC_2, -z); } else { setVoltageSources (1); allocMatrixMNA (); voltageSource (VSRC_1, NODE_1, NODE_2); } }
WaterPhysicsSystem::Edge* WaterPhysicsSystem::Edge::split(Vec2f _point, Boundary* _boundary) { Vertex* anchor = new Vertex(_point, _boundary, true); Edge* edge = new Edge; edge->setA(anchor, bPosition()); edge->setB(b); setB(anchor); return edge; }
TransformationMatrix::TransformationMatrix(const CGAffineTransform& t) { setA(t.a); setB(t.b); setC(t.c); setD(t.d); setE(t.tx); setF(t.ty); }
void digisource::initDC (void) { char * init = getPropertyString ("init"); nr_double_t v = getPropertyDouble ("V"); bool lo = !strcmp (init, "low"); allocMatrixMNA (); setC (VSRC_1, NODE_1, 1.0); setB (NODE_1, VSRC_1, 1.0); setD (VSRC_1, VSRC_1, 0.0); setE (VSRC_1, lo ? 0 : v); }
int main(void) { if (b == 0) setB(); if (a == 0) setA(); assert(a == 1); return 0; }
Quaternion::Quaternion(const Dcm &dcm) : Vector(4) { setA(0.5f * sqrtf(1 + dcm(0, 0) + dcm(1, 1) + dcm(2, 2))); setB((dcm(2, 1) - dcm(1, 2)) / (4 * getA())); setC((dcm(0, 2) - dcm(2, 0)) / (4 * getA())); setD((dcm(1, 0) - dcm(0, 1)) / (4 * getA())); }
MEvent::MEvent(unsigned tick, int port, int channel, const Event& e, MidiTrack* trk) { m_track = trk; m_source = SystemSource; setChannel(channel); setTime(tick); setPort(port); setLoopNum(0); switch (e.type()) { case Note: setType(ME_NOTEON); setA(e.dataA()); setB(e.dataB()); break; case Controller: setType(ME_CONTROLLER); setA(e.dataA()); // controller number setB(e.dataB()); // controller value break; case PAfter: setType(ME_POLYAFTER); setA(e.dataA()); setB(e.dataB()); break; case CAfter: setType(ME_AFTERTOUCH); setA(e.dataA()); setB(0); break; case Sysex: setType(ME_SYSEX); setData(e.eventData()); break; default: printf("MEvent::MEvent(): event type %d not implemented\n", type()); break; } }
void circulator::initDC (void) { nr_double_t z1 = getPropertyDouble ("Z1"); nr_double_t z2 = getPropertyDouble ("Z2"); nr_double_t z3 = getPropertyDouble ("Z3"); nr_double_t r1 = (z0 - z1) / (z0 + z1); nr_double_t r2 = (z0 - z2) / (z0 + z2); nr_double_t r3 = (z0 - z3) / (z0 + z3); nr_double_t d = 1 - r1 * r2 * r3; nr_double_t s11 = (r2 * r3 - r1) / d; nr_double_t s22 = (r1 * r3 - r2) / d; nr_double_t s33 = (r1 * r2 - r3) / d; nr_double_t s12 = sqrt (z2/z1) * (z1+z0) / (z2+z0) * r3 * (1-r1*r1) / d; nr_double_t s23 = sqrt (z3/z2) * (z2+z0) / (z3+z0) * r1 * (1-r2*r2) / d; nr_double_t s31 = sqrt (z1/z3) * (z3+z0) / (z1+z0) * r2 * (1-r3*r3) / d; nr_double_t s21 = sqrt (z1/z2) * (z2+z0) / (z1+z0) * (1-r2*r2) / d; nr_double_t s13 = sqrt (z3/z1) * (z1+z0) / (z3+z0) * (1-r1*r1) / d; nr_double_t s32 = sqrt (z2/z3) * (z3+z0) / (z2+z0) * (1-r3*r3) / d; allocMatrixMNA (); setB (NODE_1, VSRC_1, +1.0); setB (NODE_1, VSRC_2, +0.0); setB (NODE_1, VSRC_3, +0.0); setB (NODE_2, VSRC_1, +0.0); setB (NODE_2, VSRC_2, +1.0); setB (NODE_2, VSRC_3, +0.0); setB (NODE_3, VSRC_1, +0.0); setB (NODE_3, VSRC_2, +0.0); setB (NODE_3, VSRC_3, +1.0); setC (VSRC_1, NODE_1, s11 - 1.0); setC (VSRC_1, NODE_2, s12); setC (VSRC_1, NODE_3, s13); setC (VSRC_2, NODE_1, s21); setC (VSRC_2, NODE_2, s22 - 1.0); setC (VSRC_2, NODE_3, s23); setC (VSRC_3, NODE_1, s31); setC (VSRC_3, NODE_2, s32); setC (VSRC_3, NODE_3, s33 - 1.0); setD (VSRC_1, VSRC_1, z0 * (s11 + 1.0)); setD (VSRC_1, VSRC_2, z0 * s12); setD (VSRC_1, VSRC_3, z0 * s13); setD (VSRC_2, VSRC_1, z0 * s21); setD (VSRC_2, VSRC_2, z0 * (s22 + 1.0)); setD (VSRC_2, VSRC_3, z0 * s23); setD (VSRC_3, VSRC_1, z0 * s31); setD (VSRC_3, VSRC_2, z0 * s32); setD (VSRC_3, VSRC_3, z0 * (s33 + 1.0)); setE (VSRC_1, +0.0); setE (VSRC_2, +0.0); setE (VSRC_3, +0.0); }
void Triangle::configure(const std::string& parameters) { if (parameters.empty()) return; std::vector<std::string> values = Op::split(parameters, " "); std::size_t required = 3; if (values.size() < required) { std::ostringstream ex; ex << "[configuration error] term <" << className() << ">" << " requires <" << required << "> parameters"; throw fl::Exception(ex.str(), FL_AT); } setA(Op::toScalar(values.at(0))); setB(Op::toScalar(values.at(1))); setC(Op::toScalar(values.at(2))); }
Quaternion::Quaternion(const Dcm &dcm) : Vector(4) { // avoiding singularities by not using // division equations setA(0.5 * sqrt(1.0 + double(dcm(0, 0) + dcm(1, 1) + dcm(2, 2)))); setB(0.5 * sqrt(1.0 + double(dcm(0, 0) - dcm(1, 1) - dcm(2, 2)))); setC(0.5 * sqrt(1.0 + double(-dcm(0, 0) + dcm(1, 1) - dcm(2, 2)))); setD(0.5 * sqrt(1.0 + double(-dcm(0, 0) - dcm(1, 1) + dcm(2, 2)))); }
void isolator::initDC (void) { nr_double_t z1 = getPropertyDouble ("Z1"); nr_double_t z2 = getPropertyDouble ("Z2"); #if AUGMENTED nr_double_t z21 = 2 * sqrt (z1 * z2); setVoltageSources (2); allocMatrixMNA (); setB (NODE_1, VSRC_1, +1.0); setB (NODE_1, VSRC_2, +0.0); setB (NODE_2, VSRC_1, +0.0); setB (NODE_2, VSRC_2, +1.0); setC (VSRC_1, NODE_1, -1.0); setC (VSRC_1, NODE_2, +0.0); setC (VSRC_2, NODE_1, +0.0); setC (VSRC_2, NODE_2, -1.0); setD (VSRC_1, VSRC_1, +z1); setD (VSRC_2, VSRC_2, +z2); setD (VSRC_1, VSRC_2, +0.0); setD (VSRC_2, VSRC_1, +z21); setE (VSRC_1, +0.0); setE (VSRC_2, +0.0); #else setVoltageSources (0); allocMatrixMNA (); setY (NODE_1, NODE_1, 1 / z1); setY (NODE_1, NODE_2, 0); setY (NODE_2, NODE_1, -2 / sqrt (z1 * z2)); setY (NODE_2, NODE_2, 1 / z2); #endif }
int main(void) { while(c) { if (b == 0) goto L; if (check()) { c = 0; L: setA(); setB(); } } return 0; }
Quaternion::Quaternion(const EulerAngles &euler) : Vector(4) { float cosPhi_2 = cosf(euler.getPhi() / 2.0f); float cosTheta_2 = cosf(euler.getTheta() / 2.0f); float cosPsi_2 = cosf(euler.getPsi() / 2.0f); float sinPhi_2 = sinf(euler.getPhi() / 2.0f); float sinTheta_2 = sinf(euler.getTheta() / 2.0f); float sinPsi_2 = sinf(euler.getPsi() / 2.0f); setA(cosPhi_2 * cosTheta_2 * cosPsi_2 + sinPhi_2 * sinTheta_2 * sinPsi_2); setB(sinPhi_2 * cosTheta_2 * cosPsi_2 - cosPhi_2 * sinTheta_2 * sinPsi_2); setC(cosPhi_2 * sinTheta_2 * cosPsi_2 + sinPhi_2 * cosTheta_2 * sinPsi_2); setD(cosPhi_2 * cosTheta_2 * sinPsi_2 + sinPhi_2 * sinTheta_2 * cosPsi_2); }
Quaternion::Quaternion(const EulerAngles &euler) : Vector(4) { double cosPhi_2 = cos(double(euler.getPhi()) / 2.0); double sinPhi_2 = sin(double(euler.getPhi()) / 2.0); double cosTheta_2 = cos(double(euler.getTheta()) / 2.0); double sinTheta_2 = sin(double(euler.getTheta()) / 2.0); double cosPsi_2 = cos(double(euler.getPsi()) / 2.0); double sinPsi_2 = sin(double(euler.getPsi()) / 2.0); setA(cosPhi_2 * cosTheta_2 * cosPsi_2 + sinPhi_2 * sinTheta_2 * sinPsi_2); setB(sinPhi_2 * cosTheta_2 * cosPsi_2 - cosPhi_2 * sinTheta_2 * sinPsi_2); setC(cosPhi_2 * sinTheta_2 * cosPsi_2 + sinPhi_2 * cosTheta_2 * sinPsi_2); setD(cosPhi_2 * cosTheta_2 * sinPsi_2 - sinPhi_2 * sinTheta_2 * cosPsi_2); }
void TGAImage::initFirstLOD( unsigned char* srcData) { lodData[0] = new unsigned char[ getLODwidth(0) * getLODheight(0) * BPP ] ; for( int i = 0 ; i < getLODwidth(0) ; i++ ) for( int j = 0 ; j < getLODheight(0) ; j++ ) { unsigned char r, g, b, a ; if( srcData ) getRGBA( srcData, i, getLODheight(0) - 1 - j, r, g, b, a ) ; else r = g = b = a = 0 ; setR( 0, i, j, r ) ; setG( 0, i, j, g ) ; setB( 0, i, j, b ) ; setA( 0, i, j, a ) ; } goodLOD = 0 ; }
CSeaData::CSeaData( const CSeaData &object ) { setWaveInputType( object.waveInputType() ); setWaveAngle( object.waveAngle() ); setWaveHeight( object.waveHeight() ); setWaveMaxHeight( object.waveMaxHeight() ); setWaveSpreading( object.waveSpreading() ); setWaveType( object.waveType() ); setWaveLength( object.waveLength() ); setWavePeriod( object.wavePeriod() ); setCurrentInputType( object.currentInputType() ); setFlowAngle( object.flowAngle() ); setFlowSpeed( object.flowSpeed() ); setSeaTemperature( object.seaTemperature() ); setSeaTemperaturechange( object.seaTemperatureChange() ); setIceThickness( object.iceThickness() ); setR( object.r() ); setB( object.b() ); setG( object.g() ); }
CSeaData::CSeaData(): m_dbWaveInputType( false ), m_dWaveAngle( 0.0 ), m_dWaveHeight( 0.0 ), m_dWaveMaxHeight( 0.0 ), m_diWaveSpreading( 0 ), m_dWaveType( 0.0 ), m_dWaveLength( 0.0 ), m_dWavePeriod( 0.0 ), m_dbCurrentInputType( false ), m_dFlowAngle( 0.0 ), m_dFlowSpeed( 0.0 ), m_dSeaTemperature( 0.0 ), m_dSeaTemperaturechange( 0.0 ), m_dIceThickness( 0.0 ) { setR(0); setB(0); setG(0); }
void TGAImage::generateLOD( int lod ) { int dstW = getLODwidth(lod) ; int dstH = getLODheight(lod); if( lodData[lod] == NULL ) lodData[lod] = new unsigned char[ dstW * dstH * BPP ] ; int s = getLODwidth(0) / dstW ; int t = getLODheight(0) / dstH ; for( int i = 0 ; i < dstW ; i++ ) for( int j = 0 ; j < dstH ; j++ ) { int r = 0, g = 0, b = 0, a = 0 ; for( int k = 0 ; k < s ; k++ ) for( int l = 0 ; l < t ; l++ ) { r += getR( 0, i * s + k, j * t + l ) ; g += getG( 0, i * s + k, j * t + l ) ; b += getB( 0, i * s + k, j * t + l ) ; a += getA( 0, i * s + k, j * t + l ) ; } r /= s * t ; g /= s * t ; b /= s * t ; a /= s * t ; setR( lod, i, j, r ) ; setG( lod, i, j, g ) ; setB( lod, i, j, b ) ; setA( lod, i, j, a ) ; } goodLOD = lod ; }