Пример #1
0
ECDiode::ECDiode(Circuit& ownerCircuit) :
            Component(ownerCircuit)
{
    m_diode = new Diode();

    ElementMap *map = new ElementMap(m_diode);
    m_elementMapList.append(map);

    m_pinMap.insert("n1", new ECNode(ownerCircuit, map->pin(0)));
    m_pinMap.insert("p1", new ECNode(ownerCircuit, map->pin(1)));

	DiodeSettings ds; // it will have the default properties that we use

	Property * i_s =  new Property("I_S", Variant::Type::Double);
	i_s->setCaption(tr("Saturation Current"));
	i_s->setUnit("A");
	i_s->setMinValue(1e-20);
	i_s->setMaxValue(1e-0);
	i_s->setValue(ds.I_S);
	i_s->setAdvanced(true);
    addProperty(i_s);

    Property *n = new Property("N", Variant::Type::Double);
	n->setCaption(tr("Emission Coefficient"));
	n->setMinValue(1.0);
	n->setMaxValue(1e1);
	n->setValue(ds.N);
	n->setAdvanced(true);
    addProperty(n);

    Property *v_b = new Property("V_B", Variant::Type::Double);
	v_b->setCaption(tr("Breakdown Voltage"));
	v_b->setUnit("V");
	v_b->setMinAbsValue(1e-5);
	v_b->setMaxValue(1e10);
	v_b->setValue(ds.V_B);
	v_b->setAdvanced(true);
    addProperty(v_b);

// 	createProperty( "R", Variant::Type::Double );
// 	property("R")->setCaption( i18n("Series Resistance") );
// 	property("R")->setUnit( QChar(0x3a9) );
// 	property("R")->setMinValue(1e-5);
// 	property("R")->setMaxValue(1e0);
// 	property("R")->setValue( ds.R );
// 	property("R")->setAdvanced(true);

    ownerCircuit.addComponent(this);
}
Пример #2
0
Capacitor::Capacitor(Circuit &ownerCircuit) : Component(ownerCircuit)
{
    // model
    m_capacitance = new Capacitance(0.001, LINEAR_UPDATE_PERIOD);
    ElementMap *m_elemMap = new ElementMap(m_capacitance);
    m_elementMapList.append(m_elemMap);

    // pins
    m_pinMap.insert("n1", new ECNode(ownerCircuit, m_elemMap->pin(0)));
    m_pinMap.insert("p1", new ECNode(ownerCircuit, m_elemMap->pin(1)));

    Property *cap = new Property("Capacitance", Variant::Type::Double);
    cap->setCaption(tr("Capacitance"));
    cap->setUnit("F");
    cap->setMinValue(1e-12);
    cap->setMaxValue(1e12);
    cap->setValue(1e-3);
    addProperty(cap);

    ownerCircuit.addComponent(this);
}
Пример #3
0
//BEGIN class ADDAC
ADDAC::ADDAC(Circuit& ownerCircuit) : Component(ownerCircuit)
{
	m_numBits = 0;
	m_range = 0;

    Property *bits = new Property("numBits", Variant::Type::Int);
    bits->setCaption( tr("Number Bits") );
    bits->setMinValue(2);
    bits->setMaxValue(max_ADDAC_bits);
    bits->setValue(2);
    addProperty(bits);

    Property *range = new Property("range", Variant::Type::Double);
    range->setCaption( tr("Input Range") );
    range->setUnit("V");
    range->setMinValue(-1e12);
    range->setMaxValue(1e12);
    range->setValue(5);
    addProperty(range);

    /*
	createProperty( "numBits",  Variant::Type::Int );
	property("numBits")->setCaption( i18n("Number Bits") );
	property("numBits")->setMinValue(2);
	property("numBits")->setMaxValue(max_ADDAC_bits);
	property("numBits")->setValue(2);

	createProperty( "range", Variant::Type::Double );
	property("range")->setCaption( i18n("Input Range") );
	property("range")->setUnit("V");
	property("range")->setMinValue(-1e12);
	property("range")->setMaxValue(1e12);
	property("range")->setValue(5);
    */
    ownerCircuit.addComponent(this);
}