コード例 #1
0
ファイル: SteamThing.cs プロジェクト: dntichy/IOT
        public InfoTable GetSteamSensorReadings()
        {
            var table = new InfoTable(getDataShapeDefinition("SteamSensorReadings"));

            var now = DateTime.Now;

            try
            {
                //entry 1
                var entry = new ValueCollection();
                entry.SetStringValue(SENSOR_NAME_FIELD, "Sensor Alpha");
                entry.SetDateTimeValue(ACTIV_TIME_FIELD, now.AddDays(1));
                entry.SetNumberValue(TEMPERATURE_FIELD, 50);
                entry.SetNumberValue(PRESSURE_FIELD, 15);
                entry.SetBooleanValue(FAULT_STATUS_FIELD, false);
                entry.SetBooleanValue(INLET_VALVE_FIELD, true);
                entry.SetNumberValue(TEMPERATURE_LIMIT_FIELD, 150);
                entry.SetNumberValue(TOTAL_FLOW_FIELD, 87);
                table.addRow(entry);

                //entry 2
                entry = new ValueCollection();
                entry.SetStringValue(SENSOR_NAME_FIELD, "Sensor Beta");
                entry.SetDateTimeValue(ACTIV_TIME_FIELD, now.AddDays(2));
                entry.SetNumberValue(TEMPERATURE_FIELD, 60);
                entry.SetNumberValue(PRESSURE_FIELD, 25);
                entry.SetBooleanValue(FAULT_STATUS_FIELD, true);
                entry.SetBooleanValue(INLET_VALVE_FIELD, true);
                entry.SetNumberValue(TEMPERATURE_LIMIT_FIELD, 150);
                entry.SetNumberValue(TOTAL_FLOW_FIELD, 77);
                table.addRow(entry);

                //entry 3
                entry = new ValueCollection();
                entry.SetStringValue(SENSOR_NAME_FIELD, "Sensor Gamma");
                entry.SetDateTimeValue(ACTIV_TIME_FIELD, now.AddDays(3));
                entry.SetNumberValue(TEMPERATURE_FIELD, 70);
                entry.SetNumberValue(PRESSURE_FIELD, 30);
                entry.SetBooleanValue(FAULT_STATUS_FIELD, true);
                entry.SetBooleanValue(INLET_VALVE_FIELD, true);
                entry.SetNumberValue(TEMPERATURE_LIMIT_FIELD, 150);
                entry.SetNumberValue(TOTAL_FLOW_FIELD, 67);
                table.addRow(entry);

                //entry 4
                entry = new ValueCollection();
                entry.SetStringValue(SENSOR_NAME_FIELD, "Sensor Delta");
                entry.SetDateTimeValue(ACTIV_TIME_FIELD, now.AddDays(4));
                entry.SetNumberValue(TEMPERATURE_FIELD, 80);
                entry.SetNumberValue(PRESSURE_FIELD, 35);
                entry.SetBooleanValue(FAULT_STATUS_FIELD, false);
                entry.SetBooleanValue(INLET_VALVE_FIELD, true);
                entry.SetNumberValue(TEMPERATURE_LIMIT_FIELD, 150);
                entry.SetNumberValue(TOTAL_FLOW_FIELD, 57);
                table.addRow(entry);

                //entry 5
                entry = new ValueCollection();
                entry.SetStringValue(SENSOR_NAME_FIELD, "Sensor Epsilon");
                entry.SetDateTimeValue(ACTIV_TIME_FIELD, now.AddDays(5));
                entry.SetNumberValue(TEMPERATURE_FIELD, 90);
                entry.SetNumberValue(PRESSURE_FIELD, 40);
                entry.SetBooleanValue(FAULT_STATUS_FIELD, true);
                entry.SetBooleanValue(INLET_VALVE_FIELD, false);
                entry.SetNumberValue(TEMPERATURE_LIMIT_FIELD, 150);
                entry.SetNumberValue(TOTAL_FLOW_FIELD, 47);
                table.addRow(entry);
            }
            catch (Exception e)
            {
                // handle exception as appropriate
            }

            return(table);
        }