blockSortWithIndices
Extends from Modelica.Icons.ObsoleteModel (Icon for classes that are obsolete and will be removed in later versions).
Information
Block that sorts the elements of the input signal u.
If the parameter ascending = true, then the output signal y satisfies
yi <= yi+1 for all i ∈ {1, ..., n-1}.
Otherwise, it satisfies
yi >= yi+1 for all i ∈ {1, ..., n-1}.
The output signal yIdx contains the indices of the sorted elements,
with respect to the input vector u.
Usage
Note that this block shall only be used for input signals u that are
time sampled.
Otherwise, in simulation, numerical noise from a nonlinear solver or from an
implicit time integration algorithm may cause the simulation to stall.
Numerical noise can be present if an input depends
on a state variable or a quantity that requires an iterative solution,
such as a temperature or a mass flow rate of an HVAC system.
In real controllers, measurement noise may cause the output to change frequently.
This block may for example be used in a variable air volume flow controller to access the position of the dampers that are most open.
Parameters
| Type | Name | Default | Description |
|---|---|---|---|
| Integer | nin | 0 | Number of input connections |
| Boolean | ascending | true | Set to true if ascending order, otherwise order is descending |
Connectors
| Type | Name | Default | Description |
|---|---|---|---|
| Buildings.Controls.OBC.CDL.Interfaces.RealInput[nin] | u | Connector of Real input signals | |
| Buildings.Controls.OBC.CDL.Interfaces.RealOutput[nin] | y | Sorted vector | |
| Buildings.Controls.OBC.CDL.Interfaces.IntegerOutput[nin] | yIdx | Indices of the sorted vector with respect to the original vector |
Revisions
-
March 29, 2024, by Antoine Gautier:
Added an output variable with the indices of the sorted elements. -
March 2, 2020, by Michael Wetter:
Changed icon to display dynamically the output value. -
September 22, 2017, by Michael Wetter:
Reimplemented function to make it work with OpenModelica. -
September 14, 2017, by Jianjun Hu:
Changed model name. -
January 10, 2017, by Milica Grahovac:
Initial CDL implementation. -
November 21, 2011, by Michael Wetter:
Removedassertstatement. -
November 25, 2008, by Michael Wetter:
First implementation.