示例#1
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("$", ""));
            }
        }
示例#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("$", ""));
            }
        }
示例#3
0
 public void ChangePiecewiseLinear(string variableName, SimplePiecewise newPiecewise)
 {
     Log(String.Format("Updating  piecewise linear function for {0}", variableName));
     VariableSummary summ =
         new VariableSummary(
             Scenario.Network.FunctionManager.Variables.FirstOrDefault(v => v.FullName == ("$" + variableName)),
             Scenario);
     summ.UpdatePiecewise(newPiecewise);
 }
示例#4
0
        public void UpdatePiecewise(SimplePiecewise newPiecewise)
        {
            LinearVariable linV = (LinearVariable)Variable;

            newPiecewise.ApplyTo(linV);
        }
示例#5
0
 public void UpdatePiecewise(SimplePiecewise newPiecewise)
 {
     LinearVariable linV = (LinearVariable) Variable;
     newPiecewise.ApplyTo(linV);
 }