function
Estimation.FusionHorizon.storeMeasurement
Write one packed sample into a measurement queue and return the queue
Public declarations
Explicit source declarations; dimensions, modifications and defaults are shown as written, without evaluation.
| Role | Name | Type | Dimensions / attributes / default | Description |
|---|---|---|---|---|
| input | queue | Real | [:, :] | |
| input | slot | Integer | | Row to write; any value outside 1..size(queue,1) writes nothing, which is how a tick that admits no measurement stores nothing without a branch |
| input | row | Real | [size(queue, 2)] | |
| output | updated | Real | [size(queue, 1), size(queue, 2)] |
Modelica declarations and implementation
Show parameters, interfaces and source
Parameters, inputs, outputs, defaults and equations from the source file.
function storeMeasurement
"Write one packed sample into a measurement queue and return the queue"
input Real queue[:, :];
input Integer slot
"Row to write; any value outside 1..size(queue,1) writes nothing, which is
how a tick that admits no measurement stores nothing without a branch";
input Real row[size(queue, 2)];
output Real updated[size(queue, 1), size(queue, 2)];
protected
Real hit;
algorithm
// Masked and fixed-length for the reasons recorded in
// Estimation.FusionHorizon.storeMeasurement's read counterpart. Generic in
// the row width so the five aiding sources share one store.
for k in 1:size(queue, 1) loop
hit := if k == slot then 1.0 else 0.0;
updated[k, :] := hit * row + (1.0 - hit) * queue[k, :];
end for;
end storeMeasurement;