Exemple #1
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++;
                          }
                      }
                  }
              }
          }
      }
Exemple #2
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);
        }