diff --git a/ApsimNG/Presenters/CLEM/ActivityLedgerGridPresenter.cs b/ApsimNG/Presenters/CLEM/ActivityLedgerGridPresenter.cs index ab20b8509f..9c91ab6af2 100644 --- a/ApsimNG/Presenters/CLEM/ActivityLedgerGridPresenter.cs +++ b/ApsimNG/Presenters/CLEM/ActivityLedgerGridPresenter.cs @@ -115,7 +115,10 @@ public void Attach(object model, object view, ExplorerPresenter explorerPresente public void Refresh() { // now get report model to create data as we need to generate the HTML report independent of ApsimNG - Grid.DataSource = (ModelReport as ReportActivitiesPerformed).CreateDataTable(dataStore, Path.GetDirectoryName(this.explorerPresenter.ApsimXFile.FileName), Utility.Configuration.Settings.DarkTheme); + Grid.DataSource = !Utility.Configuration.Settings.ThemeRestartRequired ? + (ModelReport as ReportActivitiesPerformed).CreateDataTable(dataStore, Path.GetDirectoryName(this.explorerPresenter.ApsimXFile.FileName), Utility.Configuration.Settings.DarkTheme) : + (ModelReport as ReportActivitiesPerformed).CreateDataTable(dataStore, Path.GetDirectoryName(this.explorerPresenter.ApsimXFile.FileName), !Utility.Configuration.Settings.DarkTheme); + this.Grid.LockLeftMostColumns(1); // lock activity name. } diff --git a/ApsimNG/Presenters/CLEM/LabourAllocationPresenter.cs b/ApsimNG/Presenters/CLEM/LabourAllocationPresenter.cs index 045a8300ec..8221b40605 100644 --- a/ApsimNG/Presenters/CLEM/LabourAllocationPresenter.cs +++ b/ApsimNG/Presenters/CLEM/LabourAllocationPresenter.cs @@ -125,32 +125,13 @@ private string CreateHTML() // Start building table // apply theme based settings - if (!Utility.Configuration.Settings.DarkTheme) + if (!Utility.Configuration.Settings.ThemeRestartRequired) { - // light theme - htmlString = htmlString.Replace("[FontColor]", "#000000"); - htmlString = htmlString.Replace("[GridColor]", "Black"); - htmlString = htmlString.Replace("[WarningBackground]", "#FFFFFA"); - htmlString = htmlString.Replace("[MessageBackground]", "#FAFAFF"); - htmlString = htmlString.Replace("[DisabledColour]", "#cccccc"); - htmlString = htmlString.Replace("[TableBackground]", "background-color: white;"); - htmlString = htmlString.Replace("[ContDefaultBack]", "#FAFAFA"); - htmlString = htmlString.Replace("[ContDefaultBanner]", "#000"); - htmlString = htmlString.Replace("[HeaderFontColor]", "white"); - + htmlString = !Utility.Configuration.Settings.DarkTheme ? ModifyHTMLStyle(htmlString, false) : ModifyHTMLStyle(htmlString, true); } else { - // dark theme - htmlString = htmlString.Replace("[FontColor]", "#E5E5E5"); - htmlString = htmlString.Replace("[GridColor]", "#888"); - htmlString = htmlString.Replace("[WarningBackground]", "rgba(255, 102, 0, 0.4)"); - htmlString = htmlString.Replace("[MessageBackground]", "rgba(100, 149, 237, 0.4)"); - htmlString = htmlString.Replace("[DisabledColour]", "#666666"); - htmlString = htmlString.Replace("[TableBackground]", "background-color: rgba(50, 50, 50, 0.5);"); - htmlString = htmlString.Replace("[ContDefaultBack]", "#282828"); - htmlString = htmlString.Replace("[ContDefaultBanner]", "#686868"); - htmlString = htmlString.Replace("[HeaderFontColor]", "#333333"); + htmlString = !Utility.Configuration.Settings.DarkTheme ? ModifyHTMLStyle(htmlString, true) : ModifyHTMLStyle(htmlString, false); } // get CLEM Zone @@ -276,6 +257,8 @@ private string CreateHTML() } } + + private string TableRowHTML(IModel model) { // create row @@ -515,5 +498,38 @@ public void Detach() { } + private static string ModifyHTMLStyle(string htmlString, bool isDarkMode ) + { + string reformattedHTML = htmlString; + if ( isDarkMode ) + { + // dark theme + reformattedHTML = reformattedHTML.Replace("[FontColor]", "#E5E5E5"); + reformattedHTML = reformattedHTML.Replace("[GridColor]", "#888"); + reformattedHTML = reformattedHTML.Replace("[WarningBackground]", "rgba(255, 102, 0, 0.4)"); + reformattedHTML = reformattedHTML.Replace("[MessageBackground]", "rgba(100, 149, 237, 0.4)"); + reformattedHTML = reformattedHTML.Replace("[DisabledColour]", "#666666"); + reformattedHTML = reformattedHTML.Replace("[TableBackground]", "background-color: rgba(50, 50, 50, 0.5);"); + reformattedHTML = reformattedHTML.Replace("[ContDefaultBack]", "#282828"); + reformattedHTML = reformattedHTML.Replace("[ContDefaultBanner]", "#686868"); + reformattedHTML = reformattedHTML.Replace("[HeaderFontColor]", "#333333"); + } + else + { + // light theme + reformattedHTML = reformattedHTML.Replace("[FontColor]", "#000000"); + reformattedHTML = reformattedHTML.Replace("[GridColor]", "Black"); + reformattedHTML = reformattedHTML.Replace("[WarningBackground]", "#FFFFFA"); + reformattedHTML = reformattedHTML.Replace("[MessageBackground]", "#FAFAFF"); + reformattedHTML = reformattedHTML.Replace("[DisabledColour]", "#cccccc"); + reformattedHTML = reformattedHTML.Replace("[TableBackground]", "background-color: white;"); + reformattedHTML = reformattedHTML.Replace("[ContDefaultBack]", "#FAFAFA"); + reformattedHTML = reformattedHTML.Replace("[ContDefaultBanner]", "#000"); + reformattedHTML = reformattedHTML.Replace("[HeaderFontColor]", "white"); + } + + return reformattedHTML; + } + } } diff --git a/ApsimNG/Presenters/CLEM/MessagePresenter.cs b/ApsimNG/Presenters/CLEM/MessagePresenter.cs index 06eca10a43..d6d2e8c592 100644 --- a/ApsimNG/Presenters/CLEM/MessagePresenter.cs +++ b/ApsimNG/Presenters/CLEM/MessagePresenter.cs @@ -246,31 +246,13 @@ private string CreateHTML() "\n\n\n"; // apply theme based settings - if (!Utility.Configuration.Settings.DarkTheme) + if (!Utility.Configuration.Settings.ThemeRestartRequired) { - // light theme - htmlString = htmlString.Replace("[FontColor]", "#000000"); - - htmlString = htmlString.Replace("[ContError]", "#FFFAFA"); - htmlString = htmlString.Replace("[ContWarn]", "#FFFFFA"); - htmlString = htmlString.Replace("[ContMessage]", "#FAFAFF"); - htmlString = htmlString.Replace("[ContOK]", "#FAFFFF"); - // values - htmlString = htmlString.Replace("[ValueSetBack]", "#e8fbfc"); - htmlString = htmlString.Replace("[ValueSetFont]", "#000000"); + htmlString = !Utility.Configuration.Settings.DarkTheme ? ModifyHTMLStyle(htmlString, false) : ModifyHTMLStyle(htmlString, true); } else { - // dark theme - htmlString = htmlString.Replace("[FontColor]", "#E5E5E5"); - - htmlString = htmlString.Replace("[ContError]", "#490000"); - htmlString = htmlString.Replace("[ContWarn]", "#A35D00"); - htmlString = htmlString.Replace("[ContMessage]", "#030028"); - htmlString = htmlString.Replace("[ContOK]", "#0C440C"); - // values - htmlString = htmlString.Replace("[ValueSetBack]", "#49adc4"); - htmlString = htmlString.Replace("[ValueSetFont]", "#0e2023"); + htmlString = !Utility.Configuration.Settings.DarkTheme ? ModifyHTMLStyle(htmlString, true) : ModifyHTMLStyle(htmlString, false); } @@ -442,5 +424,38 @@ public void Detach() { } + private static string ModifyHTMLStyle(string htmlString, bool isDarkMode ) + { + string reformattedHTML = htmlString; + if ( isDarkMode ) + { + // dark theme + reformattedHTML = reformattedHTML.Replace("[FontColor]", "#E5E5E5"); + + reformattedHTML = reformattedHTML.Replace("[ContError]", "#490000"); + reformattedHTML = reformattedHTML.Replace("[ContWarn]", "#A35D00"); + reformattedHTML = reformattedHTML.Replace("[ContMessage]", "#030028"); + reformattedHTML = reformattedHTML.Replace("[ContOK]", "#0C440C"); + // values + reformattedHTML = reformattedHTML.Replace("[ValueSetBack]", "#49adc4"); + reformattedHTML = reformattedHTML.Replace("[ValueSetFont]", "#0e2023"); + } + else + { + // light theme + reformattedHTML = reformattedHTML.Replace("[FontColor]", "#000000"); + + reformattedHTML = reformattedHTML.Replace("[ContError]", "#FFFAFA"); + reformattedHTML = reformattedHTML.Replace("[ContWarn]", "#FFFFFA"); + reformattedHTML = reformattedHTML.Replace("[ContMessage]", "#FAFAFF"); + reformattedHTML = reformattedHTML.Replace("[ContOK]", "#FAFFFF"); + // values + reformattedHTML = reformattedHTML.Replace("[ValueSetBack]", "#e8fbfc"); + reformattedHTML = reformattedHTML.Replace("[ValueSetFont]", "#000000"); + } + + return reformattedHTML; + } + } } diff --git a/ApsimNG/Presenters/GraphPresenter.cs b/ApsimNG/Presenters/GraphPresenter.cs index 6f128b58aa..f4f5822cb8 100644 --- a/ApsimNG/Presenters/GraphPresenter.cs +++ b/ApsimNG/Presenters/GraphPresenter.cs @@ -341,7 +341,7 @@ private void DrawOnView(SeriesDefinition definition) { try { - System.Drawing.Color colour = GetColour(definition.Colour); + System.Drawing.Color colour = definition.Colour; // Create the series and populate it with data. if (definition.Type == SeriesType.Bar) @@ -431,16 +431,6 @@ private void DrawOnView(SeriesDefinition definition) } } - private System.Drawing.Color GetColour(System.Drawing.Color colour) - { - // If dark theme is active, and colour is black, use white instead. - // This won't help at all if the colour is a dark grey. - if (Utility.Configuration.Settings.DarkTheme && colour.R == 0 && colour.G == 0 && colour.B == 0) - return System.Drawing.Color.White; - - return colour; - } - /// Draws the specified series definition on the view. /// The list of annotations private void DrawOnView(IEnumerable annotations) @@ -506,7 +496,7 @@ private void DrawOnView(IEnumerable annotations) textAnnotation.textRotation, AxisPosition.Bottom, AxisPosition.Left, - GetColour(textAnnotation.colour)); + textAnnotation.colour); } else if (annotation is LineAnnotation lineAnnotation) { @@ -517,7 +507,7 @@ private void DrawOnView(IEnumerable annotations) lineAnnotation.y2, lineAnnotation.type, lineAnnotation.thickness, - GetColour(lineAnnotation.colour), + lineAnnotation.colour, lineAnnotation.InFrontOfSeries, lineAnnotation.ToolTip); } diff --git a/ApsimNG/Utility/Configuration.cs b/ApsimNG/Utility/Configuration.cs index e9b7d3b683..04faa3b181 100644 --- a/ApsimNG/Utility/Configuration.cs +++ b/ApsimNG/Utility/Configuration.cs @@ -16,6 +16,8 @@ public class Configuration /// The configuration file private string configurationFile = null; + public bool ThemeRestartRequired = false; + /// The location for the form public Point MainFormLocation { get; set; } @@ -374,6 +376,7 @@ private void OnDarkThemeToggled() { EditorStyleName = DarkTheme ? "Adwaita-dark" : "Adwaita"; + ThemeRestartRequired = !ThemeRestartRequired; } } diff --git a/ApsimNG/Utility/ConfigurationConverter.cs b/ApsimNG/Utility/ConfigurationConverter.cs index efc29d5b1c..d6e484c92c 100644 --- a/ApsimNG/Utility/ConfigurationConverter.cs +++ b/ApsimNG/Utility/ConfigurationConverter.cs @@ -49,7 +49,12 @@ public static Configuration DoConvert(string fileName) XmlSerializer serializer = new XmlSerializer(typeof(Configuration), typeof(Configuration).GetNestedTypes()); using (XmlReader reader = new XmlNodeReader(document)) - return serializer.Deserialize(reader) as Configuration; + { + Configuration configurationSettings = serializer.Deserialize(reader) as Configuration; + // reset to false as this should be false at the beginning of every APSIM launch. + configurationSettings.ThemeRestartRequired = false; + return configurationSettings; + } } /// diff --git a/ApsimNG/Utility/SettingsDialog.cs b/ApsimNG/Utility/SettingsDialog.cs index daf480fad9..0ec58e4fb1 100644 --- a/ApsimNG/Utility/SettingsDialog.cs +++ b/ApsimNG/Utility/SettingsDialog.cs @@ -18,6 +18,7 @@ namespace UserInterface.Views /// public class SettingsDialog : Dialog { + private Window parentWindow = null; private PropertyView propertyEditor; Dictionary properties = new Dictionary(); List> pendingChanges = new List>(); @@ -38,6 +39,7 @@ public SettingsDialog(Window parent) : base("Settings", box = ContentArea; box.PackStart(propertyEditor.MainWidget, true, true, 0); + parentWindow = parent; propertyEditor.MainWidget.ShowAll(); propertyEditor.PropertyChanged += OnPropertyChanged; Refresh(); @@ -143,6 +145,32 @@ private void ApplyChange(PropertyInfo property, object newValue) if (newValue != null && newValue.GetType() != property.PropertyType) newValue = ReflectionUtilities.StringToObject(property.PropertyType, newValue.ToString(), CultureInfo.CurrentCulture); property.SetValue(Configuration.Settings, newValue); + if (property.Name.Equals("DarkTheme")) + { + ShowMsgDialog("Theme will be applied on next restart.", + "Restart Required", + Gtk.MessageType.Info, + ButtonsType.Ok, + parentWindow); + } + } + + /// Show a message in a dialog box + /// The message. + /// Title of the dialog. + /// Message type (info, warning, error, ...). + /// Type of buttons to be shown in the dialog. + /// The error level. + /// The main window. + public int ShowMsgDialog(string message, string title, Gtk.MessageType msgType, Gtk.ButtonsType buttonType, Window masterWindow) + { + MessageDialog md = new Gtk.MessageDialog(masterWindow, Gtk.DialogFlags.Modal, + msgType, buttonType, message); + md.Title = title; + md.WindowPosition = WindowPosition.Center; + int result = md.Run(); + md.Dispose(); + return result; } } } \ No newline at end of file diff --git a/ApsimNG/Views/DirectedGraphView.cs b/ApsimNG/Views/DirectedGraphView.cs index 9406dffab5..9e688ef9c8 100644 --- a/ApsimNG/Views/DirectedGraphView.cs +++ b/ApsimNG/Views/DirectedGraphView.cs @@ -212,7 +212,10 @@ private void OnDrawingAreaExpose(object sender, DrawnArgs args) if (isDrawingArc) arcs.Add(tempArc); - DirectedGraphRenderer.DarkMode = Configuration.Settings.DarkTheme; + // Account for change in theme. + if (!Configuration.Settings.ThemeRestartRequired) + DirectedGraphRenderer.DarkMode = Configuration.Settings.DarkTheme; + else DirectedGraphRenderer.DarkMode = !Configuration.Settings.DarkTheme; DirectedGraphRenderer.Draw(drawingContext, arcs, nodes, selectionRectangle); if (isDrawingArc) diff --git a/ApsimNG/Views/EditorView.cs b/ApsimNG/Views/EditorView.cs index 39b0281611..38cf1f4e43 100644 --- a/ApsimNG/Views/EditorView.cs +++ b/ApsimNG/Views/EditorView.cs @@ -395,7 +395,10 @@ private void InitialiseWidget() StyleScheme style = StyleSchemeManager.Default.GetScheme(Configuration.Settings.EditorStyleName); if (style == null) { - string defaultStyle = Configuration.Settings.DarkTheme ? defaultDarkStyle : defaultLightStyle; + string defaultStyle = ""; + if (!Configuration.Settings.ThemeRestartRequired) + defaultStyle = Configuration.Settings.DarkTheme ? defaultDarkStyle : defaultLightStyle; + else defaultStyle = Configuration.Settings.DarkTheme ? defaultLightStyle : defaultDarkStyle; style = StyleSchemeManager.Default.GetScheme(defaultStyle); } if (style != null) diff --git a/ApsimNG/Views/GraphView.cs b/ApsimNG/Views/GraphView.cs index fac4c7cf36..84db6e11c7 100644 --- a/ApsimNG/Views/GraphView.cs +++ b/ApsimNG/Views/GraphView.cs @@ -165,10 +165,19 @@ protected override void Initialise(ViewBase ownerView, GLib.Object gtkControl) captionLabel.Text = null; captionEventBox.ButtonPressEvent += OnCaptionLabelDoubleClick; } - Color foreground = Utility.Configuration.Settings.DarkTheme ? Color.White : Color.Black; - ForegroundColour = Utility.Colour.ToOxy(foreground); - if (!Utility.Configuration.Settings.DarkTheme) - BackColor = Utility.Colour.ToOxy(Color.White); + + Color foregroundColor = Color.Gray; + if (!Configuration.Settings.ThemeRestartRequired) + foregroundColor = Configuration.Settings.DarkTheme ? Color.White : Color.Black; + else foregroundColor = Configuration.Settings.DarkTheme ? Color.Black : Color.White; + ForegroundColour = Colour.ToOxy(foregroundColor); + + Color backgroundColor = Color.Gray; + if (!Configuration.Settings.ThemeRestartRequired) + backgroundColor = Configuration.Settings.DarkTheme ? Color.FromArgb(255,48,48,48) : Color.White; + else backgroundColor = Configuration.Settings.DarkTheme ? Color.White : Color.FromArgb(255,48,48,48); + BackColor = Colour.ToOxy(backgroundColor); + mainWidget.Destroyed += _mainWidget_Destroyed; // Not sure why but Oxyplot fonts are not scaled correctly on .net core on high DPI screens. diff --git a/ApsimNG/Views/TreeProxyView.cs b/ApsimNG/Views/TreeProxyView.cs index c0c3ebe248..1150e863a9 100644 --- a/ApsimNG/Views/TreeProxyView.cs +++ b/ApsimNG/Views/TreeProxyView.cs @@ -143,8 +143,8 @@ public void DrawGraphs(DataTable spatialData) seriesShade.Title = "Shade"; seriesShade.ItemsSource = pointsShade; aboveGroundGraph.Model.Series.Add(seriesShade); - Color foregroundColour = Utility.Configuration.Settings.DarkTheme ? Color.White : Color.Black; - Color backgroundColour = Utility.Configuration.Settings.DarkTheme ? Color.Black : Color.White; + Color foregroundColour = ConfigureColor(true); + Color backgroundColour = ConfigureColor(false); SetForegroundColour(aboveGroundGraph, foregroundColour); SetBackgroundColour(aboveGroundGraph, backgroundColour); } @@ -201,9 +201,9 @@ public void DrawGraphs(DataTable spatialData) series.ItemsSource = points; belowGroundGraph.Model.Series.Add(series); } - - Color foregroundColour = Utility.Configuration.Settings.DarkTheme ? Color.White : Color.Black; - Color backgroundColour = Utility.Configuration.Settings.DarkTheme ? Color.Black : Color.White; + + Color foregroundColour = ConfigureColor(true); + Color backgroundColour = ConfigureColor(false); SetForegroundColour(belowGroundGraph, foregroundColour); SetBackgroundColour(belowGroundGraph, backgroundColour); } @@ -266,5 +266,37 @@ private void MainWidgetDestroyed(object sender, EventArgs e) ShowError(err); } } + + /// + /// Configures foreground or background color. + /// Used to take into account when a theme is changed and + /// when a restart is required to change a theme. + /// + /// + /// Either Color.Black or Color.White + private Color ConfigureColor(bool isForegroundColor) + { + Color returnColor = Color.FromArgb(255, 48, 48, 48); + if (isForegroundColor) + { + if (Utility.Configuration.Settings.ThemeRestartRequired) + { + returnColor = Utility.Configuration.Settings.DarkTheme ? Color.Black : Color.White; + } + else returnColor = Utility.Configuration.Settings.DarkTheme ? Color.White : Color.Black; + + return returnColor; + } + else + { + if (Utility.Configuration.Settings.ThemeRestartRequired) + { + returnColor = Utility.Configuration.Settings.DarkTheme ? Color.White : Color.Black; + } + else returnColor = Utility.Configuration.Settings.DarkTheme ? Color.Black : Color.White; + + return returnColor; + } + } } } \ No newline at end of file diff --git a/Models/Core/ApsimFile/Converter.cs b/Models/Core/ApsimFile/Converter.cs index 0b72f92e5e..cacb4e73fa 100644 --- a/Models/Core/ApsimFile/Converter.cs +++ b/Models/Core/ApsimFile/Converter.cs @@ -24,7 +24,7 @@ namespace Models.Core.ApsimFile public class Converter { /// Gets the latest .apsimx file format version. - public static int LatestVersion { get { return 177; } } + public static int LatestVersion { get { return 178; } } /// Converts a .apsimx string to the latest version. /// XML or JSON string to convert. @@ -5592,6 +5592,19 @@ private static void UpgradeToVersion177(JObject root, string fileName) } } } + + /// + /// Adds a NitrificationInhibition model to CERESNitrificationModel. + /// + /// + /// + private static void UpgradeToVersion178(JObject root, string fileName) + { + foreach (var rate in JsonUtilities.ChildrenOfType(root, "CERESNitrificationModel")) + { + JsonUtilities.AddConstantFunctionIfNotExists(rate, "NitrificationInhibition", "1.0"); + } + } } } diff --git a/Models/Core/ConfigFile/ConfigFile.cs b/Models/Core/ConfigFile/ConfigFile.cs index e00b4825bd..d03e165991 100644 --- a/Models/Core/ConfigFile/ConfigFile.cs +++ b/Models/Core/ConfigFile/ConfigFile.cs @@ -310,6 +310,7 @@ public static List EncodeSpacesInCommandList(List commandsList) Regex rxBrokenNodeEnd = new Regex(@"([\w])+(\]){1}"); Regex rxNode = new Regex(@"(\[){1}([\w\s])+(\]){1}"); Regex rxFactorSpecification = new Regex(@"(.)*(\=)(.)*(\=)(.)*"); + Regex rxNodeWithChild = new Regex(@"(\[{1})([\w\d\s])*(\]){1}(\.){1}([\w\d\s])*"); List normalizedList = new(); StringBuilder correctedLineString = new(); @@ -369,7 +370,12 @@ public static List EncodeSpacesInCommandList(List commandsList) else if (rxNode.IsMatch(section)) { if (section.Contains('.')) - correctedLineString.Append(section); + { + if (rxNodeWithChild.IsMatch(section) && section != lineSections.Last()) + correctedLineString.Append(section + " "); + else + correctedLineString.Append(section); + } else if (section == lineSections.Last()) correctedLineString.Append(section); else correctedLineString.Append(section + " "); @@ -554,7 +560,7 @@ public static string ReplaceBatchFilePlaceholders(string commandString, DataRow { if (!commandString.Contains('$')) return commandString; - return BatchFile.GetCommandReplacements(commandString, dataRow, dataRowIndex); + return BatchFile.GetCommandReplacements(commandString, dataRow, dataRowIndex); } } } diff --git a/Models/Functions/SoilFunctions/CERESNitrificationModel.cs b/Models/Functions/SoilFunctions/CERESNitrificationModel.cs index 4739c52953..b63aeb7a1b 100644 --- a/Models/Functions/SoilFunctions/CERESNitrificationModel.cs +++ b/Models/Functions/SoilFunctions/CERESNitrificationModel.cs @@ -40,6 +40,12 @@ public class CERESNitrificationModel : Model, IFunction [Units("ppm")] public double ConcentrationAtHalfMax { get; set; } = 90; + /// + /// Nitirification inhibition function. + /// + [Link(Type = LinkType.Child, ByName = true)] + public IFunction NitrificationInhibition { get; set; } + /// Gets the value. /// The value. public double Value(int arrayIndex = -1) @@ -53,7 +59,11 @@ public double Value(int arrayIndex = -1) RateModifier = Math.Min(RateModifier, CERESWF.Value(arrayIndex)); RateModifier = Math.Min(RateModifier, CERESpHF.Value(arrayIndex)); - return PotentialRate * RateModifier; + double inhibitor = 1; + if (NitrificationInhibition != null) + inhibitor = NitrificationInhibition.Value(); + + return PotentialRate * RateModifier * inhibitor; } } } \ No newline at end of file diff --git a/Models/Report/EventReportFrequency.cs b/Models/Report/EventReportFrequency.cs index 370f499b7f..7428fd7e2a 100644 --- a/Models/Report/EventReportFrequency.cs +++ b/Models/Report/EventReportFrequency.cs @@ -1,6 +1,7 @@ using System; using APSIM.Shared.Utilities; using Models.Core; +using Models.Functions; namespace Models { @@ -9,6 +10,7 @@ class EventReportFrequency private readonly Report report; private readonly IEvent events; private readonly string eventName; + private readonly IBooleanFunction expression; /// /// Try and parse a frequency line and return an instance of a IReportFrequency. @@ -22,13 +24,13 @@ public static bool TryParse(string line, Report report, IEvent events) string[] tokens = StringUtilities.SplitStringHonouringBrackets(line, " ", '[', ']'); if (tokens.Length == 1) { - new EventReportFrequency(report, events, tokens[0]); + new EventReportFrequency(report, events, tokens[0], null); return true; } else - if (tokens.Length > 1 && line.IndexOfAny(new char[] { '=', '<', '>', '&', '|' }) == 0) + if (tokens.Length > 1 && line.IndexOfAny(new char[] { '=', '<', '>', '&', '|' }) == 0) { - new EventReportFrequency(report, events, line); + new EventReportFrequency(report, events, line, null); return true; } else @@ -38,16 +40,18 @@ public static bool TryParse(string line, Report report, IEvent events) } /// - /// Private constructor. + /// Constructor. /// /// An instance of the report model. /// An instance of an event publish/subscribe engine. /// The name of the event to subscribe to. - private EventReportFrequency(Report report, IEvent events, string eventName) + /// An expression to also match against + public EventReportFrequency(Report report, IEvent events, string eventName, IBooleanFunction expression = null) { this.report = report; this.events = events; this.eventName = eventName; + this.expression = expression; events.Subscribe(eventName, OnEvent); } @@ -56,7 +60,15 @@ private EventReportFrequency(Report report, IEvent events, string eventName) /// Event data. private void OnEvent(object sender, EventArgs e) { - report.DoOutput(); + if (this.expression == null) + { + report.DoOutput(); + } + else + { + if (this.expression.Value()) + report.DoOutput(); + } } } } diff --git a/Models/Report/ExpressionReportFrequency.cs b/Models/Report/ExpressionReportFrequency.cs index b08b75b9af..ac2a93e9fa 100644 --- a/Models/Report/ExpressionReportFrequency.cs +++ b/Models/Report/ExpressionReportFrequency.cs @@ -1,6 +1,7 @@ using System; using Models.Core; using Models.Functions; +using APSIM.Shared.Utilities; namespace Models { @@ -20,14 +21,64 @@ class ExpressionReportFrequency /// true if line was able to be parsed. public static bool TryParse(string line, Report report, IEvent events, ScriptCompiler compiler) { - line = line.Replace("[", "") - .Replace("]", ""); + + string clean_line = line; + clean_line = clean_line.Replace("[", ""); + clean_line = clean_line.Replace("]", ""); - if (CSharpExpressionFunction.Compile(line, report, compiler, out IBooleanFunction function, out string errorMessages)) + IBooleanFunction function = null; + string errorMessages = ""; + + bool compiled = CSharpExpressionFunction.Compile(clean_line, report, compiler, out function, out errorMessages); + if (compiled) { new ExpressionReportFrequency(report, events, function); return true; } + + //If the line could not be evaluated as an expression, see if part of it was an event, in case we have an event with a condition + + string[] tokens = StringUtilities.SplitStringHonouringBrackets(line, " ", '[', ']'); + int eventIndex = -1; + clean_line = ""; + //find which token is an event + for(int i = 0; i < tokens.Length; i++) { + if (eventIndex < 0) + { + try + { + //If we can subscribe to the event, it is valid. + events.Subscribe(tokens[i], TestEventHandler); + events.Unsubscribe(tokens[i], TestEventHandler); + eventIndex = i; + clean_line += "true "; + } + catch { + //If this fails, it was not a valid event + clean_line += tokens[i] + " "; + } + } + else + { + clean_line += tokens[i] + " "; + } + } + + //if we didn't find an event, then this is just an invalid expression, return false. + if (eventIndex < 0) + return false; + + //if we did, recompile our condition with "true" where the event was + clean_line = clean_line.Trim(); + clean_line = clean_line.Replace("[", ""); + clean_line = clean_line.Replace("]", ""); + compiled = CSharpExpressionFunction.Compile(clean_line, report, compiler, out function, out errorMessages); + if (compiled) + { + new EventReportFrequency(report, events, tokens[eventIndex], function); + return true; + } + return false; } @@ -53,5 +104,13 @@ private void OnDoReport(object sender, EventArgs e) if (expressionFunction.Value()) report.DoOutput(); } + + /// An event handler for testing if a token is a valid event + /// Event sender + /// Event arguments + private static void TestEventHandler(object sender, EventArgs e) + { + //do nothing + } } } diff --git a/Models/Resources/AGPBrowntop.json b/Models/Resources/AGPBrowntop.json index 9d94efe4f7..a22c427be9 100644 --- a/Models/Resources/AGPBrowntop.json +++ b/Models/Resources/AGPBrowntop.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "Name": "Simulations", "Children": [ { diff --git a/Models/Resources/AGPCocksfoot.json b/Models/Resources/AGPCocksfoot.json index e78200b544..164c5da620 100644 --- a/Models/Resources/AGPCocksfoot.json +++ b/Models/Resources/AGPCocksfoot.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "Name": "Simulations", "Children": [ { diff --git a/Models/Resources/AGPKikuyu.json b/Models/Resources/AGPKikuyu.json index f12cdaaa7f..c35f914136 100644 --- a/Models/Resources/AGPKikuyu.json +++ b/Models/Resources/AGPKikuyu.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "Name": "Simulations", "Children": [ { diff --git a/Models/Resources/AGPLucerne.json b/Models/Resources/AGPLucerne.json index 3d673e8dd8..66b45898fe 100644 --- a/Models/Resources/AGPLucerne.json +++ b/Models/Resources/AGPLucerne.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "Name": "Simulations", "Children": [ { diff --git a/Models/Resources/AGPPaspalum.json b/Models/Resources/AGPPaspalum.json index 172968079f..3f6da36e95 100644 --- a/Models/Resources/AGPPaspalum.json +++ b/Models/Resources/AGPPaspalum.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "Name": "Simulations", "Children": [ { diff --git a/Models/Resources/AGPPhalaris.json b/Models/Resources/AGPPhalaris.json index 8cc93de2bf..b3ce61a351 100644 --- a/Models/Resources/AGPPhalaris.json +++ b/Models/Resources/AGPPhalaris.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "Name": "Simulations", "Children": [ { diff --git a/Models/Resources/AGPRedClover.json b/Models/Resources/AGPRedClover.json index d44f8117ee..04f90c44c9 100644 --- a/Models/Resources/AGPRedClover.json +++ b/Models/Resources/AGPRedClover.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "Name": "Simulations", "Children": [ { diff --git a/Models/Resources/AGPRhodes.json b/Models/Resources/AGPRhodes.json index ce0c3ffe80..5c56f49b34 100644 --- a/Models/Resources/AGPRhodes.json +++ b/Models/Resources/AGPRhodes.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "Name": "Simulations", "Children": [ { diff --git a/Models/Resources/AGPRyegrass.json b/Models/Resources/AGPRyegrass.json index 3ade80f7cd..f0978c54a5 100644 --- a/Models/Resources/AGPRyegrass.json +++ b/Models/Resources/AGPRyegrass.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "Name": "Simulations", "Children": [ { diff --git a/Models/Resources/AGPTallFescue.json b/Models/Resources/AGPTallFescue.json index 8b7b0830c2..64cab8d822 100644 --- a/Models/Resources/AGPTallFescue.json +++ b/Models/Resources/AGPTallFescue.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "Name": "Simulations", "Children": [ { diff --git a/Models/Resources/AGPWhiteClover.json b/Models/Resources/AGPWhiteClover.json index 7a2ab6fdb1..87db2cb46a 100644 --- a/Models/Resources/AGPWhiteClover.json +++ b/Models/Resources/AGPWhiteClover.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "Name": "Simulations", "Children": [ { diff --git a/Models/Resources/Barley.json b/Models/Resources/Barley.json index 4235a34d2f..06654bac55 100644 --- a/Models/Resources/Barley.json +++ b/Models/Resources/Barley.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "Name": "Simulations", "Children": [ { diff --git a/Models/Resources/Canola.json b/Models/Resources/Canola.json index 63814b552f..25cb69e66a 100644 --- a/Models/Resources/Canola.json +++ b/Models/Resources/Canola.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "Name": "Simulations", "Children": [ { diff --git a/Models/Resources/Chickpea.json b/Models/Resources/Chickpea.json index dcaa35e4ae..c2a5563c78 100644 --- a/Models/Resources/Chickpea.json +++ b/Models/Resources/Chickpea.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "Name": "Simulations", "Children": [ { diff --git a/Models/Resources/Chicory.json b/Models/Resources/Chicory.json index 0a29fbab98..e3a96b6796 100644 --- a/Models/Resources/Chicory.json +++ b/Models/Resources/Chicory.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "Name": "Simulations", "Children": [ { diff --git a/Models/Resources/Eucalyptus.json b/Models/Resources/Eucalyptus.json index 371e059619..120a213aaf 100644 --- a/Models/Resources/Eucalyptus.json +++ b/Models/Resources/Eucalyptus.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "Name": "Simulations", "Children": [ { diff --git a/Models/Resources/Fertiliser.json b/Models/Resources/Fertiliser.json index 3ed8a83188..a0b9e76bd1 100644 --- a/Models/Resources/Fertiliser.json +++ b/Models/Resources/Fertiliser.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "Name": "Simulations", "Children": [ { diff --git a/Models/Resources/FodderBeet.json b/Models/Resources/FodderBeet.json index d651fbaccb..e051f3ff30 100644 --- a/Models/Resources/FodderBeet.json +++ b/Models/Resources/FodderBeet.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "Name": "Simulations", "Children": [ { diff --git a/Models/Resources/Gliricidia.json b/Models/Resources/Gliricidia.json index b8d66ea91d..850ef446d9 100644 --- a/Models/Resources/Gliricidia.json +++ b/Models/Resources/Gliricidia.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "Name": "Simulations", "Children": [ { diff --git a/Models/Resources/Grapevine.json b/Models/Resources/Grapevine.json index 7413badcfb..b5077abafe 100644 --- a/Models/Resources/Grapevine.json +++ b/Models/Resources/Grapevine.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "Name": "Simulations", "Children": [ { diff --git a/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/Angus.json b/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/Angus.json index 3b3a3d61e3..562fc9ef3d 100644 --- a/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/Angus.json +++ b/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/Angus.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "ApsimVersion": "0.0.0.0", "Name": "Simulations", "Children": [ diff --git a/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/Beef Shorthorn.json b/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/Beef Shorthorn.json index 6ee76d676b..ae927b9c2d 100644 --- a/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/Beef Shorthorn.json +++ b/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/Beef Shorthorn.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "ApsimVersion": "0.0.0.0", "Name": "Simulations", "Children": [ diff --git a/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/Brahman.json b/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/Brahman.json index bb37c0b9a4..d62109c75e 100644 --- a/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/Brahman.json +++ b/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/Brahman.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "ApsimVersion": "0.0.0.0", "Name": "Simulations", "Children": [ diff --git a/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/British x Brahman.json b/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/British x Brahman.json index 9278f1d66d..11697d7401 100644 --- a/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/British x Brahman.json +++ b/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/British x Brahman.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "ApsimVersion": "0.0.0.0", "Name": "Simulations", "Children": [ diff --git a/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/British x Charolais.json b/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/British x Charolais.json index 439eb2b98f..7dc314ee58 100644 --- a/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/British x Charolais.json +++ b/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/British x Charolais.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "ApsimVersion": "0.0.0.0", "Name": "Simulations", "Children": [ diff --git a/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/British x Friesian.json b/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/British x Friesian.json index 099f8806b2..db341fdb1f 100644 --- a/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/British x Friesian.json +++ b/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/British x Friesian.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "ApsimVersion": "0.0.0.0", "Name": "Simulations", "Children": [ diff --git a/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/British x Holstein.json b/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/British x Holstein.json index 1df5a7238c..2f1404758f 100644 --- a/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/British x Holstein.json +++ b/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/British x Holstein.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "ApsimVersion": "0.0.0.0", "Name": "Simulations", "Children": [ diff --git a/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/Charolais x Friesian.json b/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/Charolais x Friesian.json index da2d0a9945..6968ac3fc2 100644 --- a/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/Charolais x Friesian.json +++ b/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/Charolais x Friesian.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "ApsimVersion": "0.0.0.0", "Name": "Simulations", "Children": [ diff --git a/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/Charolais x Holstein.json b/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/Charolais x Holstein.json index 1954631fc5..a40d2add5c 100644 --- a/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/Charolais x Holstein.json +++ b/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/Charolais x Holstein.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "ApsimVersion": "0.0.0.0", "Name": "Simulations", "Children": [ diff --git a/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/Charolais.json b/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/Charolais.json index a417b7221e..555a59f817 100644 --- a/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/Charolais.json +++ b/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/Charolais.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "ApsimVersion": "0.0.0.0", "Name": "Simulations", "Children": [ diff --git a/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/Chianina.json b/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/Chianina.json index f7b933cf68..5f103dde7d 100644 --- a/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/Chianina.json +++ b/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/Chianina.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "ApsimVersion": "0.0.0.0", "Name": "Simulations", "Children": [ diff --git a/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/Hereford.json b/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/Hereford.json index 7908262107..d6ca47eb49 100644 --- a/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/Hereford.json +++ b/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/Hereford.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "ApsimVersion": "0.0.0.0", "Name": "Simulations", "Children": [ diff --git a/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/Limousin.json b/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/Limousin.json index ee2b9183d1..5fb01e97cf 100644 --- a/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/Limousin.json +++ b/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/Limousin.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "ApsimVersion": "0.0.0.0", "Name": "Simulations", "Children": [ diff --git a/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/Simmental.json b/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/Simmental.json index 154d8ad3c1..55537698cc 100644 --- a/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/Simmental.json +++ b/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/Simmental.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "ApsimVersion": "0.0.0.0", "Name": "Simulations", "Children": [ diff --git a/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/South Devon.json b/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/South Devon.json index e95d594c09..28c2fb3e0b 100644 --- a/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/South Devon.json +++ b/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/South Devon.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "ApsimVersion": "0.0.0.0", "Name": "Simulations", "Children": [ diff --git a/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/Ujimqin Cattle.json b/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/Ujimqin Cattle.json index 6051b7a0df..6213989414 100644 --- a/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/Ujimqin Cattle.json +++ b/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/Ujimqin Cattle.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "ApsimVersion": "0.0.0.0", "Name": "Simulations", "Children": [ diff --git a/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/Ujimqin x Angus (1st cross).json b/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/Ujimqin x Angus (1st cross).json index 91e09019ad..26fb2be613 100644 --- a/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/Ujimqin x Angus (1st cross).json +++ b/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/Ujimqin x Angus (1st cross).json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "ApsimVersion": "0.0.0.0", "Name": "Simulations", "Children": [ diff --git a/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/Ujimqin x Angus (2nd cross).json b/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/Ujimqin x Angus (2nd cross).json index d791827d5a..f60c65305b 100644 --- a/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/Ujimqin x Angus (2nd cross).json +++ b/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/Ujimqin x Angus (2nd cross).json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "ApsimVersion": "0.0.0.0", "Name": "Simulations", "Children": [ diff --git a/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/Ujimqin x Charolais (1st cross).json b/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/Ujimqin x Charolais (1st cross).json index 02deadd273..7f2c5780bd 100644 --- a/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/Ujimqin x Charolais (1st cross).json +++ b/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/Ujimqin x Charolais (1st cross).json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "ApsimVersion": "0.0.0.0", "Name": "Simulations", "Children": [ diff --git a/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/Ujimqin x Charolais (2nd cross).json b/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/Ujimqin x Charolais (2nd cross).json index 02a898a671..4dcb91a75e 100644 --- a/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/Ujimqin x Charolais (2nd cross).json +++ b/Models/Resources/GrazPlan/Genotypes/Cattle/Beef/Ujimqin x Charolais (2nd cross).json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "ApsimVersion": "0.0.0.0", "Name": "Simulations", "Children": [ diff --git a/Models/Resources/GrazPlan/Genotypes/Cattle/Dairy/Ayrshire.json b/Models/Resources/GrazPlan/Genotypes/Cattle/Dairy/Ayrshire.json index 12d82578d0..88c0a555fa 100644 --- a/Models/Resources/GrazPlan/Genotypes/Cattle/Dairy/Ayrshire.json +++ b/Models/Resources/GrazPlan/Genotypes/Cattle/Dairy/Ayrshire.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "ApsimVersion": "0.0.0.0", "Name": "Simulations", "Children": [ diff --git a/Models/Resources/GrazPlan/Genotypes/Cattle/Dairy/Brown Swiss.json b/Models/Resources/GrazPlan/Genotypes/Cattle/Dairy/Brown Swiss.json index c64464ead6..13eb186794 100644 --- a/Models/Resources/GrazPlan/Genotypes/Cattle/Dairy/Brown Swiss.json +++ b/Models/Resources/GrazPlan/Genotypes/Cattle/Dairy/Brown Swiss.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "ApsimVersion": "0.0.0.0", "Name": "Simulations", "Children": [ diff --git a/Models/Resources/GrazPlan/Genotypes/Cattle/Dairy/Dairy Shorthorn.json b/Models/Resources/GrazPlan/Genotypes/Cattle/Dairy/Dairy Shorthorn.json index 338b468d3e..bbaca8e35a 100644 --- a/Models/Resources/GrazPlan/Genotypes/Cattle/Dairy/Dairy Shorthorn.json +++ b/Models/Resources/GrazPlan/Genotypes/Cattle/Dairy/Dairy Shorthorn.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "ApsimVersion": "0.0.0.0", "Name": "Simulations", "Children": [ diff --git a/Models/Resources/GrazPlan/Genotypes/Cattle/Dairy/Friesian.json b/Models/Resources/GrazPlan/Genotypes/Cattle/Dairy/Friesian.json index 9c88579ed6..aa3f043e83 100644 --- a/Models/Resources/GrazPlan/Genotypes/Cattle/Dairy/Friesian.json +++ b/Models/Resources/GrazPlan/Genotypes/Cattle/Dairy/Friesian.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "ApsimVersion": "0.0.0.0", "Name": "Simulations", "Children": [ diff --git a/Models/Resources/GrazPlan/Genotypes/Cattle/Dairy/Guernsey.json b/Models/Resources/GrazPlan/Genotypes/Cattle/Dairy/Guernsey.json index 6db01ea1be..6133e9debd 100644 --- a/Models/Resources/GrazPlan/Genotypes/Cattle/Dairy/Guernsey.json +++ b/Models/Resources/GrazPlan/Genotypes/Cattle/Dairy/Guernsey.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "ApsimVersion": "0.0.0.0", "Name": "Simulations", "Children": [ diff --git a/Models/Resources/GrazPlan/Genotypes/Cattle/Dairy/Holstein.json b/Models/Resources/GrazPlan/Genotypes/Cattle/Dairy/Holstein.json index ecbf0efbc0..cbb5347b86 100644 --- a/Models/Resources/GrazPlan/Genotypes/Cattle/Dairy/Holstein.json +++ b/Models/Resources/GrazPlan/Genotypes/Cattle/Dairy/Holstein.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "ApsimVersion": "0.0.0.0", "Name": "Simulations", "Children": [ diff --git a/Models/Resources/GrazPlan/Genotypes/Cattle/Dairy/Jersey.json b/Models/Resources/GrazPlan/Genotypes/Cattle/Dairy/Jersey.json index 6923947220..43ba75607a 100644 --- a/Models/Resources/GrazPlan/Genotypes/Cattle/Dairy/Jersey.json +++ b/Models/Resources/GrazPlan/Genotypes/Cattle/Dairy/Jersey.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "ApsimVersion": "0.0.0.0", "Name": "Simulations", "Children": [ diff --git a/Models/Resources/GrazPlan/Genotypes/Goats/Ujimqin Goats.json b/Models/Resources/GrazPlan/Genotypes/Goats/Ujimqin Goats.json index 0c5b72a643..1e768142cf 100644 --- a/Models/Resources/GrazPlan/Genotypes/Goats/Ujimqin Goats.json +++ b/Models/Resources/GrazPlan/Genotypes/Goats/Ujimqin Goats.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "ApsimVersion": "0.0.0.0", "Name": "Simulations", "Children": [ diff --git a/Models/Resources/GrazPlan/Genotypes/Sheep/Crossbreds/Border Leicester x Merino.json b/Models/Resources/GrazPlan/Genotypes/Sheep/Crossbreds/Border Leicester x Merino.json index b3e6f07dae..6062aa179c 100644 --- a/Models/Resources/GrazPlan/Genotypes/Sheep/Crossbreds/Border Leicester x Merino.json +++ b/Models/Resources/GrazPlan/Genotypes/Sheep/Crossbreds/Border Leicester x Merino.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "ApsimVersion": "0.0.0.0", "Name": "Simulations", "Children": [ diff --git a/Models/Resources/GrazPlan/Genotypes/Sheep/Crossbreds/Dorset x Merino.json b/Models/Resources/GrazPlan/Genotypes/Sheep/Crossbreds/Dorset x Merino.json index 7fb726fb66..826f52efa1 100644 --- a/Models/Resources/GrazPlan/Genotypes/Sheep/Crossbreds/Dorset x Merino.json +++ b/Models/Resources/GrazPlan/Genotypes/Sheep/Crossbreds/Dorset x Merino.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "ApsimVersion": "0.0.0.0", "Name": "Simulations", "Children": [ diff --git a/Models/Resources/GrazPlan/Genotypes/Sheep/Crossbreds/Mongolian x Merino.json b/Models/Resources/GrazPlan/Genotypes/Sheep/Crossbreds/Mongolian x Merino.json index 667b595f4d..62e9dbfe0d 100644 --- a/Models/Resources/GrazPlan/Genotypes/Sheep/Crossbreds/Mongolian x Merino.json +++ b/Models/Resources/GrazPlan/Genotypes/Sheep/Crossbreds/Mongolian x Merino.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "ApsimVersion": "0.0.0.0", "Name": "Simulations", "Children": [ diff --git a/Models/Resources/GrazPlan/Genotypes/Sheep/Meat breeds/Blackface x Whiteface.json b/Models/Resources/GrazPlan/Genotypes/Sheep/Meat breeds/Blackface x Whiteface.json index e0e3fb618c..0ab900831b 100644 --- a/Models/Resources/GrazPlan/Genotypes/Sheep/Meat breeds/Blackface x Whiteface.json +++ b/Models/Resources/GrazPlan/Genotypes/Sheep/Meat breeds/Blackface x Whiteface.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "ApsimVersion": "0.0.0.0", "Name": "Simulations", "Children": [ diff --git a/Models/Resources/GrazPlan/Genotypes/Sheep/Meat breeds/Border Leicester.json b/Models/Resources/GrazPlan/Genotypes/Sheep/Meat breeds/Border Leicester.json index 3934569aaf..cde1232824 100644 --- a/Models/Resources/GrazPlan/Genotypes/Sheep/Meat breeds/Border Leicester.json +++ b/Models/Resources/GrazPlan/Genotypes/Sheep/Meat breeds/Border Leicester.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "ApsimVersion": "0.0.0.0", "Name": "Simulations", "Children": [ diff --git a/Models/Resources/GrazPlan/Genotypes/Sheep/Meat breeds/Cheviot.json b/Models/Resources/GrazPlan/Genotypes/Sheep/Meat breeds/Cheviot.json index bfa5f87754..2fbad8274c 100644 --- a/Models/Resources/GrazPlan/Genotypes/Sheep/Meat breeds/Cheviot.json +++ b/Models/Resources/GrazPlan/Genotypes/Sheep/Meat breeds/Cheviot.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "ApsimVersion": "0.0.0.0", "Name": "Simulations", "Children": [ diff --git a/Models/Resources/GrazPlan/Genotypes/Sheep/Meat breeds/Columbia.json b/Models/Resources/GrazPlan/Genotypes/Sheep/Meat breeds/Columbia.json index c366e71e7e..166207b88f 100644 --- a/Models/Resources/GrazPlan/Genotypes/Sheep/Meat breeds/Columbia.json +++ b/Models/Resources/GrazPlan/Genotypes/Sheep/Meat breeds/Columbia.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "ApsimVersion": "0.0.0.0", "Name": "Simulations", "Children": [ diff --git a/Models/Resources/GrazPlan/Genotypes/Sheep/Meat breeds/Dorset.json b/Models/Resources/GrazPlan/Genotypes/Sheep/Meat breeds/Dorset.json index 76569c77b8..c48f16ff69 100644 --- a/Models/Resources/GrazPlan/Genotypes/Sheep/Meat breeds/Dorset.json +++ b/Models/Resources/GrazPlan/Genotypes/Sheep/Meat breeds/Dorset.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "ApsimVersion": "0.0.0.0", "Name": "Simulations", "Children": [ diff --git a/Models/Resources/GrazPlan/Genotypes/Sheep/Meat breeds/Finnsheep.json b/Models/Resources/GrazPlan/Genotypes/Sheep/Meat breeds/Finnsheep.json index 2d69b46708..703149752a 100644 --- a/Models/Resources/GrazPlan/Genotypes/Sheep/Meat breeds/Finnsheep.json +++ b/Models/Resources/GrazPlan/Genotypes/Sheep/Meat breeds/Finnsheep.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "ApsimVersion": "0.0.0.0", "Name": "Simulations", "Children": [ diff --git a/Models/Resources/GrazPlan/Genotypes/Sheep/Meat breeds/Hampshire.json b/Models/Resources/GrazPlan/Genotypes/Sheep/Meat breeds/Hampshire.json index 54e0d04f7d..aa1853a477 100644 --- a/Models/Resources/GrazPlan/Genotypes/Sheep/Meat breeds/Hampshire.json +++ b/Models/Resources/GrazPlan/Genotypes/Sheep/Meat breeds/Hampshire.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "ApsimVersion": "0.0.0.0", "Name": "Simulations", "Children": [ diff --git a/Models/Resources/GrazPlan/Genotypes/Sheep/Meat breeds/Polypay.json b/Models/Resources/GrazPlan/Genotypes/Sheep/Meat breeds/Polypay.json index d82bae411e..fdc396ce26 100644 --- a/Models/Resources/GrazPlan/Genotypes/Sheep/Meat breeds/Polypay.json +++ b/Models/Resources/GrazPlan/Genotypes/Sheep/Meat breeds/Polypay.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "ApsimVersion": "0.0.0.0", "Name": "Simulations", "Children": [ diff --git a/Models/Resources/GrazPlan/Genotypes/Sheep/Meat breeds/Rambouillet.json b/Models/Resources/GrazPlan/Genotypes/Sheep/Meat breeds/Rambouillet.json index efbe0ae648..54f90a4473 100644 --- a/Models/Resources/GrazPlan/Genotypes/Sheep/Meat breeds/Rambouillet.json +++ b/Models/Resources/GrazPlan/Genotypes/Sheep/Meat breeds/Rambouillet.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "ApsimVersion": "0.0.0.0", "Name": "Simulations", "Children": [ diff --git a/Models/Resources/GrazPlan/Genotypes/Sheep/Meat breeds/Ryeland.json b/Models/Resources/GrazPlan/Genotypes/Sheep/Meat breeds/Ryeland.json index 6b88573f86..e513fd11d4 100644 --- a/Models/Resources/GrazPlan/Genotypes/Sheep/Meat breeds/Ryeland.json +++ b/Models/Resources/GrazPlan/Genotypes/Sheep/Meat breeds/Ryeland.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "ApsimVersion": "0.0.0.0", "Name": "Simulations", "Children": [ diff --git a/Models/Resources/GrazPlan/Genotypes/Sheep/Meat breeds/Southdown (US).json b/Models/Resources/GrazPlan/Genotypes/Sheep/Meat breeds/Southdown (US).json index c067b52abe..c4be768440 100644 --- a/Models/Resources/GrazPlan/Genotypes/Sheep/Meat breeds/Southdown (US).json +++ b/Models/Resources/GrazPlan/Genotypes/Sheep/Meat breeds/Southdown (US).json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "ApsimVersion": "0.0.0.0", "Name": "Simulations", "Children": [ diff --git a/Models/Resources/GrazPlan/Genotypes/Sheep/Meat breeds/Southdown.json b/Models/Resources/GrazPlan/Genotypes/Sheep/Meat breeds/Southdown.json index 10c4880c3d..40952102cc 100644 --- a/Models/Resources/GrazPlan/Genotypes/Sheep/Meat breeds/Southdown.json +++ b/Models/Resources/GrazPlan/Genotypes/Sheep/Meat breeds/Southdown.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "ApsimVersion": "0.0.0.0", "Name": "Simulations", "Children": [ diff --git a/Models/Resources/GrazPlan/Genotypes/Sheep/Meat breeds/Suffolk (US).json b/Models/Resources/GrazPlan/Genotypes/Sheep/Meat breeds/Suffolk (US).json index a7f8bed6f7..1065d43868 100644 --- a/Models/Resources/GrazPlan/Genotypes/Sheep/Meat breeds/Suffolk (US).json +++ b/Models/Resources/GrazPlan/Genotypes/Sheep/Meat breeds/Suffolk (US).json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "ApsimVersion": "0.0.0.0", "Name": "Simulations", "Children": [ diff --git a/Models/Resources/GrazPlan/Genotypes/Sheep/Meat breeds/Suffolk.json b/Models/Resources/GrazPlan/Genotypes/Sheep/Meat breeds/Suffolk.json index 9d7b7e5b7e..c3ca2142c3 100644 --- a/Models/Resources/GrazPlan/Genotypes/Sheep/Meat breeds/Suffolk.json +++ b/Models/Resources/GrazPlan/Genotypes/Sheep/Meat breeds/Suffolk.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "ApsimVersion": "0.0.0.0", "Name": "Simulations", "Children": [ diff --git a/Models/Resources/GrazPlan/Genotypes/Sheep/Meat breeds/Texel.json b/Models/Resources/GrazPlan/Genotypes/Sheep/Meat breeds/Texel.json index 783ddf8cb1..a4e7c83998 100644 --- a/Models/Resources/GrazPlan/Genotypes/Sheep/Meat breeds/Texel.json +++ b/Models/Resources/GrazPlan/Genotypes/Sheep/Meat breeds/Texel.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "ApsimVersion": "0.0.0.0", "Name": "Simulations", "Children": [ diff --git a/Models/Resources/GrazPlan/Genotypes/Sheep/Meat breeds/Ujimqin Sheep.json b/Models/Resources/GrazPlan/Genotypes/Sheep/Meat breeds/Ujimqin Sheep.json index 601eb3f596..2d90c080d0 100644 --- a/Models/Resources/GrazPlan/Genotypes/Sheep/Meat breeds/Ujimqin Sheep.json +++ b/Models/Resources/GrazPlan/Genotypes/Sheep/Meat breeds/Ujimqin Sheep.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "ApsimVersion": "0.0.0.0", "Name": "Simulations", "Children": [ diff --git a/Models/Resources/GrazPlan/Genotypes/Sheep/Wool breeds/Corriedale.json b/Models/Resources/GrazPlan/Genotypes/Sheep/Wool breeds/Corriedale.json index 6fa393badf..821a738b67 100644 --- a/Models/Resources/GrazPlan/Genotypes/Sheep/Wool breeds/Corriedale.json +++ b/Models/Resources/GrazPlan/Genotypes/Sheep/Wool breeds/Corriedale.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "ApsimVersion": "0.0.0.0", "Name": "Simulations", "Children": [ diff --git a/Models/Resources/GrazPlan/Genotypes/Sheep/Wool breeds/Delaine-Merino.json b/Models/Resources/GrazPlan/Genotypes/Sheep/Wool breeds/Delaine-Merino.json index ae72bb042e..c1f8c02be3 100644 --- a/Models/Resources/GrazPlan/Genotypes/Sheep/Wool breeds/Delaine-Merino.json +++ b/Models/Resources/GrazPlan/Genotypes/Sheep/Wool breeds/Delaine-Merino.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "ApsimVersion": "0.0.0.0", "Name": "Simulations", "Children": [ diff --git a/Models/Resources/GrazPlan/Genotypes/Sheep/Wool breeds/Large Merino.json b/Models/Resources/GrazPlan/Genotypes/Sheep/Wool breeds/Large Merino.json index 1ea85ed321..79c9776930 100644 --- a/Models/Resources/GrazPlan/Genotypes/Sheep/Wool breeds/Large Merino.json +++ b/Models/Resources/GrazPlan/Genotypes/Sheep/Wool breeds/Large Merino.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "ApsimVersion": "0.0.0.0", "Name": "Simulations", "Children": [ diff --git a/Models/Resources/GrazPlan/Genotypes/Sheep/Wool breeds/Medium Merino.json b/Models/Resources/GrazPlan/Genotypes/Sheep/Wool breeds/Medium Merino.json index 7671f5c9f6..d96318c79a 100644 --- a/Models/Resources/GrazPlan/Genotypes/Sheep/Wool breeds/Medium Merino.json +++ b/Models/Resources/GrazPlan/Genotypes/Sheep/Wool breeds/Medium Merino.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "ApsimVersion": "0.0.0.0", "Name": "Simulations", "Children": [ diff --git a/Models/Resources/GrazPlan/Genotypes/Sheep/Wool breeds/Polwarth.json b/Models/Resources/GrazPlan/Genotypes/Sheep/Wool breeds/Polwarth.json index ea9c73a347..9edefa4ddb 100644 --- a/Models/Resources/GrazPlan/Genotypes/Sheep/Wool breeds/Polwarth.json +++ b/Models/Resources/GrazPlan/Genotypes/Sheep/Wool breeds/Polwarth.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "ApsimVersion": "0.0.0.0", "Name": "Simulations", "Children": [ diff --git a/Models/Resources/GrazPlan/Genotypes/Sheep/Wool breeds/Romney.json b/Models/Resources/GrazPlan/Genotypes/Sheep/Wool breeds/Romney.json index cd1a69db90..63b31d97d3 100644 --- a/Models/Resources/GrazPlan/Genotypes/Sheep/Wool breeds/Romney.json +++ b/Models/Resources/GrazPlan/Genotypes/Sheep/Wool breeds/Romney.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "ApsimVersion": "0.0.0.0", "Name": "Simulations", "Children": [ diff --git a/Models/Resources/GrazPlan/Genotypes/Sheep/Wool breeds/Small Merino.json b/Models/Resources/GrazPlan/Genotypes/Sheep/Wool breeds/Small Merino.json index e3d6d44470..5a98ac41b0 100644 --- a/Models/Resources/GrazPlan/Genotypes/Sheep/Wool breeds/Small Merino.json +++ b/Models/Resources/GrazPlan/Genotypes/Sheep/Wool breeds/Small Merino.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "ApsimVersion": "0.0.0.0", "Name": "Simulations", "Children": [ diff --git a/Models/Resources/GrazPlan/Genotypes/Sheep/Wool breeds/Targhee.json b/Models/Resources/GrazPlan/Genotypes/Sheep/Wool breeds/Targhee.json index 8ad0c34c8f..a5085d8fec 100644 --- a/Models/Resources/GrazPlan/Genotypes/Sheep/Wool breeds/Targhee.json +++ b/Models/Resources/GrazPlan/Genotypes/Sheep/Wool breeds/Targhee.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "ApsimVersion": "0.0.0.0", "Name": "Simulations", "Children": [ diff --git a/Models/Resources/Maize.json b/Models/Resources/Maize.json index f6ea95056f..ff2cf1d1e7 100644 --- a/Models/Resources/Maize.json +++ b/Models/Resources/Maize.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "Name": "Simulations", "Children": [ { diff --git a/Models/Resources/MicroClimate.json b/Models/Resources/MicroClimate.json index 270f61a81b..cc928b8a0d 100644 --- a/Models/Resources/MicroClimate.json +++ b/Models/Resources/MicroClimate.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "Name": "Simulations", "Children": [ { diff --git a/Models/Resources/Mungbean.json b/Models/Resources/Mungbean.json index a71bfce59d..416931d398 100644 --- a/Models/Resources/Mungbean.json +++ b/Models/Resources/Mungbean.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "Name": "Simulations", "Children": [ { diff --git a/Models/Resources/Nutrient.json b/Models/Resources/Nutrient.json index 9e73613a66..c79219f4de 100644 --- a/Models/Resources/Nutrient.json +++ b/Models/Resources/Nutrient.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "Name": "Simulations", "Children": [ { @@ -1301,6 +1301,11 @@ "Children": [], "Enabled": true, "ReadOnly": false + }, + { + "$type": "Models.Functions.Constant, Models", + "Name": "NitrificationInhibition", + "FixedValue": "1.0" } ], "Enabled": true, diff --git a/Models/Resources/Oats.json b/Models/Resources/Oats.json index 68de98173a..9cd340a3dd 100644 --- a/Models/Resources/Oats.json +++ b/Models/Resources/Oats.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "Name": "Simulations", "Children": [ { diff --git a/Models/Resources/OilPalm.json b/Models/Resources/OilPalm.json index 3be283abba..dd2c4a636f 100644 --- a/Models/Resources/OilPalm.json +++ b/Models/Resources/OilPalm.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "Name": "Simulations", "Children": [ { diff --git a/Models/Resources/Peanut.json b/Models/Resources/Peanut.json index 947f91322a..fcce3cc5e8 100644 --- a/Models/Resources/Peanut.json +++ b/Models/Resources/Peanut.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "Name": "Simulations", "Children": [ { diff --git a/Models/Resources/Pinus.json b/Models/Resources/Pinus.json index af4f3282f3..0978538713 100644 --- a/Models/Resources/Pinus.json +++ b/Models/Resources/Pinus.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "Name": "Simulations", "Children": [ { diff --git a/Models/Resources/PlantainForage.json b/Models/Resources/PlantainForage.json index 6c91bf9ffa..ff45f2092e 100644 --- a/Models/Resources/PlantainForage.json +++ b/Models/Resources/PlantainForage.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "Name": "Simulations", "Children": [ { diff --git a/Models/Resources/Potato.json b/Models/Resources/Potato.json index acee80356d..01e46814c8 100644 --- a/Models/Resources/Potato.json +++ b/Models/Resources/Potato.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "Name": "Simulations", "Children": [ { diff --git a/Models/Resources/RedClover.json b/Models/Resources/RedClover.json index d810a4fc2b..5afabfa30e 100644 --- a/Models/Resources/RedClover.json +++ b/Models/Resources/RedClover.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "Name": "Simulations", "Children": [ { diff --git a/Models/Resources/SCRUM.json b/Models/Resources/SCRUM.json index 4080c50264..34b3abbf4d 100644 --- a/Models/Resources/SCRUM.json +++ b/Models/Resources/SCRUM.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "Name": "Simulations", "Children": [ { diff --git a/Models/Resources/Slurp.json b/Models/Resources/Slurp.json index ab32a0d727..a79b6fbfca 100644 --- a/Models/Resources/Slurp.json +++ b/Models/Resources/Slurp.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "Name": "Simulations", "Children": [ { diff --git a/Models/Resources/Sorghum.json b/Models/Resources/Sorghum.json index c5da927d45..cac1e5574d 100644 --- a/Models/Resources/Sorghum.json +++ b/Models/Resources/Sorghum.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "Name": "Simulations", "Children": [ { diff --git a/Models/Resources/Soybean.json b/Models/Resources/Soybean.json index efa7445500..2630adadc3 100644 --- a/Models/Resources/Soybean.json +++ b/Models/Resources/Soybean.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "Name": "Simulations", "Children": [ { diff --git a/Models/Resources/Sugarcane.json b/Models/Resources/Sugarcane.json index d0f41b75bb..184349e785 100644 --- a/Models/Resources/Sugarcane.json +++ b/Models/Resources/Sugarcane.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "Name": "Simulations", "Children": [ { diff --git a/Models/Resources/SurfaceOrganicMatter.json b/Models/Resources/SurfaceOrganicMatter.json index 250747dddd..8dd280cdbd 100644 --- a/Models/Resources/SurfaceOrganicMatter.json +++ b/Models/Resources/SurfaceOrganicMatter.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "Name": "Simulations", "Children": [ { diff --git a/Models/Resources/WaterBalance.json b/Models/Resources/WaterBalance.json index a8c9ffb529..07f0c0b223 100644 --- a/Models/Resources/WaterBalance.json +++ b/Models/Resources/WaterBalance.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "Name": "Simulations", "Children": [ { diff --git a/Models/Resources/Wheat.json b/Models/Resources/Wheat.json index 4a1c64721a..eb62a613d7 100644 --- a/Models/Resources/Wheat.json +++ b/Models/Resources/Wheat.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "Name": "Simulations", "Children": [ { diff --git a/Models/Resources/WhiteClover.json b/Models/Resources/WhiteClover.json index e12c21cd97..b4584ba4a7 100644 --- a/Models/Resources/WhiteClover.json +++ b/Models/Resources/WhiteClover.json @@ -1,7 +1,7 @@ { "$type": "Models.Core.Simulations, Models", "ExplorerWidth": 0, - "Version": 177, + "Version": 178, "Name": "Simulations", "Children": [ { diff --git a/Tests/UnitTests/CommandLineArgsTests.cs b/Tests/UnitTests/CommandLineArgsTests.cs index f8890dee40..ee4d14cea3 100644 --- a/Tests/UnitTests/CommandLineArgsTests.cs +++ b/Tests/UnitTests/CommandLineArgsTests.cs @@ -869,7 +869,7 @@ public void TestApplySwitch_WithConfigFileWithManagerOverride_ModifiesManager() var modifiedPair = KeyValuePair.Create("StartDate", "2-May"); Assert.That(manager.Parameters.Contains(modifiedPair), Is.True); } - + /// /// Test log switch works as expected. /// @@ -916,17 +916,17 @@ public void InMemoryDBSwitch_WorksWithApplySwitch() string simFileNameWithoutExt = Path.GetFileNameWithoutExtension(sims.FileName); string simsFileName = Path.GetFileName(sims.FileName); string dbFilePath = Path.GetTempPath() + simFileNameWithoutExt + ".db"; - string commandsFilePath = Path.Combine(Path.GetTempPath(),"commands.txt"); - string newFileString = + string commandsFilePath = Path.Combine(Path.GetTempPath(), "commands.txt"); + string newFileString = $"load {simsFileName}{Environment.NewLine}" + $"duplicate [Simulation] Simulation1{Environment.NewLine}" + - $"save {simFileNameWithoutExt + "-new.apsimx"}{Environment.NewLine}"+ + $"save {simFileNameWithoutExt + "-new.apsimx"}{Environment.NewLine}" + $"run{Environment.NewLine}"; - File.WriteAllText(commandsFilePath,newFileString); + File.WriteAllText(commandsFilePath, newFileString); Utilities.RunModels($"--apply {commandsFilePath} --in-memory-db"); var fileInfo = new FileInfo(dbFilePath); long fileLength = fileInfo.Length; - Assert.That(fileLength, Is.EqualTo(4096)); + Assert.That(fileLength, Is.EqualTo(4096)); } [Test] @@ -936,16 +936,16 @@ public void InMemoryDBSwitch_WorksWithApplySwitch_WithFile() string simFileNameWithoutExt = Path.GetFileNameWithoutExtension(sims.FileName); string simsFileName = Path.GetFileName(sims.FileName); string dbFilePath = Path.GetTempPath() + simFileNameWithoutExt + ".db"; - string commandsFilePath = Path.Combine(Path.GetTempPath(),"commands.txt"); - string newFileString = + string commandsFilePath = Path.Combine(Path.GetTempPath(), "commands.txt"); + string newFileString = $"duplicate [Simulation] Simulation1{Environment.NewLine}" + - $"save {simFileNameWithoutExt + "-new.apsimx"}{Environment.NewLine}"+ + $"save {simFileNameWithoutExt + "-new.apsimx"}{Environment.NewLine}" + $"run{Environment.NewLine}"; - File.WriteAllText(commandsFilePath,newFileString); + File.WriteAllText(commandsFilePath, newFileString); Utilities.RunModels($"{sims.FileName} --apply {commandsFilePath} --in-memory-db"); var fileInfo = new FileInfo(dbFilePath); long fileLength = fileInfo.Length; - Assert.That(fileLength, Is.EqualTo(4096)); + Assert.That(fileLength, Is.EqualTo(4096)); } [Test] @@ -958,12 +958,12 @@ public void BatchSwitch_WorksWithApplySwitch_WithFile() string simsFilePath = Path.Combine(Path.GetTempPath(), simsFileName); // Create config file. - string commandsFilePath = Path.Combine(Path.GetTempPath(),"commands.txt"); - string newFileString = + string commandsFilePath = Path.Combine(Path.GetTempPath(), "commands.txt"); + string newFileString = $"[Simulation].Name=$sim-name{Environment.NewLine}" + - $"save {simFileNameWithoutExt + "-new.apsimx"}{Environment.NewLine}"+ + $"save {simFileNameWithoutExt + "-new.apsimx"}{Environment.NewLine}" + $"run{Environment.NewLine}"; - File.WriteAllText(commandsFilePath,newFileString); + File.WriteAllText(commandsFilePath, newFileString); // Create a batch file string batchFilePath = Path.Combine(Path.GetTempPath(), "batch.csv"); @@ -992,13 +992,13 @@ public void BatchSwitch_WorksWithApplySwitch() string simsFilePath = Path.Combine(Path.GetTempPath(), simsFileName); // Create config file. - string commandsFilePath = Path.Combine(Path.GetTempPath(),"commands.txt"); - string newFileString = + string commandsFilePath = Path.Combine(Path.GetTempPath(), "commands.txt"); + string newFileString = $"load {simsFileName}{Environment.NewLine}" + $"[Simulation].Name=$sim-name{Environment.NewLine}" + - $"save {simFileNameWithoutExt + "-new.apsimx"}{Environment.NewLine}"+ + $"save {simFileNameWithoutExt + "-new.apsimx"}{Environment.NewLine}" + $"run{Environment.NewLine}"; - File.WriteAllText(commandsFilePath,newFileString); + File.WriteAllText(commandsFilePath, newFileString); // Create a batch file string batchFilePath = Path.Combine(Path.GetTempPath(), "batch.csv"); @@ -1030,5 +1030,44 @@ public void Test_ListEnabledSimulationNames_OnlyShowsEnabledSimulations() Assert.That(actual, Is.EqualTo(expected)); } + [Test] + public void TestApplySwitch_RecognisesParentNode_WithChild() + { + Simulations file = Utilities.GetRunnableSim(); + Simulations file2 = Utilities.GetRunnableSim(); + Simulations file3 = Utilities.GetRunnableSim(); + + Zone fieldNode = file.FindInScope(); + + // Get path string for the config file that changes the date. + string newApsimFile = file2.FileName; + string savingApsimFileName = file3.FileName; + int indexOfNameStart = savingApsimFileName.LastIndexOf(Path.DirectorySeparatorChar) + 1; + string savingApsimFileNameShort = savingApsimFileName.Substring(indexOfNameStart); + string newFileString = $"add [Simulation].Zone {newApsimFile};[Report]\nsave {savingApsimFileNameShort} "; + string newTempConfigFile = Path.Combine(Path.GetTempPath(), "config2.txt"); + + File.WriteAllText(newTempConfigFile, newFileString); + + bool fileExists = File.Exists(newTempConfigFile); + bool apsimFileExists = File.Exists(newApsimFile); + Assert.That(File.Exists(newTempConfigFile), Is.True); + Assert.That(File.Exists(newApsimFile), Is.True); + + Utilities.RunModels(file, $"--apply {newTempConfigFile}"); + + string text = File.ReadAllText(savingApsimFileName); + // Reload simulation from file text. Needed to see changes made. + Simulations originalSimAfterAdd = FileFormat.ReadFromString(text, e => throw e, false).NewModel as Simulations; + + // Get new values from changed simulation. + Zone fieldNodeAfterChange = originalSimAfterAdd.FindInScope(); + // See if the report shows up as a second child of Field with a specific name. + Models.Report newReportNode = fieldNodeAfterChange.FindChild("Report1"); + Assert.That(newReportNode, Is.Not.Null); + + } + + } } diff --git a/Tests/UnitTests/Report/EventReportFrequencyTests.cs b/Tests/UnitTests/Report/EventReportFrequencyTests.cs index 461826cde1..5d0138766d 100644 --- a/Tests/UnitTests/Report/EventReportFrequencyTests.cs +++ b/Tests/UnitTests/Report/EventReportFrequencyTests.cs @@ -1,12 +1,8 @@ -using APSIM.Shared.Utilities; -using DocumentFormat.OpenXml.Bibliography; using Models; using Models.Core; using Moq; using NUnit.Framework; -using System; using System.Collections.Generic; -using UnitTests.Weather; namespace UnitTests.Reporting { @@ -45,7 +41,7 @@ public void TestReportingDate(string line) /// /// Input line - should be any valid reporting frequency using a model event. [TestCase("[Clock].DoReport")] - [TestCase("[Clock with space].DoReport")] + [TestCase("[Clock with space].DoReport")] public void TestReportingFrequency(string line) { //this is the order lines are parsed by Report.cs @@ -59,6 +55,7 @@ public void TestReportingFrequency(string line) /// /// Input line - should be any valid reporting frequency using a model event. [TestCase("[Clock].Today.Month == 1 && [Clock].Today.Day == 1")] + [TestCase("[Clock].DoReport && [Clock].Today.Year > 2000")] public void TestReportingExpression(string line) { Models.Report report = new Models.Report()