示例#1
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);
}
示例#2
0
void vcvs::initTR (void) {
  nr_double_t t = getPropertyDouble ("T");
  initDC ();
  deleteHistory ();
  if (t > 0.0) {
    setHistory (true);
    initHistory (t);
    setC (VSRC_1, NODE_1, 0.0); setC (VSRC_1, NODE_4, 0.0);
  }
}
示例#3
0
文件: opamp.cpp 项目: Freecore/qucs
void opamp::calcDC (void) {
  nr_double_t g    = getPropertyDouble ("G");
  nr_double_t uMax = getPropertyDouble ("Umax");
  nr_double_t Uin  = real (getV (NODE_INP) - getV (NODE_INM));
  nr_double_t Uout = uMax * M_2_PI * atan (Uin * g * M_PI_2 / uMax);
  gv = g / (1 + sqr (M_PI_2 / uMax * g * Uin)) + GMin;
  setC (VSRC_1, NODE_INP, +gv);
  setC (VSRC_1, NODE_INM, -gv);
  setE (VSRC_1, Uin * gv - Uout);
}
示例#4
0
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 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 ();
}
示例#6
0
文件: opamp.cpp 项目: Freecore/qucs
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);
}
示例#7
0
void control::event2() {
    setA(false);
    setC(true);
    qDebug() << "Plastic Bottling Size Reached";
    qDebug() << "Molding Bottle";
    QTimer::singleShot(500, this, SLOT(event3()));
}
示例#8
0
void control::event3() {
    setB(false);
    QTimer::singleShot(4000, this, SLOT(event1()));
    setB(true);
    setC(false);
    qDebug() << "Bottle Ready";
}
示例#9
0
文件: digital.cpp 项目: Freecore/qucs
// 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);
}
示例#10
0
/**
 *  Kopierfunktion von @p ArchivInfo.
 *
 *  @param[in] to     Zielposition
 *  @param[in] from   Quellposition
 *  @param[in] count  Anzahl
 *  @param[in] source Quelle
 *
 *  @author FloSoft
 */
void ArchivInfo::copy(size_t to, size_t from, size_t count, const ArchivInfo& source)
{
    if(to + count > size())
        data.resize(to + count);

    for(size_t f = from; f < from + count; ++to, ++f)
        setC(to, *source.get(f));
}
示例#11
0
Quaternion::Quaternion() :
	Vector(4)
{
	setA(1.0f);
	setB(0.0f);
	setC(0.0f);
	setD(0.0f);
}
示例#12
0
文件: tline.cpp 项目: Freecore/qucs
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);
  }
}
示例#13
0
void vam::calcTR (nr_double_t t) {
  nr_double_t f = getPropertyDouble ("f");
  nr_double_t p = getPropertyDouble ("Phase");
  nr_double_t d = getPropertyDouble ("m");
  nr_double_t a = getPropertyDouble ("U");
  nr_double_t u = a * sin (2 * M_PI * f * t + rad (p));
  setE (VSRC_1, u);
  setC (VSRC_1, NODE_3, -u * d);
}
TransformationMatrix::TransformationMatrix(const CGAffineTransform& t)
{
    setA(t.a);
    setB(t.b);
    setC(t.c);
    setD(t.d);
    setE(t.tx);
    setF(t.ty);
}
示例#15
0
文件: digital.cpp 项目: Freecore/qucs
// Computes variable MNA entries during DC analysis.
void digital::calcDC (void) {
  calcOutput ();
  calcDerivatives ();
  for (i = 0, Veq = 0; i < getSize () - 1; i++) {
    setC (VSRC_1, NODE_IN1 + i, g[i]);
    Veq += g[i] * getVin (i);
  }
  setE (VSRC_1, Veq - Vout);
}
示例#16
0
Quaternion::Quaternion(float a, float b,
		       float c, float d) :
	Vector(4)
{
	setA(a);
	setB(b);
	setC(c);
	setD(d);
}
示例#17
0
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);
}
示例#18
0
文件: digital.cpp 项目: Freecore/qucs
// Initialize transient analysis.
void digital::initTR (void) {
  nr_double_t t = getPropertyDouble ("t");
  initDC ();
  deleteHistory ();
  if (t > 0.0) {
    delay = true;
    setHistory (true);
    initHistory (t);
    setC (VSRC_1, NODE_OUT, 1);
  }
}
示例#19
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()));
}
// for FEM_ObjectBroker, recvSelf must invoke
PFEMElement2DBubble::PFEMElement2DBubble()
    :Element(0, ELE_TAG_PFEMElement2DBubble), ntags(6), 
     rho(0), mu(0), bx(0), by(0), J(0.0), dJ(6), numDOFs(),thickness(1.0), kappa(-1), parameterID(0)
{
    for(int i=0;i<3;i++)
    {
        nodes[2*i] = 0;
        nodes[2*i+1] = 0;
        thePCs[i] = 0;
    }

    setC();
}
示例#21
0
文件: main.c 项目: Archeleus/random
void sieve()
{
	primes = calloc(LEN, sizeof(unsigned));
	base = calloc(MAX/64, sizeof(unsigned));
	unsigned register i, j, k;
	    for(i=3; i<LMT; i+=2)
	        if(!chkC(base, i))
	            for(j=i*i, k=i<<1; j<MAX; j+=k)
	                setC(base, j);
	    for(i=3, j=0; i<MAX; i+=2)
	        if(!chkC(base, i))
	            primes[j++] = i;
}
示例#22
0
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);
}
示例#23
0
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))));
}
示例#24
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)));
 }
示例#25
0
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
}
/**
 *  lädt die Mapdaten aus einer Datei.
 *
 *  @param[in] file Dateihandle der Datei
 *  @param[in] only_header Soll nur der Header gelesen werden?
 *
 *	@return liefert Null bei Erfolg, ungleich Null bei Fehler
 *
 *  @author FloSoft
 */
int glArchivItem_Map::load(FILE *file, bool only_header)
{
	if(loadHelper(file, only_header) != 0)
		return 1;

	alloc_inc(2);

	header = dynamic_cast<const libsiedler2::ArchivItem_Map_Header*>(get(0));
	assert(header);

	if(only_header)
		return 0;

	// Noch nicht am Ende der Datei?
	unsigned i = 0,j = 0;
	//if(!feof(file))
	//{
	//	// Gucken, wieviel noch danach kommt
	//	i = ftell(file);
	//	fseek(file, 0L, SEEK_END);
	//	j = ftell(file);
	//	fseek(file, i, SEEK_SET);
	//}

	if((unsigned int)(j-i) > (unsigned int)(header->getWidth() * header->getHeight() * 2))
	{
		// Wenn noch Platz ist, restliches Zeug noch auslesen
		libsiedler2::ArchivItem_Raw *reservations = dynamic_cast<libsiedler2::ArchivItem_Raw *>(glAllocator(libsiedler2::BOBTYPE_RAW, 0, NULL));
		if(reservations->load(file, header->getWidth() * header->getHeight()) != 0)
			return 2;
		set(MAP_RESERVATIONS, reservations);

		libsiedler2::ArchivItem_Raw *owner = dynamic_cast<libsiedler2::ArchivItem_Raw *>(glAllocator(libsiedler2::BOBTYPE_RAW, 0, NULL));
		if(owner->load(file, header->getWidth() * header->getHeight()) != 0)
			return 3;
		set(MAP_OWNER, owner);
	}
	else
	{
		libsiedler2::ArchivItem_Raw *item = dynamic_cast<libsiedler2::ArchivItem_Raw *>(glAllocator(libsiedler2::BOBTYPE_RAW, 0, NULL));
		item->alloc(header->getWidth() * header->getHeight());

		set(MAP_RESERVATIONS, item);
		setC(MAP_OWNER, item);
	}

	return 0;
}
示例#27
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);
}
// for object
PFEMElement2DBubble::PFEMElement2DBubble(int tag, int nd1, int nd2, int nd3,
                                         double r, double m, double b1, double b2, 
                                         double thk, double ka)
    :Element(tag, ELE_TAG_PFEMElement2DBubble), ntags(6), 
     rho(r), mu(m), bx(b1), by(b2), J(0.0), dJ(6), numDOFs(), 
     thickness(thk), kappa(ka), parameterID(0)
{
    ntags(0)=nd1; ntags(2)=nd2; ntags(4)=nd3;
    for(int i=0;i<3;i++)
    {
        nodes[2*i] = 0;
        nodes[2*i+1] = 0;
        ntags(2*i+1) = ntags(2*i);
        thePCs[i] = 0;
    }

    setC();
}
示例#29
0
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);
}
示例#30
0
void vcvs::calcAC (nr_double_t frequency) {
  nr_double_t t = getPropertyDouble ("T");
  nr_complex_t g = polar (getPropertyDouble ("G"),
			  - 2.0 * M_PI * frequency * t);
  setC (VSRC_1, NODE_1, +g); setC (VSRC_1, NODE_4, -g);
}