Пример #1
0
        public bool addOutputVariable(string nodeName, SmOutput.outputType type)
        {
            bool bsuccess = false;

            if (type != SmOutput.outputType.nodeVolume)
            {
                throw new Exception("Unsupported output type for node " + nodeName);
            }

            foreach (Node _node in nodes)
            {
                if (_node.name == nodeName)
                {
                    SmOutput xout = new SmOutput();
                    xout.type  = SmOutput.outputType.nodeVolume;
                    xout.name  = "Volume in " + nodeName;
                    xout.nodex = _node;

                    output.addNewDataSeries(xout);
                    bsuccess = true;
                }
            }


            if (!bsuccess)
            {
                throw new Exception("could not find output variable " + nodeName);
            }

            return(bsuccess);
        }
Пример #2
0
        public bool addOutputVariable(string outletName)
        {
            bool bsuccess = false;

            foreach (int i in iOutlets)
            {
                if (nodes[i].name == outletName)
                {
                    SmOutput xout = new SmOutput();
                    xout.type = SmOutput.outputType.outletFlowTimeSeries;
                    xout.name = outletName;
                    //jeg er i gang her MB og alle andre steder relateret til output. :
                    foreach (Node _node in nodes)
                    {
                        if (_node.name == outletName) //not robust - add check for type.
                        {
                            xout.outletx = (Outlet)_node;
                        }
                    }

                    output.addNewDataSeries(xout);
                    bsuccess = true;
                }
            }

            if (!bsuccess)
            {
                throw new Exception("could not find output variable " + outletName);
            }

            return(bsuccess);
        }
Пример #3
0
      private void addOutputVariablesFromParameters(string[,] paramTable)
      {
          {
              bool bInOutputSection = false;

              for (int i = 0; i < paramTable.GetLength(0); i++)
              {
                  if (paramTable[i, 0] == "[Output]")
                  {
                      bInOutputSection = true;
                  }

                  if (bInOutputSection)
                  {
                      if (paramTable[i, 0] == "[EndSect]")
                      {
                          bInOutputSection = false;
                      }
                      else
                      {
                          while (paramTable[i, 0] == "<output>")
                          {
                              switch (paramTable[i, 1])
                              {
                              case "Flow":
                                  addOutputVariable(paramTable[i, 2], paramTable[i, 3], paramTable[i, 4]);
                                  break;

                              case "Vol":
                                  addOutputVariable(paramTable[i, 2], SmOutput.OutputType.nodeVolume);
                                  break;

                              case "outletFlow":
                                  addOutputVariable(paramTable[i, 2]);
                                  break;

                              case "GlobalVolume":
                                  addOutputVariable(SmOutput.OutputType.GlobalVolumen);
                                  break;

                              case "NodeWL":
                                  SmOutput xout = new SmOutput();
                                  xout.type    = SmOutput.OutputType.nodeWaterLevel;
                                  xout.name    = paramTable[i, 4];
                                  xout.nodex   = getNode(paramTable[i, 2]);
                                  xout.derived = new DerivedValue(paramTable[i, 5]);
                                  output.addNewDataSeries(xout);
                                  break;

                              default:
                                  throw new NotImplementedException("Unknown connection type: " + paramTable[i, 1]);
                              }

                              i++;
                          }
                      }
                  }
              }
          }
      }
Пример #4
0
        public bool addOutputVariable(SmOutput.outputType type)
        {
            bool bsuccess = false;

            SmOutput xout = new SmOutput();

            xout.type = type;
            xout.name = type.ToString();
            output.addNewDataSeries(xout);
            bsuccess = true;
            return(bsuccess);
        }
Пример #5
0
      public bool addOutputVariable(string fromNode, string toNode, string name)
      {
          bool bsuccess = false;
          Node N1       = getNodeOrDivider(fromNode);
          Node N2       = getNodeOrDivider(toNode);
          // string toName = getNode(toNode).name;
          //problem at outlets for samme index - lav om.

          int  fromIndex    = N1.index;
          int  toIndex      = N2.index;
          bool bFromDivider = false;
          bool bToDivder    = false;

          if (N1 is FlowDivider)
          {
              bFromDivider = true;
          }
          if (N2 is FlowDivider)
          {
              bToDivder = true;
          }

          foreach (Connection con in connections)
          {
              if (con.from == fromIndex && con.to == toIndex)
              {
                  //adapt to dividers
                  if (bFromDivider)
                  {
                      if (!(flowDividers[fromIndex].name == fromNode))
                      {
                          continue;
                      }
                  }
                  if (bToDivder)
                  {
                      if (!(flowDividers[toIndex].name == toNode))
                      {
                          continue;
                      }
                  }
                  //end adapt to dividers
                  SmOutput xout = new SmOutput();
                  xout.name     = name;
                  con.bIsOutput = true;
                  xout.con      = con;
                  output.addNewDataSeries(xout);
                  bsuccess = true;
              }
          }

          return(bsuccess);
      }
Пример #6
0
      public bool addOutputVariable(string outletName)
      {
          bool bsuccess = false;

          foreach (int i in iOutlets)
          {
              if (nodes[i].name == outletName)
              {
                  SmOutput xout = new SmOutput();
                  xout.type    = SmOutput.OutputType.outletFlowTimeSeries;
                  xout.name    = outletName;
                  xout.outletx = (Outlet)nodes[i];
                  output.addNewDataSeries(xout);
                  bsuccess = true;
              }
          }
          if (!bsuccess)
          {
              throw new Exception("could not find output variable " + outletName);
          }
          return(bsuccess);
      }
Пример #7
0
        public bool addOutputVariable(string fromNode, string toNode, string name)
        {
            bool bsuccess = false;

            int fromIndex = getNode(fromNode).index;
            int toIndex   = getNode(toNode).index;

            // string toName = getNode(toNode).name;
            //problem at outlets for samme index - lav om.
            foreach (Connection con in connections)
            {
                if (con.from == fromIndex && con.to == toIndex)
                {
                    SmOutput xout = new SmOutput();
                    xout.name = name;
                    xout.con  = con;
                    output.addNewDataSeries(xout);
                    bsuccess = true;
                }
            }

            return(bsuccess);
        }
Пример #8
0
 public void addNewDataSeries(SmOutput outx)
 {
     dataCollection.Add(outx);
     timeInSeconds.Clear();
 }