fish001

[Simulation Model] 05-Voltage Source and Current Source

 
Overview

Lichuang EDA Simulation Classroom-Voltage Source and Current Source

      Voltage sources and current sources are both idealized circuit models and are often used to demonstrate circuit principles. Select the appropriate voltage source or current source to power the circuit through the respective drop-down boxes. This type of voltage and current source is also called an "independent power supply."

      An ideal voltage source means that its two ends can always maintain a certain voltage regardless of the current flowing through it. The current flowing through the voltage source depends on the power supply of the external circuit to which it is connected. The actual voltage source is equivalent to an ideal voltage source connected in series with a resistor. If the internal resistance R0 is infinitesimal, or much smaller than the external resistance of the voltage source, the voltage source can be considered an ideal voltage source. The circuit is as follows:

hyG0FN9kMnAN6r1fvIiGpxKrrnbwS3xEhyGMBd8X.png

      An ideal current source refers to a power source whose output current is constant, its DC equivalent resistance is infinite, and its AC equivalent resistance is infinite. If the internal resistance R0 is infinite, or much larger than the external resistance of the voltage source, the current source can be considered an ideal power source. A real current source is equivalent to an ideal current source connected in parallel with a resistor, and its circuit is as follows:

odUROresJAP8FuZOD8L1BVLdm0a07iKstppApeCD.png

      The following will introduce the configuration and usage instructions of each voltage source and current source in the Easy EDA simulation mode. Since the configuration methods of voltage sources and current sources are the same, the voltage source is used as an example to explain. You can demonstrate the specific configuration of the current source by yourself. Function.

 

1. Direct current source (DC)

      Configuration syntax: DC ([DC parameters] [AC amplitude] [AC phase])

      DC signal source, generally used for power supply. Find the voltage source or current source in the power library of the basic library and place it directly on the canvas. Set the DC voltage parameters or current parameters according to the design needs. The AC amplitude and phase default to 0. Pay attention to the voltage and current flow direction during use.

tZQ2Tu5fIyjmpylpJn7TIxQHS9TC0Xyv8LkEBh5p.png

 

2. Sine source (SIN)

      Configuration syntax: SIN ([DC offset] [amplitude] [frequency] [delay] [damping factor] [phase] [AC amplitude] [AC phase])

      The sinusoidal source is the AC source. AC sources are widely used in simulations and can replace function generators to generate an AC signal. Here are some commonly used communication source setting cases for everyone to learn from:

(1) Simulate household 220V AC power

      Simulating household 220V alternating current is a commonly used simulation operation. The setting method is: simulate a voltage source or current source in the canvas, then select it with the mouse, and set it as a sine source in the property bar on the right. It can also be found in the basic library by pulling down. The sine source is placed directly. Since the household 220V is the AC effective value, the voltage source is set to amplitude, and the data displayed by the multimeter is also the effective value. If you want to simulate the actual household power supply, the amplitude should be set to about 311V, the frequency should be 50Hz, and the other items should be left blank. That’s it.

YhbnYourP6hKIw2odaYuD4ryHuPGkIQ4rz8x0SlY.png

(2) 90° phase-shifted waveform

      How to phase shift the waveform? According to the sine wave configuration syntax, you only need to fill in the angle that needs to be shifted in the phase [deg] position. You can fill in a positive number or a negative number. Take a look at the following example:

      Generate a sine wave Sin1 with an amplitude of 1V and a frequency of 1KHz. The configuration is as follows:

          SIN(0 1 1k 0 0 0)

      The sine wave Sin2 that moves the waveform phase forward by 90° is set as follows:

            SIN(0 1 1k 0 0 -90)

luEtOLTBpJFGUUbnsFgEJN0Du338j6o6RrShF8sT.png

(3) Delay to generate a specified number of periodic waveforms

      The delay function is easy to use. According to the syntax, you only need to enter the time to be delayed in the delay column. The default unit is S (seconds). You can generate a fixed number of waveforms according to the syntax. In fact, the number of waveforms is What is omitted can be understood as there is no limit to the number of waveform periods under normal circumstances. If you want to limit it, you only need to add the display period after the setting syntax.

      Generate a sine wave Sin3 with a delay of 1ms, an amplitude of 1V, and a frequency of 1KHz. The configuration is as follows:

            SIN(0 1 1k 1m 0 0)

      Set the sine wave Sin4 displayed in the first two cycles of the Sin3 waveform as follows:

            SIN(0 1 1k 1m 0 0 2)

VxzImEulXiDEAmadf0HdLt6ZOXKncBdZJHLHas8N.png

(4) Set damping factor

      The damping factor setting is easily ignored. Many students often do not pay attention to the damping factor when learning simulations, and are overwhelmed by watching the generated waveforms getting smaller and smaller. The damping factor plays a hindering role here, making our The waveform is reduced according to a certain proportion until it reaches 0. Damping factor = 1/τ, where τ is the time constant. Let’s take a look at the following three simulation settings:

ic5r1FSduHEq1LSFLHmeN9qKuDvTh8fGSRmiZBRh.png

      The waveform of Sin5 is set to a sine wave with an amplitude of 1V, 1KHz and a damping factor of 1/1000, while the V+ and V- voltage probes measure the state when the capacitance is the initial state of 1V and -1V respectively. Since the resistor R is equal to 1K and the capacitor C is equal to 1uF, the capacitor charge and discharge time constant τ=RC=0.001 is consistent with the damping factor setting of the sinusoidal source. The simulation waveform is as follows:

dvogEGp2RWPKinPcrQKgAFjDz42GXq9d9w24OdEs.png

 

3. Pulse source (PULSE)

      Configuration syntax: PULSE ([initial value] [pulsation value] [delay] [rise time] [fall time] [pulse width] [pulse period] [AC amplitude] [AC phase])

      Since it is a pulse source, the duty cycle is fixed at 50%. If you want to generate a square wave with any duty cycle, then use a function generator~ But the advantage of the pulse wave is that it can produce various styles of waveforms. Such as trapezoidal wave, triangle wave, sawtooth wave, etc.

(1) Basic pulse configuration

      According to the configuration syntax, we can first configure a square wave with a pulsation value of 1V and a period of 500Hz, and then review the delay display and fixed period display functions mentioned earlier.

      Square wave Pulse1 needs to set a rise time and fall time as small as possible. Here it is set to 1ns, the half cycle and pulse width are set to 1ms, and the period is 2ms. The configuration is as follows:

             PULSE(0 1 0 1n 1n 1m 2m)

      Delay the square wave Pulse1 for 2 seconds and then set the square wave Pulse2 waveform to display only two cycles. The waveform configuration is as follows:

            PULSE(0 1 2m 1n 1n 1m 2m 2)

      The simulation waveform diagram is as follows:

d1jozoDlp0GB8Oojyab9zUBd88fFxasPNEEKhT0u.png

(2) Special pulse configuration

      As mentioned earlier, the pulse wave can be set to trapezoidal wave, triangle wave and sawtooth wave. In fact, the trick lies in the configuration of the rise time and fall time. If the rise and fall time is set small enough, it can be approximated as a line perpendicular to the X-axis. A straight line, but if the time is set larger, it will be a diagonal line, but this time cannot exceed the cycle time. If it exceeds, you can think about what will happen.

      Generate a trapezoidal wave Pulse3 with an initial value of 0V, a ripple value of 1V, a rise time and fall time of 0.5ms, a pulse width of 0.5ms, and a period of 2ms. The configuration is as follows:

            PULSE(0 1 0 0.5m 0.5m 0.5m 2m)

      Generate a triangular wave Pulse4 with an initial value of 0V, a ripple value of 1V, a rise time and a fall time of 0.5ms, a pulse width of 0, and a period of 1ms. The Pulse4 configuration is as follows:

            PULSE(0 1 0 0.5m 0.5m 0 1m)

      Generate a sawtooth wave Pulse5 with an initial value of 0V, a ripple value of 1V, a rise time of 1ms, a fall time of 0, a pulse width of 0, and a period of 1ms. The configuration is as follows:

            PULSE(0 1 0 1m 0 0 1m)

      The simulation waveform diagram is as follows:

WQsQ80BLxDdB5P4ny64wruEVoFvd1Vd5cINHTHQa.png

 

4. Index source (EXP)

      Configuration syntax: EXP ([Initial value] [Peak value] [Rise delay] [Rise time constant] [Fall delay] [Fall time constant] [AC amplitude] [AC phase])

      The exponential source is used to create a single pulse source with exponential rising and falling edges. According to the syntax, we configure an exponential waveform Exp1 with an initial value of 0, rising first and then falling, and an Exp2 waveform with an initial value of 1, falling first and then rising.

      The initial value is 0, the peak value is 1V, the rise delay is 5ms, the rise time constant is 1ms, the fall delay is 30ms, and the fall time constant is 2ms. The Exp1 waveform configuration is as follows:

            EXP(0 1 5m 1m 30m 2m)

      The initial value is 1V, the peak value is 0, the rise delay is 5ms, the rise time constant is 2ms, the fall delay is 30ms, and the fall time constant is 2ms. The Exp2 waveform configuration is as follows:

            EXP(1 0 5m 2m 30m 2m)

      At this time, the simulation waveform is:

s3g6cKsRd9ytDZV110gJXmNc4iAEb3AUSV820PQD.png

      Note: The rise and fall referred to here are not nominal rises and falls. It is necessary to combine the initial state and the peak value to determine whether it is a true rise or a true fall. For time constants, please see the previous introduction to the capacitor model. Click to view capacitor explanation

 

5. Single frequency frequency modulation source (SFFM)

      Configuration syntax: EXP ([DC offset] [amplitude] [carrier frequency] [modulation index] [signal frequency] [AC amplitude] [AC phase])

      When using a single-frequency FM source to output a signal, the following formula must be met:

            V(t)=DC_offset+A*sin(2*π*Fc*t+M*sin(2*π*Fs*t))

      Among them, DC_offset is the DC offset, A is the amplitude, Fc is the carrier frequency, M is the modulation index, and Fs is the signal frequency.
      Use the sine source introduced earlier to generate a 100Hz and 1Khz sine wave respectively, and then use a single frequency frequency modulation source to generate A signal with a carrier frequency of 1K and a signal frequency of 100Hz is analyzed for comparison.

      A sine wave signal with an amplitude of 1V and a frequency of 100Hz is configured as follows:

            SIN(0 1 100)

      A sine wave signal with an amplitude of 1V and a frequency of 1KHz is configured as follows:

            SIN(0 1 1K)

      The single-frequency FM wave signal configuration with an amplitude of 1V, a carrier frequency of 1Khz, a modulation index of 5, and a signal frequency of 100Hz is as follows:

            SFFM(0 1 1k 5 100)

      The simulation waveform is as follows:

DztutIDRsOTZvUEGMLgpnlmE6HQ9f33nRPeOLp3b.png

 

6. Piecewise linear source (PWL)

      Configuration syntax: EXP([time1][value1][time2][value2]... ...[AC amplitude][AC phase])

      The piecewise linear source is used to generate a signal connected by multiple segments of polygonal lines, which can generate arbitrary waveforms such as triangle waves, sawtooth waves, and staircase waves. First set up a simple triangle wave to experience the usage of piecewise linear sources:

      To generate a single triangular wave with a frequency of 2s and an amplitude of 1V, the initial time and value of the segmented linear source configuration can be set to 0. After 1s, the amplitude becomes 1V, and then the amplitude drops to 1V within 1s. 0V, the configuration is as follows:

            PWL(0 0 1 1 2 0)

m3B0urbbHqQ0nawhEo8mlUfqpShHBoovhatogfDg.png

      If you want to generate an uninterrupted waveform or a fixed number of waveforms, you cannot just add the number of cycles at the end like the previous waveform configuration. At this time, you need to add statements indicating the number and the end of the waveform in the instruction.

      Generate a sawtooth wave signal with a frequency of 1s and an amplitude of 1V. Then the initial time and value of the segmented linear source configuration can be set to 0. After 1s, the amplitude becomes 1V, and then drops to 0V in a short period of time. The time cannot be 0, and can be set as small as possible, such as 0.001s. To generate a continuous signal, you need to add     the repeat forever...endrepeat instruction to the instruction. The configuration is as follows:

            PWL repeat forever(0 0 1 1 1.001 0)endrepeat

      If you want to generate a fixed number of sawtooth wave signals, the above repeat forever statement should be changed to repeat for X, where X is the number of generated cycles. If you need to generate a 5-cycle waveform, the configuration is as follows:

            PWL repeat for 5(0 0 1 1 1.001 0)endrepeat

      The above two waveform results are as follows:

b0SoRUCCnpAj7eloaqad3TVZty02ckhaPwbA3aEv.png

 

7. Behavior source (PWL)

      Configuration syntax: EXP([time1][value1][time2][value2]... ...[AC amplitude][AC phase])

      The proper application of behavioral sources in simulations requires a powerful model. Each behavioral source is composed of equations, so behavioral sources can be used to generate waveforms generated by any equation. The voltage source output formula is V=..., and the current source The formula is I=.... When using equations, be careful not to use curly brackets. The expressions need to be on the same line and cannot be separated into lines. If you enter it in the netlist, you can use the "+" sign to continue. Give a few examples to illustrate the usage of the behavior source function.

      Configure a waveform with an output voltage of 2pi as: V=2*pi. The waveform is displayed as follows:

G9Fr1A0QeEuAcTYLu3M1de5BbXw3ytb72RCM8CXq.png      Then make a case composed of multiple waveforms, use a DC source to output a voltage V(A) of 2V, and use a row source to output a voltage V(B) of 1V, then V(C)=V(A)+V( B), the output voltage waveform is as follows:

9NmjEUY3vU36hayMAhyYHwYYcscgAU8iZ1xbt8xI.png

Precautions:

      If the AC analysis command is used to analyze the circuit, the AC amplitude needs to be set to 1 and the AC voltage phase to 0. In other cases, it is left blank by default.

 

All the above case projects can be opened in the editor as follows to run the simulation

The video explanation is as follows: Click to view the video explanation

参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2024-11-15 08:17:34

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号