diff --git a/PWC.Asim/Algorithms/PWC.Asim.Algorithms.PvFsc/Properties/AssemblyInfo.cs b/PWC.Asim/Algorithms/PWC.Asim.Algorithms.PvFsc/Properties/AssemblyInfo.cs index 78c4db4..170d084 100644 --- a/PWC.Asim/Algorithms/PWC.Asim.Algorithms.PvFsc/Properties/AssemblyInfo.cs +++ b/PWC.Asim/Algorithms/PWC.Asim.Algorithms.PvFsc/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.1.*")] -[assembly: AssemblyFileVersion("2.1.*")] +[assembly: AssemblyVersion("2.2.*")] +[assembly: AssemblyFileVersion("2.2.*")] diff --git a/PWC.Asim/Algorithms/PWC.Asim.Algorithms.PvNone/Properties/AssemblyInfo.cs b/PWC.Asim/Algorithms/PWC.Asim.Algorithms.PvNone/Properties/AssemblyInfo.cs index 70451c2..5b9a71e 100644 --- a/PWC.Asim/Algorithms/PWC.Asim.Algorithms.PvNone/Properties/AssemblyInfo.cs +++ b/PWC.Asim/Algorithms/PWC.Asim.Algorithms.PvNone/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.1.*")] -[assembly: AssemblyFileVersion("2.1.*")] +[assembly: AssemblyVersion("2.2.*")] +[assembly: AssemblyFileVersion("2.2.*")] diff --git a/PWC.Asim/Algorithms/PWC.Asim.Algorithms.PvSimple/Properties/AssemblyInfo.cs b/PWC.Asim/Algorithms/PWC.Asim.Algorithms.PvSimple/Properties/AssemblyInfo.cs index 8010d57..7ea9bf8 100644 --- a/PWC.Asim/Algorithms/PWC.Asim.Algorithms.PvSimple/Properties/AssemblyInfo.cs +++ b/PWC.Asim/Algorithms/PWC.Asim.Algorithms.PvSimple/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.1.*")] -[assembly: AssemblyFileVersion("2.1.*")] +[assembly: AssemblyVersion("2.2.*")] +[assembly: AssemblyFileVersion("2.2.*")] diff --git a/PWC.Asim/Data/Asim Addin.xla b/PWC.Asim/Data/Asim Addin.xla index 6bb3759..73b7243 100644 Binary files a/PWC.Asim/Data/Asim Addin.xla and b/PWC.Asim/Data/Asim Addin.xla differ diff --git a/PWC.Asim/Data/Example.xls b/PWC.Asim/Data/Example.xls index 9e49721..6bc9632 100644 Binary files a/PWC.Asim/Data/Example.xls and b/PWC.Asim/Data/Example.xls differ diff --git a/PWC.Asim/Data/Example.xlsx b/PWC.Asim/Data/Example.xlsx index be75144..a861b7a 100644 Binary files a/PWC.Asim/Data/Example.xlsx and b/PWC.Asim/Data/Example.xlsx differ diff --git a/PWC.Asim/Data/load.zip b/PWC.Asim/Data/load.zip new file mode 100644 index 0000000..65dea2e Binary files /dev/null and b/PWC.Asim/Data/load.zip differ diff --git a/PWC.Asim/Data/tma.bat b/PWC.Asim/Data/tma.bat index 5bd623b..f057b4d 100644 --- a/PWC.Asim/Data/tma.bat +++ b/PWC.Asim/Data/tma.bat @@ -6,7 +6,10 @@ set FILES= echo starting tma with %* > tma.log call :splitFiles %ASIM_OUTPUTFILES% set "FILESBS=%FILES:\=/%" -echo call %1 %FILESBS% >> tma.log +set FILE_NAME="%~nx1" +set FILE_FOLDER="%~dp1" +cd %FILE_FOLDER% +echo call %FILE_NAME% %FILESBS% >> tma.log call %1 %FILESBS% endlocal GOTO:EOF @@ -15,7 +18,8 @@ GOTO:EOF set tosplit=%* for /F "tokens=1,* delims=," %%A in ("%tosplit%") DO ( rem echo parsing %%A - call :FullPath "%%A" FP + call :QuoteString %%A str + call :FullPath !str! FP echo received path !FP! >> tma.log set FILES=!FILES! -get "!FP!" IF [%%B] == [] exit /b @@ -26,3 +30,7 @@ GOTO:EOF :FullPath set "%~2=%~dpnx1" GOTO:EOF + +:QuoteString +for /f "useback tokens=*" %%A in ('%1') do set %~2="%%~A" +GOTO:EOF \ No newline at end of file diff --git a/PWC.Asim/PWC.Asim.ConsoleApp/Program.cs b/PWC.Asim/PWC.Asim.ConsoleApp/Program.cs index 69e5bbd..eded808 100644 --- a/PWC.Asim/PWC.Asim.ConsoleApp/Program.cs +++ b/PWC.Asim/PWC.Asim.ConsoleApp/Program.cs @@ -42,6 +42,7 @@ enum Arguments Algorithm, GeneratorStats, Report, + Eval, Debug } @@ -163,6 +164,10 @@ static void Main(string[] args) _simulator.AddReport(arglist.Dequeue(), arglist.Dequeue()); break; + case Arguments.Eval: + _simulator.AddEval(arglist.Dequeue()); + break; + case Arguments.Debug: log.Debug = true; log.WriteLine("Turning on debug logging"); diff --git a/PWC.Asim/PWC.Asim.ConsoleApp/Properties/AssemblyInfo.cs b/PWC.Asim/PWC.Asim.ConsoleApp/Properties/AssemblyInfo.cs index ddd7ef9..b4120c8 100644 --- a/PWC.Asim/PWC.Asim.ConsoleApp/Properties/AssemblyInfo.cs +++ b/PWC.Asim/PWC.Asim.ConsoleApp/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.1.*")] -[assembly: AssemblyFileVersion("2.1.*")] +[assembly: AssemblyVersion("2.2.*")] +[assembly: AssemblyFileVersion("2.2.*")] diff --git a/PWC.Asim/PWC.Asim.Core/Actors/OutputData.cs b/PWC.Asim/PWC.Asim.Core/Actors/OutputData.cs index e4a4fa9..fbbb3f5 100644 --- a/PWC.Asim/PWC.Asim.Core/Actors/OutputData.cs +++ b/PWC.Asim/PWC.Asim.Core/Actors/OutputData.cs @@ -79,7 +79,7 @@ public OutputData(string filename, string[] vars, uint outputEvery = 1, DateTime _filename = filename; try { - _file = new FileStream(_filename, FileMode.OpenOrCreate, FileAccess.Write); + _file = new FileStream(_filename, FileMode.Create, FileAccess.Write); var buf = new BufferedStream(_file); _stream = new StreamWriter(buf); } diff --git a/PWC.Asim/PWC.Asim.Core/Actors/RunTimeExtentions.cs b/PWC.Asim/PWC.Asim.Core/Actors/RunTimeExtentions.cs new file mode 100644 index 0000000..8864407 --- /dev/null +++ b/PWC.Asim/PWC.Asim.Core/Actors/RunTimeExtentions.cs @@ -0,0 +1,183 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Text.RegularExpressions; +using Microsoft.CSharp; +using PWC.Asim.Core.Contracts; +using PWC.Asim.Core.Exceptions; +using PWC.Asim.Core.Utils; + +namespace PWC.Asim.Core.Actors +{ + class RunTimeExtentions : IActor + { + private readonly SharedContainer _sharedVars = SharedContainer.Instance; + private int _asimRteCnt = 0; + private readonly IList _runTimeExtensions = new List(); + private Delegates.EvalBlock[] _evalBlocks; + // private readonly IList _times = new List(); + + public RunTimeExtentions(IEnumerable files = null) + { + if (files == null) + return; + foreach (var file in files) + { + File.ReadAllLines(file).ToList().ForEach(l => _runTimeExtensions.Add(l)); + } + } + + public void Init() + { + + } + + public void Run(ulong iteration) + { + // DateTime st, et; + if (iteration == 0) + { + if (!_runTimeExtensions.Any()) + return; + Console.WriteLine("RTE Parsing run-time extensions"); + // st = DateTime.Now; + ParseLines(_runTimeExtensions); + // et = DateTime.Now; + // Console.WriteLine("RTE Loaded run-time extensions in {0}s", (et - st).TotalSeconds); + Console.WriteLine("RTE Loaded run-time extensions"); + } + + if (_asimRteCnt == 0) + return; + // run all evals + // st = DateTime.Now; + for (int i = 0; i < _asimRteCnt; i++) + { + _evalBlocks[i](iteration); + } + //et = DateTime.Now; + //_times.Add((et - st).TotalSeconds); + } + + public void Finish() + { + if (_asimRteCnt == 0) + return; + double tot = 0; + //_times.ToList().ForEach(t => tot += t); + //Console.WriteLine("RTE total time {0}s, ave time {1}s", tot, tot / _times.Count); + } + + private void ParseLines(IList lines) + { + var c = new CSharpCodeProvider(); + ICodeCompiler icc = c.CreateCompiler(); + var cp = new CompilerParameters(); + + cp.CompilerOptions = "/t:library"; + cp.GenerateInMemory = true; + + cp.ReferencedAssemblies.Add("system.dll"); + var thisAsembly = typeof(RunTimeExtentions).Assembly.CodeBase; + thisAsembly = new Uri(thisAsembly).LocalPath; + // cp.ReferencedAssemblies.Add("PWC.Asim.Core.dll"); + cp.ReferencedAssemblies.Add(thisAsembly); + + var codeBuilder = new StringBuilder(); + var methods = new StringBuilder(); + var varInstance = new StringBuilder(); + + var sharedVars = new List(); + var wordRegex = new Regex(@"\b[A-Z][A-Za-z0-9]+\b"); + // look for MixedCaseWords in the eval lines + foreach (var line in lines) + { + var matches = wordRegex.Matches(line); + foreach (Match match in matches) + { + sharedVars.Add(match.Value); + } + } + // trim words into an actual list of shared vars: + sharedVars = _sharedVars.GetAllNames().Intersect(sharedVars).ToList(); + + // now go back and replace real shared "Name" with "Name.Val" + foreach (var line in lines) + { + if (string.IsNullOrWhiteSpace(line)) + continue; + string replacedLine = line; + sharedVars.ForEach(s => replacedLine = replacedLine.Replace(s, s + ".Val")); + // build the list of methods + methods.Append(string.Format(MethodFmt, _asimRteCnt++, replacedLine, _asimRteCnt)); + } + + foreach (var v in sharedVars) + { + // build the list of private shared var instances + varInstance.Append(string.Format(InstanceFmt, v)); + } + // build the code + codeBuilder.Append(string.Format(PlumbingFmt, varInstance, methods)); + + var code = codeBuilder.ToString(); + CompilerResults cr = icc.CompileAssemblyFromSource(cp, code); + if (cr.Errors.Count > 0) + { + var e = cr.Errors[0]; + Console.WriteLine("RTE ERROR on line {0}: {1}", e.Line, e.ErrorText); + Console.WriteLine("=========="); + var l = 1; + foreach (var line in code.Split('\n')) + { + Console.WriteLine("{0,3}: {1}", l++, line); + } + Console.WriteLine("=========="); + throw new SimulationException("The Run Time Evalution file failed to compile."); + } + + Console.WriteLine("RTE compiled successfully."); + + Assembly a = cr.CompiledAssembly; + object rteClass = a.CreateInstance("PWC.Asim.Core.Eval.AsimRteClass"); + Type t = rteClass.GetType(); + _evalBlocks = new Delegates.EvalBlock[_asimRteCnt]; + for (int i = 0; i < _asimRteCnt; i++) + { + MethodInfo evalFunc = t.GetMethod("EvalMethod" + i); + var d = Delegate.CreateDelegate(typeof(Delegates.EvalBlock), rteClass, evalFunc); + _evalBlocks[i] = (Delegates.EvalBlock)d; + } + } + + const string PlumbingFmt = @" +using System; +using PWC.Asim.Core.Utils; +namespace PWC.Asim.Core.Eval +{{ + public class AsimRteClass + {{ + private static readonly SharedContainer Share = SharedContainer.Instance; +// Begin Instances of shared variables +{0} +// End Instances of shared variables + +// Begin definition of methods to evaluate +{1} +// End definition of methods to evaluate + }} +}}"; + const string InstanceFmt = @" private readonly Shared {0} = Share.GetOrNew(""{0}""); +"; + const string MethodFmt = @" + public object EvalMethod{0}(ulong it) + {{ + return {1}; // eval line {2} + }} +"; + } +} diff --git a/PWC.Asim/PWC.Asim.Core/Contracts/Delegates.cs b/PWC.Asim/PWC.Asim.Core/Contracts/Delegates.cs index 210bb40..594dee4 100644 --- a/PWC.Asim/PWC.Asim.Core/Contracts/Delegates.cs +++ b/PWC.Asim/PWC.Asim.Core/Contracts/Delegates.cs @@ -37,5 +37,12 @@ public class Delegates public delegate double SolarController(double pvAvailP, double lastSetP, double genP, double genSpinP, double genIdealP, double loadP, double statSpinSetP, double switchDownP); + + /// + /// All eval blocks will be run in a method with this signature. The return type is ignored. + /// + /// The current iteration + /// + public delegate object EvalBlock(ulong it); } } diff --git a/PWC.Asim/PWC.Asim.Core/PWC.Asim.Core.csproj b/PWC.Asim/PWC.Asim.Core/PWC.Asim.Core.csproj index c841996..0d2ad3e 100644 --- a/PWC.Asim/PWC.Asim.Core/PWC.Asim.Core.csproj +++ b/PWC.Asim/PWC.Asim.Core/PWC.Asim.Core.csproj @@ -84,6 +84,7 @@ + diff --git a/PWC.Asim/PWC.Asim.Core/Properties/AssemblyInfo.cs b/PWC.Asim/PWC.Asim.Core/Properties/AssemblyInfo.cs index a476886..66f4999 100644 --- a/PWC.Asim/PWC.Asim.Core/Properties/AssemblyInfo.cs +++ b/PWC.Asim/PWC.Asim.Core/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.1.*")] -[assembly: AssemblyFileVersion("2.1.*")] +[assembly: AssemblyVersion("2.2.*")] +[assembly: AssemblyFileVersion("2.2.*")] diff --git a/PWC.Asim/PWC.Asim.Core/Utils/Simulator.cs b/PWC.Asim/PWC.Asim.Core/Utils/Simulator.cs index 7c777c6..043016f 100644 --- a/PWC.Asim/PWC.Asim.Core/Utils/Simulator.cs +++ b/PWC.Asim/PWC.Asim.Core/Utils/Simulator.cs @@ -65,7 +65,8 @@ private class ReportFile private Timer _timer; private List _inputActors = new List(); private List _outputActors = new List(); - private List _reportFiles = new List(); + private readonly List _reportFiles = new List(); + private readonly List _evalFiles = new List(); private StreamWriter _watchWriter; private readonly Dictionary _controllers = new Dictionary(); private readonly SharedContainer _sharedVars = SharedContainer.Instance; @@ -100,16 +101,22 @@ public void AddReport(string template, string output) _reportFiles.Add(new ReportFile() {Template = template, Output = output}); } + public void AddEval(string file) + { + _evalFiles.Add(file); + } + #endregion Options public void Simulate() { - int nActors = _inputActors.Count + _outputActors.Count + 5; // 5 is number of explicit classes set below + int nActors = _inputActors.Count + _outputActors.Count + 6; // 6 is number of explicit classes set below int iA = 0; var actors = new IActor[nActors]; _inputActors.ForEach(i => actors[iA++] = new NextData(i.Filename, StartTime, i.Recycle)); // add extra simulation actors here. Order is important: + actors[iA++] = new RunTimeExtentions(_evalFiles); actors[iA++] = new Load(); actors[iA++] = new Station(); actors[iA++] = new SheddableLoadMgr(); diff --git a/PWC.Asim/PWC.Asim.ExcelTools/Interface/ConfigSettings.cs b/PWC.Asim/PWC.Asim.ExcelTools/Interface/ConfigSettings.cs index 2235858..2c96c66 100644 --- a/PWC.Asim/PWC.Asim.ExcelTools/Interface/ConfigSettings.cs +++ b/PWC.Asim/PWC.Asim.ExcelTools/Interface/ConfigSettings.cs @@ -67,6 +67,8 @@ public class ConfigSettings public List Reports { get; set; } + public List EvalFiles { get; set; } + public LogFileInformation LogInformation { get; set; } private DateTime _dateSimulatorRun; @@ -93,6 +95,7 @@ public ConfigSettings() Reports = new List(); ExtraArgList = new List>(); BatchCommands = new List>(); + EvalFiles = new List(); RunSimulator = true; _dateSimulatorRun = DateTime.Now; Simulator = Environment.GetEnvironmentVariable("ProgramFiles") + @"\Power Water Corporation\Asim\Asim.exe"; diff --git a/PWC.Asim/PWC.Asim.ExcelTools/Logic/AutomateWorksheet.cs b/PWC.Asim/PWC.Asim.ExcelTools/Logic/AutomateWorksheet.cs index 0a3d2a1..56ebd2b 100644 --- a/PWC.Asim/PWC.Asim.ExcelTools/Logic/AutomateWorksheet.cs +++ b/PWC.Asim/PWC.Asim.ExcelTools/Logic/AutomateWorksheet.cs @@ -296,6 +296,15 @@ private void ParseConfigData(MyWorksheet worksheet) }); break; + case "eval": + for (int j = 2; j <= data.GetLength(1); j++) + { + var cell = data[i, j]; + if (cell != null) + _settings.EvalFiles.Add(cell.ToString()); + } + break; + default: Console.WriteLine("unknown option: '" + s + "'"); break; diff --git a/PWC.Asim/PWC.Asim.ExcelTools/Logic/Simulator.cs b/PWC.Asim/PWC.Asim.ExcelTools/Logic/Simulator.cs index 8c6ca8e..384ab1b 100644 --- a/PWC.Asim/PWC.Asim.ExcelTools/Logic/Simulator.cs +++ b/PWC.Asim/PWC.Asim.ExcelTools/Logic/Simulator.cs @@ -186,6 +186,12 @@ private string GenerateArguments(ConfigSettings settings) } }); + settings.EvalFiles.ForEach(file => + { + args.Append(" --eval "); + args.Append(Helper.Quote + file + Helper.Quote); + }); + if (!string.IsNullOrWhiteSpace(settings.WatchFile) && settings.WatchGlobs.Any()) { args.Append(" --watch "); diff --git a/PWC.Asim/PWC.Asim.ExcelTools/Properties/AssemblyInfo.cs b/PWC.Asim/PWC.Asim.ExcelTools/Properties/AssemblyInfo.cs index 5e10d75..ce1f2ba 100644 --- a/PWC.Asim/PWC.Asim.ExcelTools/Properties/AssemblyInfo.cs +++ b/PWC.Asim/PWC.Asim.ExcelTools/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.1.*")] -[assembly: AssemblyFileVersion("2.1.*")] +[assembly: AssemblyVersion("2.2.*")] +[assembly: AssemblyFileVersion("2.2.*")] diff --git a/PWC.Asim/PWC.Asim.Installer/PWC.Asim.Installer.wixproj b/PWC.Asim/PWC.Asim.Installer/PWC.Asim.Installer.wixproj index 53b6306..8e2027f 100644 --- a/PWC.Asim/PWC.Asim.Installer/PWC.Asim.Installer.wixproj +++ b/PWC.Asim/PWC.Asim.Installer/PWC.Asim.Installer.wixproj @@ -28,14 +28,14 @@ - - $(WixExtDir)\WixUtilExtension.dll - WixUtilExtension - $(WixExtDir)\WixUIExtension.dll WixUIExtension + + $(WixExtDir)\WixUtilExtension.dll + WixUtilExtension + diff --git a/PWC.Asim/PWC.Asim.Installer/Product.wxs b/PWC.Asim/PWC.Asim.Installer/Product.wxs index 668199c..cdcaf32 100644 --- a/PWC.Asim/PWC.Asim.Installer/Product.wxs +++ b/PWC.Asim/PWC.Asim.Installer/Product.wxs @@ -7,7 +7,7 @@ See http://wix.tramontana.co.hu/tutorial and --> - + @@ -28,6 +28,7 @@ See http://wix.tramontana.co.hu/tutorial and + @@ -58,6 +59,7 @@ See http://wix.tramontana.co.hu/tutorial and + @@ -65,6 +67,15 @@ See http://wix.tramontana.co.hu/tutorial and + + + + @@ -117,32 +128,11 @@ See http://wix.tramontana.co.hu/tutorial and - - - - - - - - - - - - - - - - - - - - - - + + + + + @@ -150,13 +140,13 @@ See http://wix.tramontana.co.hu/tutorial and - + + @@ -197,9 +187,6 @@ See http://wix.tramontana.co.hu/tutorial and - - - @@ -210,23 +197,31 @@ See http://wix.tramontana.co.hu/tutorial and + + + + + + + - + WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 and NOT Installed + + NOT Installed + - - - - - - + + + + + + + diff --git a/PWC.Asim/PWC.Asim.Tests/CoreTests.cs b/PWC.Asim/PWC.Asim.Tests/CoreTests.cs index df415dd..0e10e95 100644 --- a/PWC.Asim/PWC.Asim.Tests/CoreTests.cs +++ b/PWC.Asim/PWC.Asim.Tests/CoreTests.cs @@ -32,13 +32,7 @@ class CoreTests : TestBase [SetUp] public void Cleanup() { - // Reset static values to their default (0) - var sharedVars = SharedContainer.Instance; - var vars = sharedVars.GetAllNames(); - foreach (string n in vars) - { - sharedVars.GetExisting(n).Val = 0; - } + CoreCleanup(); } [Test] diff --git a/PWC.Asim/PWC.Asim.Tests/PWC.Asim.Tests.csproj b/PWC.Asim/PWC.Asim.Tests/PWC.Asim.Tests.csproj index 39d1923..175de18 100644 --- a/PWC.Asim/PWC.Asim.Tests/PWC.Asim.Tests.csproj +++ b/PWC.Asim/PWC.Asim.Tests/PWC.Asim.Tests.csproj @@ -50,6 +50,7 @@ + diff --git a/PWC.Asim/PWC.Asim.Tests/Properties/AssemblyInfo.cs b/PWC.Asim/PWC.Asim.Tests/Properties/AssemblyInfo.cs index 5b7dcd2..3b02a6f 100644 --- a/PWC.Asim/PWC.Asim.Tests/Properties/AssemblyInfo.cs +++ b/PWC.Asim/PWC.Asim.Tests/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.1.*")] -[assembly: AssemblyFileVersion("2.1.*")] +[assembly: AssemblyVersion("2.2.*")] +[assembly: AssemblyFileVersion("2.2.*")] diff --git a/PWC.Asim/PWC.Asim.Tests/TestBase.cs b/PWC.Asim/PWC.Asim.Tests/TestBase.cs index 7142b21..73c1afd 100644 --- a/PWC.Asim/PWC.Asim.Tests/TestBase.cs +++ b/PWC.Asim/PWC.Asim.Tests/TestBase.cs @@ -339,5 +339,20 @@ public void InsertFuelConsumption(SharedContainer instance, double fuelConst, in instance.GetOrNew("Gen" + i + "FuelCons5L").Val = 0; } } + + /// + /// Use this function to cleanup shared variables when running core tests. This is + /// not necessary for console app regression tests. + /// + protected void CoreCleanup() + { + // Reset static values to their default (0) + var sharedVars = SharedContainer.Instance; + var vars = sharedVars.GetAllNames(); + foreach (string n in vars) + { + sharedVars.GetExisting(n).Val = 0; + } + } } } diff --git a/PWC.Asim/build.bat b/PWC.Asim/build.bat index 1fef8be..4b7f659 100644 --- a/PWC.Asim/build.bat +++ b/PWC.Asim/build.bat @@ -36,7 +36,7 @@ xcopy Algorithms\PWC.Asim.Algorithms.PvSimple\bin\Release\PWC.Asim.Algorithms.Pv xcopy Algorithms\PWC.Asim.Algorithms.PvFsc\bin\Release\PWC.Asim.Algorithms.PvFsc.dll %BUILDDIR%\bin rem docs -xcopy "..\docs\Model User Manual.pdf" %BUILDDIR%\docs +xcopy "..\docs\Reference Manual.pdf" %BUILDDIR%\docs xcopy "..\docs\InstallingMacro\Excel Addin Installation.pdf" %BUILDDIR%\docs rem Excel Addin diff --git a/README.txt b/README.txt index 6ca43ad..93ca335 100644 --- a/README.txt +++ b/README.txt @@ -19,21 +19,25 @@ along with this program. If not, see . USING Further details on running the program can be found in the manual - -"Model User Manual.pdf", in the docs folder. +"Reference Manaul.pdf", in the docs folder. CONTRIBUTING -Please assign the copyright on all contributions to Power Water Corporation. -Please provide patches to source code in unified diff format. Contributions -can be emailed to the author: -Iain Buchanan, iain DOT buchanan AT radicalsystems DOT com DOT au +Please use the Fork & Pull method to submit a pull request via GitHub. + +All pull requests must include: + - Formatted and tested code + - Updated documentation + - Unit tests to thoroughly test the behaviour and edge cases of your feature / bugfix BUG REPORTS -Due to the nature of this program, please make bug reports as small as possible. -If possible, reproduce the bug using a small set of input and output files. +Due to the large size of output files, please make bug reports as small as possible. +If possible, reproduce the bug using a small set of input and output files representing +a few hours of simulation time. + Include in your bug report all input files and executable files required to reproduce the bug, and detailed steps to reproduce the behaviour, as well as what behaviour you were expecing. diff --git a/docs/QuickStartGuide/1 Download.png b/docs/QuickStartGuide/1 Download.png new file mode 100644 index 0000000..2d1c3f0 Binary files /dev/null and b/docs/QuickStartGuide/1 Download.png differ diff --git a/docs/QuickStartGuide/4.2a Add-Ins.png b/docs/QuickStartGuide/4.2a Add-Ins.png new file mode 100644 index 0000000..e205383 Binary files /dev/null and b/docs/QuickStartGuide/4.2a Add-Ins.png differ diff --git a/docs/QuickStartGuide/4.2b AddIns Excel2010.png b/docs/QuickStartGuide/4.2b AddIns Excel2010.png new file mode 100644 index 0000000..bf4879b Binary files /dev/null and b/docs/QuickStartGuide/4.2b AddIns Excel2010.png differ diff --git a/docs/QuickStartGuide/4.2b Options Excel2010.png b/docs/QuickStartGuide/4.2b Options Excel2010.png new file mode 100644 index 0000000..15d0272 Binary files /dev/null and b/docs/QuickStartGuide/4.2b Options Excel2010.png differ diff --git a/docs/QuickStartGuide/4.3 Simulator Macros.png b/docs/QuickStartGuide/4.3 Simulator Macros.png new file mode 100644 index 0000000..b1af8fb Binary files /dev/null and b/docs/QuickStartGuide/4.3 Simulator Macros.png differ diff --git a/docs/QuickStartGuide/5.4a AsimMenu.png b/docs/QuickStartGuide/5.4a AsimMenu.png new file mode 100644 index 0000000..e56c1d5 Binary files /dev/null and b/docs/QuickStartGuide/5.4a AsimMenu.png differ diff --git a/docs/QuickStartGuide/5.4b AsimMenu.png b/docs/QuickStartGuide/5.4b AsimMenu.png new file mode 100644 index 0000000..777119e Binary files /dev/null and b/docs/QuickStartGuide/5.4b AsimMenu.png differ diff --git a/docs/QuickStartGuide/Quick Start.docx b/docs/QuickStartGuide/Quick Start.docx new file mode 100644 index 0000000..ee8aa15 Binary files /dev/null and b/docs/QuickStartGuide/Quick Start.docx differ diff --git a/docs/QuickStartGuide/Quick Start.pdf b/docs/QuickStartGuide/Quick Start.pdf new file mode 100644 index 0000000..072b906 Binary files /dev/null and b/docs/QuickStartGuide/Quick Start.pdf differ diff --git a/docs/Reference Manual.docx b/docs/Reference Manual.docx index 8525ee1..397110f 100644 Binary files a/docs/Reference Manual.docx and b/docs/Reference Manual.docx differ diff --git a/docs/Reference Manual.pdf b/docs/Reference Manual.pdf index edfe3a9..9b9a444 100644 Binary files a/docs/Reference Manual.pdf and b/docs/Reference Manual.pdf differ