/// <summary>A method that can be called by other models to perform a line of output.</summary> public void DoOutput(object sender, EventArgs args) { object[] valuesToWrite = new object[columns.Count]; for (int i = 0; i < columns.Count; i++) { valuesToWrite[i] = columns[i].GetValue(); } storage.WriteRow(simulation.Name, Name, columnNames, columnUnits, valuesToWrite); }
/// <summary>Write a message to the summary</summary> /// <param name="model">The model writing the message</param> /// <param name="message">The message to write</param> public void WriteMessage(IModel model, string message) { if (CaptureSummaryText) { if (storage == null) { throw new ApsimXException(model, "No datastore is available!"); } string modelPath = Apsim.FullPath(model); string relativeModelPath = modelPath.Replace(Apsim.FullPath(simulation) + ".", string.Empty); object[] values = new object[] { relativeModelPath, clock.Today, message, Convert.ToInt32(Simulation.ErrorLevel.Information) }; storage.WriteRow(simulation.Name, "_Messages", summaryTableColumnNames, null, values); } }
/// <summary>A method that can be called by other models to perform a line of output.</summary> public new void DoOutput() { object[] valuesToWrite = new object[columns.Count]; for (int i = 0; i < columns.Count; i++) { // if contains Pools[ then get the value if (columns[i].Name.Contains("-")) { string[] values = columns[i].Name.Split('-'); double value = grazeStore.GetValueByPoolAge(Convert.ToInt32(values[1]), values[2]); if (value != 0) { valuesToWrite[i] = Math.Round(value, 2); } } else { // otherwise normal approach valuesToWrite[i] = columns[i].GetValue(); } } storage.WriteRow(simulation.Name, Name, columnNames, columnUnits, valuesToWrite); }
/// <summary>Write a message to the summary</summary> /// <param name="model">The model writing the message</param> /// <param name="message">The message to write</param> public void WriteMessage(IModel model, string message) { object[] values = new object[] { relativeModelPath, clock.Today, message, Convert.ToInt32(Simulation.ErrorLevel.Information) }; storage.WriteRow(simulation.Name, "_Messages", summaryTableColumnNames, null, values); }