Analog Code Model

An analog code model contains only analog functionality and is called every time the circuit matrix is loaded. These models can be as simple as a gain block, or as complex as an IC Mosfet model.

Model Name     Example                                  Description                                   Parameter Defaults     
                                                                                                                             
Gain           ag1 1 2 amp                              Simple gain block with 1 input and 1 output:  in_offset=0.0 V        
               .model amp gain (in_offset=0.1gain=5.0   both input and output referenced to ground.    out_offset=0.0 V       
               +out_offset=-0.01)                       output=(input - in_offset) * gain +           gain=1.0               
                                                        out_offset;                                                           
                                                                                                                             
Summer         a1 [1 2 3] 4 sum                         Summation block requiring at least 2 inputs   in_offset=0.0 V        
               .model sum summer (in_offset=[0.1 -0.2   and having 1 output.                          out_offset=0.0 V       
               0.05]                                    temp=0;                                       in_gain=1.0            
               + in_gain=[2.0 1.0 1.0]                  for (i=0; i < number_of_inputs; i++)          out_gain=1.0           
               +out_gain=5.0  out_offset=-0.01)         temp=temp + (input[i] - in_offset[i]) *                          
                                                                         n_gain[i];                                          
                                                        output=temp * out_gain + out_offset;                                 
                                                                                                                             
Multiplier     ax3 [1 2 3 4 5] 5 mu1                    Multiplication block requiring at least 2     in_offset=0.0 V        
               .model mu1 mult                          inputs and having 1 output.                   out_offset=0.0 V       
               +(in_offset=[0.0 0.1 0.2 0.3 0.4]        output=out_gain;                              in_gain=1.0            
               +in_gain=[1.0 1.1 1.2 1.3 1.4]           for (i=0; i < number_of_inputs; i++)          out_gain=1.0           
               +out_gain=5.0  out_offset=-0.01)             output=output *                                                  
                                                                           (input[i] - in_offset[i]) *                        
                                                        in_gain[i];                                                           
                                                        output=output + out_offset;                                          
                                                                                                                             
Divider        a1div [1 2] 3 divx                       Division block requiring 2 inputs (numerator  in_offset=0.0 V        
               .model divx divide (in_offset=[0.0 0.1]  and denominator) and having 1 output.          out_offset=0.0 V       
               +in_gain=[1.0 1.1]                       output=( (input[1]-in_offset[1])*in_gain[1] ) in_gain=1.0            
               +out_gain=5.0  out_offset=-0.01)         /                                              out_gain=1.0           
                                                               ( (input[2]-in_offset[2])*in_gain[2] )                        
                                                        *                                                                     
                                                              out_gain + out_offset/;                                        
                                                                                                                             
Constant       a1 1 2 alim                              Signal limitation block requiring 1 input and in_offset=0.0 V        
Limiter         .model alim limit (in_offset=0.1         1 output where the limits are constants.       gain=1.0               
               +gain=5.0                                output=(input-in_offset) * gain;              out_lower_limit=0.0 V  
               +out_lower_limit=0.25                    if (fraction== TRUE)                          out_upper_limit=1.0 V  
               +out_upper_limit=4.75                        limit_range=limit_range *                 limit_range=1.0 uV     
               +limit_range=0.1                         (out_upper_limit-                              fraction=FALSE         
               +fraction=FALSE)                                                    out_lower_limit);                         
                                                        if (output >= out_upper_limit)                                     
                                                            output=out_upper_limit;                                          
                                                        else if (output <= out_lower_limit)                                
                                                            output=out_lower_limit; else if (output                          
                                                        < out_lower_limit+limit_range)                                      
                                                            output=smooth_lower_corner(output);                              
                                                        else if (output >                                                  
                                                        out_upper_limit-limit_range)                                          
                                                            output=smooth_upper_corner(output);                              
                                                                                                                             
Controlled     aclimit in cntl_up cntl_dn out vlimit    Signal limitation block requiring 3 inputs (a in_offset=0.0 V        
Limiter         .model vlimit climit (in_offset=0.1      signal input and 2 control inputs) and 1 output gain=1.0               
               +gain=5.0                                where the limits are variable.                 upper_delta=0.0 V      
               + _delta=0.25                            output=(input-in_offset) * gain;              lower_delta=0.0 V      
               +upper_delta=0.40                        if (fraction== TRUE)                          limit_range=1.0 uV     
               +limit_range=0.1                         limit_range=limit_range *                     fraction=FALSE         
               +fraction=FALSE)                         (cntl_up - upper_delta - cntl_dn +                                   
                                                        lower_delta);                                                         
                                                        if (output >= cntl_up-upper_delta)                                 
                                                        output=cntl_up-upper_delta;                                          
                                                        else if (output <= cntl_dn+lower_delta)                            
                                                        output=cntl_dn+lower_delta;                                          
                                                        else if (output <                                                  
                                                        cntl_dn+lower_delta+limit_range)                                      
                                                        output=smooth_lower_corner(output);                                  
                                                        else if (output >                                                  
                                                        cntl_up-upper_delta-limit_range)                                      
                                                        output=smooth_upper_corner(output);                                  
                                                                                                                             
Piece-Wise     apwlcs cntl out pwlsc                    Piece-Wise Linear Controlled Source requiring x_array=None           
Linear        .model pwlsc pwl (x_array=[0.0  0.5  1.0  1 control input and 1 output. Based on the     y_array=None           
Controlled      2.0                                     value of &quotcntl", the correct segment of input_domain=0.01 V    
Source          +3.0  4.0  5.0]                         x_arrayis found.  The output is the linear     fraction=TRUE          
               +y_array=[1.0 1.65 2.72 7.39 20.1 54.6   interpolation across the corresponding y_array                        
               148]                                     segment.  Values of &quotcntl" outside the                        
               +input_domain=0.07                       range of x_array are clamped to the minimum (or                        
               +fraction=TRUE)                          maximum) of y_array.  Smoothing occurs around                         
                                                        each point based on the value of input_domain                         
                                                        and fraction.                                                         
                                                                                                                             
Analog Switch  asw1 c1 out asw                          An analog switch having 1 control input and 1 cntl_off=0.0 V         
               .model asw aswitch (cntl_off=0.0         output and whose resistance can vary either    cntl_on=1.0 V          
               cntl_on=3.3                              linearly or logarithmically.                   r_off=1.0e12 Ohm       
               +r_off=250K                              if (log== TRUE) {                             r_on=1.0 Ohm           
               +r_on=250 log=TRUE)                      = log(r_off / r_on) / (cntl_on - cntl_off);   log=TRUE               
                                                        = r_on * exp(temp * (cntl_on - cntl_input));;                        
                                                        }                                                                    
                                                        else {                                                               
                                                        temp=(r_on - r_off) / (cntl_on - cntl_off);                          
                                                        r=cntl_input * temp + ((r_off*cntl_on -                              
                                                        _on*cntl_off) / (cntl_on - cntl_off));                               
                                                        }                                                                    
                                                        output= output(previous) / r;                                        
                                                                                                                             
Zener Diode    az out 2 my_zener                        A Zener diode model for DC characteristics    v_breakdown=None       
               .model my_zener zener (v_breakdown=10    only that is based on common parameters listed i_breakdown=20 mA      
               +i_breakdown=0.02                        in data sheets.                                r_breakdown=1.0 Ohm    
               +r_breakdown=1.0 i_rev=1e-6 i_sat=1e-12)                                               n_forward=1.0          
                                                                                                      i_rev=1.0 uA           
                                                                                                      i_sat=1.0 pA           
                                                                                                      limit_switch=FALSE     
                                                                                                                             
Hysteresis     ah1 in out schm_trig                     A simple hysteresis buffer block.             Hyst=0.1 V             
               .model schm_trig hyst (in_low=0.7                                                      out_lower_limit=0.0 V  
               in_high=2.4                                                                             in_low=0.0 V           
               +hyst=0.5                                                                              in_high=1.0 V          
               +out_lower_limit=0.5 out_upper_limit=3.0                                               out_upper_limit=1.0 V  
               +input_domain=0.01 fraction=TRUE)                                                      input_domain=0.01 V    
                                                                                                      fraction=TRUE          
                                                                                                                             
Differentiator ad1 in out dv_dt                         Calculates the derivative of the input with   Gain=1.0               
               .model dv_dt d_dt (gain=1.0              respect to time.                               input_offset=0.0 V     
               input_offset=0.0                                                                        out_lower_limit=0.0 V  
               +out_lower_limit=-1e12                                                                 out_upper_limit=0.0 V  
               +out_upper_limit=1e12                                                                  limit_range=1.0e-6     
               +limit_range=1e-6)                                                                                            
                                                                                                                             
Integrator     ai1 in out integrator                    Calculates the integral of the input with     gain=1.0               
               .model integrator int (gain=1.0          respect to time.                               input_offset=0.0 V     
               input_offset=0.0                                                                        out_lower_limit=0.0 V  
               +out_lower_limit=-1e12                                                                 out_upper_limit=0.0 V  
               +out_upper_limit=1e12                                                                  limit_range=1.0 uV     
               +limit_range=1e-6 out_ic=10.0)                                                         out_ic=0.0 VS          
                                                                                                                             
Laplace        a_lap1 in out laplace1                   Implements a Laplace Transfer function        gain=1.0               
Transfer       .model laplace1 s_xfer (gain=0.139713    describing V(out) / V(in) = num(S) / den(S).   input_offset=0.0 V     
Functions      +in_offset=0.1                           The order of the numerator polynomial must be  num_coeff = None       
               +num_coeff=[1.0 0.0 0.07464102]          less than or equal to the order of the         den_coeff = None       
               +den_coeff=[1.0 0.998942 0.01170077]     denominator polynomial.  The coefficients of   int_ic = 0.0 V         
               +denormalized_freq=1500                  num_coeff and den_coeff are ordered from       denormalized_freq = 1.0 
               +int_ic=1.0)                             highest power to lowest power.  Coefficients   Rad                     
                                                        that are zero must be explicitly listed.The    out_lower_limit=None   
                                                                                                      out_upper_limit=None   
                                                                                                      _range=1.0e-6          
                                                                                                      _ic=0.0                
                                                                                                                             
Pulse Width    apwm vin vref vramp vout pwm             Implements a Pulse Width Modulation function.  gain=100.0             
Modulator      .model pwm pwm (gain=100                 When vin+vramp+vin_offset >= vref, the output vin_offset=0.0 V       
               + vin_offset=0.1                         goes high.  When vin+vramp+vin_offset < vref, minvout = 0.0 V        
               + minvout=0.5 maxvout=3.5)               the output goes low.                           maxvout = 5.0 V        
                                                                                                                             

 

Return to main help menu