Library
Contents Up Previous Next

Library

The library keyword is used to declare librairies. The library declaration must be finsihed by a semiconlon. One or more libraries can be declared. The available libraries are:

  • base.cib : resitors, capacitors and others
  • logic.cib : logic gates : AND, OR, XOR, NOT, Flip-Flop, etc.
  • ic.cib : NE555
  • ibis.cib : input and output driver model for simulation with IBIS files
  • transistor.cib : NPN, PNP and other transistor models

Example: library base;

The library contains the definition of components used in simulations. Components are defined by symbolic equations as shown in the following examples. Refer to the file base.cib located in the /lib directory of SimCAS directory for all defined models.

  • The first step is to declare the component name with its ports:
    component R( @1, @2, value=100 ) // if <value> is omitted in the instance declaration, the instanciated resistor would have a default value of 100 ohms
    
    @1 and @2 are R the two resistor nodes <value> is the value given to the resistor. It can be followed by an "=" meaning that the default value is 100 in this case.
  • the second step is to declare voltage and current through and accross nodes :
    U = across( @1, @2 );
    I = through( @1, @2 );
    
  • the third step is to declare physical equations
    /* Physical equations */
     U = value * I;
    

Below are some examples from the base.cib library :

  • Resistor
    component R( @1, @2, value=100 ) // if <value> is ommitted in the instance declaration, the instanciated resistor would have a default value of 100 ohms
    {
      /* Nodal equations */
      U = across( @1, @2 );
      I = through( @1, @2 );
      /* Physical equations */
      U = value * I;
    }
    
  • Capacitor
    component C( @1, @2, value=1u ) // if <value> is ommitted in the instance declaration, the instanciated resistor would have a default value of 1 uF
    {
      /* Nodal equations */
      U = across( @1, @2 );
      I = through( @1, @2 );
      /* Physical equations */
      I = value * d( U ) / dt;
    }
    
  • Inductor
    component L( @1, @2, value=1n ) // if <value> is ommitted in the instance declaration, the instanciated resistor would have a default value of 1 nH
    {
      /* Nodal equations */
      U = across( @1, @2 );
      I = through( @1, @2 );
      /* Physical equations */
      U = value * d( I ) / dt;
    }
    
  • Voltage source
    component V( @1, @2, value=1 ) // if <value> is ommitted in the instance declaration, the instanciated resistor would have a default value of 1 V
    {
      /* Nodal equations */
      U = across( @1, @2 );
      I = through( @1, @2 );
      /* Physical equations */
      U = value;
    }