diff --git a/datamodel/app/view/swmm_views/02_vw_swmm_junctions.sql b/datamodel/app/view/swmm_views/02_vw_swmm_junctions.sql index 14befc540..26dc794be 100644 --- a/datamodel/app/view/swmm_views/02_vw_swmm_junctions.sql +++ b/datamodel/app/view/swmm_views/02_vw_swmm_junctions.sql @@ -8,9 +8,9 @@ SELECT wn.obj_id as Name, coalesce(wn.bottom_level,0) as InvertElev, (co.level-wn.bottom_level) as MaxDepth, - NULL::float as InitDepth, - NULL::float as SurchargeDepth, - NULL::float as PondedArea, + 0.0::float as InitDepth, + 0.0::float as SurchargeDepth, + 0.0::float as PondedArea, ws.identifier::text as description, CONCAT_WS(',', 'manhole', mf.value_en) as tag, wn.situation3d_geometry as geom, @@ -41,9 +41,9 @@ SELECT wn.obj_id as Name, coalesce(wn.bottom_level,0) as InvertElev, (co.level-wn.bottom_level) as MaxDepth, - NULL::float as InitDepth, - NULL::float as SurchargeDepth, - NULL::float as PondedArea, + 0.0::float as InitDepth, + 0.0::float as SurchargeDepth, + 0.0::float as PondedArea, ws.identifier::text as description, CONCAT_WS(',','special_structure', ss_fu.value_en) as tag, wn.situation3d_geometry as geom, @@ -106,9 +106,9 @@ SELECT coalesce(from_wn.obj_id, concat('from_node@',re.obj_id)) as Name, coalesce(from_wn.bottom_level, 0) as InvertElev, 0 as MaxDepth, - NULL::float as InitDepth, - NULL::float as SurchargeDepth, - NULL::float as PondedArea, + 0.0::float as InitDepth, + 0.0::float as SurchargeDepth, + 0.0::float as PondedArea, coalesce(from_wn.obj_id, concat('from_node@',re.obj_id)) as description, 'junction without structure' as tag, coalesce(from_wn.situation3d_geometry, ST_StartPoint(re.progression3d_geometry)) as geom, @@ -142,9 +142,9 @@ SELECT coalesce(to_wn.obj_id, concat('to_node@',re.obj_id)) as Name, coalesce(to_wn.bottom_level, 0) as InvertElev, 0 as MaxDepth, - NULL::float as InitDepth, - NULL::float as SurchargeDepth, - NULL::float as PondedArea, + 0.0::float as InitDepth, + 0.0::float as SurchargeDepth, + 0.0::float as PondedArea, coalesce(to_wn.obj_id, concat('to_node@',re.obj_id)) as description, 'junction without structure' as tag, coalesce(to_wn.situation3d_geometry, ST_EndPoint(re.progression3d_geometry)) as geom, diff --git a/datamodel/app/view/swmm_views/08_vw_swmm_outfalls.sql b/datamodel/app/view/swmm_views/08_vw_swmm_outfalls.sql index 8267fe714..30a014edc 100644 --- a/datamodel/app/view/swmm_views/08_vw_swmm_outfalls.sql +++ b/datamodel/app/view/swmm_views/08_vw_swmm_outfalls.sql @@ -6,10 +6,16 @@ CREATE OR REPLACE VIEW tww_app.swmm_vw_outfalls AS SELECT wn.obj_id as Name, coalesce(wn.bottom_level,0) as InvertElev, - 'FREE'::varchar as Type, - NULL as StageData, + CASE + WHEN dp.waterlevel_hydraulic IS NOT NULL THEN 'FIXED' + ELSE 'FREE' + END as Type, -- Type of outfall boundary condition: FREE: outfall stage determined by minimum of critical flow depth and normal flow depth in the connecting conduit. NORMAL: outfall stage based on normal flow depth in the connecting conduit. FIXED: outfall stage set to a fixed value. TIDAL: outfall stage given by a table of tide elevation versus time of day. TIMESERIES: outfall stage supplied from a time series of elevations + CASE + WHEN dp.waterlevel_hydraulic IS NOT NULL THEN dp.waterlevel_hydraulic + ELSE 0 + END as StageData, 'NO'::varchar as tide_gate, - NULL::varchar as RouteTo, + '0'::varchar as RouteTo, ws.identifier as description, dp.obj_id::varchar as tag, wn.situation3d_geometry as geom, @@ -36,10 +42,10 @@ UNION SELECT wn.obj_id as Name, coalesce(wn.bottom_level,0) as InvertElev, - 'FREE'::varchar as Type, - NULL as StageData, + 'FREE' as Type, -- Type of outfall boundary condition: FREE: outfall stage determined by minimum of critical flow depth and normal flow depth in the connecting conduit. NORMAL: outfall stage based on normal flow depth in the connecting conduit. FIXED: outfall stage set to a fixed value. TIDAL: outfall stage given by a table of tide elevation versus time of day. TIMESERIES: outfall stage supplied from a time series of elevations + 0 as StageData, 'NO'::varchar as tide_gate, - NULL::varchar as RouteTo, + '0'::varchar as RouteTo, ws.identifier as description, ii.obj_id::varchar as tag, wn.situation3d_geometry as geom, diff --git a/datamodel/app/view/swmm_views/09_vw_swmm_subcatchments.sql b/datamodel/app/view/swmm_views/09_vw_swmm_subcatchments.sql index b2e7c2227..b460b6050 100644 --- a/datamodel/app/view/swmm_views/09_vw_swmm_subcatchments.sql +++ b/datamodel/app/view/swmm_views/09_vw_swmm_subcatchments.sql @@ -20,10 +20,10 @@ SELECT ELSE (ca.surface_area::numeric)::double precision END AS Area, CASE - WHEN state = 'rw_current' then discharge_coefficient_rw_current - WHEN state = 'rw_planned' then discharge_coefficient_rw_planned - WHEN state = 'ww_current' then discharge_coefficient_ww_current - WHEN state = 'ww_planned' then discharge_coefficient_ww_planned + WHEN state = 'rw_current' AND discharge_coefficient_rw_current IS NOT NULL then discharge_coefficient_rw_current + WHEN state = 'rw_planned' AND discharge_coefficient_rw_planned IS NOT NULL then discharge_coefficient_rw_planned + WHEN state = 'ww_current' AND discharge_coefficient_ww_current IS NOT NULL then discharge_coefficient_ww_current + WHEN state = 'ww_planned' AND discharge_coefficient_ww_planned IS NOT NULL then discharge_coefficient_ww_planned ELSE 0 END as percImperv, -- take from catchment_area instead of default value CASE @@ -41,7 +41,7 @@ SELECT END as Width, -- Width of overland flow path estimation 0.5 as percSlope, -- default value 0 as CurbLen, -- default value - NULL::varchar as SnowPack, -- default value + 'default_snow_pack'::varchar as SnowPack, -- default value CASE WHEN fk_wastewater_networkelement_ww_current is not null THEN diff --git a/datamodel/app/view/swmm_views/12_vw_swmm_raingages.sql b/datamodel/app/view/swmm_views/12_vw_swmm_raingages.sql index 62cb970a6..b701b7d0e 100644 --- a/datamodel/app/view/swmm_views/12_vw_swmm_raingages.sql +++ b/datamodel/app/view/swmm_views/12_vw_swmm_raingages.sql @@ -2,10 +2,10 @@ CREATE OR REPLACE VIEW tww_app.swmm_vw_raingages AS SELECT ('raingage@' , replace(ca.obj_id, ' ', '_'), '_', ca.state)::varchar as Name, - 'INTENSITY'::varchar as Format, - '0:15'::varchar as Interval, - '1.0'::varchar as SCF, - 'TIMESERIES default_tww_raingage_timeserie'::varchar as Source, + 'INTENSITY'::varchar as Format, -- Format in which the rain data are supplied: INTENSITY: each rainfall value is an average rate in inches/hour (or mm/hour) over the recording interval. VOLUME: each rainfall value is the volume of rain that fell in the recording interval (in inches or millimeters). CUMULATIVE: each rainfall value represents the cumulative rainfall that has occurred since the start of the last series of non-zero values (in inches or millimeters). + '0:15'::varchar as Interval, -- Recording time interval between gage readings in decimal hours or hours:minutes format. + '1.0'::varchar as SCF, -- Snow Catch Factor Factor that corrects gage readings for snowfall. + 'TIMESERIES default_tww_raingage_timeserie'::varchar as Source, -- Source of rainfall data; either TIMESERIES for user-defined time series data or FILE for an external data file. see Rain Gage Properties of SWMM Documentation for furhter information. st_centroid(perimeter_geometry)::geometry(Point, {SRID}) as geom, state, CASE diff --git a/datamodel/app/view/swmm_views/23_vw_swmm_xsections.sql b/datamodel/app/view/swmm_views/23_vw_swmm_xsections.sql index 0a53c3326..fabb9aff5 100644 --- a/datamodel/app/view/swmm_views/23_vw_swmm_xsections.sql +++ b/datamodel/app/view/swmm_views/23_vw_swmm_xsections.sql @@ -29,15 +29,15 @@ SELECT DISTINCT ELSE re.clear_height/1000::float/pp.height_width_ratio END WHEN pp.height_width_ratio IS NULL THEN 0.002 --ROMA: TODO default value for width to be set - ELSE 0.002 --ROMA: TODO default value for width to be set + ELSE 0.002 --TODO default value for width to be set END - ELSE NULL + ELSE 0 -- default set to 0 instead of NULL END as Geom2, --Geom3 = code -> used only for arch profile, but this code value is nowhere to be set in the TWW model 0 as Geom3, 0 as Geom4, 1 as Barrels, - NULL as Culvert, + 0 as Culvert, -- default set to 0 instead of NULL CASE WHEN ws_st.vsacode IN (7959, 6529, 6526) THEN 'planned' ELSE 'current'