The PLECS License Manager will install license files in the first directory listed for each platform because this location is usually writable by the user. However, an administrator may choose to install license files to be used for all users in the other directory.
The recommended method to register PLECS Blockset with MATLAB is to add appropriate addpath commands to the startup file startup.m in your MATLAB startup folder. For information on the startup.m file, enter doc startup in MATLAB. The PLECS Blockset Installation Wizard will assist you in creating or updating this file.
Using this method has the advantage that if you update MATLAB after having installed PLECS, the new MATLAB version will automatically know about PLECS. The disadvantage is that each user must setup their startup file individually.
As an alternative method you can register PLECS with a specific MATLAB installation using the MATLAB Path Browser or by directly editing the file pathdef.m in the directory matlabroot/toolbox/local/. This method may be appropriate if PLECS will be used by multiple users sharing the same computer. You need to add the PLECS directory and its subdirectory demos to the MATLAB search path.
If you want to keep different versions of PLECS installed in parallel on one computer, you must ensure that only one version is on your MATLAB path at any time during a MATLAB session. Otherwise, loss of data may occur. Before changing the MATLAB path, be sure to clear the currently loaded PLECS module by entering plecsclear at the MATLAB command prompt. As an additional precaution you should restart MATLAB after the change.
I am a new user of PLECS blockset and was familiarising myself with the components used to interface between Simulink and PLECS blockset. I was trying to use the electrical port block to connect simulink and PLECS blocks together as shown in the attached screenshot.
In the PLECS circuit, I only used the DC voltage source to act as a source and then used electrical ports to have the load simulated using Simulink blocks. For the load, I used a series RLC branch with just R=20ohms and connected a voltage measurement and scope across is to measure the voltage across the resistor.
I have tried simulating the resistive load in just the PLECS circuit and it runs just fine but I would like to learn to make electrical connections between Simulink and PLECS circuits. Can someone please tell me what I am doing wrong here?
I've been trying to use Simulink for modelling an oscilloscope (including DSP). I am still very novice so please forgive me if the following question is way too easy: How do I implement AC coupling (remove DC component) in Simulink while using analog signals? I know there is a DC blocker, but it only accepts discrete signals and I want to discretize my signal later with an imperfect ADC.
I'm trying to use a MATLAB function for the AC coupling, but I cannot find a way to use the existing analog signal gained from the function declaration. Instead, all MATLAB documentary seems to want me to use an analog device on my computer ( -data-acquisition.html).
I don't think using the Matlab Function Block will work since you need to hold a state. To simulate AC coupling, I believe that you need to create a high pass filter. This removes DC from the signal so that the waveform is centered around zero. The corner frequency generally needs to be very low so that there is no distortion of the waveform being measured. You can build this without any special toolboxes. You just need an integrator block, gain block and some summation blocks.
If you want using the matlab AC Coupling function, try using the Matlab Function Block : -an-example-model-that-uses-a-matlab-function-block.html . You can use it like any matlab function, i.e. function [out1, out2] = my_function(in1) but it will be defined in a simulink block.
In this class, we will use PLECS primarily to generate numerical state space descriptions from a graphical circuit model. The software has significant additional functionality which will not be covered in detail.
PLECS student licenses are available for UTK students in this class. A license can be obtained by e-mailing ith...@eecs.utk.edu and requesting a student license. The EECS Department IT will guide you through the process thereafter. The licenses are available for students to install on personal (i.e. not UTK-owned) computers.
PLECS comes in both a Standalone and Blockset package. For the purposes of ECE692, we will be using the Blockset Package, which integrates with MATLAB/Simulink. The installer for PLECS Blockset is available at the following location.
It is best if you request and receive your license from EECS IT before installing, as the installer will ask you to provide the license during the installation process. If not, you can change/update the license at any time from the prompt that appears when starting PLECS.
To integrate with MATLAB, the m-files of the PLECS Blockset need to be visible in MATLAB. The installer will attempt to configure this for you, but occasionally does not succeed. If you are having trouble using PLECS in MATLAB, make sure that the PLECS directory is in the MATLAB path. You can do this programmatically in a single script through use of the addpath() function, or can permanently add the PLECS functions to the MATLAB default through the GUI by going to "Set Path" within the "Home" toolbar, and adding the PLECS Blockset installation directory to the path. On my machine, this appears as shown below.
For the purposes of this tutorial, the main useage of PLECS is to generate a state space model of a circuit diagram. To do so, create a new Simulink model and add a PLECS Circuit from the library browser. Double-click the PLECS Circuit to open the PLECS circuit editor, and sketch your circuit. Use only electrical passives, sources, meters, and generic MOSFET elements. In the following, the MOSFETs will become ideal switches, all inductor currents and capacitor voltages will become states $x$, sources will become inputs $u$, and meters will become outputs $y$ in the state space model. Example screenshots for the creation of the buck-boost from lecture are shown below.
Once your model is created, return to MATLAB. There are three different PLECS commands which will be useful; their structure and output are shown below. In all three, 'mdl/circuit' is the path to the PLECS circuit you are analyzing, through the Simulink model that it is embedded in. For example, in the above figures, 'mdl/circuit' would be 'PLECS_BB/BB', where PLECS_BB is the name of the Simulink .mdl file and BB is the name of the PLECS circuit contained within it.
It is important to examine these vectors, as PLECS may not natively arrange the elements in these vectors in the order that you expect. The order can be altered by removing and re-inserting any element, which will move it to the end of the vector. Make sure that the content and arrangement of each vector matches your expectations.
This command produces no output, but sets the on-off state of each of the switches (MOSFET symbols) in the circuit. For example, setting swVec=[0 1] will replace the first element in the Switches vector with its on-state model, and the second element with its off-state model. For MOSFETs, this means the first switch is replaced with a resistance $r_on$ and the second switch is left open.
This command returns the state-space description of the circuit, with the specified switch configuration from the previous command. model.A, model.B, model.C, and model.D are numerical matrices which conform to the state space description of the system,
If model.I is not exactly the identity matrix, then there was at least one capacitive loop or inductive cutset in the circuit. When deriving by hand, this means that the number of states of the circuit is less than the number of reactive components. In this case, PLECS keeps all reactive elements in the state space model, but identifies which states were not actually used in the model for a complete description of the circuit through model.I. Those states that are not used are denoted by the rows of model.I which do not match the identity matrix of the same size.
The idea is that model.I will "act" as an identity matrix for the state vector. So, if we multiple $x(t)$ by model.I, we should get back $x(t)$. For the rows of model.I which match the identity matrix, this is straighforward. For those which don't, the row in model.I will show how that state can be derived solely from other states of the system. For example, if
The second through fifth elements of vec.States are the actual states of the model, and the first element can be reproduced through the sum of the last three entries of vec.States. In this case, you should see that the first column of model.A is also equal to zero, indicating that no states depend in any way on the value of the first state in vec.States.
In some cases, it will be better to remove these state(s) from the circuit model, by deleting the corresponding rows and columns from the state space matrices. The signal can always be recovered later from the relationship shown by its corresponding row in model.I
With every call to plecs('get', 'mdl/circuit', 'Topology'), PLECS will replace any variables in the model with their associated value in the workspace. In this was, the inductance of an inductor can be set to L in the circuit model, then if the calling MATLAB script first defines L=1e-6, the resulting state space matrices will be evaluated with a one microHenry inductance. The same holds of other parameters of circuit model elements (passive values, sources, MOSFET resistances, etc.)
PLECS has a feature called "State-Space Splitting" which is turned on by default for new models. This feature is used when PLECS notices that the model can be divided into multiple, smaller state space descriptions with dynamics which are well separated in the frequency domain. This is useful in time-stepping simulations, as when fast dynamics occur, only a subset of the model needs to be evaluated with small time-steps, while the remainder can be evaluated at a slower rate, reducing simulation time.