Steady-State Detector for Early Stop in Twin Activate

RSGarciarivas
RSGarciarivas
Altair Employee
edited April 24 in Altair Exchange

Overview

This is a Twin Activate block which stops the simulation when the response of a system stays within an allowed range from the desired system response.

It can be used with any system in which the desired response and actual response can be compared.

Usage

This is how the block should be implemented in a Twin Activate block diagram:

image

Inputs:

  • S: System response
  • Starget: Reference / input signal / desired response of the system
  • Error%: Maximum allowable deviation from reference during steady state [%]

Outputs:

  • Flag: This event activation port sends a signal once steady state has been reached.

Implementation

As the superblock has been masked, the user can double-click on it to edit the only parameter available, window length. The detector segments signals using a window of length N and calculates the mean before comparing this value to the reference.

Depending on the system and the time step size, this parameter should be set within the range of approximately 8 to 600 (try out different values).

image

This is how steady-state detection is implemented:

image

The process consists of three steps:

  • Window Average: A windowed average is obtained from a segment of length N of the signal.
  • Threshold Check: This part of the block check whether the obtained average is within the allowed range of reference value +/- allowed error percentage.
  • Stability Check: Two consecutive segments must comply for steady state to be detected.

 

 

Usage/Installation Instructions

Load the superblock (.scb file) into your Twin Activate model from File > Import > Twin Activate Block.

Three different examples of different systems are attached:

  • A simple transfer function block
  • A water tank with its level controlled through a PID controller
  • A PSIM - Twin Activate co-simulation of an average current mode control of a buck converter