Skip to content

Commit

Permalink
add more builtin outputs (#429)
Browse files Browse the repository at this point in the history
  • Loading branch information
edaniszewski committed Mar 30, 2020
1 parent ae11acf commit 91542e5
Showing 1 changed file with 87 additions and 22 deletions.
109 changes: 87 additions & 22 deletions sdk/output/builtins.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,19 @@ func GetBuiltins() []*Output {
&ElectricResistance,
&Frequency,
&Humidity,
&Pressure,
&Kilojoule,
&KilowattHour,
&Pascal,
&PSI,
&RPM,
&Seconds,
&State,
&Status,
&Temperature,
&Velocity,
&Voltage,
&Watt,
&Weber,
}
}

Expand All @@ -45,25 +50,14 @@ var Color = Output{
Type: "color",
}

// Seconds is an output type for a duration, measured in seconds.
var Seconds = Output{
Name: "seconds",
Type: "duration",
Precision: 3,
Unit: &Unit{
Name: "seconds",
Symbol: "s",
},
}

// ElectricCurrent is an output type for electrical current readings,
// measured in Amperes.
var ElectricCurrent = Output{
Name: "electric-current",
Type: "current",
Precision: 3,
Unit: &Unit{
Name: "amps",
Name: "ampere",
Symbol: "A",
},
}
Expand Down Expand Up @@ -102,9 +96,31 @@ var Humidity = Output{
},
}

// Pressure is an output type for pressure readings, measured in Pascals.
var Pressure = Output{
Name: "pressure",
// Kilojoule is an output type for energy readings, measured in kilojoules.
var Kilojoule = Output{
Name: "kilojoule",
Type: "energy",
Precision: 3,
Unit: &Unit{
Name: "kilojoule",
Symbol: "kJ",
},
}

// KilowattHour is an output type for energy readings, measured in kilowatt-hours.
var KilowattHour = Output{
Name: "kilowatt-hour",
Type: "energy",
Precision: 3,
Unit: &Unit{
Name: "kilowatt-hour",
Symbol: "kWh",
},
}

// Pascal is an output type for pressure readings, measured in Pascals.
var Pascal = Output{
Name: "pascal",
Type: "pressure",
Precision: 3,
Unit: &Unit{
Expand All @@ -113,6 +129,17 @@ var Pressure = Output{
},
}

// PSI is an output type for pressure readings, measured in PSI.
var PSI = Output{
Name: "psi",
Type: "pressure",
Precision: 3,
Unit: &Unit{
Name: "pounds per square inch",
Symbol: "psi",
},
}

// RPM is an output type for frequency readings, measured in revolutions per minute.
var RPM = Output{
Name: "rpm",
Expand All @@ -124,14 +151,14 @@ var RPM = Output{
},
}

// Velocity is an output type for velocity readings, measured in meters per second.
var Velocity = Output{
Name: "velocity",
Type: "velocity",
// Seconds is an output type for a duration, measured in seconds.
var Seconds = Output{
Name: "seconds",
Type: "duration",
Precision: 3,
Unit: &Unit{
Name: "meters per second",
Symbol: "m/s",
Name: "seconds",
Symbol: "s",
},
}

Expand Down Expand Up @@ -165,6 +192,17 @@ var Temperature = Output{
},
}

// Velocity is an output type for velocity readings, measured in meters per second.
var Velocity = Output{
Name: "velocity",
Type: "velocity",
Precision: 3,
Unit: &Unit{
Name: "meters per second",
Symbol: "m/s",
},
}

// Voltage is an output type for voltage readings, measured in volts.
var Voltage = Output{
Name: "voltage",
Expand All @@ -175,3 +213,30 @@ var Voltage = Output{
Symbol: "V",
},
}

// Watt is an output type for power readings, measured in watts.
var Watt = Output{
Name: "watt",
Type: "power",
Precision: 3,
Unit: &Unit{
Name: "watt",
Symbol: "W",
},
}

// Weber is an output type for magnetic flux readings, measured in Webers.
//
// Note that:
// Wb = kg•m²/s²•A = Ω•C = V•s = H•A = T•m² = J/A
//
// That means this output can be used in place of a Volt-second, for example.
var Weber = Output{
Name: "weber",
Type: "flux",
Precision: 3,
Unit: &Unit{
Name: "weber",
Symbol: "Wb",
},
}

0 comments on commit 91542e5

Please sign in to comment.