Commit f04b1441 authored by Loic Manceau's avatar Loic Manceau
Browse files

Initial commit

parents

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.21005.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SiriusQuality-PhenologyComponent", "SiriusQuality-PhenologyComponent\SiriusQuality-PhenologyComponent.csproj", "{A1EB8F2B-41D4-409F-B46F-CAD0454BA7F4}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SiriusQuality-PhenologyConsole", "SiriusQuality-PhenologyConsole\SiriusQuality-PhenologyConsole.csproj", "{CABB768C-846E-4E22-8842-1929560ADBB7}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTestPhenology", "UnitTestPhenology\UnitTestPhenology.csproj", "{7DA10374-FA1C-45DB-8FB0-FD9D3BD6FFDC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A1EB8F2B-41D4-409F-B46F-CAD0454BA7F4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A1EB8F2B-41D4-409F-B46F-CAD0454BA7F4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A1EB8F2B-41D4-409F-B46F-CAD0454BA7F4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A1EB8F2B-41D4-409F-B46F-CAD0454BA7F4}.Release|Any CPU.Build.0 = Release|Any CPU
{CABB768C-846E-4E22-8842-1929560ADBB7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CABB768C-846E-4E22-8842-1929560ADBB7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CABB768C-846E-4E22-8842-1929560ADBB7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CABB768C-846E-4E22-8842-1929560ADBB7}.Release|Any CPU.Build.0 = Release|Any CPU
{7DA10374-FA1C-45DB-8FB0-FD9D3BD6FFDC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7DA10374-FA1C-45DB-8FB0-FD9D3BD6FFDC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7DA10374-FA1C-45DB-8FB0-FD9D3BD6FFDC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7DA10374-FA1C-45DB-8FB0-FD9D3BD6FFDC}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
/*
-----------------------------------------------------------
Code generated by CRA.ModelLayer.ACC - API Code Generator
http://components.biomamodelling.org/components/acc/help/
Loic Manceau
loic.manceau@inra.fr
INRA
3/29/2018 5:59:40 PM
-----------------------------------------------------------
*/
using System;
using CRA.AgroManagement;
using CRA.ModelLayer.Strategy;
namespace SiriusQualityPhenology
{
/// <summary>
/// SiriusQualityPhenology component model interface
/// </summary>
public interface IStrategySiriusQualityPhenology : IStrategy
{
/// <summary>
/// Calculate method for models
/// </summary>
/// <param name=p>PhenologyState Domain class contains the accessors to values</param>
/// <param name=p1>PhenologyState Domain class contains the accessors to values</param>
/// <param name=ae>AgroManagement objects of impact parameters</param>
void Estimate
( PhenologyState p, PhenologyState p1, ActEvents ae);
/// <summary>
/// Test of pre conditions
/// </summary>
/// <param name=p>PhenologyState Domain class contains the accessors to values</param>
/// <param name=p1>PhenologyState Domain class contains the accessors to values</param>
/// <param name=callID>Preconditions test context</param>
/// <returns>List of violations</returns>
string TestPreConditions( PhenologyState p, PhenologyState p1, string callID);
/// <summary>
/// Test of post-conditions
/// </summary>
/// <param name=p>PhenologyState Domain class contains the accessors to values</param>
/// <param name=p1>PhenologyState Domain class contains the accessors to values</param>
/// <param name=callID>Postconditions test context</param>
/// <returns>List of violations</returns>
string TestPostConditions( PhenologyState p, PhenologyState p1, string callID);
/// <summary>
/// Set parameters to the default value
/// </summary>
void SetParametersDefaultValue();
}
}
/*
----------------------------------------------------------------
Code generated by CRA.ModelLayer.ACC - API Code Generator
http://components.biomamodelling.org/components/acc/help/
Loic Manceau
loic.manceau@inra.fr
INRA
3/29/2018 5:59:40 PM
----------------------------------------------------------------
*/
using System;
using System.Collections.Generic;
using System.Text;
using CRA.AgroManagement;
using CRA.ModelLayer.Core;
namespace SiriusQualityPhenology
{
/// <summary>
/// SiriusQualityPhenology component API
/// </summary>
public class SiriusQualityPhenologyAPI
{
private string _resultPreConditions;
private string _resultPostConditions;
Preconditions p = new Preconditions();
/// <summary>
/// Calculate method for the component
/// </summary>
/// <param name=p>PhenologyState Domain class contains the accessors to values</param>
/// <param name=p1>PhenologyState Domain class contains the accessors to values</param>
/// <param name=ae>AgroManagement objects of impact parameters</param>
public void Estimate
(IStrategySiriusQualityPhenology st, PhenologyState p, PhenologyState p1, ActEvents ae)
{
st.Estimate
( p, p1, ae);
}
/// <summary>
/// Calculate method for the component with test of preconditions
/// </summary>
/// <param name=p>PhenologyState Domain class contains the accessors to values</param>
/// <param name=p1>PhenologyState Domain class contains the accessors to values</param>
/// <param name=ae>AgroManagement objects of impact parameters</param>
/// <param name="saveLog">Save log via a writer or show on screen</param>
/// <param name="callID">Context description for violations</param>
public void Estimate
(IStrategySiriusQualityPhenology st, PhenologyState s, PhenologyState s1, ActEvents ae, bool saveLog, string callID)
{
_resultPreConditions = String.Empty;
_resultPostConditions = String.Empty;
_resultPreConditions = st.TestPreConditions(s, s1, callID);
st.Estimate(s, s1, ae);
_resultPostConditions = st.TestPostConditions(s, s1, callID);
if (_resultPreConditions != String.Empty || _resultPostConditions != String.Empty)
{
p.TestsOut(_resultPreConditions + _resultPostConditions, saveLog, callID);
}
}
/// <summary>
/// Show the about form with access to the help and codedoc
/// </summary>
public void Info()
{
// The following assumes an about form called AboutBox
//AboutBox a = new AboutBox();
//a.ShowDialog();
}
}
}
/*
-------------------------------------------------------------
Code generated by CRA.ModelLayer.ACC - API Code Generator
http://components.biomamodelling.org/components/acc/help/
Loic Manceau
loic.manceau@inra.fr
INRA
3/29/2018 5:59:40 PM
-------------------------------------------------------------
*/
using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
namespace SiriusQualityPhenology
{
public static class TraceHelper
{
static private System.Diagnostics.TraceSource Source =
new System.Diagnostics.TraceSource(System.Reflection.Assembly.GetExecutingAssembly().GetName().Name);
/// <summary>
/// Writes a trace event message to the trace listeners in the System.Diagnostics.TraceSource.Listeners
/// collection using the specified event type, event identifier, and message.
/// </summary>
/// <param name="eventType">One of the System.Diagnostics.TraceEventType values that specifies the event type of the trace data.</param>
/// <param name="id">A numeric identifier for the event</param>
/// <param name="message">The trace message to write</param>
[System.Diagnostics.Conditional("TRACE")]
public static void TraceEvent(System.Diagnostics.TraceEventType eventType, int id, string message)
{
Source.TraceEvent(eventType, id, message);
Source.Flush();
}
public static void AddListener(TraceListener listener)
{
Source.Listeners.Add(listener);
Source.Switch.Level = ~SourceLevels.Off;
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{A1EB8F2B-41D4-409F-B46F-CAD0454BA7F4}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>SiriusQuality_PhenologyComponent</RootNamespace>
<AssemblyName>SiriusQuality-PhenologyComponent</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\DLLs\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<StartupObject />
</PropertyGroup>
<ItemGroup>
<Reference Include="CRA.AgroManagement2014">
<HintPath>..\BioMa-DLL\CRA.AgroManagement2014.dll</HintPath>
</Reference>
<Reference Include="CRA.AgroManagement2014.Impacts">
<HintPath>..\BioMa-DLL\CRA.AgroManagement2014.Impacts.dll</HintPath>
</Reference>
<Reference Include="CRA.AgroManagement2014.Rules">
<HintPath>..\BioMa-DLL\CRA.AgroManagement2014.Rules.dll</HintPath>
</Reference>
<Reference Include="CRA.Core.Preconditions">
<HintPath>..\BioMa-DLL\CRA.Core.Preconditions.dll</HintPath>
</Reference>
<Reference Include="CRA.ModelLayer">
<HintPath>..\BioMa-DLL\CRA.ModelLayer.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.XML" />
<Reference Include="System.Xml.Linq" />
</ItemGroup>
<ItemGroup>
<Compile Include="API\IStrategySiriusQualityPhenology.cs" />
<Compile Include="API\SiriusQualityPhenologyAPI.cs" />
<Compile Include="API\TraceHelper.cs" />
<Compile Include="domainClass\Calendar.cs" />
<Compile Include="domainClass\Phase.cs" />
<Compile Include="domainClass\PhenologyState.cs" />
<Compile Include="domainClass\PhenologyStateVarInfo.cs" />
<Compile Include="Strategies\CalculateGAImean.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Strategies\CalculateLeafNumber.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Strategies\CalculatePhyllochron.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Strategies\CalculatePhyllochronWithPTQ.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Strategies\CalculatePhyllochronWOSowingCorrection.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Strategies\CalculatePhylSowingDateCorrection.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Strategies\CalculatePTQ.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Strategies\CalculateShootNumber.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Strategies\CalculateVernalizationProgress.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Strategies\Phenology.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Strategies\RegisterZadok.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Strategies\UpdateLeafFlag.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Strategies\UpdatePhase.cs">
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectView>ShowAllFiles</ProjectView>
</PropertyGroup>
</Project>
\ No newline at end of file
//Author:Loic Manceau loic.manceau@inra.fr
//Institution:INRA
//Author of revision:
//Date first release:6/4/2018
//Date of revision:
using System;
using System.Collections.Generic;
using System.Xml;
using System.Linq;
using CRA.ModelLayer.MetadataTypes;
using CRA.ModelLayer.Core;
using CRA.ModelLayer.Strategy;
using System.Reflection;
using VarInfo=CRA.ModelLayer.Core.VarInfo;
using Preconditions=CRA.ModelLayer.Core.Preconditions;
using SiriusQualityPhenology;
using CRA.AgroManagement;
//To make this project compile please add the reference to assembly: SiriusQuality-PhenologyComponent, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
//To make this project compile please add the reference to assembly: CRA.ModelLayer, Version=1.0.5212.29139, Culture=neutral, PublicKeyToken=null
//To make this project compile please add the reference to assembly: mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
//To make this project compile please add the reference to assembly: CRA.AgroManagement2014, Version=0.8.0.0, Culture=neutral, PublicKeyToken=null
//To make this project compile please add the reference to assembly: System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;
namespace SiriusQualityPhenology.Strategies
{
/// <summary>
///Class CalculateGAImean
/// Calculate Average Green Area Index on the TTWindowForPTQ thermal time periode
/// </summary>
public class CalculateGAImean : IStrategySiriusQualityPhenology
{
#region Constructor
public CalculateGAImean()
{
ModellingOptions mo0_0 = new ModellingOptions();
//Parameters
List<VarInfo> _parameters0_0 = new List<VarInfo>();
VarInfo v1 = new VarInfo();
v1.DefaultValue = 70;
v1.Description = "Thermal time window in which averages are computed";
v1.Id = 0;
v1.MaxValue = 70000;
v1.MinValue = 0;
v1.Name = "TTWindowForPTQ";
v1.Size = 1;
v1.Units = "°Cd";
v1.URL = "";
v1.VarType = CRA.ModelLayer.Core.VarInfo.Type.STATE;
v1.ValueType = VarInfoValueTypes.GetInstanceForName("Double");
_parameters0_0.Add(v1);
mo0_0.Parameters=_parameters0_0;
//Inputs
List<PropertyDescription> _inputs0_0 = new List<PropertyDescription>();
PropertyDescription pd1 = new PropertyDescription();
pd1.DomainClassType = typeof(SiriusQualityPhenology.PhenologyState);
pd1.PropertyName = "ListGAITTWindowForPTQ";
pd1.PropertyType = (( SiriusQualityPhenology.PhenologyStateVarInfo.ListGAITTWindowForPTQ)).ValueType.TypeForCurrentValue;
pd1.PropertyVarInfo =( SiriusQualityPhenology.PhenologyStateVarInfo.ListGAITTWindowForPTQ);
_inputs0_0.Add(pd1);
PropertyDescription pd2 = new PropertyDescription();
pd2.DomainClassType = typeof(SiriusQualityPhenology.PhenologyState);
pd2.PropertyName = "ListTTShootTTWindowForPTQ";
pd2.PropertyType = (( SiriusQualityPhenology.PhenologyStateVarInfo.ListTTShootTTWindowForPTQ)).ValueType.TypeForCurrentValue;
pd2.PropertyVarInfo =( SiriusQualityPhenology.PhenologyStateVarInfo.ListTTShootTTWindowForPTQ);
_inputs0_0.Add(pd2);
PropertyDescription pd3 = new PropertyDescription();
pd3.DomainClassType = typeof(SiriusQualityPhenology.PhenologyState);
pd3.PropertyName = "GAI";
pd3.PropertyType = (( SiriusQualityPhenology.PhenologyStateVarInfo.GAI)).ValueType.TypeForCurrentValue;
pd3.PropertyVarInfo =( SiriusQualityPhenology.PhenologyStateVarInfo.GAI);
_inputs0_0.Add(pd3);
PropertyDescription pd4 = new PropertyDescription();
pd4.DomainClassType = typeof(SiriusQualityPhenology.PhenologyState);
pd4.PropertyName = "DeltaTT";
pd4.PropertyType = (( SiriusQualityPhenology.PhenologyStateVarInfo.DeltaTT)).ValueType.TypeForCurrentValue;
pd4.PropertyVarInfo =( SiriusQualityPhenology.PhenologyStateVarInfo.DeltaTT);
_inputs0_0.Add(pd4);
PropertyDescription pd5 = new PropertyDescription();
pd5.DomainClassType = typeof(SiriusQualityPhenology.PhenologyState);
pd5.PropertyName = "pastGAI";
pd5.PropertyType = (( SiriusQualityPhenology.PhenologyStateVarInfo.pastGAI)).ValueType.TypeForCurrentValue;
pd5.PropertyVarInfo =( SiriusQualityPhenology.PhenologyStateVarInfo.pastGAI);
_inputs0_0.Add(pd5);
mo0_0.Inputs=_inputs0_0;
//Outputs
List<PropertyDescription> _outputs0_0 = new List<PropertyDescription>();
PropertyDescription pd6 = new PropertyDescription();
pd6.DomainClassType = typeof(SiriusQualityPhenology.PhenologyState);
pd6.PropertyName = "ListGAITTWindowForPTQ";
pd6.PropertyType = (( SiriusQualityPhenology.PhenologyStateVarInfo.ListGAITTWindowForPTQ)).ValueType.TypeForCurrentValue;
pd6.PropertyVarInfo =( SiriusQualityPhenology.PhenologyStateVarInfo.ListGAITTWindowForPTQ);
_outputs0_0.Add(pd6);
PropertyDescription pd7 = new PropertyDescription();
pd7.DomainClassType = typeof(SiriusQualityPhenology.PhenologyState);
pd7.PropertyName = "ListTTShootTTWindowForPTQ";
pd7.PropertyType = (( SiriusQualityPhenology.PhenologyStateVarInfo.ListTTShootTTWindowForPTQ)).ValueType.TypeForCurrentValue;
pd7.PropertyVarInfo =( SiriusQualityPhenology.PhenologyStateVarInfo.ListTTShootTTWindowForPTQ);
_outputs0_0.Add(pd7);
PropertyDescription pd8 = new PropertyDescription();
pd8.DomainClassType = typeof(SiriusQualityPhenology.PhenologyState);
pd8.PropertyName = "GAImean";
pd8.PropertyType = (( SiriusQualityPhenology.PhenologyStateVarInfo.GAImean)).ValueType.TypeForCurrentValue;
pd8.PropertyVarInfo =( SiriusQualityPhenology.PhenologyStateVarInfo.GAImean);
_outputs0_0.Add(pd8);
PropertyDescription pd9 = new PropertyDescription();
pd9.DomainClassType = typeof(SiriusQualityPhenology.PhenologyState);
pd9.PropertyName = "pastGAI";
pd9.PropertyType = (( SiriusQualityPhenology.PhenologyStateVarInfo.pastGAI)).ValueType.TypeForCurrentValue;
pd9.PropertyVarInfo =( SiriusQualityPhenology.PhenologyStateVarInfo.pastGAI);
_outputs0_0.Add(pd9);
mo0_0.Outputs=_outputs0_0;
//Associated strategies
List<string> lAssStrat0_0 = new List<string>();
mo0_0.AssociatedStrategies = lAssStrat0_0;
//Adding the modeling options to the modeling options manager
_modellingOptionsManager = new ModellingOptionsManager(mo0_0);
SetStaticParametersVarInfoDefinitions();
SetPublisherData();
}
#endregion
#region Implementation of IAnnotatable
/// <summary>
/// Description of the model
/// </summary>
public string Description
{
get { return "Calculate Average Green Area Index on the TTWindowForPTQ thermal time periode"; }
}
/// <summary>
/// URL to access the description of the model
/// </summary>
public string URL
{
get { return "http://biomamodelling.org"; }
}
#endregion
#region Implementation of IStrategy
/// <summary>
/// Domain of the model.
/// </summary>
public string Domain
{
get { return "Crop"; }
}
/// <summary>
/// Type of the model.
/// </summary>
public string ModelType
{
get { return "Development"; }
}
/// <summary>
/// Declare if the strategy is a ContextStrategy, that is, it contains logic to select a strategy at run time.
/// </summary>
public bool IsContext
{
get { return false; }
}
/// <summary>
/// Timestep to be used with this strategy
/// </summary>
public IList<int> TimeStep
{
get
{
IList<int> ts = new List<int>();
return ts;
}
}
#region Publisher Data
private PublisherData _pd;
private void SetPublisherData()
{
// Set publishers' data
_pd = new CRA.ModelLayer.MetadataTypes.PublisherData();
_pd.Add("Creator", "loic.manceau@inra.fr");
_pd.Add("Date", "6/4/2018");
_pd.Add("Publisher", "INRA");
}
public PublisherData PublisherData
{
get { return _pd; }
}
#endregion
#region ModellingOptionsManager
private ModellingOptionsManager _modellingOptionsManager;
public ModellingOptionsManager ModellingOptionsManager
{
get { return _modellingOptionsManager; }
}
#endregion