PSIM User's Manual PDF
Document Details
Uploaded by Deleted User
2020
Powersim Inc.
Tags
Summary
This document is a user's manual for PSIM, a software suite used in electrical engineering for circuit simulation. It details various functionalities, components, and settings for modeling and analyzing electrical circuits. The manual covers components like resistors, inductors, capacitors, switches and transformers.
Full Transcript
User’s Manual Powersim Inc. Chapter : -7 PSIM User’s Guide Version 2020a Release 1 May 2020 Copyright © 2001-2020 Powersim Inc. All rights reserved. No part of this manual may be photocopied or reproduced in any form or by any means without the written permis...
User’s Manual Powersim Inc. Chapter : -7 PSIM User’s Guide Version 2020a Release 1 May 2020 Copyright © 2001-2020 Powersim Inc. All rights reserved. No part of this manual may be photocopied or reproduced in any form or by any means without the written permission of Powersim Inc. Disclaimer Powersim Inc. (“Powersim”) makes no representation or warranty with respect to the adequacy or accuracy of this documentation or the software which it describes. In no event will Powersim or its direct or indirect suppliers be liable for any damages whatsoever including, but not limited to, direct, indirect, incidental, or consequential damages of any character including, without limitation, loss of business profits, data, business information, or any and all other commercial damages or losses, or for any damages in excess of the list price for the licence to the software and documentation. Powersim Inc. Email: [email protected] powersimtech.com -6 Chapter : Contents 1 General Information 1.1 Introduction 1 1.2 Circuit Structure 4 1.3 Software/Hardware Requirement 4 1.4 Installing the Program 4 1.5 Simulating a Circuit 5 1.6 Simulation Control 5 1.7 Component Parameter Specification and Format 9 2 Circuit Schematic Design 2.1 PSIM Environment 11 2.2 Creating a Circuit 14 2.3 File Menu 15 2.4 Edit Menu 16 2.5 View Menu 17 2.6 Design Suites Menu 18 2.7 Subcircuit Menu 19 2.7.1 Creating Subcircuit - In the Main Circuit 20 2.7.2 Creating Subcircuit - Inside the Subcircuit 20 2.7.3 Connecting Subcircuit - In the Main Circuit 21 2.7.4 Other Features of the Subcircuit 22 2.8 Elements Menu 24 2.9 Simulate Menu 24 2.10 Script Menu 27 2.11 Options Menu 28 2.11.1 Setting Option 28 2.11.2 Set Path Option 31 2.11.3 Customizing Toolbars and Keyboards 32 2.12 Utilities Menu 33 2.13 Managing the PSIM Library 34 2.13.1 Creating a Secondary Image 36 2.13.2 Adding a New Subcircuit Element into the Library 36 2.13.3 Adding a New DLL Element into the Library 38 2.14 Creating a Symbol Library 39 3 Waveform Processing in SIMVIEW 3.1 File Menu 42 3.2 Edit Menu 43 3.3 View Menu 43 3.4 Axis Menu 44 3.5 Screen Menu 46 3.6 Measure Menu 50 3.7 Analysis Menu 52 Chapter : -5i 3.8 Label Menu 52 3.9 Option Menu 53 3.10 Exporting Data 54 4 Power Circuit Components 4.1 Resistor-Inductor-Capacitor Branches 55 4.1.1 Resistor 55 4.1.2 Inductor 56 4.1.3 Capacitors 57 4.1.4 Combined R-L-C Branch 58 4.1.5 Rheostat 58 4.1.6 Saturable Inductor 58 4.1.7 Saturable Inductor (2) 59 4.1.8 3-Phase R-L-C and Combination Branches 60 4.1.9 3-Phase P/Q Controlled Load 61 4.1.10 Coupled Inductors 61 4.1.11 3-Phase AC Cable 63 4.1.12 Nonlinear Elements 64 4.2 Switching Devices 66 4.2.1 Diode and LED 66 4.2.2 MOSFET 68 4.2.3 IGBT 71 4.2.4 IGBT-RB 72 4.2.5 npn and pnp Transistors 73 4.2.6 Zener Diode and DIAC 76 4.2.7 Thyristor and TRIAC 77 4.2.8 GTO 78 4.2.9 Bi-Directional Switches 78 4.2.10 Gating Blocks 79 4.2.11 Pre-Built Switch Modules 80 4.3 Transformers 88 4.3.1 Ideal Transformer 88 4.3.2 Single-Phase Transformers 88 4.3.3 3-Phase Transformers 90 4.3.4 3-Phase Transformer with Saturation 92 4.4 Magnetic Elements 94 4.4.1 Winding 94 4.4.2 Leakage Flux Path 94 4.4.3 Air Gap 95 4.4.4 Linear Core 96 4.4.5 Saturable Core 96 4.5 Other Elements 98 4.5.1 Operational Amplifier 98 4.5.2 TL431 Shunt Regulator 100 4.5.3 Opto-Coupler 100 4.5.4 dv/dt Block 101 4.5.5 Relays 102 4.6 Motor Drive Module 103 4.6.1 Reference Direction of Mechanical Systems 103 4.6.2 Induction Machines 105 4.6.3 DC Machine 110 ii -4 Chapter : 4.6.4 Brushless DC Machine 111 4.6.5 Synchronous Machine with External Excitation 116 4.6.6 Permanent Magnet Synchronous Machine (PMSM) 118 4.6.6.1 PMSM Linear 118 4.6.6.2 PMSM (High Frequency) 121 4.6.6.3 PMSM (Nonlinear) 122 4.6.6.4 PMSM (Spatial Harmonics) 124 4.6.6.5 6-Phase PMSM 125 4.6.7 Switched Reluctance Machine (SRM) 126 4.6.8 Motor Control Blocks 129 4.7 MagCoupler Module 134 4.7.1 MagCoupler-DL Block 134 4.7.2 MagCoupler Block 135 4.8 MagCoupler-RT Module 138 4.9 Mechanical Elements and Sensors 142 4.9.1 Mechanical Loads 142 142 4.9.2 Mechanical-Electrical Interface Block 144 4.9.3 Mechanical Coupling Block 146 4.9.4 Gear Box 146 4.9.5 Speed/Torque Sensors 146 4.9.6 Position Sensors 148 4.10 Thermal Module 151 4.10.1 Diode Thermal Model 151 4.10.2 MOSFET Thermal Model 155 4.10.3 IGBT Thermal Model 161 4.10.4 RB-IGBT Thermal Model 165 4.10.5 Inductor Thermal Model 168 4.10.6 Device Database Editor 170 4.10.7 Adding a Switching Device to Database 171 4.11 Renewable Energy Module 176 4.11.1 Solar Modules 176 4.11.2 Wind Turbine 182 4.11.3 Battery Models 184 4.11.4 Ultracapacitor Model 190 5 Control Circuit Components 5.1 Often-Used Control Function Blocks 191 5.1.1 PID Controllers 191 5.1.2 Summers 196 5.1.3 Comparators 196 5.1.4 Limiters 198 5.1.5 Filters 198 5.2 Filters 198 5.3 Computational Function Blocks 199 5.3.1 Multiplier and Divider 199 5.3.2 Trigonometric Functions 200 5.3.3 Exponential/Power/Logarithmic Functions 200 5.3.4 Square-Root 201 5.3.5 RMS (Root-Mean-Square) 201 5.3.6 Absolute and Sign Functions 201 5.3.7 Maximum/Minimum Function 201 Chapter : iii -3 5.3.8 MOD Function 202 5.4 Other Function Blocks 202 5.4.1 Sampling/Hold Block 202 5.4.2 Lookup Table ((Trapezoidal and Square) Blocks 203 5.4.3 Fast Fourier Transform 203 5.4.4 THD Block 205 5.4.5 S-Domain Transfer Function 206 5.4.6 Time Delay Blocks 207 5.4.7 Round-Off Block 207 5.4.8 dv/dt Limiter 208 5.4.9 Multiplexers 208 5.4.10 Space Vector PWM 209 5.4.11 Discontinuous PWM 210 5.4.12 Embedded Software Block 211 5.5 Logic Components 211 5.5.1 Logic Gates 211 5.5.2 Set-Reset Flip-Flop 211 5.5.3 J-K Flip-Flops 212 5.5.4 D Flip-Flops 212 5.5.5 Monostable Multivibrator 213 5.5.6 Time Delay (Logic) 213 5.5.7 Bit Shift 213 5.5.8 Pulse Width Counter 214 5.5.9 Up/Down Counter 214 5.5.10 A/D and D/A Converters 215 5.6 Digital Control Module 216 5.6.1 Motor Control Blocks 216 5.6.2 PLL Blocks 219 5.6.3 Zero-Order Hold 221 5.6.4 Unit Delay 222 5.6.5 z-Domain Transfer Function Block 222 5.6.6 Quantization Blocks 229 5.6.7 Circular Buffers 231 5.6.8 Convolution Block 231 5.6.9 Memory Read Block 232 5.6.10 Data Array 232 5.6.11 Stack 233 5.6.12 Multi-Rate Sampling System 233 5.7 SimCoupler Module 234 5.7.1 Set-up in PSIM and Simulink 234 5.7.2 Solver Type and Time Step Selection in Simulink 235 5.7.3 Passing Parameters from Simulink to PSIM 237 5.8 PIL Module 238 5.8.1 PIL Block 238 5.8.2 PIL Block (InstaSPIN F2806x) 239 5.8.3 InstaSPIN Set Block (F2806x) 239 5.9 Design Suite Blocks 240 5.9.1 Torque Control (PMSM) 240 5.9.2 Dynamic Torque Limit Control (PMSM) 241 5.9.3 Dynamic Torque Limit Control (Nonlinear PMSM) 242 5.9.4 Voltage Control (PMSM) 243 iv -2 Chapter : 5.9.5 DC-DC Charging Control 244 5.9.6 DC-DC Discharging Control 245 5.9.7 DC-DC Regeneration Control 245 5.10 PLL Blocks 246 5.10.1 1-ph PLL 246 5.10.2 3-ph PLL 247 6 Other Components 6.1 Switch Controllers 249 6.1.1 On-Off Switch Controller 249 6.1.2 On-Off Switch Controller (Multi-Level) 249 6.1.3 Alpha Controller 250 6.1.4 PWM Lookup Table Controller 251 6.2 Sensors 256 6.3 Probes, Meters, and Scopes 6.3.1 Probes and Meters 257 6.3.2 Voltage/Current Scopes 259 6.4 Function Blocks 261 6.4.1 Control-Power Interface Block 261 6.4.2 Transformation Blocks 262 6.4.3 Lookup Tables 266 6.4.4 Math Function Blocks 270 6.4.5 DLL Blocks 270 6.4.6 C Block 272 6.4.7 Simplified C Block 274 6.5 IC Models 275 6.5.1 PWM IC 275 6.5.2 Driver IC 276 6.5.3 555 Timer 277 6.6 Initial Values 277 6.7 Parameter File 277 6.8 AC Analysis 280 6.8.1 AC Sweep Probes 282 6.8.2 AC Sweep 282 6.8.3 AC Sweep (1) 283 6.8.4 AC Sweep (2) 284 6.8.5 AC Sweep Multisine 284 6.9 Parameter Sweep 285 7 Sources 7.1 Constant 287 7.2 Time 287 7.3 Ground 287 7.4 Voltage and Current Sources 288 7.4.1 DC Source 288 7.4.2 Sinusoidal Source 288 7.4.3 Square-Wave Source 289 7.4.4 Triangular/Sawtooth Sources 290 7.4.5 Step Sources 291 Chapter : -1v 7.4.6 Piecewise Linear Source 292 7.4.7 Random Source 293 7.4.8 Math Function Source 293 7.4.9 Grounded Source Multiple 293 7.4.10 Voltage/Current-Controlled Sources 294 7.4.11 Nonlinear Voltage-Controlled Sources 295 8 Error/Warning Messages and Other Simulation Issues 8.1 Simulation Issues 296 8.1.1 Time Step Selection 296 8.1.2 Propagation Delays in Logic Circuits 296 8.1.3 Interface Between Power and Control Circuits 296 8.1.4 FFT Analysis 297 8.2 Debugging 297 8.3 Error/Warning Messages 298 vi 0 Chapter : 1 General Information 1.1 Introduction PSIM1 is a simulation software specifically designed for power electronics, motor drives, and power conversion systems. With fast simulation speed and friendly user interface, PSIM provides a powerful simulation environment to meed your simulation and development needs. The PSIM simulation environment consists of the schematic program PSIM, the simulation engine, and the waveform processing program SIMVIEW2. The simulation process is illustrated as follows. PSIM Schematic Schematic Editor (input: *.psimsch) PSIM Simulator Simulator (output: *.smv or *.txt) SIMVIEW Waveform Processor (input: *.smv or *.txt) PSIM includes the basic package, as well as the following Add-on Modules: Motor Drive: Built-in electric machine models and mechanical load models for motor drive system studies. Digital Control: Discrete library elements such as zero-order hold, z-domain transfer function blocks, quantization blocks, digital filters, for digital control system analysis. Thermal: Library elements and functions calculate semiconductor device losses and inductor losses. Renewable Energy: Library elements, such as solar module, wind turbine, battery, and ultra- capacitor models, for renewable energy applications. Motor Control Design Pre-built templates for induction motor and linear/nonlinear PMSM drives. Suite: HEV Design Suite: Pre-built templates for hybrid electric vehicle (HEV) powertrain system design. SimCoupler: Interface between PSIM and Matlab/Simulink3 for co-simulation. SPICE: Functions to link to LTspice4. MagCoupler: Interface between PSIM and the electromagnetic field analysis software JMAG5 for co-simulation. MagCoupler-RT: Link between PSIM and JMAG-RT5 data files. ModCoupler6 Interface between PSIM and ModelSim7 for co-simulation. There are two versions of the interface: ModCoupler-VHDL that supports VHDL code, and ModCoupler-Verilog that supports Verilog code. SimCoder2: Function for automatic code generation. Chapter 1: General Information 1 F2833x Target: Library elements for automatic code generation for TI F2833x series DSP. F2803x Target: Library elements for automatic code generation for TI F2803x series DSP. F2802x Target: Library elements for automatic code generation for TI F2802x series DSP. F2806x Target: Library elements for automatic code generation for TI F2806x series DSP. F2837x Target: Library elements for automatic code generation for TI F2837x series DSP. F28004x Target: Library elements for automatic code generation for TI F28004x series DSP. PE-Expert4 Target: Library elements for automatic code generation for Myway PE-Expert4 hardware platform. PIL: Interface between PSIM and TI DSP hardware boards for Processor-In-the- Loop (PIL) simulation. It also includes the function block to support TI’s InstaSPIN motor control algorithm. In addition, PSIM integrates the DSIM8 engine into its simulation environment. DSIM is known for its incredible speed and accuracy in solving very large power converter systems, and for solving detailed switching transients. DSIM shares the same schematic capture and waveform processing environment as PSIM. For more information, refer to "Tutorial - Getting Started with DSIM.pdf" and "DSIM User Manual.pdf". Also, PSIM links with the software SmartCtrl5 for control loop design. SmartCtrl is designed specifically for power converter applications. For more information, refer to "SmartCtrl User’s Guide". PSIM also provides the function to export the power stage to Typhoon HIL’s real-time simulator for Hardware- In-the-Loop HIL simulation. For more information, refer to relevant documents. With these product lineup, Powersim provides a complete platform from design to simulation, to hardware implementation. The overall environment is shown in the figure below. HIL / Hardware Design Simulation Implementation F2833x/03x/06x/02x/37x/004x/ PE-Expert4 Targets PSIM SmartCtrl TI DSP Thermal Power Auto Code Analysis Electronics Generation Motor Control PIL Thermal SimCoder TI DSP Design Suite Control Motor Drives Solar/Wind Power ModCoupler HEV Design Suite Renewable Energy ModelSim Digital Control Motor Drive FPGA HIL SimCoupler MagCoupler/ SPICE MagCoupler-RT Matlab/ Simulink DSIM LTspice JMAG Typhoon-HIL This manual covers both PSIM and all add-on Modules and subjects except the ones listed below which are covered by these documents respectively: - For SimCoder and hardware Targets: SimCoder User Manual.pdf - SPICE Module: SPICE User Manual.pdf 2 Chapter 1: General Information - PIL Module: Tutorial - Processor-In-the-Loop Simulation.pdf - Motor Control Design Suite: Tutorial - Motor Control Design Suite.pdf Tutorial - PMSM drive with sensorless control.pdf - HEV Design Suite: Tutorial - HEV Design Suite.pdf - Motor identification, InstaSPIN, and sensorless motor drives: Tutorial - Motor parameter identification with PSIM.pdf Tutorial - Simulation and code generation of TI InstaSPIN using DRV8305 EVM.pdf The organization of this manual is as follows: Chapter 1: PSIM circuit structure, software/hardware requirement, and parameter format. Chapter 2: PSIM environment and how to build a PSIM schematic. Chapter 3: Simulation result display and analysis with SIMVIEW. Chapter 4 through 7: Components in PSIM element library. Chapter 8: Error/warning messages Notes: 1. PSIM is a registered trademark of Powersim Inc., 2001-2020 2. SIMVIEW and SimCoder are trademarks of Powersim Inc., and are copyright by Powersim Inc., 2001-2020 3. Matlab and Simulink are registered trademarks of the MathWorks, Inc. 4. LTspice is copyright by Analog Devices Inc., 1998-2020 5. JMAG and JMAG-RT are copyright by JSOL Corporation, 1997-2020 6. ModCoupler is copyright by Universidad Carlos III de Madrid, 2011-2020 7. ModelSim is a registered trademark of Mentor Graphics Co. 8. DSIM is copyright by DSIM Technology Co., 2020 9. SmartCtrl is copyright by Power Smart Control S.L., 2015-2020 Chapter 1: General Information 3 1.2 Circuit Structure A circuit is represented in PSIM in four blocks: power circuit, control circuit, sensors, and switch controllers. The figure below shows the relationship between these blocks. Power Circuit Switch Sensors Controllers Control Circuit The power circuit consists of switching devices, RLC branches, transformers, and coupled inductors. The control circuit is represented in block diagram. Components in s-domain and z-domain, logic components (such as logic gates and flip flops), and nonlinear components (such as multipliers and dividers) are used in the control circuit. Sensors are used to measure power circuit quantities and pass them to the control circuit. Gating signals are then generated from the control circuit and sent back to the power circuit through switch controllers to control switches. 1.3 Software/Hardware Requirement PSIM runs in Microsoft Windows 10 or higher on personal computers. A minimum of 1GB RAM memory is needed. 1.4 Installing the Program A quick installation guide is provided in the flier “PSIM - Quick Guide” and on the USB memory stick. Some of the files in the PSIM directory are: PSIM.exe PSIM circuit schematic editor SIMVIEW.exe PSIM waveform processing program PcdEditor.exe Device database editor SetSimPath.exe Program to set up the SimCoupler Module File extensions used in PSIM are: *.psimsch PSIM schematic file *.psimpjt PSIM project file *.schpack PSIM package file *.lib PSIM library file *.fra PSIM ac analysis output file (text) *.dev Device database file *.txt Simulation output file in text format *.smv Simulation output file in binary format *.net; *.cir SPICE netlist files 4 Chapter 1: General Information 1.5 Simulating a Circuit To simulate the buck converter circuit “buck.psimsch” in "examples\dc-dc": - Start PSIM. From the File menu, choose Open Examples... , then, go to "dc-dc" folder to load the file “buck.psimsch”. - From the Simulate menu, choose Run PSIM to start the simulation. Simulation results will be saved to File “buck.smv”. - By default, Auto-run SIMVIEW is selected in the Options menu. SIMVIEW will be launched automatically. In SIMVIEW, select curves for display. If this option is not selected, from the Simulate menu, choose Run SIMVIEW to start SIMVIEW. Video tutorials are available to assist new users quickly getting familiar to PSIM’s environment and functions. These video tutorials can be found and accessed in PSIM: from the Help menu, choose "Video Tutorials >> Overview and Getting Started". 1.6 Simulation Control The Simulation Control element defines parameters and settings related to simulation. To place the Simulation Control in the schematic, go to the Simulate menu, and select Simulation Control. Image: The following tabs are in the Simulation Control dialog: PSIM: Define parameters for PSIM simulation. DSIM: Define parameters for DSIM simulation. For detailed information, refer to DSIM User’s Manual. SPICE: Define the analysis type and parameters for SPICE simulation. For detailed information, refer to SPICE User’s Manual. SimCoder: Define the hardware for SimCoder simulation and automatic code generation. For detailed information, refer to SimCoder User’s Manual. Color: Define the color of the Simulation Control image. The default color is blue. 1.6.1 PSIM Tab: The PSIM tab defines parameters for PSIM simulation. Solver Type Fixed-step: Fixed step size is used throughout whole simulation. Variable-step (dual): Two step sizes are used. The bigger step size is used most of the time while the smaller step size is used when switches change position or if there are narrow pulses. Time Step Simulation time step, in sec. Time Step Ratio The ratio between the Time Step (the bigger step size) and the smaller step size. Total Time Total simulation time, in sec. Free Run When the Free Run checkbox is not checked, the simulation will run up to the Total Time (checkbox) and then stop. But when it is checked, the simulation will run in the free-run mode and it will keep on running until manually stopped. In the free-run mode, voltage/current scopes can be used to monitor and display voltages and currents in the middle of the simulation. Chapter 1: General Information 5 Print Time Time from which simulation results are saved to the output file. No output is saved before this time. Print Step Print step. If it is set to 1, for example, every data point will be saved to the output file. If it is set to 10, only one out of 10 data points will be saved. This helps to reduce the output file size. Load Flag Flag for the LOAD function. If the flag is 1, the previous simulation values (saved by setting the Save Flag) will be loaded from a file (with the “.ssf” extension) as the initial conditions. Save Flag Flag for the SAVE function. If the flag is 1, values at the end of the current simulation will be saved to a file with the “.ssf” extension. R_switch_on Default value of the switch on-state resistance, in Ohm. R_switch_off Default value of the switch off-state resistance, in Ohm. In PSIM, the simulation time step is fixed throughout the simulation. In order to ensure accurate simulation results, the time step must be chosen properly. The factors that limit the time step in a circuit include the switching period, widths of pulses or waveforms, and intervals of transients. It is recommended that the time step should be at least one magnitude smaller than the smallest of the above. Also, an interpolation technique is implemented which will calculate the switching instants more accurately. With this technique, the error due to the misalignment of switching instants and discrete simulation points is significantly reduced. It is possible to simulate with a large time step while still maintaining accurate results. The allowable maximum time step is automatically calculated in PSIM. It is compared with the time step set by the user, and the smaller value of the two will be used in the simulation. With the SAVE and LOAD functions, the circuit voltages, currents and other quantities can be saved at the end of a simulation session, and loaded back as the initial conditions for the next simulation session. This provides the flexibility of running a long simulation in several shorter stages with different time steps and parameters. Components values and parameters of the circuit can be changed from one simulation session to the other. The circuit topology, however, must remain the same. 1.6.2 SPICE Tab: There are 3 types of analysis in SPICE: Transient, AC, and DC. Simulation parameters of different analysis types are described below. For more information on SPICE simulation, please refer to the SPICE User Manual. For Transient Analysis: Parameters The following parameters are defined: Use Initial Conditions: If this box is checked, element initial conditions will be used, and the "UIC" option will be added to the.tran command. Note: This setting also affects AC and DC analysis. Time Step: Suggested computing increment and plotting increment Tstep, in sec. It can be left undefined (blank). Max Step: Maximum step size Tmax that SPICE uses, in sec. By default, the program uses either Tstep or (Tend-Tstart)/50, whichever is smaller. Tmax is useful when one wishes to guarantee a computing interval not greater than Tmax. It can be left undefined. Start Time: Initial time Tstart, in sec. Transient analysis always begins at time zero. In the interval from zero to Tstart, the circuit is simulated, but no outputs are stored. This parameter is equivalent to Print Time in PSIM simulation parameters. It can be left undefined. End Time: Final simulation time Tend, in sec. 6 Chapter 1: General Information Integration Three integration methods can be selected for SPICE simulation: Method Trapezoidal: Trapezoidal Rule method. Modified Trapezoidal: Modified Trapezoidal Rule method. Gear: Gear method. Order: The order of the integration method. For Trapezoidal, the order can be 1 or 2. For Gear, the order can be 2 to 6. Note: This setting also affects AC and DC analysis. For AC Analysis: Sweep Type The sweep type can be: Octave, Decade, Linear, or List. Parameters for the Octave and Decade options: Start Freq: Starting frequency, in Hz. End Freq: Final frequency, in Hz. Points/oct (or dec): Number of points per octave or decade. Parameters for the Linear option: Start Freq: Starting frequency, in Hz. End Freq: Final frequency, in Hz. Points: Total number of points. Parameters for the List option: Freq List: A list of frequencies to be analyzed, in Hz. Values are separated by space. For DC Analysis: Name Name of the source for DC sweep. Source 1 is by default the x-axis. Source 2 can be enabled. DC sweep sources can be voltage, current, or temperature. Sweep Type The sweep type can be: Octave, Decade, Linear, or List. Parameters for the Octave and Decade options: Start: Starting value. End: Final value. Points/oct (or dec): Number of points per octave or decade. Parameters for the Linear option: Start: Starting value. End: Final value. Increment: Incremental step size. Parameters for the List option: List: A list of values to be analyzed. Values are separated by space. If the Enable box in the Step Run option is checked, SPICE will perform parameter sweep. The parameter definition is as below. For Step Run: Parameter Name of the parameter for Step Run. If the step run is NOT for a voltage or a current source, or temperature, the box "PARAM" must be checked. Sweep Type The sweep type can be: Octave, Decade, Linear, or List. Parameters for the Octave and Decade options: Start: Starting value. End: Final value. Points/oct (or dec): Number of points per octave or decade. Chapter 1: General Information 7 Parameters for the Linear option: Start: Starting value. End: Final value. Step: Incremental step size. Parameters for the List option: List: A list of values to be analyzed. Values are separated by space. The rest of the parameters for SPICE simulation are described below. Operating Point If the Enable box is checked, SPICE simulation will determine the dc operating point of a circuit with inductors shorted and capacitors opened. Error Tolerance If the Enabled box is checked, error tolerances for SPICE simulation can be changed. Option Otherwise, default values will be used. Error tolerances are: RELTOL: Relative tolerance TRTOL: Transient tolerance VNTOL: Absolute voltage error tolerance ABSTOL: Absolute current error tolerance CHGTOL: Charge tolerance 1.6.3 SimCoder Tab: Hardware Target The hardware target can be one of the following: None: No hardware target in the circuit F2833x: Hardware Target for TI F2833x series DSP F2802x: Hardware Target for TI F2802x series DSP F2803x: Hardware Target for TI F2803x series DSP F2806x: Hardware Target for TI F2806x series DSP F2837x: Hardware Target for TI F2837x series DSP F28004x: Hardware Target for TI F28004x series DSP PE-Expert4: Hardware Target for Myway PE-Expert4 DSP platform Memory Map Specify the memory map for compiler. For F2833x and F2803x hardware target: Options RAM Debug; RAM Release; Flash Release; and Flash RAM Release. For PE_Expert4 hardware target: PE-ViewX CPU Version Specify the CPU version. For each Hardware Target, the available CPUs are in the drop down list. InstaSPIN If the DSP is InstaSPIN enabled (for example F28069M), this box must be checked. enabled Otherwise it should be unchecked. Default Data This parameter is for fixed-point DSPs, such as F2803x. The default data type options Type are: Integer, IQ0, IQ1,... IQ30. If the box for Check Fixed-Point Range is checked, the SimCoder will check all the variables against the range and display the result. DMC Library SimCoder has function blocks of all the functions in TI’s DMC library for the following Version DMC versions: 4.0, 4.1, and 4.2. Comments Comments can be entered and these comments will be inserted at the beginning of the automatically generated code. 8 Chapter 1: General Information 1.7 Component Parameter Specification and Format The parameter dialog window of each component in PSIM has three tabs: Parameters, Other Info, and Color, as shown below. The parameters in the Parameters tab are used in the simulation. The information in the Other Info tab, on the other hand, is not used in the simulation. It is for reporting purposes only and will appear in the parts list in View >> Element List in PSIM. Information such as device rating, manufacturer, and part number can be stored under the Other Info tab. The component color can be set in the Color tab. Parameters under the Parameters tab can be a numerical value or a mathematical expression. A resistance, for example, can be specified in one of the following ways: 12.5 12.5k 12.5Ohm 12.5kOhm 25./2.Ohm R1+R2 R1*0.5+(Vo+0.7)/Io where R1, R2, Vo, and Io are symbols defined either in a parameter file (see Section 4.1), or in a main circuit if this resistor is in a subcircuit (see Section 6.3.4.1). Power-of-ten suffix letters are allowed in PSIM. The following suffix letters are supported: G 109 M 106 k or K 103 m 10-3 u 10-6 n 10-9 p 10-12 A mathematical expression can contain brackets and is not case sensitive. The following mathematical functions are allowed: + addition - subtraction * multiplication / division ^ to the power of [i.e. 2^3 = 2*2*2] ** to the power of [i.e. 2**3 = 2*2*2] sin(x) sine cos(x) cosine tan(x) tangent asin(x) arcsine arcsin(x) arcsine acos(x) arccosine arccos(x) arccosine Chapter 1: General Information 9 atan(x) arctangent arctan(x) arctangent atan2(y,x) arctangent with x and y defined sinh(x) hyperbolic sine cosh(x) hyperbolic cosine tanh(x) hyperbolic tangent pow(x,y) x to the power of y pwr(x,y) absolute value of x to the power of y, i.e. abs(x)^y sqr(x) square of x, i.e. x^2 sqrt(x) square root hypot(x1,x2,x3...) square root of x1 squared plus x2 squared, plus x3 squared, etc., i.e. sqrt(x1^2 + x2^2 + x3^2 +...) hypot(x_array) The input is an array, and it returns the square root of the sum of the array cells squared, i.e. sqrt(x_array^2 + x_array^2 + x_array^2 +...) exp(x) base-e exponential of x, i.e. e^x ln(x) (or log(x)) natural logarithm of x (base e) log10(x) common logarithm of x (base 10) abs(x) absolute sign(x) sign function that returns 1 if x > 0, -1 if x < 0, and 0 if x = 0 ceil(x) function that returns the integer larger than x floor(x) function that returns the integer smaller than x min(x1,x2,x3...) Minimum value of x1, x2, x3, etc. (no limit on the number of inputs) min(x_array) The input is an array, and it returns the minimum value of the array cells max(x1,x2,x3...) Maximum value of x1, x2, x3, etc. (no limit on the number of inputs) max(x_array) The input is an array, and it returns the maximum value of the array cells 10 Chapter 1: General Information 2 Circuit Schematic Design PSIM’s schematic program provides interactive and user-friendly interface for circuit schematic entry and editing. The PSIM user interface consists of an integrated set of windows, tools, menus, toolbars, and other elements that allow you to create, simulate, and refine your circuits in one places. 2.1 PSIM Environment The following figure shows typical screen display of PSIM environment. In the figure, to illustrate as examples, two PSIM circuit files are open: a boost power factor correction circuit and a dc-dc buck converter circuit. By default, the menu bar and the standard toolbar appear on top of the window, while the frequently used element bar appears at the bottom, and the Project View is on the left hand side. On the right hand side is the Design window. This is a graphic editor where users can build and editor their simulation circuit schematics. User may arrange schematics in the Design window in tiles (as shown above), or in tabs (as shown below). Chapter 2: Circuit Schematic Design 11 The Project View window provides an organized tree view of user’s projects and their related files, as well as the simulation result graphs. Each PSIM circuit is treated as a project. The following content are displayed in stacking tiers in the project view: Project Name: Usually this is the same as the top level PSIM circuit file name. Documents: Any files related to the project, for example document, datasheet, etc. Study: Name of the study Schematic: The PSIM schematic files, top level and subcircuits. Graphs: All probes in the PSIM schematic are included in the graph list. The following shows a buck converter example in the Project View. Project Study Schematic Main circuit Subcircuit Waveforms In this example, the project is the buck converter. It contains one study. The main circuit is "buck - main.psimsch", and the subcircuit is "buck - sub.psimsch". There are two simulation waveforms: I(S1.L1) and Vo. 12 Chapter 2: Circuit Schematic Design After the simulation is done, the waveforms I(S1.L1) and Vo can be loaded into SIMVIEW by simply double clicking on the waveform names in Project View. The waveforms can also be embedded into the schematic by dragging into the schematic. For example, the figure above shows the Vo waveform embedded in the schematic. A project may contain multiple studies. For example, one may study the buck converter circuit with a different load filter or switching frequency. To create another study out of an existing study, right click on the existing study "buck - main" and select Create Study copy. A dialog window will appear as shown below to allow you to define the new study name and determine if you wish to make a copy of the subcircuit. In this example, we will create a new study called "buck - main1" and create a copy of the subcircuit. After confirmation, the new study is created as shown below. The new files "buck - main1.psimsch" and "buck - sub.psimsch" are placed in a newly created folder "buck - main\buck - main1". Existing Study New Study Chapter 2: Circuit Schematic Design 13 To add an existing schematic file into the project as another study, right click on the project "buck - main" and select Add Study. To save the project, right click on the project "buck - main" and select Save Project. 2.2 Creating a Circuit The basic and most commonly used functions provided for circuit creation are: Get Element There are several ways to get an element from the element library. One is to use the pull- down menu. Go to the Elements menu, and go into the submenu and highlight the element to be selected. The most often used elements can be selected the Element Toolbar. It is located at the bottom of the PSIM screen by default. Another way is to use the Library Browser, as shown below. The Library Browser provides a convenient way of navigating through the library. To launch the Library Browser, go to View >> Library Browser. Element Menu Library Browser Element Toolbar Place Once an element is selected from the menu, the image of the element will appear on the screen and move with the mouse. Click the left button of the mouse to place the element at desired location on schematic. Select Element(s) To select an existing element on a schematic, click on the element. A rectangle will appear around the element. To select a section of a circuit, keep the left button of a mouse pressed and drag the mouse until the rectangle covers the selected area. Rotate Before the element is placed, right click to rotate the element. After an element is selected, select Edit >> Rotate to rotate the element. Wire To connect a wire between two nodes, select Edit >> Wire. The image of a pen will appear on the screen. To draw a wire, keep the left button of the mouse pressed and drag the mouse. A wire always starts from and end at a grid intersection. For easy inspection, a floating node is displayed as a circle, and a junction node is displayed as a solid dot. Label If two or more nodes are connected to the same label, they are connected. It is equivalent as though they were connected by wire. Using labels will reduce the cross-wiring and improve the schematic layout. The text of a label can be moved. To select the text, left click on the label, then press the 14 Chapter 2: Circuit Schematic Design Tab key. Assign To assign the parameters of an element, double click on the element. A dialog box will appear. Specify the values and hit the key or click on OK. Move To move an element or a circuit block, select the element/circuit block and drag the mouse while keeping the left button pressed. Pan Schematic To scroll schematic, right click and drag the mouse. 2.3 File Menu The following functions are provided in the File menu for various file operations: New Create a new schematic with a single worksheet with no size limit. New (worksheet) Create a new schematic with a predefined worksheet size. Open Open an existing schematic file. Open Examples Open sample schematic files that come with PSIM. Search Examples Search for sample schematic files that relevant to user’s request. Change Worksheet Change the worksheet size. Size New SPICE Netlist Create a new SPICE netlist file File Open SPICE Netlist Open an existing SPICE netlist file File New Project Create a new PSIM project. Open Project Open an existing PSIM project. Save Project Save current PSIM project. Close Close the current schematic file. Close All Close all schematic files. Save Save the current schematic file. Save As... Save the current schematic file to a different name. Save All Save all schematic files. Save with Password Save a schematic file so that it is protected with a password. When a file is password protected, it can still be used in the simulation, but one needs to enter the correct password in order to see the schematic. The password protection is used in situations where the person who created the file needs to share it with someone else, but does not wish to reveal the details of the schematic. Save in Package File Save a schematic file and all associated files to one single package file (.schpack). This is especially useful if the main circuit calls multiple subcircuits, and one needs to send the files to someone else. Rather than finding and collecting all the subcircuit files, one can just create the package file and send out the single package file. Save as Older Save a file in the previous version format. Note that if the file uses elements that Versions are unique in the current version, these elements will be omitted. Print Print the schematic. Note that the schematic is printed as it appears on the screen. If you zoom in or out the schematic, the printout will be changed accordingly. Print Preview Preview the printout. Print Selected Print only a portion of the schematic selected. Print Selected Preview Preview the printout of the portion of the schematic selected. Chapter 2: Circuit Schematic Design 15 Print Page Setup Adjust the print page position and set the print page legend. Printer Setup Set up the printer. Exit Exit the PSIM schematic program. 2.4 Edit Menu The following functions are provided in the Edit menu for circuit editing: Undo Undo the previous change. Redo Go back to the state before undoing the changes. Cut Cut the selected circuit out of the schematic. The circuit that is cut can be pasted back. To delete an element or a portion of the circuit, select the item and hit key. Copy Copy an element or a portion of a circuit into a buffer, which can then be pasted back. Paste Paste back the copied element or circuit. Select Matched Select the elements which matches the specification. Elements Select All Select the entire schematic. To select only a portion of the schematic, left click and drag the mouse. Copy to Clipboard Copy the schematic image to the clipboard which can then be pasted back in another software. One can choose one of the three options: Metafile Format, Color Bitmap, or Black and White bitmap. The metafile format is vector based, and gives better image quality especially when the image is resized. The Black & White option will result in a smaller image file size as compared to the color bitmap. Draw Draw images on the schematic for display purposes. The following images are provided: line, ellipse, rectangle, half-circles, bitmap images, and graph. To draw a bitmap image: left click the mouse and drag the mouse to define the area that will contain the bitmap image. Then select the bitmap file. To draw a graph, left click the mount and drag the mouse to define the area that will display the waveform of selected probe. Change All Text Font Change the font for all the text in the opened PSIM file Change all Text Link Change the font for all the text link in the opened PSIM file. Font Place Text To place text on the screen, choose Text. Enter the text in the dialog box, and click the left button of the mouse to place it. Place Wire Enter the wiring mode. The cursor will change to the shape of a pen. Place Label Place a label on the schematic. When two nodes are connected to two labels of the same name, they are considered physically connected. Set Node Name Name the node. This name will be captured for SPICE simulation and netlist generation. Edit Attributes When an element is selected, choose Attributes to bring out the property dialog window. Add/Remove Current Add or remove the current scope for an element that has the current flag. After Scope this function is selected, click on top of the element, and select the branch current name to display the current scope. Select the branch current name again to remove the current scope. 16 Chapter 2: Circuit Schematic Design Show/Hide Runtime Show or hide the parameters of elements that can be changed at runtime in the Variables middle of the simulation. After this is selected, the text of the parameter will appear. Double click on the text, and a small dialog window will appear. Enter the new value directly in the data field, and click Apply. Or alternatively, click on the up/down arrow keys on the keyboard to increase/decrease the value. Disable Disable an element or part of a circuit. When the element or the circuit is disabled, it will be grayed out and will be treated as non-existent as far as the simulation is concerned. This function is useful if an element or circuit needs to be excluded but not deleted from the circuit. Enable Enable a previously disabled element or circuit. Rotate Rotate the selected element or a portion of the circuit by 90o clockwise. Flip Left/Right Flip the selected element horizontally. Flip Top/Bottom Flip the selected element vertically. Find Find a particular element based on type and name. Find Next Repeat the previous Find operation. Find in Files Fined a particular element in several files. Edit Library Edit PSIM image libraries. For more details, please refer to Section 2.15. Image Editor Launch the image editor. For more details, please refer to Section 2.16. Escape Quit from any of the above editing modes by choosing Escape. 2.5 View Menu The following functions are provided in the View menu for circuit editing: Check Elements Check multi-level elements, or check elements that are supported by PSIM simulation only, or by DSIM simulation only, or by SPICE simulation only. Element List Generate the parts list of the circuit. Element Count Count the number of elements. Voltage/current probes and meters are not included in the element count. SPICE Model List List all the SPICE models defined by the.model statement in the files in all the folders under the SPICE Model Path. SPICE Subcircuit List List all the SPICE models defined by the.subckt statement in the files in all the folders under the SPICE Model Path. Application Look Select the display style for PSIM windows. Status Bar Show/hide the status bar. Toolbar Show/hide the toolbar. Element Bar Show/hide the element bar. Library Browser Launch the Library Browser. The Library Browser is another way of accessing the PSIM Element library. Project View Launch the Project View. The project view organizes and manages the related files. The projects organizing structure has been illustrated in Section 2.1 Simulation Message Launch the Simulation Message View to display messages. Find Result View Launch the Find Result View. Preview View Launch the Preview View. Previous Page Display the previous page. Next Page Display the next page. Chapter 2: Circuit Schematic Design 17 Go to Page Go to the page of specific number. Zoom In Zoom in the schematic. Zoom Out Zoom out the schematic. Fit to Page Adjust the zooming so that the entire schematic fits the screen. Zoom In Selected Zoom in to the selected area. Zoom Level Zoom the schematic to 10%, 20%,..., 200%, and custom size. Display Voltage/ If the option Save all voltages and currents (under Options >> Settings >> Current General) is checked, after the simulation is complete, choose this function to display any node voltages or branch currents. Display Differential With the option Save all voltages and currents checked, after the simulation is Voltage complete, choose this function to display any voltages between two nodes. Refresh Refresh the screen display. 2.6 Design Suites Menu This menu accesses the templates of two PSIM’s add-on optional modules: HEV Design Suite and Motor Control Design Suite. These templates captures the parameters and generate electrical circuit schematics automatically. They greatly simplify the procedures of HEV and motor control systems. The following functions are provided: Update Parameters Update the parameters in the circuit generated by design suite Show Design File Display the system in design template form Display Parameters Display the parameters of the system HEV Design Suite Run the design templates in the HEV Design Suite. Four design templates are provided: HEV Powertrain System, PHEV (plug-in hybrid electric vehicle) Powertrain System, HEV Generator, and HEV Traction Motor. Each template has its linear and nonlinear version. For more information about how to use HEV Design Suite, refer to the document "Tutorial - HEV Design Suite.pdf". Motor Control Design Run the design templates in the Motor Control Design Suite. Five design Suite templates are provided: PMSM (IPM) Drive, PMSM(IPM) Drive (Nonlinear), PMSM(SPM) Drive, PMSM Drive, and Induction Motor Drive. For more information about how to use Motor Control Design Suite, refer to the document "Tutorial - Motor Control Design Suite.pdf". 18 Chapter 2: Circuit Schematic Design 2.7 Subcircuit Menu Functions provided in the Subcircuit menu are for subcircuit editing and manipulation. The following functions are to be performed in the parent circuit (outside the subcircuit): New Subcircuit Create a new subcircuit Load Subcircuit Load an existing subcircuit. The subcircuit will appear on the screen as a block. Edit Subcircuit Edit parameters the attributes dialog of the subcircuit. Open Subcircuit Open the selected subcircuit in a new window. Display Subcircuit Name Display the name of a selected subcircuit in the main circuit Show Subcircuit Ports Display the port names of the subcircuit in the main circuit Hide Subcircuit Ports Hide the port names of the subcircuit in the main circuit The following functions are to be performed inside the subcircuit: Place Bi-directional Port Place a bi-directional connection port in the subcircuit Place Input Signal Port Place an input signal connection port in the subcircuit Place Output Signal Port Place an output signal connection port in the subcircuit Display Port Display the connection port of the subcircuit Edit Default Variable List Edit the default variable list of the subcircuit. This is done inside the subcircuit. Set Size Set the size of the subcircuit Edit Image Edit the subcircuit image One Page Up Go back to the main circuit. The subcircuit is automatically saved. Top Page Jump from a subcircuit to the top-level main circuit. This is useful for circuits with multiple layers of subcircuits. If the functions Set Size, Display Port, Edit Default Variable List, and Edit Image are performed in the main circuit, they will be applied to the main circuit instead. There are three types of subcircuit ports for signal interface with the main circuit: Bi-directional port for power circuit and mechanical systems, and input signal and output signal ports for control circuit. Even though bi-directional ports also work for control circuit, it is strongly recommended to use input or output signal ports for control circuit for better clarity. Furthermore, if a subcircuit is involved in code generation, only input or output signal ports can be used. Either click the "Edit Subcircuit" menu or right click on top of a subcircuit block, and choose Attributes would open the subcircuit property dialog window. There are three tabs: Change Subcircuit File, Subcircuit Variables, Formula, and Color. Change Subcircuit File Tab: The name of the subcircuit can be edited in the Name box. Click on the Change Subcircuit File button to change to a different subcircuit file. The selected subcircuit file will be loaded instead. Subcircuit Variables Tab: In this tab, variables used in the subcircuit can be edited. For example, a resistor in the circuit has the resistance defined as "Rparasitic", and for better clarity, this resistance is referred to as "Parasitic Resistance". Also, the resistance has a value of 1mOhm. This variable will be entered as: Variable Description:Parasitic Resistance Variable Name:Rparasitic Chapter 2: Circuit Schematic Design 19 Variable Value:1m When the checkbox for "Parasitic Resistance" is checked, in the main circuit, this variable will be displayed as: Parasitic Resistance = 1m Since subcircuit variable list can be edited, the current variable list may be different from the default variable list. One can click on the Set as Default Variables button to set the current variable list as the default list, or click on the Reload Default Variables button to reload the default list if the default list has been modified. Two functions are provided at the bottom of the dialog for SimCoder for automatic code generation. Click on the Generate Code button to generate code for this subcircuit. If the checkbox Replace subcircuit with generated code for simulation is checked, the schematic inside the subcircuit will be replaced by the generated code for simulation. Formula Tab: In this tab, the condition for enable/disable the subcircuit can be set The Check Syntax button will help user to check the syntax of the formula. Color Tab: In this tab, the subcircuit color can be changed. Example: Use of Subcircuit The circuit below illustrates the use of subcircuit. The circuit on the left is a buck converter, with the L-C filter inside a subcircuit. The content of the subcircuit is shown on the right. In this example, there are two bi-directional ports ("in+" and "in-") on the left, and two bi-directional ports ("o+" and "o-") on the right. Subcircuit Inside the subcircuit: File: chop.sch File: chop_sub.sch 2.7.1 Creating Subcircuit - In the Main Circuit The following are the steps to create the subcircuit “chop_sub.sch” in the main circuit “chop.sch”. - Open or create the main circuit “chop.sch”. - If the file “chop_sub.sch” does not exist, go to the Subcircuit menu, and select New Subcircuit. If the file exists, select Load Subcircuit instead. - A subcircuit block (rectangle) will appear on the screen. Place the subcircuit. If the circuit that is to be converted into a subcircuit has already been created in the main circuit, a quick way of converting it into a subcircuit is to select the circuit, and then right click and choose Create Subcircuit. Specify the subcircuit file name as "chop_sub.sch", and the circuit will be converted into a subcircuit. Adjust the port location and wire connection if necessary. 2.7.2 Creating Subcircuit - Inside the Subcircuit To enter the subcircuit, double click on the subcircuit block. - Create/edit the content of the subcircuit circuit exactly the same way as in the main circuit. - To specify the subcircuit size, select Set Size in the Subcircuit menu. In this example, the size is set to 4x7 (width of 4 divisions and height of 7 divisions). Note that the size of the subcircuit should be chosen such that it gives the proper appearance and allows easy wire connection in the main circuit. 20 Chapter 2: Circuit Schematic Design - Once the subcircuit is complete, define ports to connect the subcircuit nodes with the corresponding nodes in the main circuit. Choosing Place Port in the Subcircuit menu, and a port image will appear. After the port is placed in the circuit, a pop-up window (shown on the left below) will appear. Subcircuit port assignments The diamonds on the four sides represent the connection nodes and the positions of the subcircuit. They correspond to the connection nodes of the subcircuit block on the right. There are no diamonds at the four corners since connections to the corners are not permitted. When a diamond is selected, it is colored red. By default, the left diamond at the top is selected and marked with red color. Click on the desired diamond to select and to specify the port name. In this example, in the main circuit “chop.sch”, there are four linking nodes, two on the left side and two on the right side of the subcircuit block. The relative position of the nodes are that the upper two nodes are 1 division below the top and the lower two nodes are 1 division above the bottom. To specify the upper left linking node, click on the top diamond of the left side, and type “in+”. The text “in+” will be within that diamond box and a port labelled with “in+” will appear on the screen. Connect the port to the upper left node. The same procedure is repeated for the linking nodes “in-”, “out+”, and “out-”. - After the four nodes are placed, the node assignment and the subcircuit appear as shown below. The creation of the subcircuit is now complete. Save the subcircuit, and go back to the main circuit. 2.7.3 Connecting Subcircuit - In the Main Circuit Once the subcircuit is created and connection ports are defined, complete the connection to the subcircuit block in the main circuit. - In the main circuit, the connection points on the borders of the subcircuit block appear as hollow Chapter 2: Circuit Schematic Design 21 circles. - Select the subcircuit block, and select Show Subcircuit Ports in the Subcircuit menu to display the port names as defined inside the subcircuit. - Connect the wires to the connection points accordingly. 2.7.4 Other Features of the Subcircuit This section describes other features of the subcircuit through the example shown below. Inside the subcircuit: File: sub.sch File: main.sch 2.7.4.1 Passing Variables from the Main Circuit to Subcircuit In this example, the main circuit “main.sch” uses a subcircuit “sub.sch”. In the subcircuit, the inductance value is defined as “L” and the capacitance is defined as “C”. The default values of L and C can be set by selecting Subcircuit | Set Default Variable List. In this case, L is set to 5mH and C is set to 100uF. When the subcircuit is loaded into the main circuit the first time, this default variable list will appear in the tab “Subcircuit Variables” in Subcircuit | Edit Subcircuit from the main circuit “main.sch”. New variables can be added here and variable values can be changed. In this case, L is changed to 2mH, and C is kept the same as the default value. Note that the variables and the values are saved to the netlist file and used in simulation. The default variable list inside the subcircuit is not saved to the netlist and is not used for simulation. This feature allows the parameters of a subcircuit to be defined at the main circuit level. In the case where the same subcircuit is used several times in one main circuit, different parameters can be assigned to the same variable. For example, if the subcircuit “sub.sch” is used two times in above example, in one subcircuit L can be defined as 3mH, and in another subcircuit L can be defined as 1mH. Note that this example also illustrates the feature that parameters can be defined as a variable (for example “Vin” for the input dc voltage source) or a mathematical expression (for example “R1+R2” for the load resistance). The variables “Vin”, “R1”, and “R2”, are defined in the parameter file “para-main.txt”. See Section 4.1 for more details. 22 Chapter 2: Circuit Schematic Design 2.7.4.2 Customizing the Subcircuit Image The following are the procedures to customize the subcircuit image of “sub.sch”: - In the subcircuit, select Edit Image in the Subcircuit menu. A window will pop-up, as shown below. In the window, the diamonds marked red are the connection nodes of the subcircuit block, in exactly the same positions as appearing in the main circuit. - Use the drawing tool to create/edit the image for the subcircuit block. If the drawing tool is not already displayed, go to the View menu and check Drawing Tools. Click on Zoom In and Zoom Out icons on the toolbar to adjust the size of the image working area. After the image is created, the pop-out window will appear as follows. - Go back to the subcircuit window (“sub.sch” in this case), and save the subcircuit. The new subcircuit block image should appear in the main circuit. 2.7.4.3 Including Subcircuits in the PSIM Element List If you create a directory called “User Defined” under the PSIM directory, and place subcircuits inside this directory. subcircuits will appear as items in the Elements menu, under Elements | User Defined, just like any other PSIM elements. You can also create subdirectories under the directory User Defined, and place subcircuits inside the subdirectories. For example, the Elements menu may look like this: - Power - Control - Other - Sources - Symbols - User Defined - Subcircuit 1 Chapter 2: Circuit Schematic Design 23 - Project A - Subcircuit 2 - Subcircuit 3 - Project B - Subcircuit 4 In this way, common-used custom-built subcircuits can be grouped together and easily managed and accessed. 2.8 Elements Menu In PSIM, all the elements are stored under the Elements menu. They are stored in the following menus: Power Power circuit elements, such as R, L, C, switching devices, transformers, motor drive modules, and etc. Control Control circuit elements, such as computational. logic, digital control elements and etc. Other Elements interconnecting power and control circuit, such as switch controllers, voltage/current sensors, probes, and etc. Sources Various voltage and current sources SPICE Special elements for SPICE simulation. Event Control Event control elements SimCoder SimCoder blocks for automatic code generation Symbols Symbols for drawing purpose, not for simulation usage Typhoon-HIL Elements used for Typhoon-HIL export User Defined Users can create a subfolder called "User Defined" in the PSIM folder, and place common used files in this folder. The folder "User Defined" and files in the folder will appear in the Elements >> User Defined menu. Page Place a page title block for printing 2.9 Simulate Menu The following functions are provided in the Simulate menu: Simulation Control Set the simulation parameters such as time step, total time, etc. When this is selected, the cursor will change to the image of a clock. Place this clock on the schematic, and double click to display the property window. Run PSIM Simulation Run PSIM simulation Run DSIM Simulation Run DSIM simulation using the DSIM engine Run LTspice Run LTspice simulation Simulation Cancel Simulation Cancel the simulation that is currently in progress Pause Simulation Pause the simulation that is currently in progress Restart Simulation Resume a paused simulation Simulate Next Time Run the simulation to the next time step, and pause Step Run SIMVIEW Launch the waveform display program SIMVIEW Generate Netlist File Generate the PSIM netlist file Generate Netlist File Generate the PSIM netlist file in xml format (xml) View Netlist File View the generated PSIM netlist file 24 Chapter 2: Circuit Schematic Design Generate SPICE Generate the SPICE netlist for LTspice simulation. Netlist (.cir) Show Warning Show the warning messages, if any, from the simulation. Show Fixed-Point Display the fixed-point range check result. This is used for SimCoder circuits to Range Check Result check if fixed-point variables are within the range or not for fixed-point DSP (such as F2803x/F2806x/F2802x) Arrange SLINK Rearrange the SLINK nodes. This function is for the SimCoupler Module for Nodes co-simulation with Matlab/Simulink. Please refer to Section 3.6 for more details. Generate Code Generate code from the control schematic. This function is for SimCoder for automatic code generation. Please refer to SimCoder User Manual for more details. Open Generated Code Open the folder where the generated code are located. Folder Runtime Graphs Select waveforms to display in the middle of a simulation run. The dialog window of the Runtime Graphs function has two tabs: Standard and Vector. The Standard tab lists the variables for time-domain waveform display. The Vector tab defines vectors for vector plot. The real and imaginary parts of a vector comes from the same variable list as in the Standard tab. To view the simulation waveforms of output variables in the middle of simulation, one can either go to Simulate >> Runtime Graphs and select the variables, or right click on top of a voltage probe or current probe and select Runtime Graph Window from the menu. A runtime graph display the waveform in its entirety, from the beginning to the final study time. Because of this, the runtime graphs are disabled in the free-run mode as the final study time is undetermined. In the free-run mode, the majority of the element parameters can be changed during runtime in the middle of the simulation. This makes it possible to tune a circuit while inspecting key waveforms using voltage/current scopes, until desired performance is achieved. To illustrate how to run a simulation in the free-run mode, a buck converter circuit shown below is used as an example. The circuit on the left was originally set up for the one-time simulation, with the total simulation time set to a specific value. One-time simulation Simulation in the free-run mode To set up the simulation in the free-run mode: - In Simulation Control, check the Free Run checkbox. - Go to Elements >> Other >> Scopes, and select the 2-channel voltage scope. Connect the scope as shown above on the right. Chapter 2: Circuit Schematic Design 25 - Double click on the scope, and the scope image will appear. Start the simulation, and the waveforms will appear and will be updated continuously in the scope. Change the scope settings as desired. - Elements parameters can now be adjusted in the middle of the simulation. To adjust the gain of the PI controller, for example, right click on top of the PI block, and choose Runtime Variables >> Gain. The text of the gain "0.6" will be displayed if it has not been displayed already. - Click on the text "0.6", and a small dialog window will appear. The screen should look as follows. Gain of the PI controller - Place the cursor inside the input field of the dialog window for the gain, and change the gain either by pressing on the upper/down arrow keys on the keyboard, or by entering a new value and then clicking on Apply. Watch how the waveforms change as the gain is changed. Other parameters, such as current reference, dc input voltage, inductance, capacitance, and load resistance, can be changed in the similar way. - Branch currents can also be displayed in the free-run mode. To display the inductor current, for example, right click on top of the inductor, and a menu will appear. Choose Current Scopes and the branch current name. - An image of the current scope (similar to the voltage scope image, but without connection terminals) will appear. Double click on the scope to expand and view the inductor waveform. Below is how the window would look like with both the voltage scope and the current scope. Other branch currents, such as capacitor current, load current, diode current, or MOSFET switch current, can be displayed in the similar way. 26 Chapter 2: Circuit Schematic Design Current scope Voltage scope Running Simulation in a Command Line: Simulation can also be launched with the command line option by running the program PsimCmd.exe. For example, to simulate the circuit "buck.psimsch" which is stored in the folder "c:\Powersim\examples", go to the PSIM folder, and run the following command: PsimCmd -i "c:\psim\examples\buck.psimsch" -o "c:\psim\examples\buck.smv" The format of the command line is as follows: PsimCmd -i "[input file]" -o "[output file]" -v "VarName1=VarValue1" -v "VarName2=VarValue2" -t "TotalTime" -s "TimeStep" -g Note that the quotes around the parameter values must be present. The command-line parameters are: -i: Input schematic file name -o: Output file name (in either.txt or.smv extension) -v: Variable name and value. This parameter can be used multiple times. For example, to define the resistance R1 as 1.5 and the inductance L1 as 0.001, we have: -v "R1=1.5" -v "L1=0.001" -t: Total time of the simulation -s: Time step of the simulation -g Run SIMVIEW after the simulation is complete Note that the number of variables that can be defined in a command line is limited to 30. With the command-line option, one can run several circuits automatically in a batch run. 2.10 Script Menu The following functions are provided in the Script menu: Parameter Tool It launches a parameter file window. One can load an existing parameter file, or enter expressions for computation purposes. Script Tool The script tool allows one to run a script. Chapter 2: Circuit Schematic Design 27 2.11 Options Menu The following functions are provided in the Options menu for various settings: Settings... Launch the Settings dialog. Languages Select different languages for PSIM display. Auto-run SIMVIEW Automatically run SIMVIEW after the simulation is complete. Set Path... Set the PSIM search paths and device file paths. Enter Password Enter the password to view a schematic file that is password protected. Disable Password Disable the protection of a schematic file that is password protected. Customize Keyboard/ Create customized toolbars, keyboard, and application menu frame. Toolbar Save Custom Save the following custom settings to a file: Default element values; custom Settings... keyboard definition; and custom toolbar definition. This file can then be loaded on another computer using the Load Custom Settings... function. This is useful when you want to apply the same custom settings on another computer. Load Custom Load custom setting files saved by the Save Custom Settings... function. This Settings... will apply the custom settings defined in the file to this computer. Load Legacy Tool Load legacy tool bars of previous PSIM versions. Bars Deactivate Deactivate the PSIM license. This is for softkey version only. Change Softkey Change the password of login for running PSIM softkey version. This is for Password softkey version only. Check for Software Check if any newer software updates are available on the Powersim server. This Update is for licenses that have the Annual Software Maintenance only. 2.11.1 Setting Option The Settings dialog has four tabs: General, Advanced, Colors, and License. 28 Chapter 2: Circuit Schematic Design The General tab contains these sections: Editing, Text Font, Printing, and Simulation: In the Editing section: Display grid Check this option to display the grid in the PSIM schematic. Zoom factor The zoom factor defined here is used when the schematic is zoomed in or out. Enable rubber band When checked, an element or a portion of a circuit remains connected with the rest of the circuit when moved. Show print page When enabled, the border of the printout will be displayed. border Snap to grid draw When enabled, the objects in the schematic will be snapped to grid. objects In the Text Font section: Default Text Font Set the default font for the text placed in the schematic. Justification Define how the text will be aligned. Runtime Graph Font Set the text font for the runtime graphs. In the Line thickness section: Printing Define the thickness of the line as it appears at the printout. It can be set from 1 (the thinnest) to 6 (the thickest). Screen Define the line thickness displayed on the screen. It can be set from 1 (the thinnest) to 6 (the thickest). Chapter 2: Circuit Schematic Design 29 In the Simulation Section: Simulation result Simulation results can be saved in either binary format (default) or text format. format The binary format will result in a smaller result file, and will be faster to load.Set the default font for the text placed in the schematic. Limit output buffer When checked, the simulation data will be written to the result file in segment. size For example, if the buffer size is set to 20 MB, the simulation data will be first saved to the buffer, and when it reaches 20 MB, the whole 20-MB data will be written to the result file. Please note that the runtime graph only plots the data in the buffer. Therefore, when the old data are saved to the file and the new data fills in the buffer, the runtime graph will only show the waveform of the new data, and the old waveform will be lost. To retain all the waveforms in the runtime graph, one can either increase the buffer size, or un-check this option. When this option is un-checked, however, PSIM will allocate all the required memory for the buffer at the very beginning. If the simulation time step is small and the total time is long, and if there are many output curves, a very large memory may be required, which will take some time to allocate, and may even fail if the computer does not have sufficient amount of memory. Disable simulation When this option is checked, warning messages generated in the simulation are warning messages suppressed. Save all voltages and When this option is checked, all the voltages and currents of the circuit will be current saved for display. To display a voltage or current, after the simulation is complete and after results are loaded into SIMVIEW, choose View >> Display Voltage/Current (or click on the corresponding icon). When the cursor is on top of a node or a branch, it will change to the image of a voltage probe or current clamp probe. Left click the mouse, and the corresponding voltage or current will appear in SIMVIEW. To display a differential voltage, choose View >> Display Differential Voltage. Then click on the first node, and then the second node. The differential voltage waveform will appear in SIMVIEW. Maximum number of It defines the maximum number of points that an oscilloscope will plot. points for oscilloscope Increase this number to display waveforms for a longer time interval. The Advanced tab contains these sections: Updates, Backup, Idle Time, Hardware Code Generation, SPICE, Alternate PSIM Help File Path, and Parameter File Variables. In the Updates section: Check for software When this option is checked, if you have the valid software annual updates maintenance, PSIM will automatically check for new updates on the Powersim server. If a new update is available, you will be prompted to install the update. In the Backup section: Create backup files When this option is checked, PSIM will create a backup of the file currently being edited in the time interval specified. In case of a program crash, the backup file will preserve the previous work. The backup file is deleted automatically when the file is closed normally from the PSIM environment. 30 Chapter 2: Circuit Schematic Design In the Idle Time (for network version) section: Idle time This setting