Compute Linear Response Characteristics
This example shows how to compute the linear response characteristics of the storing tank temperature of a solar water heater.
Read Data
ThingSpeak™ channel 29633 contains the storing tank temperature data (in degree Celsius) of a solar water heater in Cambridge, UK. The temperature data is collected once every 15 seconds. Read the data for 2 hours from channel 29633 using the thingSpeakRead
function. Convert the timestamps to elapsed minutes from the start.
start = datetime('September 12, 2017 06:09:00 AM'); stop = datetime('September 12, 2017 8:09:00 AM'); data = thingSpeakRead(29633, 'Fields', 5, 'DateRange', [start stop], 'OutputFormat', 'table'); data.Timestamps = 24*60*(data.Timestamps-data.Timestamps(1));
Linear Response Characteristics
Assuming that solar water heater is a linear system, calculate the related performance indicators using the temperature as the response data of the system.
perfIndicators = lsiminfo(data.StoreTopTemp, days(data.Timestamps))
perfIndicators = struct with fields: TransientTime: 119.1970 SettlingTime: 78.2707 Min: 47.2000 MinTime: 106.4500 Max: 49.9000 MaxTime: 20.4333
Send Performance Indicators to ThingSpeak
Send the minimum, minimum time, maximum, and maximum time performance indicators to a ThingSpeak channel using the thingSpeakWrite
function. Change the channelID
and the writeAPIKey
to send data to your channel.
channelID = 17504; writeAPIKey = '23ZLGOBBU9TWHG2H'; thingSpeakWrite(channelID,[perfIndicators.Min,perfIndicators.MinTime,perfIndicators.Max,perfIndicators.MaxTime],'WriteKey',writeAPIKey);
See Also
Functions
lsiminfo
(Control System Toolbox) |thingSpeakRead
|thingSpeakWrite