USEPA / SWMM-EPANET_User_Interface

User interface for the Stormwater-Management-Model
111 stars 66 forks source link

Max depth for certain types of conduits #394

Closed barrc closed 4 years ago

barrc commented 4 years ago

In the Delphi GUI, the max. depth is not directly editable for certain types of conduits. Instead it's set from the cross section editor.

procedure SetConduitDepthField(const S: String);
//-----------------------------------------------------------------------------
//  Sets edit style of the Max. depth field for the Conduit Property Editor.
//-----------------------------------------------------------------------------
begin
  with Project do
  begin
    // The following shapes must use the Cross Section Editor to change
    // the conduit's max. depth value
    if SameText(S, 'HORIZ_ELLIPSE')
    or SameText(S, 'VERT_ELLIPSE')
    or SameText(S, 'ARCH')
    or SameText(S, 'IRREGULAR')
    or SameText(S, 'DUMMY')
    then ConduitProps[CONDUIT_GEOM1_INDEX].Style := esReadOnly
    else ConduitProps[CONDUIT_GEOM1_INDEX].Style := esEdit;
  end;
end;

For IRREGULAR conduits, the max depth seems to be set as max. elevation - min. elevation for the transect. Not having this value may be causing an issue with profile plots.

procedure TTransect.SetMaxDepth;
//
// Determines the max. depth of a transect.
//
var
  I: Integer;
  N: Integer;
  Ymax: Single;
  Ymin: Single;
  Y: Single;
begin
  Data[TRANSECT_MAX_DEPTH] := '';                                              //(5.1.008)
  N := Ydata.Count;
  if N < 3 then exit;
  Ymax := -1e10;
  Ymin := 1e10;
  for I := 0 to N-1 do
  begin
    if Uutils.GetSingle(Ydata[I], Y) then
    begin
      Ymin := Min(Ymin, Y);
      Ymax := Max(Ymax, Y);
    end;
  end;
  Y := Ymax - Ymin;
  if Y > 0 then Data[TRANSECT_MAX_DEPTH] := Format('%.2f', [Y]);
end;
barrc commented 4 years ago

I'll give this a try once #389 is merged

PaulDudaRESPEC commented 4 years ago

@barrc I went ahead and draft a fix for this one as you see above, you can let me know if you have other thoughts about how best to handle this one.