How can I subtract, add or multiply selected RMS simulation result signals and plot the result?

Category:
Dynamic Simulation
Answer

There are two possibilities to work with user defined variables in a dynamic simulation:

  1. Using the option ’User Defined Signal’ included within the PltDataseries. This allows calculation of additional results based on the arithmetic manipulation of one or more results. For more information refer to User Manual section 'Processed and Aggregated Results' in the chapter 'Data Series'.
  2. Using a separate DSL block. That would require you to create a DSL block, a frame, and the further definitions of object signals. Then the user defined signal will be defined as a signal in the DSL model, the simulation and plot has to be done as usual.
  3. Postprocessing using a DPL script. This is the alternative option, attached you find a small example. The advantage is the simplicity, the disadvantage is that you have to run the script after each simulation. You might consider to put the execution of the transient simulation at the beginning of the DPL script.

The script takes the result file from the simulation, gets the values for each time step, multiplies these and stores the result in another result file. You can expand this scheme by multiplying values from different result files, or perform more complicated calculations. You may want to use IntMat (matrix) or IntVec (vector) objects for temporary storage of data in that case.

Explanations:

The function reads the data from the result variables of the object passed as an external object in the basic options. The Result file in the DPL script writes a line of data when WriteDraw() is called. It is set-up in such a way as to write the Result parameters of the DPL script (on the Advanced Options Page).

Back