31 lines
994 B
SQL
31 lines
994 B
SQL
-- [controls]
|
|
|
|
create type tj.controls_1_prep as enum ('above', 'below');
|
|
|
|
-- link linkid status if node nodeid above / below value
|
|
create table tj.controls_1
|
|
(
|
|
linkid varchar(32) primary key references tj.link(id)
|
|
, status text not null -- open / closed, a pump speed setting, or a control valve setting
|
|
, nodeid varchar(32) references tj.node(id) not null
|
|
, prep tj.controls_1_prep not null
|
|
, value numeric not null
|
|
);
|
|
|
|
-- link linkid status at time time
|
|
create table tj.controls_2
|
|
(
|
|
linkid varchar(32) primary key references tj.link(id)
|
|
, status text not null -- open / closed, a pump speed setting, or a control valve setting
|
|
, time interval hour
|
|
);
|
|
|
|
-- link linkid status at clocktime clocktime am / pm
|
|
create table tj.controls_3
|
|
(
|
|
linkid varchar(32) primary key references tj.link(id)
|
|
, status text not null -- open / closed, a pump speed setting, or a control valve setting
|
|
, clocktimehour interval hour -- get am/pm from it
|
|
, clocktimemin interval minute
|
|
);
|