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("$", "")); } }
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("$", "")); } }
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); }
public void UpdatePiecewise(SimplePiecewise newPiecewise) { LinearVariable linV = (LinearVariable)Variable; newPiecewise.ApplyTo(linV); }
public void UpdatePiecewise(SimplePiecewise newPiecewise) { LinearVariable linV = (LinearVariable) Variable; newPiecewise.ApplyTo(linV); }