I am working for a demo to build relationship between different type measurements from different devices .
There are 2 measurements now, SPI_measurement & AOI_measurement.
AOI measurement is the data about fail qualify production .
SPI measurement is the data about Height/Area/Volume for the paint on the board.
The relation ship between these 2 json should be like below.
{
Aoi.boardId=SPI.boardId
Aoi.boardUnits = SPI.boardUnits
Aois. boardUnitId = SPI. boardUnitId
}
The SPI measurement will be post to C8Y first.
My first idea is to setup a monitor in apama for it, I set up a monitor for AOI measurement, then search for available SPI measurements in time windows.
But in EPL editor, it’s not allow to query with criterial for Measurement.params.
Yes Weihan, event expressions can only match on top-level primitive fields. Only top-level primitive types can be indexed in an event expression.
You can try like this:
action fillSPIVariables(Measurement aoiMeasurement) {
dictionary<string, any> params := aoiMeasurement.params;
string boardId := params["boardId"].toString();
string CompName := params.getOr("CompName","-1").toString();
string boardUnitId := params.getOr("boardUnitId","-1").toString();
string boardUnits := params.getOr("boardUnits","-1").toString();
from spi in all Measurement(type=Constants.SPI_MEASUREMENT_TYPE) within (1800.0)
where ( boardUnitId = spi.params.getOr("boardUnitId","-1").toString()
and boardUnits = spi.params.getOr("boardUnits","-1").toString()
and boardId = spi.params["boardId"].toString())
select FillSPIMeasurement(Constants.SPI_MEASUREMENT_NAME,
spi.measurements[Constants.SPI_MEASUREMENT_TYPE][Constants.SPI_MEASUREMENT_NAME].value,
spi.measurements[Constants.SPI_MEASUREMENT_TYPE][Constants.SPI_MEASUREMENT_NAME].unit) as fill{
}
}