Exemplo n.º 1
0
 public void UpdateTimeSeries(SimpleTimeSeries newTS)
 {
     var actual = FindTimeSeries();
     actual.init(newTS.AsDate(newTS.StartDate), newTS.AsDate(newTS.EndDate), TimeStep.Daily);
     foreach (TimeSeriesEvent e in newTS.Events)
     {
         actual[newTS.AsDate(e.Date)] = e.Value;
     }
 }
Exemplo n.º 2
0
        public VariableSummary(AbstractFunctionVariable v,RiverSystemScenario scenario)
        {
            Scenario = scenario;
            Variable = v;
            Name = v.Name;
            FullName = v.FullName;
            ID = v.id;
            VariableType = v.GetType().Name;
 
            if (v is BilinearVariable)
            {
                VeneerSupported = false;
            }
            else if (v is ContextVariable)
            {
                VeneerSupported = false;
            }
            else if (v is ModelledVariable)
            {
                VeneerSupported = false;
            }
            else if (v is PatternVariable)
            {
                VeneerSupported = false;
            }
            else if (v is LinearVariable)
            {
                VeneerSupported = true;
                PiecewiseFunctionData = new SimplePiecewise(v as LinearVariable);
                PiecewiseFunction = String.Format("/variables/{0}/Piecewise", FullName.Replace("$", ""));
            }
            else if (v is TimeSeriesVariable)
            {
                VeneerSupported = true;
                var tsV = (TimeSeriesVariable) v;
                VeneerDebugInfo += kvp("DisplayName", tsV.DisplayName) +
                                   kvp("ResultUnit", tsV.ResultUnit.Name);
                TimeSeriesData = new SimpleTimeSeries(FindTimeSeries());
                TimeSeries = String.Format("/variables/{0}/TimeSeries", FullName.Replace("$", ""));
            }
        }
Exemplo n.º 3
0
 public void ChangeInputTimeSeries(string variableName, SimpleTimeSeries newTimeSeries)
 {
     Log(String.Format("Updating time series for {0}", variableName));
     VariableSummary summ =
         new VariableSummary(
             Scenario.Network.FunctionManager.Variables.FirstOrDefault(v => v.FullName == ("$" + variableName)),
             Scenario);
     summ.UpdateTimeSeries(newTimeSeries);
 }