PLECS User Forum - Recent questions and answers
http://forum.plexim.com/qa
Powered by Question2AnswerAnswered: At t=0: Electrical model inputs are infinite or NaN?
http://forum.plexim.com/75/at-t-0-electrical-model-inputs-are-infinite-or-nan?show=78#a78
The "Signal type" parameter of the inport "Vbat_in" is set to "Gate signal". This is indicated in the block icon by the angular brackets around the port number. Please see the documentation about the meaning of this parameter.<br />
<br />
If you use the input signal to control a voltage source, you must set the "Signal type" parameter to "Continuous signal" or "auto".http://forum.plexim.com/75/at-t-0-electrical-model-inputs-are-infinite-or-nan?show=78#a78Thu, 22 Feb 2018 11:53:04 +0000Answered: What does the "Number of points" refer to in AC sweep Analysis?
http://forum.plexim.com/67/what-does-the-number-of-points-refer-to-in-ac-sweep-analysis?show=77#a77
<p>Hello,</p><p>Per our documentation:</p><pre class="editorCode"><strong>Frequency scale</strong>
Specifies whether the sweep frequencies should be distributed on a </pre><pre class="editorCode">linear or logarithmic scale.
<strong>Number of points</strong>
The number of automatically distributed frequencies.</pre><p>You can change the number to be something different from 21 and whether you want the points to be spaced linearly in between your minimum and maximum frequency or using a logarithmic distribution.</p><p>Thank you,</p><p>Kris</p><p> </p>http://forum.plexim.com/67/what-does-the-number-of-points-refer-to-in-ac-sweep-analysis?show=77#a77Wed, 21 Feb 2018 18:45:54 +0000Answered: anyone knows how to use the AC sweep of Analysis Tools?
http://forum.plexim.com/70/anyone-knows-how-to-use-the-ac-sweep-of-analysis-tools?show=76#a76
Hello,<br />
<br />
The AC Sweep tool, as well as the Impulse Response and Multitone tools, are not using magic and will not automatically produce valid results. You will need to review the included documentation on how to use them, and perhaps theory on control loop frequency response techniques in general.<br />
<br />
Our demo model library contains two examples of using the Analysis Tools to check the stability of a closed-loop system. The names of the models are "Buck Converter with Loop Gain Analysis" and "Half-Bridge LLC Converter with Analysis Tools".<br />
<br />
As a general suggestion, you will need to be more specific with your question, or attach a model showing your issue, for another user to provide guidance. What you have said here is simply too vague.<br />
<br />
Best regards,<br />
<br />
Krishttp://forum.plexim.com/70/anyone-knows-how-to-use-the-ac-sweep-of-analysis-tools?show=76#a76Wed, 21 Feb 2018 18:17:00 +0000Answered: Turn-off und Turn-on
http://forum.plexim.com/68/turn-off-und-turn-on?show=71#a71
Hi,<br />
<br />
You can check the implementation of the turn-on delay block by right-clicking the component and selecting "subsystem->look under mask". Further, if you right-click the component and select "subsystem->break library link" you can also change the underlying implementation.<br />
<br />
If I understand you correctly you would like to do something like in the attached model? The "monoflop" block from the library might help you building up what you want to achieve.<br />
<br />
Best regards,<br />
NFhttp://forum.plexim.com/68/turn-off-und-turn-on?show=71#a71Wed, 21 Feb 2018 08:25:09 +0000Answered: Why is my steady state analysis of a dc-dc converter aborted due to errors?
http://forum.plexim.com/63/why-steady-state-analysis-of-converter-aborted-due-to-errors?show=64#a64
<p>It didn't find a steady state. This means your system takes too long to get to the steady state from simulation start.</p><p>A simple fix would be to switch to "Stored system state" in the Initialization tab of the simulation preferences. You must store a state where the system is in steady state. For example after a normal simulation.</p><p>Another possibility is to set the number of init cycles in the Analysis Tools dialog.</p><p>I strongly advise using the "Help" button in the Analysis Tools to get to the documentation. There you find:</p><p><strong>[...]Number of init. cycles</strong><br>The number of cycle-by-cycle simulations to be performed before the Newton iterations are started. When an analysis fails to converge because the starting point was too far from the steady-state solution, this parameter can help to get better starting conditions. The default is 0. [...]</p><p>Cheers </p><p>Falk</p><p> </p>http://forum.plexim.com/63/why-steady-state-analysis-of-converter-aborted-due-to-errors?show=64#a64Fri, 16 Feb 2018 14:46:55 +0000Answered: Error during steady-state analysis in PLECS Blockset
http://forum.plexim.com/52/error-during-steady-state-analysis-in-plecs-blockset?show=61#a61
<p>This looks like a bug in the Steady-State Analysis. Please contact Plexim Support (<a rel="nofollow" href="http://www.plexim.com/support/contact">http://www.plexim.com/support/contact</a>) and send in a (possibly reduced) model that reproduces the problem.</p>http://forum.plexim.com/52/error-during-steady-state-analysis-in-plecs-blockset?show=61#a61Fri, 16 Feb 2018 10:35:09 +0000Answered: how to get the transfer function of DC/DC boost converter in open mode and current control mode?
http://forum.plexim.com/48/transfer-function-boost-converter-open-current-control-mode?show=59#a59
<p>The "Analysis Tools" chapter in the PLECS manual has application examples both for PLECS Standalone and PLECS Blockset.</p><ol><li>Open the online manual by choosing the menu "Help > PLECS Documentation".</li><li>In the frame on the left hand side click on the tab "Contents". (If the frame is hidden, click on the tool button with the magnifying glass.)</li><li>Navigate to "PLECS Online Help > Analysis Tools" and choose "Usage in PLECS Standalone" or "Usage in PLECS Blockset", then scroll down to the section "Application Example".</li></ol><p>If this does not help, you might consider editing your question to clarify what exactly you do not understand. Often it also helps to attach a model to show what you have.</p>http://forum.plexim.com/48/transfer-function-boost-converter-open-current-control-mode?show=59#a59Fri, 16 Feb 2018 10:24:18 +0000Answered: Where can I find an example of digital peak current control of a buck converter?
http://forum.plexim.com/57/where-example-digital-peak-current-control-buck-converter?show=58#a58
<p>The Demo Browser (and Help Viewer) has a search function.</p><ol><li>Open the Demo Browser by choosing the menu "Window > Demo Models".</li><li>In the frame on the left hand side click on the tab "Search". (If the frame is hidden, click on the tool button with the magnifying glass.)</li><li>Enter your search term "digital peak current control" and click on "Search".</li><li>The first hit "PLECS Demo: IControl.plecs" is most likely the model that you are looking for. Click on the link "Open this model" on the top right to open the demo model.</li></ol>http://forum.plexim.com/57/where-example-digital-peak-current-control-buck-converter?show=58#a58Fri, 16 Feb 2018 10:13:23 +0000Answered: Small signal analysis for 3-phase inverter
http://forum.plexim.com/37/small-signal-analysis-for-3-phase-inverter?show=55#a55
Hi yunpeng, <br />
<br />
I'm not experienced in inverters, but would suggest to do small signal analysis at different DC operating points. Can you give more information about the control system?<br />
<br />
Cheers<br />
<br />
Falkhttp://forum.plexim.com/37/small-signal-analysis-for-3-phase-inverter?show=55#a55Thu, 15 Feb 2018 06:54:00 +0000Answered: How do we use C Script box?
http://forum.plexim.com/28/how-do-we-use-c-script-box?show=54#a54
It's not too bad to figure out. As Falk said start by reading the documentation and looking at the examples. It took me about a day to go through that and then try some simple scripts. I'm no expert now but I am now able to do state machines (although Plexim provides native support for state machines) and logic blocks in c-script. I'm actually converting some of these from Verilog into C.<br />
<br />
I use a trigger so that the c-script is only executed on certain clock edges. It then might do a bunch of If/then/else statements, and updates its outputs, until asked to execute again.<br />
<br />
...Rogerhttp://forum.plexim.com/28/how-do-we-use-c-script-box?show=54#a54Wed, 14 Feb 2018 22:56:41 +0000Answered: how to draw or create a tangent for step response so I can take the value of A to tune PID?
http://forum.plexim.com/41/draw-create-tangent-for-step-response-can-take-the-value-tune?show=46#a46
Hi,<br />
<br />
You can use the PLECS scope to do this. Either place the cursors close to the beginning of the step response and calculate the slope or, if you assume an exponential step response, place the second cursor at ≈63% of the final value and read off the time constant directly. (Like in the attached picture)<br />
<br />
I hope this helps you.<br />
Best regards,<br />
NFhttp://forum.plexim.com/41/draw-create-tangent-for-step-response-can-take-the-value-tune?show=46#a46Tue, 13 Feb 2018 07:57:10 +0000Answered: How can I determine now long my simulation takes?
http://forum.plexim.com/42/how-can-i-determine-now-long-my-simulation-takes?show=43#a43
<p>To determine the actual (wall clock) time taken for a simulation run to complete in PLECS Standalone, only a few lines of code are required in a Simulation Script. The resulting value can then be viewed in the PLECS Console window. This could be useful, for example, when determining how different simulation setups or changes to a model affect simulation speed.</p><p>The required code for this is as follows:</p><pre class="editorCode">tic
plecs('simulate')
toc</pre><p>To run the scripted simulation demonstration in the attached PLECS Standalone example model, select “Simulation scripts…” from the Simulation menu and run the script. The Octave console can be accessed by selecting “Show Console” from the Window menu.</p><p>Note that the same time calculation commands apply for PLECS Blockset in Simulink and can be executed in a MATLAB script:</p><pre class="editorCode">tic
sim(‘model_name’, Parameters)
toc</pre>http://forum.plexim.com/42/how-can-i-determine-now-long-my-simulation-takes?show=43#a43Thu, 08 Feb 2018 23:32:53 +0000Answered: what is the calculation delay in PID used for?
http://forum.plexim.com/38/what-is-the-calculation-delay-in-pid-used-for?show=39#a39
Hi EMdude, <br />
<br />
The PI controller is not in the library, but you can use the one from the example in your models.<br />
<br />
Setting the calculation delay to zero is not a valid input for the C-Script based PI-Contreller. However you may put in a very small value to make it's effect negligible.<br />
<br />
Understanding the C-Script requires deeper knowledge of the PLECS system and using it is not recommended for the beginner. The C-Script chapter in the documentation is a good read and also gives some examples.<br />
<br />
Cheers<br />
<br />
Falkhttp://forum.plexim.com/38/what-is-the-calculation-delay-in-pid-used-for?show=39#a39Wed, 07 Feb 2018 10:30:57 +0000Answered: How to do steady state analysis in PLECS blockset
http://forum.plexim.com/30/how-to-do-steady-state-analysis-in-plecs-blockset?show=34#a34
Hello Roy,<br />
<br />
The PLECS Analysis Tools, including Steady-State Analysis, are available in PLECS Blockset. Please see Chapter 8 in our current User Manual (specifically Page 162 - "Usage in PLECS Blockset") for details. Our manual is available as a free download from our website, or alternatively you can use the inbuilt searchable help tool of PLECS, where the same instructions are contained. There are also several demo models included with PLECS Blockset showing the operation of the Steady-State Analysis tool.<br />
<br />
Regards,<br />
<br />
Krishttp://forum.plexim.com/30/how-to-do-steady-state-analysis-in-plecs-blockset?show=34#a34Tue, 06 Feb 2018 00:50:01 +0000Answered: Is possible to execute the Steady-State Analysis from simulation script?
http://forum.plexim.com/29/possible-execute-steady-state-analysis-simulation-script?show=31#a31
<p>Hello Irubino01, </p><p>There is a good example in the Documentation in the chapter Simulation Scripts:</p><pre class="editorCode">mdlVars = struct('varL', 50e-6);
opts = struct('ModelVars', mdlVars);
plecs('scope', './Scope', 'ClearTraces');
inductorValues = [50, 100, 200];
for ix = 1:length(inductorValues)
opts.ModelVars.varL=inductorValues(ix) * 1e-6;
out = plecs('simulate', opts);
plecs('scope', './Scope', 'HoldTrace', ...
['L=' mat2str(inductorValues(ix)) 'uH']);
[maxv, maxidx] = max(out.Values(1,:));
printf('Max current for L=%duH: %f at %fs\n', ...
inductorValues(ix), maxv, out.Time(maxidx));
end</pre><pre class="editorCode">
</pre><p class="editorCode">Adjust example according to your circuit and instead of</p><pre class="editorCode">plecs('simulate', opts) </pre><p class="editorCode">use </p><pre class="editorCode">plecs('analyze', 'analysisName', opts)</pre><p class="editorCode">where 'analysisName' is the Description string of your Analysis.</p><pre class="editorCode">
</pre><pre class="editorCode">Best Regards, </pre><pre class="editorCode">Falk</pre>http://forum.plexim.com/29/possible-execute-steady-state-analysis-simulation-script?show=31#a31Mon, 05 Feb 2018 07:53:40 +0000Answered: Scripts + Storing value
http://forum.plexim.com/25/scripts-storing-value?show=26#a26
<p>Hi,</p><p>you can place an output port on your top level schematic. When you run <em>plecs('simulate') </em>it returns the values of the signals that are connected to top-level output ports. These values can then be assigned to variables in the next simulation run (using the <em>ModelVars</em> struct in the simulate command).</p><p>Kind regards,</p><p>Oliver</p>http://forum.plexim.com/25/scripts-storing-value?show=26#a26Thu, 01 Feb 2018 19:02:41 +0000Answered: Working with complex numbers in C-Script block
http://forum.plexim.com/23/working-with-complex-numbers-in-c-script-block?show=24#a24
<p>Hi,<br><br>you can work around the extension error by defining your own imaginary constant:</p><pre class="editorCode">const double complex i = csqrt(-1);</pre><p>However, depending on your operating system you'll most likely see other errors later. In short, we do not support complex calculations in C-Scripts at this time, but we'll see whether this can be improved in a later release.<br><br>Kind regards,<br><br>Oliver Schwartz</p>http://forum.plexim.com/23/working-with-complex-numbers-in-c-script-block?show=24#a24Tue, 30 Jan 2018 16:50:43 +0000Answered: PLECS Blockset installation problem - undefined function or variable 'plecslib'
http://forum.plexim.com/20/blockset-installation-undefined-function-variable-plecslib?show=21#a21
Hi Roy,<br />
<br />
This error typically occurs if your MATLAB paths weren't properly set. When you installed PLECS Blockset, the installation wizard had you create a startup.m file (at 3:03 of the below video). This file is made to be initialized every time you boot MATLAB and, thus, let your MATLAB add the necessary PLECS and PLECS/demos folders to its path for you automatically. This will only happen, however, if the location of this startup.m file (the default is [your username]/Documents/MATLAB/) is also listed in your MATLAB path. Please verify that all three of these paths highlighted in this installation video are present in your "Set Path" window within MATLAB: <a href="http://plexim.com/support/videos/installing-blockset-win" rel="nofollow">http://plexim.com/support/videos/installing-blockset-win</a>. If your startup.m file was properly created and pointed to within MATLAB paths, you should get the PLECS and PLECS/demos paths added automatically upon MATLAB reboot. If you need to start the PLECS installation wizard manually for any reason, you may do so via a shortcut in the "PLECS Blockset" folder.<br />
<br />
Regards,<br />
<br />
Vitalikhttp://forum.plexim.com/20/blockset-installation-undefined-function-variable-plecslib?show=21#a21Mon, 29 Jan 2018 15:59:42 +0000Answered: Variable pole modeling
http://forum.plexim.com/18/variable-pole-modeling?show=19#a19
A low pass filter has the transfer function G(s) = 1/(Ts+1). Typically you would use a Transfer Function block to model this in PLECS. To be able to control the time constant T with an input signal, you need to implement the transfer function with discrete Sum, Product and Integrator blocks.<br />
<br />
You have: G(s) = Y(s)/U(s) = 1/(Ts+1)<br />
<br />
⇒ Y(s)*(Ts+1) = U(s)<br />
<br />
⇒ ...<br />
<br />
⇒ Y(s) = 1/T * 1/s * (U(s)-Y(s))<br />
<br />
This is implemented in the attached model.http://forum.plexim.com/18/variable-pole-modeling?show=19#a19Fri, 26 Jan 2018 16:56:51 +0000Answered: Which is the most accurate way to simulate/calculate the efficiency of power electronics?
http://forum.plexim.com/14/accurate-simulate-calculate-efficiency-power-electronics?show=17#a17
<p>Hi Fabian,</p><p>The second formula is the one to take. One reason for example why they give different results is that the switching losses are not withdrawn from the circuit as PLECS treats switching transitions as ideal. This means P<sub>out</sub> calculated from electrical quantities in the circuit is generally different from the term P<sub>in</sub>-P<sub>loss</sub>, where P<sub>loss</sub> is calculated from thermal descriptions.<br><br>I hope this helps you.<br>Best regards,<br>NF</p>http://forum.plexim.com/14/accurate-simulate-calculate-efficiency-power-electronics?show=17#a17Thu, 25 Jan 2018 15:34:22 +0000Answered: Using fsolve to find x1 and x2
http://forum.plexim.com/13/using-fsolve-to-find-x1-and-x2?show=16#a16
<p>The problem stated in your example model looks a bit strange: Why would you want to modify the <em>starting point</em> x0 for the call to fsolve during the simulation?</p><p>I suspect that you rather want to solve a <em>parameterised</em> set of equations like the following</p><ul><li>C*x<sub>1</sub> - x<sub>2</sub> - exp(-x<sub>1</sub>) = 0</li><li>-x<sub>1</sub> + C*x<sub>2</sub> - exp(-x<sub>2</sub>) = 0</li></ul><p>with C being a parameter that you wish to vary throughout the simulation.</p><p>This can be done using the Algebraic Constraint block introduced in PLECS 4.1. Please see the attached model. The two Function blocks implement the left hand sides of the two equations with u(1) and u(2) representing x<sub>1</sub> and x<sub>2</sub> and u(3) representing the parameter C. The Algebraic Constraint block finds x<sub>1</sub> and x<sub>2</sub> such that the Function blocks will output 0.</p>http://forum.plexim.com/13/using-fsolve-to-find-x1-and-x2?show=16#a16Wed, 24 Jan 2018 20:33:36 +0000Answered: Is it possible to import waveform data into PLECS?
http://forum.plexim.com/11/is-it-possible-to-import-waveform-data-into-plecs?show=12#a12
It is possible in PLECS to import data obtained from an offline analysis, via post-processing, or from an external means, such as a real oscilloscope. If the data is saved in a comma separated value (.csv) format, it can easily be read into lookup table blocks in PLECS that are used as sources for direct viewing in a Scope or to drive actuators.<br />
<br />
In the attached PLECS Standalone model example, a Waveform Generator subsystem has been developed to demonstrate this functionality and which can easily be modified for custom use cases. In the subsystem's initialization commands (Ctrl+M) it can be seen that the current simulation time signal from a Clock block is provided as the input values x to two 1D Lookup Tables. These inputs provide the index mapping to output values f(x). In this case, two columns of waveform data captured from two channels of an actual scope, are stored in a separate spreadsheet file called ‘data.csv’.<br />
<br />
One should view the subsystem mask initialization commands (Ctrl+M, see the ‘Parameters’ tab) to fully understand the implementation. The user is able to scale up the number of plots easily should a data file contain more column data, and can also use a Multiplexer block to combine waveforms into the same plot window.http://forum.plexim.com/11/is-it-possible-to-import-waveform-data-into-plecs?show=12#a12Wed, 17 Jan 2018 21:31:40 +0000Answered: Why is there no Derivative block in the component library?
http://forum.plexim.com/9/why-is-there-no-derivative-block-in-the-component-library?show=10#a10
<p>PLECS does not provide a Derivative block because numerical derivatives have very bad numerical properties. To be reasonably accurate, they need small time steps; the automatic step-size control of a variable-step solver, however, only works for integrators but not for derivatives. Another practical issue is that a derivative amplifies noise in the system.</p><p>It is therefore preferable to formulate a problem in such a way that it can be modeled with integrators rather than derivatives.</p><p>If you absolutely must use a derivative in conjunction with a variable-step solver, you can implement one with a C-Script as follows:</p><p><strong>Setup</strong></p><ul><li>Number of inputs: 1</li><li>Number of outputs: 1</li><li>Number of disc. states: 2</li><li>Sample time: 0</li></ul><p><strong>Code declarations</strong></p><pre class="editorCode">#define lastTime DiscState(0)
#define lastInput DiscState(1)</pre><p><strong>Start function</strong></p><pre class="editorCode">lastTime = CurrentTime;
Output(0) = 0;</pre><p><strong>Output function</strong></p><pre class="editorCode">if (lastTime != CurrentTime)
{
Output(0) = (Input(0) - lastInput)/(CurrentTime - lastTime);
}</pre><p><strong>Update function</strong></p><pre class="editorCode">lastTime = CurrentTime;</pre><pre class="editorCode">lastInput = Input(0);</pre><p>See the attached PLECS Standalone demo model for a working implementation. Notice the visible difference between the differentiated sine signal and the cosine signal. This difference will become smaller if you reduce the maximum step size in the solver settings.</p>http://forum.plexim.com/9/why-is-there-no-derivative-block-in-the-component-library?show=10#a10Wed, 17 Jan 2018 21:19:44 +0000Answered: Where do I enter the ESR for a capacitor?
http://forum.plexim.com/7/where-do-i-enter-the-esr-for-a-capacitor?show=8#a8
Passive components in PLECS are idealized and do not include physical parameters such as the associated resistance. You can simply place a resistor in series with a capacitor to add this effect, however. Attached is a PLECS Standalone model that contains a custom subsystem where a capacitor includes an equivalent series resistance (ESR) under the hood and is accessible as a mask parameter. It is simply provided for users who do not want to add a resistor in series connection each time in the schematic, but do require that a capacitor has an ESR associated with it.http://forum.plexim.com/7/where-do-i-enter-the-esr-for-a-capacitor?show=8#a8Tue, 16 Jan 2018 22:07:12 +0000Answered: Has anyone developed a thermal fuse block?
http://forum.plexim.com/5/has-anyone-developed-a-thermal-fuse-block?show=6#a6
The attached PLECS Standalone model contains a subsystem implementation to behave as a fuse component. The user can specify the temperature limit for the device, at which point the fuse would blow and open the circuit. The implementation is open to the user (Ctrl+U) and circuit parameters such as the thermal impedance, ambient temperature, and electrical resistance can be modified for a custom design.http://forum.plexim.com/5/has-anyone-developed-a-thermal-fuse-block?show=6#a6Tue, 16 Jan 2018 22:03:18 +0000Answered: Do you have a 3-bit selector or 8 to 1 multiplexer component?
http://forum.plexim.com/3/do-you-have-a-3-bit-selector-or-8-to-1-multiplexer-component?show=4#a4
The attached PLECS Standalone model contains a custom subsystem developed to behave as an 8-to-1 multiplexer or data selector. The block takes 8 signals as inputs and using three select signals routes one of the inputs to the output. The implementation is open to the user (Ctrl+U) and can help to show how other types of multiplexer logic can be designed.http://forum.plexim.com/3/do-you-have-a-3-bit-selector-or-8-to-1-multiplexer-component?show=4#a4Tue, 16 Jan 2018 22:00:13 +0000