// This is -*- Verilog-A -*-

// ============================================================================
//
// (c) Copyright 2005, All Rights Reserved, Philips Electronics N.V.
//
//
// Version: August 22, 2005
//
// ============================================================================

// Spice primitives
// Verilog-AMS LRM 2.0 Annex E "SPICE compatibility"

`include "disciplines.vams"
`include "constants.vams"

`ifdef CONDUCTOR_VA
`else
`define CONDUCTOR_VA 1

`ifdef TNOM
`else
`define TNOM 25
`endif

/**
 * @brief linear conductor with 2nd order temperature dependency.
 *
 * A linear conductor is defined by the constituent relationship I = V*G,
 * which is Ohm's law in its conductance form - also known as Siemens' law.
 *
 * The temperature dependency of the conductor is determined before applying
 * Siemens' law. Be aware that with the same non-zero temperature coefficients
 * a resistor and a conductor will behave differently.
 *
 * If the temperature-corrected conductance is 0, the conductor resolves to an
 * open.
 *
 * @param g		conductance in [S].
 * @param tc1		first order temperature coefficient in [S/K].
 * @param tc2		second order temperature coefficient in [S/K^2].
 */

module Conductor (p, n);
inout p, n;
electrical p, n;
parameter g = 1m;
parameter tc1 = 0.0;
parameter tc2 = 0.0;

real gt, dta, tnom;

analog begin

  @(initial_step) begin
    tnom = `P_CELSIUS0 + `TNOM;
  end

  dta = $temperature - tnom;
  gt = g * (1 + tc1 * dta + tc2 * dta * dta);

  I(p, n) <+ V(p, n) * gt;

end

endmodule // Conductor

`endif
