How to Create a Piecewise Linear Source SPICE Model

Team EMA

Modeling designs help engineers verify whether their circuit will function as intended. Modeling programs simulate circuit behavior under different conditions and in accordance with the design requirements, allowing engineers to better plan and build circuits. 

Every SPICE simulation needs to have a source or input signal. To analyze how the circuit will behave in real life, this input must be modeled accurately. If not modeled accurately, functionality issues can go undetected until far later in the design process, wasting time and money. To efficiently and accurately model a source, the intended input signal needs to be interpreted by identifying the type and signal values for replication. 

What is a Piecewise Linear Source (PWL)

Piecewise Linear (PWL) functions are used to create a waveform from a series of straight line segments connecting points which are defined by the user. Since PWL functions are useful in creating custom waveforms, they are typically used in defining voltage or current sources. 

What is needed to Model a Piecewise Linear Source

A piecewise linear source is time-dependent and contains time-value pairs; to accurately model a PWL source, there are two items that must be defined. 

  • Type
    • Which type of signal will be the input for the circuit: voltage or current?
  • Data Points
    • What are the signal values at designated time intervals?

This information must be incorporated into the SPICE simulation model which can be achieved by manually creating or editing a text file. Keep in mind if the source signal created is not the intended outcome, the time pairs within the SPICE model will need to be edited manually. For example:

  • If the signal needs to be repeated, additional time pairs must be added to the simulation model. 
  • If the voltage or current values need to be scaled, each value in the pin pair must be edited. 
  • If the time values need to be scaled, each value in the pin pair must be edited.
  • If the signal needs to be offset, voltage must be added to each value in the pin pair

This manual process to produce the desired source signal is time consuming and increases the likelihood of errors; however, the PSpice Modeling App provides a fast, easily-configurable, and fully-integrated method to create piecewise linear sources for simulation.

PSpice Modeling App

The PWL modeling application quickly creates a time-dependent piecewise linear source model with a wizard-based approach. The necessary source specifications pre-defined and users can easily input desired parameters such as:

  •  Source Type:
    • Select either a Voltage PWL or Current PWL
  • Data Points
    • Quickly specify the current or voltage values as specific time intervals to define time pairs or upload a PWL text file containing the time and value separated with a space.
  • Signal Repetition:
    • Save times by only defining time/value pairs for a single period and easily select how many times you want your signal to repeat with options including none, a user-defined amount, or forever. 
  • Value and Time Scaling Factor:
    • Rather than manually adjusting each unit of the time pair, specify a factor by which the value or time in each PWL pair will be multiplied. 
  • AC and DC:
    • Quickly specify the AC or DC voltage magnitude to be automatically added to each PWL pair, achieving the intended AC sweep, bias point, or transient analysis. 

Using the inputted information above, the PSpice Modeling App generates a schematic symbol and automatically associates the newly created SPICE model without leaving the OrCAD Capture environment. The PSpice Modeling App also automatically manages the simulation profile configuration, eliminating any library set up for simulation. To learn more, be sure to keep an eye out for additional SPICE model how-to's in this series. 





Previous Article
How to Create a Pulse Source SPICE Model
How to Create a Pulse Source SPICE Model

Modeling designs help engineers verify whether their circuit will function as intended. This tutorial will ...

Next Article
How To Find PSpice Models For Simulation And Design
How To Find PSpice Models For Simulation And Design

Using PSpice models for simulation and design can accurately model and simulate electronic circuits in any ...