Skip to content

Instantly share code, notes, and snippets.

@mcroissant
mcroissant / IotKinesisSql
Last active March 26, 2019 13:32
Iot Kinesis SQL
CREATE OR REPLACE STREAM "DESTINATION_SQL_STREAM" (time_stamp bigint, mean_value double);
CREATE OR REPLACE PUMP "STREAM_PUMP" AS INSERT INTO "DESTINATION_SQL_STREAM"
SELECT STREAM
MAX("COL_timestamp") OVER TEN_SECOND_SLIDING_WINDOW as time_stamp,
AVG(cast("v" as double)) OVER TEN_SECOND_SLIDING_WINDOW AS mean_value
FROM "SOURCE_SQL_STREAM_001"
WHERE "id" = 'Simulation Examples.Functions.Sine4'
WINDOW TEN_SECOND_SLIDING_WINDOW AS (
PARTITION BY "COL_timestamp"
RANGE INTERVAL '10' SECOND PRECEDING);
@mcroissant
mcroissant / SimpleStoreFeature.sila.xml
Created July 5, 2019 10:03
Sila simple storage feature
<?xml version="1.0" encoding="utf-8" ?>
<Feature SiLA2Version="0.1" FeatureVersion="1.0" Originator="org.silastandard" Category="examples"
xmlns="http://www.sila-standard.org"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.sila-standard.org https://gitlab.com/SiLA2/sila_base/raw/master/schema/FeatureDefinition.xsd">
<Identifier>AutomatedStorage</Identifier>
<DisplayName>Automated Storage</DisplayName>
<Description>Feature allowing to interact with automated storage remote controls</Description>
<Command>
<Identifier>StoreRackWithNoContentCheck</Identifier>
@mcroissant
mcroissant / AutomatedStorageImpl.java
Created July 5, 2019 11:46
Implement sila feature
package sila_java.servers.automated_freezer.automated_storage;
import sila2.org.silastandard.examples.automatedstorage.v1.AutomatedStorageGrpc;
import sila2.org.silastandard.examples.automatedstorage.v1.AutomatedStorageOuterClass;
import sila_java.library.core.sila.types.SiLAErrors;
public class AutomatedStorageImpl extends AutomatedStorageGrpc.AutomatedStorageImplBase{
/**
*/
builder.addFeature(
"org.silastandard/examples/v1/AutomatedStorage",
getResourceContent("AutomatedStorage.sila.xml"),
new AutomatedStorageImpl()
);
@mcroissant
mcroissant / simple_empty_feature.xml
Last active October 17, 2019 15:08
Empty Sila Feature
<?xml version="1.0" encoding="utf-8" ?>
<Feature SiLA2Version="0.1" FeatureVersion="1.0" Originator="org.silastandard" Category="examples"
xmlns="http://www.sila-standard.org"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.sila-standard.org https://gitlab.com/SiLA2/sila_base/raw/master/schema/FeatureDefinition.xsd">
<Identifier>AutomatedStorage</Identifier>
<DisplayName>Automated Storage</DisplayName>
<Description>Feature allowing to interact with automated storage remote controls</Description>
...
@mcroissant
mcroissant / simple_sila_command.xml
Last active October 17, 2019 15:15
Simple SiLA Command
<Command>
<Identifier>StoreRackWithNoContentCheck</Identifier>
<DisplayName>Store Rack without checking content</DisplayName>
<Description>Store a rack without checking for its content in term of mapping of tubes position</Description>
<Observable>No</Observable>
<Parameter>
...
</Parameter>
<Response>
...
@mcroissant
mcroissant / simple_sila_parameter.xml
Created October 17, 2019 15:23
Simple SiLA Parameter
<Command>
...
<Parameter>
<Identifier>RackBarcode</Identifier>
<DisplayName>Rack Barcode</DisplayName>
<Description>The barcode of the rack that will be inserted into the automated freezer</Description>
<DataType>
<Basic>String</Basic>
</DataType>
</Parameter>
@mcroissant
mcroissant / complex_list_parameter.xml
Created October 17, 2019 15:36
Complex parameter with a list and structure
<Command>
...
<Parameter>
<Identifier>ExpectedRackContent</Identifier>
<DisplayName>Expected Rack Content</DisplayName>
<Description>The vials barcode and position which are expected within the rack</Description>
<DataType>
<List>
<DataType>
<Structure>
@mcroissant
mcroissant / sila_simple_property.xml
Last active October 17, 2019 15:51
SiLA Property definition
<Feature>
...
<Property>
<Identifier>FreezerTemperature</Identifier>
<DisplayName>Freezer Temperature</DisplayName>
<Description>The current temperature of the freezer</Description>
<DataType>
<Basic>Real</Basic>
</DataType>
<Observable>Yes</Observable>
@mcroissant
mcroissant / sila_data_type_definition.xml
Created November 19, 2019 11:42
Sila2 Data Type Definition
<DataTypeDefinition>
<Identifier>Rack</Identifier>
<DisplayName>Rack</DisplayName>
<Description>Rack entity containing containers </Description>
<DataType>
...
</DataType>
</DataTypeDefinition>