I have the following Spec Explorer model (see below) and got the following error:
Description Block(ExplorationRuntimeException#0: "The requested Int32 value '(366 - day) - 6' is symbolic and cannot be converted to a fixed value
Stack trace:
at dayUnitilChr.ModelProgram.daystoChristmas(System.Int32,System.Int32,System.Int32)
" Current executing rule method is dayUnitilChr.ModelProgram.daystoChristmas(System.Int32,System.Int32,System.Int32)), InCall(<error>)
Iwas wondering if anyonehas run
into this problemand how hehas solvedthis
if needed I can share the solution
thank you in advance
kind regards
-------------------------
using
System;
using
System.Collections.Generic;
using
System.Text;
using
Microsoft.Modeling;
namespace
dayUnitilChr
{
///<summary>
///An example model program.
///</summary>
//[TypeBinding("ClassLibrary1.Class1")]
staticclassModelProgram
{
staticboolisFinished = false;
staticstringdaystoChr = " ";
[
AcceptingStateCondition]
publicstaticboolIsFinished()
{
returnisFinished;
}
[
Rule(Action ="daystoChristmas(year, month, day)/result")]
staticstringdaystoChristmas(intyear,intmonth,intday)
{
Combination.Strategy(CombinationStrategy.Coverage);
intdaysLeft = 0;
intfeb = 0;
int[] days =newint[12] { 365, 334, 306, 275, 245, 214, 184, 153, 122, 92, 61, 31 };
boolleap =false;
if(year % 4 == 0 && year % 100 != 0 || year % 400 == 0)
{
leap =
true;
}
if(leap ==true)
{
feb = 1;
}
if(month <= 1)
{
daysLeft = (days[month] + feb) - day - 6;
daystoChr =
"there are "+ daysLeft +" days until Christmas";
}
else
{
daysLeft = (days[month] - day) - 6;
daystoChr =
"there are "+ daysLeft +" days until Christmas";
}
returndaystoChr;
}
}
}