Category:Cumulus MX: Difference between revisions

1,394 bytes added ,  17:21, 6 May 2020
m
Line 714: Line 714:
** This section is about uploading to a database table that contains one row for each day.
** This section is about uploading to a database table that contains one row for each day.
** This feature takes the set of values that MX has just used for the line added to this [[dayfile.txt|log file]] at the end of the day, and soon afterwards inserts those same values into a new row (with columns named as per SQL example below) in a database table.
** This feature takes the set of values that MX has just used for the line added to this [[dayfile.txt|log file]] at the end of the day, and soon afterwards inserts those same values into a new row (with columns named as per SQL example below) in a database table.
#If you don't have a table in your database for this upload (skip to step 3 if you do), first
#If you don't have a table in your database for this upload (skip to step after SQL if you do), first
#* Choose Table name - the default table name is "Dayfile", but you can choose any other name
#* Choose Table name - the default table name is "Dayfile", but you can choose any other name
#*Now move down the screen and click the '''Save''' button, and wait for MX to pop up '''Settings Saved''' message
#*Now move down the screen and click the '''Save''' button, and wait for MX to pop up '''Settings Saved''' message
# Now find "Create database table" section below the Save button and click '''Create Dayfile'''.
# Now find "Create database table" section below the Save button and click '''Create Dayfile'''.
#*This will create the table using the following SQL (here using default table name):
#* MX will confirm when table has been created.
<pre>CREATE TABLE Dayfile (LogDate date NOT NULL ,HighWindGust decimal(4,1) NOT NULL,HWindGBear varchar(3) NOT NULL,THWindG varchar(5) NOT NULL,MinTemp decimal(5,1) NOT NULL,TMinTemp varchar(5) NOT NULL,MaxTemp decimal(5,1) NOT NULL,TMaxTemp varchar(5) NOT NULL,MinPress decimal(6,1) NOT NULL,TMinPress varchar(5) NOT NULL,MaxPress decimal(6,1) NOT NULL,TMaxPress varchar(5) NOT NULL,MaxRainRate decimal(4,1) NOT NULL,TMaxRR varchar(5) NOT NULL,TotRainFall decimal(6,1) NOT NULL,AvgTemp decimal(4,1) NOT NULL,TotWindRun decimal(5,1) NOT NULL,HighAvgWSpeed decimal(3,1),THAvgWSpeed varchar(5),LowHum decimal(4,0),TLowHum varchar(5),HighHum decimal(4,0),THighHum varchar(5),TotalEvap decimal(5,1),HoursSun decimal(3,1),HighHeatInd decimal(4,1),THighHeatInd varchar(5),HighAppTemp decimal(4,1),THighAppTemp varchar(5),LowAppTemp decimal(4,1),TLowAppTemp varchar(5),HighHourRain decimal(4,1),THighHourRain varchar(5),LowWindChill decimal(4,1),TLowWindChill varchar(5),HighDewPoint decimal(4,1),THighDewPoint varchar(5),LowDewPoint decimal(4,1),TLowDewPoint varchar(5),DomWindDir varchar(3),HeatDegDays decimal(4,1),CoolDegDays decimal(4,1),HighSolarRad decimal(5,1),THighSolarRad varchar(5),HighUV decimal(3,1),THighUV varchar(5),HWindGBearSym varchar(3),DomWindDirSym varchar(3),PRIMARY KEY(LogDate)) COMMENT = "Dayfile from Cumulus"</pre>
#*This will create the table using the following SQL (here using default table name) (the last 4 items were added in MX version 3.6.0):
<pre>CREATE TABLE Dayfile (LogDate date NOT NULL ,HighWindGust decimal(4,1) NOT NULL,HWindGBear varchar(3) NOT NULL,THWindG varchar(5) NOT NULL,MinTemp decimal(5,1) NOT NULL,TMinTemp varchar(5) NOT NULL,MaxTemp decimal(5,1) NOT NULL,TMaxTemp varchar(5) NOT NULL,MinPress decimal(6,1) NOT NULL,TMinPress varchar(5) NOT NULL,MaxPress decimal(6,1) NOT NULL,TMaxPress varchar(5) NOT NULL,MaxRainRate decimal(4,1) NOT NULL,TMaxRR varchar(5) NOT NULL,TotRainFall decimal(6,1) NOT NULL,AvgTemp decimal(4,1) NOT NULL,TotWindRun decimal(5,1) NOT NULL,HighAvgWSpeed decimal(3,1),THAvgWSpeed varchar(5),LowHum decimal(4,0),TLowHum varchar(5),HighHum decimal(4,0),THighHum varchar(5),TotalEvap decimal(5,1),HoursSun decimal(3,1),HighHeatInd decimal(4,1),THighHeatInd varchar(5),HighAppTemp decimal(4,1),THighAppTemp varchar(5),LowAppTemp decimal(4,1),TLowAppTemp varchar(5),HighHourRain decimal(4,1),THighHourRain varchar(5),LowWindChill decimal(4,1),TLowWindChill varchar(5),HighDewPoint decimal(4,1),THighDewPoint varchar(5),LowDewPoint decimal(4,1),TLowDewPoint varchar(5),DomWindDir varchar(3),HeatDegDays decimal(4,1),CoolDegDays decimal(4,1),HighSolarRad decimal(5,1),THighSolarRad varchar(5),HighUV decimal(3,1),THighUV varchar(5),HWindGBearSym varchar(3),DomWindDirSym varchar(3),PRIMARY KEY(LogDate,
'MaxFeelsLike',  'decimal(4,1)' ,'TMaxFeelsLike',  'varchar(5)','MinFeelsLike',  'decimal(4,1)','TMinFeelsLike',  'varchar(5)' ) COMMENT = "Dayfile from Cumulus"</pre>
#With the table existing, all you need to do is:
#With the table existing, all you need to do is:
#* Enable - tick here when you are ready for this action [using the schema (set of column names) in the SQL quoted below] to happen at end of day
#* Enable - tick here when you are ready for this action [using the schema (set of column names) in the SQL quoted above] to happen at end of day
#* Now move down the screen and click the '''Save''' button, and wait for MX to pop up '''Settings Saved''' message.
#* Now move down the screen and click the '''Save''' button, and wait for MX to pop up '''Settings Saved''' message.
#At the end of the meteorological day, MX will now automatically run the SQL to add a new row with the daily summary values as mentioned at the start of this section.
#At the end of the meteorological day, MX will now automatically run the SQL to add a new row with the daily summary values as mentioned at the start of this section.
Line 742: Line 744:
**This database table has one row for each line in that monthly log.
**This database table has one row for each line in that monthly log.
** This feature takes the set of values that MX has just added to the monthly log file, and soon afterwards inserts those same values into a new row in a database table.
** This feature takes the set of values that MX has just added to the monthly log file, and soon afterwards inserts those same values into a new row in a database table.
#If you don't have a table in your database for this upload (skip to step 3 if you do), first
#If you don't have a table in your database for this upload (skip to step after SQL if you do), first
#* Choose Table name - the default table name is "Monthly", but you can choose any other name
#* Choose Table name - the default table name is "Monthly", but you can choose any other name
#*Now move down the screen and click the '''Save''' button, and wait for MX to pop up '''Settings Saved''' message
#*Now move down the screen and click the '''Save''' button, and wait for MX to pop up '''Settings Saved''' message
# Now find "Create database table" section below the Save button and click '''Create Monthly'''.
# Now find "Create database table" section below the Save button and click '''Create Monthly'''.
 
#* MX will confirm when table has been created.
 
#* The SQL used to create the table is (columns marked NOT NULL have been in use for all Cumulus versions, the other columns have been added from various different versions) <pre>CREATE TABLE Monthly ('LogDateTime',        'DATETIME NOT NULL', 'Temp',              'decimal(4,1) NOT NULL', 'Humidity',          'decimal(4,1) NOT NULL',
** Just like with the dayfile.txt upload option, you select the table name in this option and click Save button, then use a separate option, lower down this settings page, to create the necessary table and that option is '''Create Monthly'''.
'Dewpoint',          'decimal(4,1) NOT NULL', 'Windspeed',          'decimal(4,1) NOT NULL', 'Windgust',          'decimal(4,1) NOT NULL','Windbearing'        'smallint(3) unsigned zerofill NOT NULL',
** This feature allows you to upload the file that Cumulus creates each month to log detailed measurements on a regular basis, apart from the Save button below it there are just two items:
'RainRate',          'decimal(4,$rainDec) NOT NULL', 'TodayRainSoFar',    'decimal(4,$rainDec) NOT NULL', 'Pressure',          'decimal(6,2) NOT NULL', 'Raincounter',        'decimal(6,2) NOT NULL',
**# A tick box, where you tick if you want a standard table structure to be used to reflect the fields in the [[Monthly_log_files|detailed log file]]
'InsideTemp',        'decimal(4,1) NOT NULL', 'InsideHumidity',    'decimal(4,1) NOT NULL', 'LatestWindGust',    'decimal(5,1) NOT NULL', 'WindChill',          'decimal(4,1) NOT NULL',
**# A text box where you can change the default table name to one that suits you better. Do not leave this blank, SQL requires a table name.
'HeatIndex',          'decimal(4,1) NOT NULL', 'UVindex',            'decimal(4,1)', 'SolarRad',          'decimal(5,1)', 'Evapotrans',        'decimal(4,1)', 'AnnualEvapTran',    'decimal(5,1)',
'ApparentTemp',      'decimal(4,1)', 'MaxSolarRad',        'decimal(5,1)', 'HrsSunShine',        'decimal(3,1)', 'CurrWindBearing',   'varchar(3)', 'RG11rain',          'decimal(4,1)',
'RainSinceMidnight',  'decimal(4,1)', 'WindbearingSym',    'varchar(3)','CurrWindBearingSym', 'varchar(3)', 'FeelsLike',          'decimal(4,1)')  COMMENT = "Monthly logs from Cumulus";</pre>
#With the table existing, all you need to do is:
#* Enable - tick here when you are ready for this action [using the schema (set of column names) in the SQL quoted above] to happen at end of day
#* Now move down the screen and click the '''Save''' button, and wait for MX to pop up '''Settings Saved''' message.
** The upload you select here will happen every time MX creates a new line in the monthly log file, it might be every 10 minutes, but you may have configured a different interval.
** The upload you select here will happen every time MX creates a new line in the monthly log file, it might be every 10 minutes, but you may have configured a different interval.


5,838

edits