Writing Debug Info to Summary
When developing and debugging Manager
scripts in APSIM Next Gen, it’s helpful to write custom messages to the Summary window.
Purpose
To output internal script data, such as calculated variables, to the Summary window during simulation.
Code Example
using System;
using Models.Core;
using Models.Functions;
namespace Models
{
[Serializable]
public class Script : Model
{
// Link to the Summary model to write messages to the simulation log
[Link] private Summary summary = null;
// Subscribe to the 'DoManagement' event, which is triggered daily
[EventSubscribe("DoManagement")]
private void OnDoManagement(object sender, EventArgs e)
{
.WriteMessage(this, "Hello from manager script", MessageType.Diagnostic);
summary}
}
}
Additional Resources
Manager Model Documentation and Examples
Provides guidance on scripting within the Manager model, including examples of accessing and manipulating model variables.APSIM Next Gen Training Manuals
A collection of tutorials and manuals covering various aspects of APSIM Next Gen.APSIM GitHub Discussions
A community forum for discussing APSIM-related topics and getting help from other users and developers.