Пример #1
0
    public void Open()
    {
      Connection c = Connection.Create(@"..\..\..\testdata\mike11\novomr6.xns11");

      CrossSectionDataFactory cd = new CrossSectionDataFactory();

      var xsecs = cd.Open(@"..\..\..\testdata\mike11\novomr6.xns11", null);
      

      CrossSectionFactory cf = new CrossSectionFactory();
      var v= new CrossSectionPointList();
      v.Add(new CrossSectionPoint(0,5));
      v.Add(new CrossSectionPoint(1,2));
      v.Add(new CrossSectionPoint(2,2));
      v.Add(new CrossSectionPoint(3,5));

      cf.BuildOpen("tempo");
      cf.SetRawPoints(v);
      
      var cs = cf.GetCrossSection();

      CrossSectionData d = new CrossSectionData();
      d.Add(cs);
      d.Connection = Connection.Create(@"c:\temp\new.xns11");
      


      
     
      CrossSectionFactory cdd = new CrossSectionFactory();
     
     
    }
Пример #2
0
        public void Open()
        {
            Connection c = Connection.Create(@"..\..\..\testdata\mike11\novomr6.xns11");

            CrossSectionDataFactory cd = new CrossSectionDataFactory();

            var xsecs = cd.Open(@"..\..\..\testdata\mike11\novomr6.xns11", null);


            CrossSectionFactory cf = new CrossSectionFactory();
            var v = new CrossSectionPointList();

            v.Add(new CrossSectionPoint(0, 5));
            v.Add(new CrossSectionPoint(1, 2));
            v.Add(new CrossSectionPoint(2, 2));
            v.Add(new CrossSectionPoint(3, 5));

            cf.BuildOpen("tempo");
            cf.SetRawPoints(v);

            var cs = cf.GetCrossSection();

            CrossSectionData d = new CrossSectionData();

            d.Add(cs);
            d.Connection = Connection.Create(@"c:\temp\new.xns11");



            CrossSectionFactory cdd = new CrossSectionFactory();
        }
        /// <summary>
        /// Create a new circular cross section and add it to the CrossSectionData object
        /// </summary>
        /// <param name="csData">Cross section data object</param>
        public static void CreateAndAddCircularCrossSection(CrossSectionData csData)
        {
            // Creates a class representing a cross section with raw data attached.
            CrossSectionFactory builder = new CrossSectionFactory();

            builder.BuildCircular(2);

            // Defines the location of the current cross section. The Z-coordinate
            // is the bottom level of the cross section (unless defined by the
            // raw data (the open cross sections)).
            builder.SetLocation(new ZLocation("pipe A", 10)
            {
                Z = 0
            });

            // Set flow resistance
            FlowResistance flowResistance = new FlowResistance();

            flowResistance.ResistanceDistribution = ResistanceDistribution.ExponentVarying;
            flowResistance.ResistanceValue        = 75;
            flowResistance.ResistanceTopValue     = 85;
            flowResistance.ExpDepExponent         = 1.5;
            flowResistance.Formulation            = ResistanceFormulation.Manning_M;
            builder.SetFlowResistance(flowResistance);

            // Get cross section from builder
            CrossSectionLocated cs = builder.GetCrossSection();

            cs.TopoID = "1";

            // Calculates the processed levels, storage areas, radii, etc, ie, fill in all
            // ProcessedXXX properties.
            cs.BaseCrossSection.CalculateProcessedData();

            // Validates the data. The constraints are that the levels and the areas after sorting
            // must be monotonically increasing.
            IDiagnostics diagnostics = cs.Validate();

            if (diagnostics.ErrorCountRecursive > 0)
            {
                throw new Exception(String.Format("Number of errors: {0}", diagnostics.Errors.Count));
            }

            // Add the cross section
            csData.Add(cs);
        }
Пример #4
0
        /// <summary>
        /// Adds a new cross section to the CrossSectionData object
        /// </summary>
        /// <param name="csData">Cross section data object</param>
        public static void AddCrossSection(CrossSectionData csData)
        {
            // Note: Raw data must be ordered from left to right in order for hydraulic radius to be processed correctly

            // Creates a class representing a cross section with raw data attached.
            CrossSectionFactory builder = new CrossSectionFactory();

            builder.BuildOpen("");

            // Defines the location of the current cross section. The Z-coordinate
            // is the bottom level of the cross section (unless defined by the
            // raw data (the open cross sections)).
            builder.SetLocation(new ZLocation("river B", 500)
            {
                Z = 0
            });

            // Create a number of points
            CrossSectionPointList points = new CrossSectionPointList();

            points.Add(new CrossSectionPoint(-1.0, 2.0));
            points.Add(new CrossSectionPoint(0.0, 1.0));
            points.Add(new CrossSectionPoint(0.0, 0.0));
            points.Add(new CrossSectionPoint(1.0, 0.0));
            points.Add(new CrossSectionPoint(1.0, 1.0));
            points.Add(new CrossSectionPoint(2.0, 2.0));
            points.Add(new CrossSectionPoint(3.0, 2.0)); // dummy point, outside right levee bank marker
            // Sets the markers at left/right side and lowest point.
            builder.SetRawPoints(points);
            builder.SetLeftLeveeBank(points[0]);
            builder.SetLowestPoint(points[3]);
            builder.SetRightLeveeBank(points[5]);

            // Set flow resistance
            FlowResistance flowResistance = new FlowResistance();

            flowResistance.ResistanceDistribution = ResistanceDistribution.Uniform;
            flowResistance.ResistanceValue        = 1;
            flowResistance.Formulation            = ResistanceFormulation.Relative;
            builder.SetFlowResistance(flowResistance);
            builder.SetRadiusType(RadiusType.ResistanceRadius);

            // Get cross section from builder
            CrossSectionLocated cs = builder.GetCrossSection();

            cs.TopoID = "1";

            // Calculates the processed levels, storage areas, radii, etc, ie, fill in all
            // ProcessedXXX properties.
            cs.BaseCrossSection.CalculateProcessedData();

            // Validates the data. The constraints are that the levels and the areas after sorting
            // must be monotonically increasing.
            IDiagnostics diagnostics = cs.Validate();

            if (diagnostics.ErrorCountRecursive > 0)
            {
                throw new Exception(String.Format("Number of errors: {0}", diagnostics.Errors.Count));
            }

            // Add the cross section
            csData.Add(cs);
        }