1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184
|
# This in an example describing the configuration options of the DBWriter.
# The example does NOT show on how to configure the database backends.
# This information is available in the snippets in this directory.
# This sample is configured to work together with the simulator example
# found in examples_confs/solarpowerlog_simulator
# NOTE: This example DOES NOT create the required tables, see
# db_create_table below
application:
{
dbglevel = "ALL"
};
inverter :
{
inverters = (
{
#TODO replace this minimal config by an include to the examples.
name = "Simulator";
dbglevel = "ERROR";
description = "Sample Inverter for the DB Example";
manufacturer = "SPUTNIK_ENGINEERING";
model ="S-Series";
comms = "TCP/IP";
tcpadr = "127.0.0.1";
tcpport = "12345";
tcptimeout = 5000;
commadr = 1;
}
);
};
logger:
{
loggers = (
{
# We want to have a DBWriter:
type = "DBWriter";
# This DB Writer is known as (required)
name = "DBWriter_tst";
# And gets its data from
datasource = "Simulator";
# Get the database configured.
# (See there for details)
@include "solarpowerlog-sqlite3.conf"
## this list specifies the jobs to be done...
# jobs are bundled data sets, which should be logged to
# a table
db_jobs = (
{
# Time between logging to the database.
# unit is seconds.
# Currently REQUIRED (but might be changed later.)
db_logevery=5.0;
# (optional) Should we only log if actually *something* changed
# If set to "true" the logger will only write to the
# database if actual data changed (might reduce db size)
# (note: to determine if something has changed only data from
# the inverter is considered -- not e.g %TIMESTAMP or like.
# this defaults to "false"
# db_logchangedonly=false;
# (optional) Sparse data are data sets which are only partially
# available.
# When true, this option allows to log data even if only
# a subset of the data is available
# If this this is false, solarpowerlog will not log anything
# unless it has got all the data. (default)
# db_allowsparse=false;
# (REQUIRED) The table to be used for this job
db_table="mytable";
# Should the table create on startup?
# POTENTIALLY DANGEROUS -- can cause data loss.
# You have these options:
# "no" (or any other setting)
# do not create any tables
# "YES"
# A uppercase YES will create the table if it does
# no exists yet: The table is not if it already exists.
# (if your SQL supports this)
# "YES-WIPE-MY-DATA"
# This will DELETE the table before creating it.
# "print-sql-statement" (lower case string): Just log the
# statement required to create the table as INFO-Level message.
# (This is good to give you an hint to create the table yourself)
#
# NOTE2: The table will not be created directly on startup,
# but with some delay, as solarpyesowerlog first needs to figure
# out the data-types to be used for each column -- As it cannot
# create tables with sparse datasets.
# This also means that db_layout must only reference existing
# Capabilities and provided by the inverter.
# db_create_table="no";
# (REQUIRED) specifies some principle operational mode
# (note: selectors are explained later)
# for the DB-Writer. Options are:
# continuous
# like CVS, just logging everything to one big
# table. You maybe want a %TIMESTAMP.
# $Selektors are not available.
# single
# for status/single rows -- e.g tables with just one row
# showing the actual status. This needs a $selector,
# which specifies the condition to select the to-be-updated
# row.
# cumulative
# log day/month/year/hourly data. This something between
# continuous/sinlge:
# It will update a row instead of adding a new row, but
# add new rows if there was no row to be udated.
# To select the right row all %modifiers are used as
# selectors. To have the possibility to only use a sub-set
# of those %-types, only the ones starting with "!" will be
# considered as selectors.
# You can of course also use static "$" selectors like in
# the single mode.
# There are dedicated examples showinng these modes!
db_operation_mode="continuous";
#db_operation_mode="single";
#db_operation_mode="cumulative";
# Special keywords for data
# The DBWriter internally creates some handy data which can be
# used to be logged to the database,
# Currently the following special keywords are understood:
# %TIMESTAMP, %YEAR, %MONTH, %DAY, %HOUR, %MINUTE
# When used, they expand to the wallclock value;
# (where timestamp expands to the unix timestamp)
# Selectors
# In the single and cumulative modes, solarpowerlog needs to
# update the data and make decisions which rows it needs to
# update.
# For this the selectors are used.
# Selectors can be recognized by a "$" or "!" as the first
# character.
# "$" is used when a literal should be used as a selector.
# For example "$Inv1" selects the literal string "Inv1"
# "!" is used when of the "special Keywords" should be used as
# the selector. For example "!MONTH" is using the current
# month to select the row.
# There can be more than one selector -- in this case they all
# have to match.
# single mode does not honor "!" selectors.
# The db_layout list describes the mapping between the data to
# logged and the columns of the table.
# See the example for the syntax.
# Capability/Keyword describes what to log by specifying the
# the inverters' capability.
# Also you can use the special keywords and (in single and
# cumulative mode) the selectors.
# The following cumulative example logs only the current power
# along with the timestamp. The timestamp goes to the column
# "created" and the feeding power to the column "pac"
db_layout = (
# [ "Capability/Keyword" , "column" ],
[ "%TIMESTAMP" , "created" ],
[ "Current Grid Feeding Power", "pac" ]
);
}
/*
# a second jobs would go in the block...
,
{
db_logevery=60.0;
db_table="table2";
(...)
}
*/
)
}
);
};
|