<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://help.syscad.net/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Rod.Stephenson</id>
	<title>SysCAD Documentation - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://help.syscad.net/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Rod.Stephenson"/>
	<link rel="alternate" type="text/html" href="https://help.syscad.net/Special:Contributions/Rod.Stephenson"/>
	<updated>2026-06-04T04:46:27Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.4</generator>
	<entry>
		<id>https://help.syscad.net/index.php?title=Array_Class&amp;diff=84627</id>
		<title>Array Class</title>
		<link rel="alternate" type="text/html" href="https://help.syscad.net/index.php?title=Array_Class&amp;diff=84627"/>
		<updated>2026-05-26T15:41:14Z</updated>

		<summary type="html">&lt;p&gt;Rod.Stephenson: /* Member Functions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:PGM]] [[Category:Examples]]&lt;br /&gt;
{{Navigation|[[PGMs]]|[[Class - Introduction|Classes]]}}&lt;br /&gt;
{{User Defined Classes Header Table |currentpage=4}}&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
{{TOC}}&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
The ARRAY class provides member functions to create a &amp;lt;u&amp;gt;dynamic array&amp;lt;/u&amp;gt; and manipulate its elements. &lt;br /&gt;
* The user may read in an array from a file.  The file may be either a CSV file, created using Excel, or a TXT file, created using a test editor such as Notepad++. &lt;br /&gt;
* The user may set constant values into an array when it is declared.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notes:&#039;&#039;&#039;&lt;br /&gt;
# The initial length of the array is zero.&lt;br /&gt;
# &#039;&#039;&#039;The array is zero indexed&#039;&#039;&#039;, i.e. the index of the first element in the array is zero, and NOT 1.  Therefore, the final element in an array of length &#039;&#039;n&#039;&#039; will have an index = &#039;&#039;n-1&#039;&#039;.&lt;br /&gt;
# If the index is out of range (0 &amp;lt;= &#039;&#039;index&#039;&#039; &amp;lt; &#039;&#039;length&#039;&#039;) then a runtime &amp;quot;PGM class execution error&amp;quot; will occur and the ARRAY operation will be ignored.&lt;br /&gt;
# The Array class allows user to Get / Set &#039;&#039;numeric values&#039;&#039; only.  Please see [[StrArray Class]] for getting/setting &#039;&#039;String values&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Data Members ==&lt;br /&gt;
&lt;br /&gt;
None&lt;br /&gt;
&lt;br /&gt;
== Member Functions ==&lt;br /&gt;
The examples in the table below is based on the following variables and array declarations.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;pgm&amp;quot;&amp;gt;&lt;br /&gt;
STRING   ArrayFileName&lt;br /&gt;
REAL     e, DotProduct&lt;br /&gt;
LONG     d&lt;br /&gt;
BIT      OK@, EqualOK@, SortOK@, AddOK@, SubOK@, MultOK@, DivOK@&lt;br /&gt;
ARRAY    a, b, c, NewA, A1, A2, PreVals, z ;declares array instances&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot; &lt;br /&gt;
| width=&amp;quot;15%&amp;quot; |&#039;&#039;&#039;Call &#039;&#039;&#039; || width=&amp;quot;35%&amp;quot; | &#039;&#039;&#039;Functionality&#039;&#039;&#039;|| width=&amp;quot;6%&amp;quot; |&#039;&#039;&#039;Return Type &#039;&#039;&#039; || width=&amp;quot;25%&amp;quot; |&#039;&#039;&#039;Parameters &#039;&#039;&#039; || width=&amp;quot;30%&amp;quot; | &#039;&#039;&#039;Example&#039;&#039;&#039; &lt;br /&gt;
|-&lt;br /&gt;
||&#039;&#039;&#039;SetLen&#039;&#039;&#039;(&#039;&#039;length&#039;&#039;) || Sets the size of the array to &#039;&#039;length&#039;&#039; || || &#039;&#039;length :&#039;&#039; the required length of the array, is of data type INTEGER || a.SetLen(5)&lt;br /&gt;
|-&lt;br /&gt;
||&#039;&#039;&#039;GetLen&#039;&#039;&#039;() || The function returns the length of the array. || integer || None || d = a.GetLen()&lt;br /&gt;
|-&lt;br /&gt;
||&#039;&#039;&#039;SetSize&#039;&#039;&#039;(&#039;&#039;length&#039;&#039;) &amp;lt;br&amp;gt; {{Available139|30807}} || Sets the size of the array to &#039;&#039;length&#039;&#039;. SetSize() function is an equivalent alternative to SetLen() || || &#039;&#039;length :&#039;&#039; the required size of the array, is of data type INTEGER || a.SetSize(5)&lt;br /&gt;
|-&lt;br /&gt;
||&#039;&#039;&#039;Size&#039;&#039;&#039;() &amp;lt;br&amp;gt; {{Available139|30807}} || The function returns the length of the array. Size() function is an equivalent alternative to GetLen(). || integer || None || d = a.Size()&lt;br /&gt;
|-&lt;br /&gt;
|| &#039;&#039;&#039;SetAt&#039;&#039;&#039;(&#039;&#039;index, value&#039;&#039;) || This sets the element of the array, which corresponds to the given &#039;&#039;index&#039;&#039; to the specified &#039;&#039;value&#039;&#039;. || || &#039;&#039;index&#039;&#039;: the index of the required entry in the array (&#039;&#039;&#039;Note:&#039;&#039;&#039; index starts at zero). This is of data type, INTEGER. &amp;lt;br&amp;gt; &#039;&#039;value :&#039;&#039; the value to which the specified element, in the array, will be set. This is of data type, REAL.&#039;&#039; || a.SetAt(0, 3)&amp;lt;br&amp;gt; OR:&amp;lt;br&amp;gt;a[0] = 3&lt;br /&gt;
|-&lt;br /&gt;
||&#039;&#039;&#039;GetAt&#039;&#039;&#039;(&#039;&#039;index&#039;&#039;) || This retrieves the value (type real) of the element from the array, which corresponds to the given &#039;&#039;index&#039;&#039;. || Real || &#039;&#039;index :&#039;&#039; the index of the required entry in the array (&#039;&#039;&#039;Note:&#039;&#039;&#039; index starts at zero). This is of data type INTEGER. || e = a.GetAt(0)&amp;lt;br&amp;gt; or: &amp;lt;br&amp;gt;e = a[0]&lt;br /&gt;
|-&lt;br /&gt;
||&#039;&#039;&#039;IncAt&#039;&#039;&#039;(&#039;&#039;Index, value&#039;&#039;) || This increases the element of the array by the specified value. || || &#039;&#039;index :&#039;&#039; the index of the required entry in the array (&#039;&#039;&#039;Note:&#039;&#039;&#039; index starts at zero). This is of data type INTEGER. &amp;lt;br&amp;gt; &#039;&#039;value :&#039;&#039; the value to which the specified element, in the array, will be increased. This is of data type REAL.&#039;&#039; || &amp;quot;a.IncAt(3, 10)&amp;quot; is equivalent to:&amp;lt;br&amp;gt;temp = a.GetAt(3)&amp;lt;br&amp;gt;a.SetAt(3, temp + 10)&lt;br /&gt;
|-&lt;br /&gt;
||&#039;&#039;&#039;DecAt&#039;&#039;&#039;(&#039;&#039;Index, value&#039;&#039;) || This decreases the element of the array by the specified value. || || &#039;&#039;index :&#039;&#039; the index of the required entry in the array (&#039;&#039;&#039;Note:&#039;&#039;&#039; index starts at zero). This is of data type INTEGER. &amp;lt;br&amp;gt; &#039;&#039;value :&#039;&#039; the value to which the specified element, in the array, will be decreased. This is of data type REAL.&#039;&#039; || &amp;quot;a.DecAt(3, 5)&amp;quot; is equivalent to:&amp;lt;br&amp;gt;temp = a.GetAt(3)&amp;lt;br&amp;gt;a.SetAt(3, temp - 5)&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
||&#039;&#039;&#039;Sum&#039;&#039;&#039;() || This calculates the sum of all elements in the array. || Real || None || e = a.Sum()&lt;br /&gt;
|-&lt;br /&gt;
||&#039;&#039;&#039;Avg&#039;&#039;&#039;() || This calculates the average of all elements in the array. || Real || None || e = a.Avg()&lt;br /&gt;
|-&lt;br /&gt;
||&#039;&#039;&#039;Min&#039;&#039;&#039;() || This returns the minimum value of all elements in the array. || Real || None || e = a.Min()&lt;br /&gt;
|-&lt;br /&gt;
||&#039;&#039;&#039;MinIndex&#039;&#039;&#039;() || This returns the index of the minimum value in the array.  If multiple entries of equal minimum value, the first index is returned.  Return value is -1 for empty array. || integer || None || d = a.MinIndex()&lt;br /&gt;
|-&lt;br /&gt;
||&#039;&#039;&#039;Max&#039;&#039;&#039;() || This returns the maximum value of all elements in the array. || Real || None || e = a.Max()&lt;br /&gt;
|-&lt;br /&gt;
||&#039;&#039;&#039;MaxIndex&#039;&#039;&#039;() || This returns the index of the maximum value in the array.  If multiple entries of equal maximum value, the first index is returned.  Return value is -1 for empty array. || integer || None || d = a.MaxIndex()&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Norm&#039;&#039;&#039;() &amp;lt;br&amp;gt; {{Available139|30807}} || This normalises the contents of the array such that the sum is 1. Equivalent to a.OpDiv(a.Sum()). || || None || a.Norm() &lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Reverse&#039;&#039;&#039;() &amp;lt;br&amp;gt; {{Available139|30807}} || This reverses the sequence of all elements in the array. || || None || a.Reverse() &lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Sort&#039;&#039;&#039;(&#039;&#039;Ascending/Descending&#039;&#039;) || This re-arranges all elements in the array in ascending / descending order. || || 0: Descending order, &amp;lt;br&amp;gt; 1: Ascending order || a.Sort(1) &lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;IsSorted&#039;&#039;&#039;(&#039;&#039;Ascending/Descending&#039;&#039;) || This checks if the array is sorted in ascending / descending order. Returns True if array is sorted in the specified order. || Bit || 0: Descending order, &amp;lt;br&amp;gt; 1: Ascending order || SortOK = a.IsSorted(1)&lt;br /&gt;
|-&lt;br /&gt;
||&lt;br /&gt;
&#039;&#039;&#039;Load&#039;&#039;&#039;(&#039;&#039;arrayfilename&#039;&#039;)&lt;br /&gt;
||&lt;br /&gt;
This creates a new array from a file.&lt;br /&gt;
* The first element on each line, of the specified file, is read in as an element of the array, until either an empty line or end-of-file character is reached.&lt;br /&gt;
* The function returns the value, True if the file was read or, False if the file was not read.&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; if any elements exist in the array, prior to calling &#039;&#039;&#039;Load&#039;&#039;&#039;, these elements will be overridden.&#039;&#039; &lt;br /&gt;
||&lt;br /&gt;
Bit&lt;br /&gt;
||&lt;br /&gt;
&#039;&#039;arrayfileName :&#039;&#039; either the actual filename and path in quotations or a STR variable, which refers to the file. Use $Prj in the folder string for folders relative to the project folder.&lt;br /&gt;
||&lt;br /&gt;
ArrayFileName = &amp;quot;c:\SysCAD\array.csv&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
OK = b.Load(ArrayFileName)&amp;lt;br&amp;gt;&lt;br /&gt;
or&amp;lt;br&amp;gt;&lt;br /&gt;
OK = c.Load(&amp;quot;$Prj\data.txt&amp;quot;)&lt;br /&gt;
|-&lt;br /&gt;
||&lt;br /&gt;
&#039;&#039;&#039;Save&#039;&#039;&#039;(&#039;&#039;arrayfilename&#039;&#039;)&lt;br /&gt;
||&lt;br /&gt;
This saves the array data to a comma separated text file.&lt;br /&gt;
* If the specified file exists it is overwritten.&lt;br /&gt;
* The function returns, True if the file was saved or, False if the file was not saved.&lt;br /&gt;
* This could fail for any file access reason, for example: invalid folder, invalid filename, file access error, file already open in another application, etc.&lt;br /&gt;
||&lt;br /&gt;
Bit&lt;br /&gt;
||&lt;br /&gt;
&#039;&#039;arrayfileName :&#039;&#039; either the actual filename and path in quotations or a STR variable, which refers to the file. Use $Prj in the folder string for folders relative to the project folder.&lt;br /&gt;
||&lt;br /&gt;
OK = a.Save(&amp;quot;$Prj\data_output.txt&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
||&lt;br /&gt;
&#039;&#039;&#039;CopyToClipboard&#039;&#039;&#039;()&lt;br /&gt;
||&lt;br /&gt;
This saves the array data to the clipboard.&lt;br /&gt;
The function returns the value, True.&lt;br /&gt;
||&lt;br /&gt;
Bit&lt;br /&gt;
||&lt;br /&gt;
None&lt;br /&gt;
||&lt;br /&gt;
OK = a.CopyToClipboard()&lt;br /&gt;
|-&lt;br /&gt;
||&#039;&#039;&#039;SetAll&#039;&#039;&#039;(&#039;&#039;value&#039;&#039;) || This sets all the elements of the array to the specified &#039;&#039;value&#039;&#039;. || || &#039;&#039;value :&#039;&#039; the required initialising value. This is of data type REAL.&#039;&#039; || a.SetAll(0)&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Scale&#039;&#039;&#039;(&#039;&#039;value&#039;&#039;) || All the elements of the array are scaled by the specified &#039;&#039;value&#039;&#039; &amp;lt;br&amp;gt;(New value = original value * Scale). || || &#039;&#039;value :&#039;&#039; the required scaling factor. This is of data type REAL.&#039;&#039; || a.Scale(2) &amp;lt;br&amp;gt;-  Each value of the Array &amp;quot;a&amp;quot; will be increased by factor of 2.&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Offset&#039;&#039;&#039;(&#039;&#039;value&#039;&#039;) || All the elements of the array are offset by the specified &#039;&#039;value&#039;&#039; &amp;lt;br&amp;gt;(New value = original value + Offset). || || &#039;&#039;value :&#039;&#039; the required offset value. This is of data type REAL.&#039;&#039; || a.Offset(5) &amp;lt;br&amp;gt;- Each value of the Array &amp;quot;a&amp;quot; will be increased by 5.&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Copy&#039;&#039;&#039;(&#039;&#039;Array&#039;&#039;) || All the elements of the specified array are copied into the new array. || || &#039;&#039;Array:&#039;&#039; the name of the array to copy from. This is an ARRAY class.&#039;&#039; || PreVals.Copy(a) &amp;lt;br&amp;gt;- The values in Array &amp;quot;a&amp;quot; are copied into the Array &amp;quot;PreVals&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Append&#039;&#039;&#039;(&#039;&#039;Array&#039;&#039;) &amp;lt;br&amp;gt; {{Available139|30807}} || All the elements of the specified array are added to the end of the existing array. The new length of the array will be the sum of the original length plus the length of the specified array.|| || &#039;&#039;Array:&#039;&#039; the name of the array to append. This is an ARRAY class.&#039;&#039; || PreVals.Append(a) &amp;lt;br&amp;gt;- The values in Array &amp;quot;a&amp;quot; are appended to the end of the Array &amp;quot;PreVals&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;AppendItem&#039;&#039;&#039;(&#039;&#039;value&#039;&#039;) &amp;lt;br&amp;gt; {{Available139|30874}} || Increase the length of the array by one with the supplied value. || || &#039;&#039;value:&#039;&#039; the value to which the last element in the array will be set. || a.AppendItem(42)&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;InsertAt&#039;&#039;&#039;(&#039;&#039;index&#039;&#039;, &#039;&#039;value&#039;&#039;) &amp;lt;br&amp;gt; {{Available139|32112}} || Increase the length of the array by one inserting the supplied value at the specified &#039;&#039;index&#039;&#039;. || || &#039;&#039;index:&#039;&#039; the zero based index in array where the value must be inserted. Index data type is INTEGER and must be in range for Array length.&amp;lt;br&amp;gt; &#039;&#039;value:&#039;&#039; the value to be set at the new inserted element in the array. || a.InsertAt(0, 42)&amp;lt;br&amp;gt;- Inserts 42 at start of array.&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;RemoveAt&#039;&#039;&#039;(&#039;&#039;index&#039;&#039;, &#039;&#039;count&#039;&#039;) &amp;lt;br&amp;gt; {{Available139|32112}} || Decrease the length of the array by removing &#039;&#039;count&#039;&#039; (or less) values starting at the specified &#039;&#039;index&#039;&#039;. || || &#039;&#039;index:&#039;&#039; the zero based index in array where values must be deleted. Index data type is INTEGER and must be in range for Array length. &amp;lt;br&amp;gt; &#039;&#039;count:&#039;&#039; the number of elements to be removed. The value of &#039;&#039;count&#039;&#039; may be large, exceeding the current array length in which case all elements from the specified &#039;&#039;index&#039;&#039; are removed. Count data type is INTEGER. || a.RemoveAt(5, 1)&amp;lt;br&amp;gt;- Removes one element at index 5.&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;IsEqual&#039;&#039;&#039;(&#039;&#039;Array&#039;&#039;) || This compares the current array with the specified array data, if each element of the array are equal, the function returns the value, True. || Bit || &#039;&#039;Array:&#039;&#039; the name of the array to compare with. This is an ARRAY class.&#039;&#039; || EqualOK = PreVals.IsEqual(a) &amp;lt;br&amp;gt;- The values in array &amp;quot;PreVals&amp;quot; are compared to the values of the Array &amp;quot;a&amp;quot;.  Returns true if they are equal.&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Add&#039;&#039;&#039;(&#039;&#039;Array&#039;&#039;) || This function performs addition between current array and a specified array. New value for each element in current array = value in current array + specified array. &amp;lt;br&amp;gt; The two arrays must have the same length, otherwise value remains unchanged and error is returned. || Bit || &#039;&#039;Array:&#039;&#039; the name of the specified array. This is an ARRAY class. ||  AddOK = NewA.add(A1) &amp;lt;br&amp;gt; (each element in NewA = NewA + A1)&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Sub&#039;&#039;&#039;(&#039;&#039;Array&#039;&#039;) || This function performs subtraction between current array and a specified array. New value for each element in current array = value in current array - specified array. &amp;lt;br&amp;gt; The two arrays must have the same length, otherwise value remains unchanged and error is returned. || Bit ||&#039;&#039;Array:&#039;&#039; the name of the specified array. This is an ARRAY class. ||  SubOK = NewA.Sub(A1) &amp;lt;br&amp;gt; (each element in NewA = NewA - A1)&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Mult&#039;&#039;&#039;(&#039;&#039;Array&#039;&#039;) || This function performs multiplication between current array and a specified array. New value for each element in current array = value in current array x specified array. &amp;lt;br&amp;gt; The two arrays must have the same length, otherwise value remains unchanged and error is returned. || Bit || &#039;&#039;Array:&#039;&#039; the name of the specified array. This is an ARRAY class. ||  MultOK = NewA.Mult(A1)  &amp;lt;br&amp;gt; (each element in NewA = NewA * A1)&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Div&#039;&#039;&#039;(&#039;&#039;Array&#039;&#039;) || This function performs division between current array and a specified array. New value for each element in current array = value in current array / specified array.&amp;lt;br&amp;gt; The two arrays must have the same length, otherwise value remains unchanged and error is returned. || Bit ||&#039;&#039;Array:&#039;&#039; the name of the specified array. This is an ARRAY class. ||  DivOK = NewA.Div(A1) &amp;lt;br&amp;gt; (each element in NewA = NewA / A1)&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;CopyAdd&#039;&#039;&#039;(&#039;&#039;Array1, Array2&#039;&#039;) || This function performs addition between two arrays and stores the values in a new array (current array).   Value for each element in current array = value in array1 + array2. &amp;lt;br&amp;gt; The two arrays must have the same length, otherwise value remains unchanged and error is returned. || Bit || &#039;&#039;Array1:&#039;&#039; the name of the first specified array. This is an ARRAY class. &amp;lt;br&amp;gt; &#039;&#039;Array2:&#039;&#039; the name of the second specified array. This is an ARRAY class.&#039;&#039;||  AddOK = NewA.CopyAdd(A1, A2) &amp;lt;br&amp;gt; (each element in NewA = A1 + A2)&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;CopySub&#039;&#039;&#039;(&#039;&#039;Array1, Array2&#039;&#039;) || This function performs subtraction between two arrays and stores the values in a new array (current array).   Value for each element in current array = value in array1 - array2. &amp;lt;br&amp;gt; The two arrays must have the same length, otherwise value remains unchanged and error is returned. || Bit || &#039;&#039;Array1:&#039;&#039; the name of the first specified array. This is an ARRAY class. &amp;lt;br&amp;gt; &#039;&#039;Array2:&#039;&#039; the name of the second specified array. This is an ARRAY class.||  AddOK = NewA.CopySub(A1, A2) &amp;lt;br&amp;gt; (each element in NewA = A1 - A2)&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;CopyMult&#039;&#039;&#039;(&#039;&#039;Array1, Array2&#039;&#039;) || This function performs multiplication between two arrays and stores the values in a new array (current array).   Value for each element in current array = value in array1 x array2. &amp;lt;br&amp;gt; The two arrays must have the same length, otherwise value remains unchanged and error is returned. || Bit || &#039;&#039;Array1:&#039;&#039; the name of the first specified array. This is an ARRAY class. &amp;lt;br&amp;gt; &#039;&#039;Array2:&#039;&#039; the name of the second specified array. This is an ARRAY class. ||  AddOK = NewA.CopyMult(A1, A2) &amp;lt;br&amp;gt; (each element in NewA = A1 * A2)&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;CopyDiv&#039;&#039;&#039;(&#039;&#039;Array1, Array2&#039;&#039;) || This function performs division between two arrays and stores the values in a new array (current array).   Value for each element in current array = value in array1 / array2. &amp;lt;br&amp;gt; The two arrays must have the same length, otherwise value remains unchanged and error is returned. || Bit || &#039;&#039;Array1:&#039;&#039; the name of the first specified array. This is an ARRAY class. &amp;lt;br&amp;gt; &#039;&#039;Array2:&#039;&#039; the name of the second specified array. This is an ARRAY class.||  AddOK = NewA.CopyDiv(A1, A2)&amp;lt;br&amp;gt; (each element in NewA = A1 / A2)&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Inner&#039;&#039;&#039;(&#039;&#039;Array&#039;&#039;) || This returns the Sum of Element i (Current Array * Specified Array).  The two arrays must have the same length, otherwise error is returned. || REAL || &#039;&#039;Array:&#039;&#039; the name of the second array. This is an ARRAY class.&#039;&#039; || DotProduct = a.Inner(PreVals)&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;CircConv&#039;&#039;&#039;(&#039;&#039;Array&#039;&#039;) &amp;lt;br&amp;gt; {{Available139|30613}} || This function performs circular convolution calculation between the current array and a specified array. New value for each element in current array is calculated as the integral of the product of the two arrays after one is reversed and shifted.  The values in the current array will be replaced with the new value. &amp;lt;br&amp;gt; The two arrays are expected to have the same length. || Bit || &#039;&#039;Array:&#039;&#039; the name of the specified array. This is an ARRAY class. ||  AddOK = NewA.CirConv(A1) &amp;lt;br&amp;gt; (each element in NewA = circular convolution of NewA and A1)&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;CopyCircConv&#039;&#039;&#039;(&#039;&#039;Array1, Array2&#039;&#039;) &amp;lt;br&amp;gt; {{Available139|30613}} || This function performs circular convolution calculation between two arrays and stores the values in a new array (current array).   Value for each element in current array is calculated as the integral of the product of the two arrays after one is reversed and shifted. &amp;lt;br&amp;gt; The two arrays are expected to have the same length. || Bit || &#039;&#039;Array1:&#039;&#039; the name of the first specified array. This is an ARRAY class. &amp;lt;br&amp;gt; &#039;&#039;Array2:&#039;&#039; the name of the second specified array. This is an ARRAY class.&#039;&#039;||  AddOK = NewA.CopyCirConv(A1, A2) &amp;lt;br&amp;gt; (each element in NewA = circular convolution of A1 and A2)&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;SetFromStr&#039;&#039;&#039;(&#039;&#039;Str s, Str Separ&#039;&#039;) &amp;lt;br&amp;gt; {{Available139|35544}}|| This function enables the unpacking of a string into an array, converting each element into a number. It internally utilises the StrToFlt function. &amp;lt;br&amp;gt; The array’s length is determined by the number of items derived from unpacking the string.|| REAL || &#039;&#039;s&#039;&#039; is the string that requires unpacking. &amp;lt;br&amp;gt; &#039;&#039;Separ&#039;&#039; is the separator used within the string ‘s’ to define the divisions. ||x.SetFromStr(&amp;quot;35,4,30&amp;quot;, &amp;quot;,&amp;quot;) will unpack the three numbers into the array ‘x’, resulting in x[0]=35, x[1]=4, and x[2]=30. &lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;CopyToStr&#039;&#039;&#039;(&#039;&#039;Str Separ&#039;&#039;) &amp;lt;br&amp;gt; {{Available139|35544}}|| This function enables the consolidation of a ‘Array’ into a single string. || STRING|| &#039;&#039;Separ&#039;&#039; denotes the delimiter used within the string ‘s’ to demarcate its segments. ||x.CopyToStr(&amp;quot;,&amp;quot;) will combine the elements of the &#039;Array&#039; named &#039;x&#039; into the string &amp;quot;35,4,30&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;PushBack&#039;&#039;&#039;(&#039;&#039;value&#039;&#039;) &amp;lt;br&amp;gt; &#039;&#039;&#039;PushFront&#039;&#039;&#039;(&#039;&#039;value&#039;&#039;) &amp;lt;br&amp;gt; {{Available140}}|| These methods put &#039;&#039;value&#039;&#039; at the start or end of the array and increase the size. ||  || &#039;&#039;value&#039;&#039;: the value to be set. || Equivalent to InsertAt(0, value) &lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;PopBack&#039;&#039;&#039;() &amp;lt;br&amp;gt; &#039;&#039;&#039;PopFront&#039;&#039;&#039;() &amp;lt;br&amp;gt; {{Available140}}|| These functions return the value at the start or end, and decrease the size. || Real ||  || If A = [1., 2., 3.],  A.PopBack() returns 3.0 &amp;lt;br&amp;gt; After, A = [1, 2]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;PushFrontPopBack&#039;&#039;&#039;(&#039;&#039;value&#039;&#039;) &amp;lt;br&amp;gt; &#039;&#039;&#039;PushBackPopFront&#039;&#039;&#039;(&#039;&#039;value&#039;&#039;) &amp;lt;br&amp;gt; {{Available140}}|| These functions treat the array as a FIFO queue, adding an item at one end and removing and returning the item at the other end. All items are moved up or down in the array and the size is unchanged || Real || Real || If A = [3., 4., 2.]  then A.PushFrontPopBack(7): &amp;lt;br&amp;gt; * returns 2. &amp;lt;br&amp;gt; * A is now [7.,  3.,   4.] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Watch ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;Watch&#039;&#039;&#039; keyword can be used to display the Array values in the Access Window.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;u&amp;gt;Syntax&amp;lt;/u&amp;gt;&#039;&#039;&#039;:&lt;br /&gt;
* Individual elements in the array can be made visible - e.g. &amp;quot;Watch A[2]&amp;quot; or &amp;quot;Watch A@[2]&amp;quot;. &lt;br /&gt;
* A range of array elements can be made visible - e.g. &amp;quot;Watch A[All,5]&amp;quot; which would show the first 5 elements of the array. &lt;br /&gt;
* If the &amp;quot;@&amp;quot; symbol is included, then the array elements will be read only fields in the access window.&lt;br /&gt;
&lt;br /&gt;
=== Array with Constant Values ===&lt;br /&gt;
&lt;br /&gt;
The user may declare an array with a set of constant values.  This allows the user to set up an array with known values for direct use. It can be a useful alternative to reading values from a CSV file.  Once defined, the contents or size of this constant Array cannot be changed.  Where a number is not specified for an entry, 0 is assumed.  The contents of the array are not saved as they are defined in the code.  From {{Available139|32217||y}}, the list can include system constants (for example NAN or PI), or user defined constants.  From {{Available139|32325||y}}, the const keyword should be used, otherwise a load warning (or error) is given.&lt;br /&gt;
&lt;br /&gt;
The syntax is:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;pgm&amp;quot;&amp;gt;&lt;br /&gt;
const ARRAY a = {n1,n2,n3,....} ;Syntax from {{Available139|32325||y}}&lt;br /&gt;
ARRAY a = {n1,n2,n3,....} ;Syntax before {{Available139|32325||y}}&lt;br /&gt;
;where n1, n2 etc. are real numbers or constants.&lt;br /&gt;
;Example&lt;br /&gt;
const Array SomePrimes = {2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Caution ===&lt;br /&gt;
&lt;br /&gt;
Using a GetAt within a SetAt can sometimes fail. This may be for expressions with multiple array references.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;pgm&amp;quot;&amp;gt;&lt;br /&gt;
;For example:&lt;br /&gt;
a.SetAt(i, a.GetAt(i+1))  ;This can sometimes fail&lt;br /&gt;
&lt;br /&gt;
;The solution is to use a temporary variable to first retrieve the GetAt value and then call SetAt as follows:&lt;br /&gt;
Real   Tmp&lt;br /&gt;
Tmp = a.GetAt(i+1)&lt;br /&gt;
a.SetAt(i, Tmp)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;pgm&amp;quot;&amp;gt;&lt;br /&gt;
STRING      ArrayFileName&lt;br /&gt;
REAL        d, e, f, Total@, Average@, Minimum@, Maximum@, DotProduct@&lt;br /&gt;
BIT         OK@, CopyOK@, SortOK@, AddOK@, SubOK@&lt;br /&gt;
ARRAY       a                           ;declares array instance.&lt;br /&gt;
ARRAY       b{e}, c{e}                  ;declares array instances that are excluded from save (for efficiency).&lt;br /&gt;
const ARRAY x = {60,35,25,62,105}       ;declares an array z with constant values.&lt;br /&gt;
;ARRAY      x = {60,35,25,62,105}       ;Old syntax before {{Removed139|32325||y}}&lt;br /&gt;
ARRAY       y, y1, y2 &lt;br /&gt;
const ARRAY y3 = {20,35,45,62,105,150}  ;declares an array y3 with constant values.&lt;br /&gt;
const ARRAY z = {20,35,45,62,105}       ;declares an array z with constant values.&lt;br /&gt;
&lt;br /&gt;
Sub InitialiseSolution()&lt;br /&gt;
  ArrayFileName = &amp;quot;c:\SysCAD\array.csv&amp;quot;&lt;br /&gt;
  OK = b.Load(ArrayFileName)&lt;br /&gt;
  OK = c.Load(&amp;quot;$Prj\data.txt&amp;quot;)&lt;br /&gt;
  a.SetLen(5)                  ;sets the array length&lt;br /&gt;
  y.copy(x)                    ;array x is copied into array y, returns {60,35,25,62,105}&lt;br /&gt;
  CopyOK = y.isEqual(x)        ;compares array y with array x, returns true&lt;br /&gt;
  y.sort(1)                    ;sorts array y in ascending order, returns {25,35,60,62,105}&lt;br /&gt;
  SortOK = y.IsSorted(1)       ;checks if array y is sorted in ascending order, returns true&lt;br /&gt;
  y1.copy(y)                   ;copies y, returns {25,35,60,62,105}&lt;br /&gt;
  y1.scale(2)                  ;multiplies each element by scaling factor of 2, returns {50, 70, 120, 124, 210}&lt;br /&gt;
  y2.copy(y)                   ;copies y, returns {25,35,60,62,105}&lt;br /&gt;
  y2.offset(5)                 ;adds each element by offset factor of 5, returns {30, 40, 65, 67, 110}&lt;br /&gt;
  AddOK = y.add(y2)            ;Adds each element of y to elements of y2, y now becomes {55, 75, 125, 129, 215}, returns true &lt;br /&gt;
  SubOK = y1.sub(y3)           ;returns false since array length of y1 does not equal to y3. Array y1 unchanged.&lt;br /&gt;
  DotProduct = y.inner(y2)     ;sum of each element y_i * y2_i, returns 45068&lt;br /&gt;
EndSub&lt;br /&gt;
&lt;br /&gt;
;Logic   &lt;br /&gt;
d = a.GetLen()               ;gets the array length&lt;br /&gt;
a.SetAll(2.2/2)              ;sets all elements&lt;br /&gt;
a.IncAt(0, 7.0)              ;increments the first element&lt;br /&gt;
a[d-1] = 3.3                 ;sets last element &lt;br /&gt;
e = a[0]                     ;gets first element&lt;br /&gt;
f = z[3]                     ;gets the fourth element of array z, so f = 62&lt;br /&gt;
Total = z.Sum()              ;gets the sum of all the values in array z, Total = 267&lt;br /&gt;
Average = z.Avg()            ;gets the average of all the values in array z, Average = 53.4&lt;br /&gt;
Minimum = z.Min()            ;gets the minimum of all the values in array z, Minimum = 20&lt;br /&gt;
Maximum = z.Max()            ;gets the maximum of all the values in array z, Maximum = 105&lt;br /&gt;
$&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See also: [[Python Example - Optimization#Calculating_the_objective_error | Optimisation Example]] shows using these Array tools in a real example for plant tuning calculating an objective function.&lt;/div&gt;</summary>
		<author><name>Rod.Stephenson</name></author>
	</entry>
	<entry>
		<id>https://help.syscad.net/index.php?title=Array_Class&amp;diff=84626</id>
		<title>Array Class</title>
		<link rel="alternate" type="text/html" href="https://help.syscad.net/index.php?title=Array_Class&amp;diff=84626"/>
		<updated>2026-05-26T15:40:19Z</updated>

		<summary type="html">&lt;p&gt;Rod.Stephenson: /* Member Functions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:PGM]] [[Category:Examples]]&lt;br /&gt;
{{Navigation|[[PGMs]]|[[Class - Introduction|Classes]]}}&lt;br /&gt;
{{User Defined Classes Header Table |currentpage=4}}&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
{{TOC}}&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
The ARRAY class provides member functions to create a &amp;lt;u&amp;gt;dynamic array&amp;lt;/u&amp;gt; and manipulate its elements. &lt;br /&gt;
* The user may read in an array from a file.  The file may be either a CSV file, created using Excel, or a TXT file, created using a test editor such as Notepad++. &lt;br /&gt;
* The user may set constant values into an array when it is declared.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notes:&#039;&#039;&#039;&lt;br /&gt;
# The initial length of the array is zero.&lt;br /&gt;
# &#039;&#039;&#039;The array is zero indexed&#039;&#039;&#039;, i.e. the index of the first element in the array is zero, and NOT 1.  Therefore, the final element in an array of length &#039;&#039;n&#039;&#039; will have an index = &#039;&#039;n-1&#039;&#039;.&lt;br /&gt;
# If the index is out of range (0 &amp;lt;= &#039;&#039;index&#039;&#039; &amp;lt; &#039;&#039;length&#039;&#039;) then a runtime &amp;quot;PGM class execution error&amp;quot; will occur and the ARRAY operation will be ignored.&lt;br /&gt;
# The Array class allows user to Get / Set &#039;&#039;numeric values&#039;&#039; only.  Please see [[StrArray Class]] for getting/setting &#039;&#039;String values&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Data Members ==&lt;br /&gt;
&lt;br /&gt;
None&lt;br /&gt;
&lt;br /&gt;
== Member Functions ==&lt;br /&gt;
The examples in the table below is based on the following variables and array declarations.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;pgm&amp;quot;&amp;gt;&lt;br /&gt;
STRING   ArrayFileName&lt;br /&gt;
REAL     e, DotProduct&lt;br /&gt;
LONG     d&lt;br /&gt;
BIT      OK@, EqualOK@, SortOK@, AddOK@, SubOK@, MultOK@, DivOK@&lt;br /&gt;
ARRAY    a, b, c, NewA, A1, A2, PreVals, z ;declares array instances&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot; &lt;br /&gt;
| width=&amp;quot;15%&amp;quot; |&#039;&#039;&#039;Call &#039;&#039;&#039; || width=&amp;quot;35%&amp;quot; | &#039;&#039;&#039;Functionality&#039;&#039;&#039;|| width=&amp;quot;6%&amp;quot; |&#039;&#039;&#039;Return Type &#039;&#039;&#039; || width=&amp;quot;25%&amp;quot; |&#039;&#039;&#039;Parameters &#039;&#039;&#039; || width=&amp;quot;30%&amp;quot; | &#039;&#039;&#039;Example&#039;&#039;&#039; &lt;br /&gt;
|-&lt;br /&gt;
||&#039;&#039;&#039;SetLen&#039;&#039;&#039;(&#039;&#039;length&#039;&#039;) || Sets the size of the array to &#039;&#039;length&#039;&#039; || || &#039;&#039;length :&#039;&#039; the required length of the array, is of data type INTEGER || a.SetLen(5)&lt;br /&gt;
|-&lt;br /&gt;
||&#039;&#039;&#039;GetLen&#039;&#039;&#039;() || The function returns the length of the array. || integer || None || d = a.GetLen()&lt;br /&gt;
|-&lt;br /&gt;
||&#039;&#039;&#039;SetSize&#039;&#039;&#039;(&#039;&#039;length&#039;&#039;) &amp;lt;br&amp;gt; {{Available139|30807}} || Sets the size of the array to &#039;&#039;length&#039;&#039;. SetSize() function is an equivalent alternative to SetLen() || || &#039;&#039;length :&#039;&#039; the required size of the array, is of data type INTEGER || a.SetSize(5)&lt;br /&gt;
|-&lt;br /&gt;
||&#039;&#039;&#039;Size&#039;&#039;&#039;() &amp;lt;br&amp;gt; {{Available139|30807}} || The function returns the length of the array. Size() function is an equivalent alternative to GetLen(). || integer || None || d = a.Size()&lt;br /&gt;
|-&lt;br /&gt;
|| &#039;&#039;&#039;SetAt&#039;&#039;&#039;(&#039;&#039;index, value&#039;&#039;) || This sets the element of the array, which corresponds to the given &#039;&#039;index&#039;&#039; to the specified &#039;&#039;value&#039;&#039;. || || &#039;&#039;index&#039;&#039;: the index of the required entry in the array (&#039;&#039;&#039;Note:&#039;&#039;&#039; index starts at zero). This is of data type, INTEGER. &amp;lt;br&amp;gt; &#039;&#039;value :&#039;&#039; the value to which the specified element, in the array, will be set. This is of data type, REAL.&#039;&#039; || a.SetAt(0, 3)&amp;lt;br&amp;gt; OR:&amp;lt;br&amp;gt;a[0] = 3&lt;br /&gt;
|-&lt;br /&gt;
||&#039;&#039;&#039;GetAt&#039;&#039;&#039;(&#039;&#039;index&#039;&#039;) || This retrieves the value (type real) of the element from the array, which corresponds to the given &#039;&#039;index&#039;&#039;. || Real || &#039;&#039;index :&#039;&#039; the index of the required entry in the array (&#039;&#039;&#039;Note:&#039;&#039;&#039; index starts at zero). This is of data type INTEGER. || e = a.GetAt(0)&amp;lt;br&amp;gt; or: &amp;lt;br&amp;gt;e = a[0]&lt;br /&gt;
|-&lt;br /&gt;
||&#039;&#039;&#039;IncAt&#039;&#039;&#039;(&#039;&#039;Index, value&#039;&#039;) || This increases the element of the array by the specified value. || || &#039;&#039;index :&#039;&#039; the index of the required entry in the array (&#039;&#039;&#039;Note:&#039;&#039;&#039; index starts at zero). This is of data type INTEGER. &amp;lt;br&amp;gt; &#039;&#039;value :&#039;&#039; the value to which the specified element, in the array, will be increased. This is of data type REAL.&#039;&#039; || &amp;quot;a.IncAt(3, 10)&amp;quot; is equivalent to:&amp;lt;br&amp;gt;temp = a.GetAt(3)&amp;lt;br&amp;gt;a.SetAt(3, temp + 10)&lt;br /&gt;
|-&lt;br /&gt;
||&#039;&#039;&#039;DecAt&#039;&#039;&#039;(&#039;&#039;Index, value&#039;&#039;) || This decreases the element of the array by the specified value. || || &#039;&#039;index :&#039;&#039; the index of the required entry in the array (&#039;&#039;&#039;Note:&#039;&#039;&#039; index starts at zero). This is of data type INTEGER. &amp;lt;br&amp;gt; &#039;&#039;value :&#039;&#039; the value to which the specified element, in the array, will be decreased. This is of data type REAL.&#039;&#039; || &amp;quot;a.DecAt(3, 5)&amp;quot; is equivalent to:&amp;lt;br&amp;gt;temp = a.GetAt(3)&amp;lt;br&amp;gt;a.SetAt(3, temp - 5)&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
||&#039;&#039;&#039;Sum&#039;&#039;&#039;() || This calculates the sum of all elements in the array. || Real || None || e = a.Sum()&lt;br /&gt;
|-&lt;br /&gt;
||&#039;&#039;&#039;Avg&#039;&#039;&#039;() || This calculates the average of all elements in the array. || Real || None || e = a.Avg()&lt;br /&gt;
|-&lt;br /&gt;
||&#039;&#039;&#039;Min&#039;&#039;&#039;() || This returns the minimum value of all elements in the array. || Real || None || e = a.Min()&lt;br /&gt;
|-&lt;br /&gt;
||&#039;&#039;&#039;MinIndex&#039;&#039;&#039;() || This returns the index of the minimum value in the array.  If multiple entries of equal minimum value, the first index is returned.  Return value is -1 for empty array. || integer || None || d = a.MinIndex()&lt;br /&gt;
|-&lt;br /&gt;
||&#039;&#039;&#039;Max&#039;&#039;&#039;() || This returns the maximum value of all elements in the array. || Real || None || e = a.Max()&lt;br /&gt;
|-&lt;br /&gt;
||&#039;&#039;&#039;MaxIndex&#039;&#039;&#039;() || This returns the index of the maximum value in the array.  If multiple entries of equal maximum value, the first index is returned.  Return value is -1 for empty array. || integer || None || d = a.MaxIndex()&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Norm&#039;&#039;&#039;() &amp;lt;br&amp;gt; {{Available139|30807}} || This normalises the contents of the array such that the sum is 1. Equivalent to a.OpDiv(a.Sum()). || || None || a.Norm() &lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Reverse&#039;&#039;&#039;() &amp;lt;br&amp;gt; {{Available139|30807}} || This reverses the sequence of all elements in the array. || || None || a.Reverse() &lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Sort&#039;&#039;&#039;(&#039;&#039;Ascending/Descending&#039;&#039;) || This re-arranges all elements in the array in ascending / descending order. || || 0: Descending order, &amp;lt;br&amp;gt; 1: Ascending order || a.Sort(1) &lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;IsSorted&#039;&#039;&#039;(&#039;&#039;Ascending/Descending&#039;&#039;) || This checks if the array is sorted in ascending / descending order. Returns True if array is sorted in the specified order. || Bit || 0: Descending order, &amp;lt;br&amp;gt; 1: Ascending order || SortOK = a.IsSorted(1)&lt;br /&gt;
|-&lt;br /&gt;
||&lt;br /&gt;
&#039;&#039;&#039;Load&#039;&#039;&#039;(&#039;&#039;arrayfilename&#039;&#039;)&lt;br /&gt;
||&lt;br /&gt;
This creates a new array from a file.&lt;br /&gt;
* The first element on each line, of the specified file, is read in as an element of the array, until either an empty line or end-of-file character is reached.&lt;br /&gt;
* The function returns the value, True if the file was read or, False if the file was not read.&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; if any elements exist in the array, prior to calling &#039;&#039;&#039;Load&#039;&#039;&#039;, these elements will be overridden.&#039;&#039; &lt;br /&gt;
||&lt;br /&gt;
Bit&lt;br /&gt;
||&lt;br /&gt;
&#039;&#039;arrayfileName :&#039;&#039; either the actual filename and path in quotations or a STR variable, which refers to the file. Use $Prj in the folder string for folders relative to the project folder.&lt;br /&gt;
||&lt;br /&gt;
ArrayFileName = &amp;quot;c:\SysCAD\array.csv&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
OK = b.Load(ArrayFileName)&amp;lt;br&amp;gt;&lt;br /&gt;
or&amp;lt;br&amp;gt;&lt;br /&gt;
OK = c.Load(&amp;quot;$Prj\data.txt&amp;quot;)&lt;br /&gt;
|-&lt;br /&gt;
||&lt;br /&gt;
&#039;&#039;&#039;Save&#039;&#039;&#039;(&#039;&#039;arrayfilename&#039;&#039;)&lt;br /&gt;
||&lt;br /&gt;
This saves the array data to a comma separated text file.&lt;br /&gt;
* If the specified file exists it is overwritten.&lt;br /&gt;
* The function returns, True if the file was saved or, False if the file was not saved.&lt;br /&gt;
* This could fail for any file access reason, for example: invalid folder, invalid filename, file access error, file already open in another application, etc.&lt;br /&gt;
||&lt;br /&gt;
Bit&lt;br /&gt;
||&lt;br /&gt;
&#039;&#039;arrayfileName :&#039;&#039; either the actual filename and path in quotations or a STR variable, which refers to the file. Use $Prj in the folder string for folders relative to the project folder.&lt;br /&gt;
||&lt;br /&gt;
OK = a.Save(&amp;quot;$Prj\data_output.txt&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
||&lt;br /&gt;
&#039;&#039;&#039;CopyToClipboard&#039;&#039;&#039;()&lt;br /&gt;
||&lt;br /&gt;
This saves the array data to the clipboard.&lt;br /&gt;
The function returns the value, True.&lt;br /&gt;
||&lt;br /&gt;
Bit&lt;br /&gt;
||&lt;br /&gt;
None&lt;br /&gt;
||&lt;br /&gt;
OK = a.CopyToClipboard()&lt;br /&gt;
|-&lt;br /&gt;
||&#039;&#039;&#039;SetAll&#039;&#039;&#039;(&#039;&#039;value&#039;&#039;) || This sets all the elements of the array to the specified &#039;&#039;value&#039;&#039;. || || &#039;&#039;value :&#039;&#039; the required initialising value. This is of data type REAL.&#039;&#039; || a.SetAll(0)&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Scale&#039;&#039;&#039;(&#039;&#039;value&#039;&#039;) || All the elements of the array are scaled by the specified &#039;&#039;value&#039;&#039; &amp;lt;br&amp;gt;(New value = original value * Scale). || || &#039;&#039;value :&#039;&#039; the required scaling factor. This is of data type REAL.&#039;&#039; || a.Scale(2) &amp;lt;br&amp;gt;-  Each value of the Array &amp;quot;a&amp;quot; will be increased by factor of 2.&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Offset&#039;&#039;&#039;(&#039;&#039;value&#039;&#039;) || All the elements of the array are offset by the specified &#039;&#039;value&#039;&#039; &amp;lt;br&amp;gt;(New value = original value + Offset). || || &#039;&#039;value :&#039;&#039; the required offset value. This is of data type REAL.&#039;&#039; || a.Offset(5) &amp;lt;br&amp;gt;- Each value of the Array &amp;quot;a&amp;quot; will be increased by 5.&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Copy&#039;&#039;&#039;(&#039;&#039;Array&#039;&#039;) || All the elements of the specified array are copied into the new array. || || &#039;&#039;Array:&#039;&#039; the name of the array to copy from. This is an ARRAY class.&#039;&#039; || PreVals.Copy(a) &amp;lt;br&amp;gt;- The values in Array &amp;quot;a&amp;quot; are copied into the Array &amp;quot;PreVals&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Append&#039;&#039;&#039;(&#039;&#039;Array&#039;&#039;) &amp;lt;br&amp;gt; {{Available139|30807}} || All the elements of the specified array are added to the end of the existing array. The new length of the array will be the sum of the original length plus the length of the specified array.|| || &#039;&#039;Array:&#039;&#039; the name of the array to append. This is an ARRAY class.&#039;&#039; || PreVals.Append(a) &amp;lt;br&amp;gt;- The values in Array &amp;quot;a&amp;quot; are appended to the end of the Array &amp;quot;PreVals&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;AppendItem&#039;&#039;&#039;(&#039;&#039;value&#039;&#039;) &amp;lt;br&amp;gt; {{Available139|30874}} || Increase the length of the array by one with the supplied value. || || &#039;&#039;value:&#039;&#039; the value to which the last element in the array will be set. || a.AppendItem(42)&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;InsertAt&#039;&#039;&#039;(&#039;&#039;index&#039;&#039;, &#039;&#039;value&#039;&#039;) &amp;lt;br&amp;gt; {{Available139|32112}} || Increase the length of the array by one inserting the supplied value at the specified &#039;&#039;index&#039;&#039;. || || &#039;&#039;index:&#039;&#039; the zero based index in array where the value must be inserted. Index data type is INTEGER and must be in range for Array length.&amp;lt;br&amp;gt; &#039;&#039;value:&#039;&#039; the value to be set at the new inserted element in the array. || a.InsertAt(0, 42)&amp;lt;br&amp;gt;- Inserts 42 at start of array.&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;RemoveAt&#039;&#039;&#039;(&#039;&#039;index&#039;&#039;, &#039;&#039;count&#039;&#039;) &amp;lt;br&amp;gt; {{Available139|32112}} || Decrease the length of the array by removing &#039;&#039;count&#039;&#039; (or less) values starting at the specified &#039;&#039;index&#039;&#039;. || || &#039;&#039;index:&#039;&#039; the zero based index in array where values must be deleted. Index data type is INTEGER and must be in range for Array length. &amp;lt;br&amp;gt; &#039;&#039;count:&#039;&#039; the number of elements to be removed. The value of &#039;&#039;count&#039;&#039; may be large, exceeding the current array length in which case all elements from the specified &#039;&#039;index&#039;&#039; are removed. Count data type is INTEGER. || a.RemoveAt(5, 1)&amp;lt;br&amp;gt;- Removes one element at index 5.&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;IsEqual&#039;&#039;&#039;(&#039;&#039;Array&#039;&#039;) || This compares the current array with the specified array data, if each element of the array are equal, the function returns the value, True. || Bit || &#039;&#039;Array:&#039;&#039; the name of the array to compare with. This is an ARRAY class.&#039;&#039; || EqualOK = PreVals.IsEqual(a) &amp;lt;br&amp;gt;- The values in array &amp;quot;PreVals&amp;quot; are compared to the values of the Array &amp;quot;a&amp;quot;.  Returns true if they are equal.&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Add&#039;&#039;&#039;(&#039;&#039;Array&#039;&#039;) || This function performs addition between current array and a specified array. New value for each element in current array = value in current array + specified array. &amp;lt;br&amp;gt; The two arrays must have the same length, otherwise value remains unchanged and error is returned. || Bit || &#039;&#039;Array:&#039;&#039; the name of the specified array. This is an ARRAY class. ||  AddOK = NewA.add(A1) &amp;lt;br&amp;gt; (each element in NewA = NewA + A1)&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Sub&#039;&#039;&#039;(&#039;&#039;Array&#039;&#039;) || This function performs subtraction between current array and a specified array. New value for each element in current array = value in current array - specified array. &amp;lt;br&amp;gt; The two arrays must have the same length, otherwise value remains unchanged and error is returned. || Bit ||&#039;&#039;Array:&#039;&#039; the name of the specified array. This is an ARRAY class. ||  SubOK = NewA.Sub(A1) &amp;lt;br&amp;gt; (each element in NewA = NewA - A1)&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Mult&#039;&#039;&#039;(&#039;&#039;Array&#039;&#039;) || This function performs multiplication between current array and a specified array. New value for each element in current array = value in current array x specified array. &amp;lt;br&amp;gt; The two arrays must have the same length, otherwise value remains unchanged and error is returned. || Bit || &#039;&#039;Array:&#039;&#039; the name of the specified array. This is an ARRAY class. ||  MultOK = NewA.Mult(A1)  &amp;lt;br&amp;gt; (each element in NewA = NewA * A1)&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Div&#039;&#039;&#039;(&#039;&#039;Array&#039;&#039;) || This function performs division between current array and a specified array. New value for each element in current array = value in current array / specified array.&amp;lt;br&amp;gt; The two arrays must have the same length, otherwise value remains unchanged and error is returned. || Bit ||&#039;&#039;Array:&#039;&#039; the name of the specified array. This is an ARRAY class. ||  DivOK = NewA.Div(A1) &amp;lt;br&amp;gt; (each element in NewA = NewA / A1)&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;CopyAdd&#039;&#039;&#039;(&#039;&#039;Array1, Array2&#039;&#039;) || This function performs addition between two arrays and stores the values in a new array (current array).   Value for each element in current array = value in array1 + array2. &amp;lt;br&amp;gt; The two arrays must have the same length, otherwise value remains unchanged and error is returned. || Bit || &#039;&#039;Array1:&#039;&#039; the name of the first specified array. This is an ARRAY class. &amp;lt;br&amp;gt; &#039;&#039;Array2:&#039;&#039; the name of the second specified array. This is an ARRAY class.&#039;&#039;||  AddOK = NewA.CopyAdd(A1, A2) &amp;lt;br&amp;gt; (each element in NewA = A1 + A2)&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;CopySub&#039;&#039;&#039;(&#039;&#039;Array1, Array2&#039;&#039;) || This function performs subtraction between two arrays and stores the values in a new array (current array).   Value for each element in current array = value in array1 - array2. &amp;lt;br&amp;gt; The two arrays must have the same length, otherwise value remains unchanged and error is returned. || Bit || &#039;&#039;Array1:&#039;&#039; the name of the first specified array. This is an ARRAY class. &amp;lt;br&amp;gt; &#039;&#039;Array2:&#039;&#039; the name of the second specified array. This is an ARRAY class.||  AddOK = NewA.CopySub(A1, A2) &amp;lt;br&amp;gt; (each element in NewA = A1 - A2)&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;CopyMult&#039;&#039;&#039;(&#039;&#039;Array1, Array2&#039;&#039;) || This function performs multiplication between two arrays and stores the values in a new array (current array).   Value for each element in current array = value in array1 x array2. &amp;lt;br&amp;gt; The two arrays must have the same length, otherwise value remains unchanged and error is returned. || Bit || &#039;&#039;Array1:&#039;&#039; the name of the first specified array. This is an ARRAY class. &amp;lt;br&amp;gt; &#039;&#039;Array2:&#039;&#039; the name of the second specified array. This is an ARRAY class. ||  AddOK = NewA.CopyMult(A1, A2) &amp;lt;br&amp;gt; (each element in NewA = A1 * A2)&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;CopyDiv&#039;&#039;&#039;(&#039;&#039;Array1, Array2&#039;&#039;) || This function performs division between two arrays and stores the values in a new array (current array).   Value for each element in current array = value in array1 / array2. &amp;lt;br&amp;gt; The two arrays must have the same length, otherwise value remains unchanged and error is returned. || Bit || &#039;&#039;Array1:&#039;&#039; the name of the first specified array. This is an ARRAY class. &amp;lt;br&amp;gt; &#039;&#039;Array2:&#039;&#039; the name of the second specified array. This is an ARRAY class.||  AddOK = NewA.CopyDiv(A1, A2)&amp;lt;br&amp;gt; (each element in NewA = A1 / A2)&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Inner&#039;&#039;&#039;(&#039;&#039;Array&#039;&#039;) || This returns the Sum of Element i (Current Array * Specified Array).  The two arrays must have the same length, otherwise error is returned. || REAL || &#039;&#039;Array:&#039;&#039; the name of the second array. This is an ARRAY class.&#039;&#039; || DotProduct = a.Inner(PreVals)&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;CircConv&#039;&#039;&#039;(&#039;&#039;Array&#039;&#039;) &amp;lt;br&amp;gt; {{Available139|30613}} || This function performs circular convolution calculation between the current array and a specified array. New value for each element in current array is calculated as the integral of the product of the two arrays after one is reversed and shifted.  The values in the current array will be replaced with the new value. &amp;lt;br&amp;gt; The two arrays are expected to have the same length. || Bit || &#039;&#039;Array:&#039;&#039; the name of the specified array. This is an ARRAY class. ||  AddOK = NewA.CirConv(A1) &amp;lt;br&amp;gt; (each element in NewA = circular convolution of NewA and A1)&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;CopyCircConv&#039;&#039;&#039;(&#039;&#039;Array1, Array2&#039;&#039;) &amp;lt;br&amp;gt; {{Available139|30613}} || This function performs circular convolution calculation between two arrays and stores the values in a new array (current array).   Value for each element in current array is calculated as the integral of the product of the two arrays after one is reversed and shifted. &amp;lt;br&amp;gt; The two arrays are expected to have the same length. || Bit || &#039;&#039;Array1:&#039;&#039; the name of the first specified array. This is an ARRAY class. &amp;lt;br&amp;gt; &#039;&#039;Array2:&#039;&#039; the name of the second specified array. This is an ARRAY class.&#039;&#039;||  AddOK = NewA.CopyCirConv(A1, A2) &amp;lt;br&amp;gt; (each element in NewA = circular convolution of A1 and A2)&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;SetFromStr&#039;&#039;&#039;(&#039;&#039;Str s, Str Separ&#039;&#039;) &amp;lt;br&amp;gt; {{Available139|35544}}|| This function enables the unpacking of a string into an array, converting each element into a number. It internally utilises the StrToFlt function. &amp;lt;br&amp;gt; The array’s length is determined by the number of items derived from unpacking the string.|| REAL || &#039;&#039;s&#039;&#039; is the string that requires unpacking. &amp;lt;br&amp;gt; &#039;&#039;Separ&#039;&#039; is the separator used within the string ‘s’ to define the divisions. ||x.SetFromStr(&amp;quot;35,4,30&amp;quot;, &amp;quot;,&amp;quot;) will unpack the three numbers into the array ‘x’, resulting in x[0]=35, x[1]=4, and x[2]=30. &lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;CopyToStr&#039;&#039;&#039;(&#039;&#039;Str Separ&#039;&#039;) &amp;lt;br&amp;gt; {{Available139|35544}}|| This function enables the consolidation of a ‘Array’ into a single string. || STRING|| &#039;&#039;Separ&#039;&#039; denotes the delimiter used within the string ‘s’ to demarcate its segments. ||x.CopyToStr(&amp;quot;,&amp;quot;) will combine the elements of the &#039;Array&#039; named &#039;x&#039; into the string &amp;quot;35,4,30&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;PushBack&#039;&#039;&#039;(&#039;&#039;value&#039;&#039;) &amp;lt;br&amp;gt; &#039;&#039;&#039;PushFront&#039;&#039;&#039;(&#039;&#039;value&#039;&#039;) &amp;lt;br&amp;gt; {{Available140}}|| These methods put &#039;&#039;value&#039;&#039; at the start or end of the array and increase the size. ||  || &#039;&#039;value&#039;&#039;: the value to be set. || Equivalent to InsertAt(0, value) &lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;PopBack&#039;&#039;&#039;() &amp;lt;br&amp;gt; &#039;&#039;&#039;PopFront&#039;&#039;&#039;() &amp;lt;br&amp;gt; {{Available140}}|| These functions return the value at the start or end, and decrease the size. || Real ||  || If A = [1., 2., 3.],  A.PopBack() returns 3.0 &amp;lt;br&amp;gt; After, A = [1, 2]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;PushFrontPopBack&#039;&#039;&#039;(&#039;&#039;value&#039;&#039;) &amp;lt;br&amp;gt; &#039;&#039;&#039;PushBackPopFront&#039;&#039;&#039;(&#039;&#039;value&#039;&#039;) &amp;lt;br&amp;gt; {{Available140}}|| These functions treat the array as a FIFO queue, adding an item at one end and removing and returning the item at the other end. All items are moved up or down in the array and the size is unchanged || Real || Real || If A = [3., 4., 2.]  then A.PushFrontPopBack(7): &amp;lt;br&amp;gt; returns 2. &amp;lt;br&amp;gt; A is now [7.,  3.,   4.] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Watch ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;Watch&#039;&#039;&#039; keyword can be used to display the Array values in the Access Window.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;u&amp;gt;Syntax&amp;lt;/u&amp;gt;&#039;&#039;&#039;:&lt;br /&gt;
* Individual elements in the array can be made visible - e.g. &amp;quot;Watch A[2]&amp;quot; or &amp;quot;Watch A@[2]&amp;quot;. &lt;br /&gt;
* A range of array elements can be made visible - e.g. &amp;quot;Watch A[All,5]&amp;quot; which would show the first 5 elements of the array. &lt;br /&gt;
* If the &amp;quot;@&amp;quot; symbol is included, then the array elements will be read only fields in the access window.&lt;br /&gt;
&lt;br /&gt;
=== Array with Constant Values ===&lt;br /&gt;
&lt;br /&gt;
The user may declare an array with a set of constant values.  This allows the user to set up an array with known values for direct use. It can be a useful alternative to reading values from a CSV file.  Once defined, the contents or size of this constant Array cannot be changed.  Where a number is not specified for an entry, 0 is assumed.  The contents of the array are not saved as they are defined in the code.  From {{Available139|32217||y}}, the list can include system constants (for example NAN or PI), or user defined constants.  From {{Available139|32325||y}}, the const keyword should be used, otherwise a load warning (or error) is given.&lt;br /&gt;
&lt;br /&gt;
The syntax is:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;pgm&amp;quot;&amp;gt;&lt;br /&gt;
const ARRAY a = {n1,n2,n3,....} ;Syntax from {{Available139|32325||y}}&lt;br /&gt;
ARRAY a = {n1,n2,n3,....} ;Syntax before {{Available139|32325||y}}&lt;br /&gt;
;where n1, n2 etc. are real numbers or constants.&lt;br /&gt;
;Example&lt;br /&gt;
const Array SomePrimes = {2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Caution ===&lt;br /&gt;
&lt;br /&gt;
Using a GetAt within a SetAt can sometimes fail. This may be for expressions with multiple array references.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;pgm&amp;quot;&amp;gt;&lt;br /&gt;
;For example:&lt;br /&gt;
a.SetAt(i, a.GetAt(i+1))  ;This can sometimes fail&lt;br /&gt;
&lt;br /&gt;
;The solution is to use a temporary variable to first retrieve the GetAt value and then call SetAt as follows:&lt;br /&gt;
Real   Tmp&lt;br /&gt;
Tmp = a.GetAt(i+1)&lt;br /&gt;
a.SetAt(i, Tmp)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;pgm&amp;quot;&amp;gt;&lt;br /&gt;
STRING      ArrayFileName&lt;br /&gt;
REAL        d, e, f, Total@, Average@, Minimum@, Maximum@, DotProduct@&lt;br /&gt;
BIT         OK@, CopyOK@, SortOK@, AddOK@, SubOK@&lt;br /&gt;
ARRAY       a                           ;declares array instance.&lt;br /&gt;
ARRAY       b{e}, c{e}                  ;declares array instances that are excluded from save (for efficiency).&lt;br /&gt;
const ARRAY x = {60,35,25,62,105}       ;declares an array z with constant values.&lt;br /&gt;
;ARRAY      x = {60,35,25,62,105}       ;Old syntax before {{Removed139|32325||y}}&lt;br /&gt;
ARRAY       y, y1, y2 &lt;br /&gt;
const ARRAY y3 = {20,35,45,62,105,150}  ;declares an array y3 with constant values.&lt;br /&gt;
const ARRAY z = {20,35,45,62,105}       ;declares an array z with constant values.&lt;br /&gt;
&lt;br /&gt;
Sub InitialiseSolution()&lt;br /&gt;
  ArrayFileName = &amp;quot;c:\SysCAD\array.csv&amp;quot;&lt;br /&gt;
  OK = b.Load(ArrayFileName)&lt;br /&gt;
  OK = c.Load(&amp;quot;$Prj\data.txt&amp;quot;)&lt;br /&gt;
  a.SetLen(5)                  ;sets the array length&lt;br /&gt;
  y.copy(x)                    ;array x is copied into array y, returns {60,35,25,62,105}&lt;br /&gt;
  CopyOK = y.isEqual(x)        ;compares array y with array x, returns true&lt;br /&gt;
  y.sort(1)                    ;sorts array y in ascending order, returns {25,35,60,62,105}&lt;br /&gt;
  SortOK = y.IsSorted(1)       ;checks if array y is sorted in ascending order, returns true&lt;br /&gt;
  y1.copy(y)                   ;copies y, returns {25,35,60,62,105}&lt;br /&gt;
  y1.scale(2)                  ;multiplies each element by scaling factor of 2, returns {50, 70, 120, 124, 210}&lt;br /&gt;
  y2.copy(y)                   ;copies y, returns {25,35,60,62,105}&lt;br /&gt;
  y2.offset(5)                 ;adds each element by offset factor of 5, returns {30, 40, 65, 67, 110}&lt;br /&gt;
  AddOK = y.add(y2)            ;Adds each element of y to elements of y2, y now becomes {55, 75, 125, 129, 215}, returns true &lt;br /&gt;
  SubOK = y1.sub(y3)           ;returns false since array length of y1 does not equal to y3. Array y1 unchanged.&lt;br /&gt;
  DotProduct = y.inner(y2)     ;sum of each element y_i * y2_i, returns 45068&lt;br /&gt;
EndSub&lt;br /&gt;
&lt;br /&gt;
;Logic   &lt;br /&gt;
d = a.GetLen()               ;gets the array length&lt;br /&gt;
a.SetAll(2.2/2)              ;sets all elements&lt;br /&gt;
a.IncAt(0, 7.0)              ;increments the first element&lt;br /&gt;
a[d-1] = 3.3                 ;sets last element &lt;br /&gt;
e = a[0]                     ;gets first element&lt;br /&gt;
f = z[3]                     ;gets the fourth element of array z, so f = 62&lt;br /&gt;
Total = z.Sum()              ;gets the sum of all the values in array z, Total = 267&lt;br /&gt;
Average = z.Avg()            ;gets the average of all the values in array z, Average = 53.4&lt;br /&gt;
Minimum = z.Min()            ;gets the minimum of all the values in array z, Minimum = 20&lt;br /&gt;
Maximum = z.Max()            ;gets the maximum of all the values in array z, Maximum = 105&lt;br /&gt;
$&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See also: [[Python Example - Optimization#Calculating_the_objective_error | Optimisation Example]] shows using these Array tools in a real example for plant tuning calculating an objective function.&lt;/div&gt;</summary>
		<author><name>Rod.Stephenson</name></author>
	</entry>
	<entry>
		<id>https://help.syscad.net/index.php?title=Array_Class&amp;diff=84625</id>
		<title>Array Class</title>
		<link rel="alternate" type="text/html" href="https://help.syscad.net/index.php?title=Array_Class&amp;diff=84625"/>
		<updated>2026-05-26T15:34:38Z</updated>

		<summary type="html">&lt;p&gt;Rod.Stephenson: /* Member Functions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:PGM]] [[Category:Examples]]&lt;br /&gt;
{{Navigation|[[PGMs]]|[[Class - Introduction|Classes]]}}&lt;br /&gt;
{{User Defined Classes Header Table |currentpage=4}}&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
{{TOC}}&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
The ARRAY class provides member functions to create a &amp;lt;u&amp;gt;dynamic array&amp;lt;/u&amp;gt; and manipulate its elements. &lt;br /&gt;
* The user may read in an array from a file.  The file may be either a CSV file, created using Excel, or a TXT file, created using a test editor such as Notepad++. &lt;br /&gt;
* The user may set constant values into an array when it is declared.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notes:&#039;&#039;&#039;&lt;br /&gt;
# The initial length of the array is zero.&lt;br /&gt;
# &#039;&#039;&#039;The array is zero indexed&#039;&#039;&#039;, i.e. the index of the first element in the array is zero, and NOT 1.  Therefore, the final element in an array of length &#039;&#039;n&#039;&#039; will have an index = &#039;&#039;n-1&#039;&#039;.&lt;br /&gt;
# If the index is out of range (0 &amp;lt;= &#039;&#039;index&#039;&#039; &amp;lt; &#039;&#039;length&#039;&#039;) then a runtime &amp;quot;PGM class execution error&amp;quot; will occur and the ARRAY operation will be ignored.&lt;br /&gt;
# The Array class allows user to Get / Set &#039;&#039;numeric values&#039;&#039; only.  Please see [[StrArray Class]] for getting/setting &#039;&#039;String values&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Data Members ==&lt;br /&gt;
&lt;br /&gt;
None&lt;br /&gt;
&lt;br /&gt;
== Member Functions ==&lt;br /&gt;
The examples in the table below is based on the following variables and array declarations.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;pgm&amp;quot;&amp;gt;&lt;br /&gt;
STRING   ArrayFileName&lt;br /&gt;
REAL     e, DotProduct&lt;br /&gt;
LONG     d&lt;br /&gt;
BIT      OK@, EqualOK@, SortOK@, AddOK@, SubOK@, MultOK@, DivOK@&lt;br /&gt;
ARRAY    a, b, c, NewA, A1, A2, PreVals, z ;declares array instances&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot; &lt;br /&gt;
| width=&amp;quot;15%&amp;quot; |&#039;&#039;&#039;Call &#039;&#039;&#039; || width=&amp;quot;35%&amp;quot; | &#039;&#039;&#039;Functionality&#039;&#039;&#039;|| width=&amp;quot;6%&amp;quot; |&#039;&#039;&#039;Return Type &#039;&#039;&#039; || width=&amp;quot;25%&amp;quot; |&#039;&#039;&#039;Parameters &#039;&#039;&#039; || width=&amp;quot;30%&amp;quot; | &#039;&#039;&#039;Example&#039;&#039;&#039; &lt;br /&gt;
|-&lt;br /&gt;
||&#039;&#039;&#039;SetLen&#039;&#039;&#039;(&#039;&#039;length&#039;&#039;) || Sets the size of the array to &#039;&#039;length&#039;&#039; || || &#039;&#039;length :&#039;&#039; the required length of the array, is of data type INTEGER || a.SetLen(5)&lt;br /&gt;
|-&lt;br /&gt;
||&#039;&#039;&#039;GetLen&#039;&#039;&#039;() || The function returns the length of the array. || integer || None || d = a.GetLen()&lt;br /&gt;
|-&lt;br /&gt;
||&#039;&#039;&#039;SetSize&#039;&#039;&#039;(&#039;&#039;length&#039;&#039;) &amp;lt;br&amp;gt; {{Available139|30807}} || Sets the size of the array to &#039;&#039;length&#039;&#039;. SetSize() function is an equivalent alternative to SetLen() || || &#039;&#039;length :&#039;&#039; the required size of the array, is of data type INTEGER || a.SetSize(5)&lt;br /&gt;
|-&lt;br /&gt;
||&#039;&#039;&#039;Size&#039;&#039;&#039;() &amp;lt;br&amp;gt; {{Available139|30807}} || The function returns the length of the array. Size() function is an equivalent alternative to GetLen(). || integer || None || d = a.Size()&lt;br /&gt;
|-&lt;br /&gt;
|| &#039;&#039;&#039;SetAt&#039;&#039;&#039;(&#039;&#039;index, value&#039;&#039;) || This sets the element of the array, which corresponds to the given &#039;&#039;index&#039;&#039; to the specified &#039;&#039;value&#039;&#039;. || || &#039;&#039;index&#039;&#039;: the index of the required entry in the array (&#039;&#039;&#039;Note:&#039;&#039;&#039; index starts at zero). This is of data type, INTEGER. &amp;lt;br&amp;gt; &#039;&#039;value :&#039;&#039; the value to which the specified element, in the array, will be set. This is of data type, REAL.&#039;&#039; || a.SetAt(0, 3)&amp;lt;br&amp;gt; OR:&amp;lt;br&amp;gt;a[0] = 3&lt;br /&gt;
|-&lt;br /&gt;
||&#039;&#039;&#039;GetAt&#039;&#039;&#039;(&#039;&#039;index&#039;&#039;) || This retrieves the value (type real) of the element from the array, which corresponds to the given &#039;&#039;index&#039;&#039;. || Real || &#039;&#039;index :&#039;&#039; the index of the required entry in the array (&#039;&#039;&#039;Note:&#039;&#039;&#039; index starts at zero). This is of data type INTEGER. || e = a.GetAt(0)&amp;lt;br&amp;gt; or: &amp;lt;br&amp;gt;e = a[0]&lt;br /&gt;
|-&lt;br /&gt;
||&#039;&#039;&#039;IncAt&#039;&#039;&#039;(&#039;&#039;Index, value&#039;&#039;) || This increases the element of the array by the specified value. || || &#039;&#039;index :&#039;&#039; the index of the required entry in the array (&#039;&#039;&#039;Note:&#039;&#039;&#039; index starts at zero). This is of data type INTEGER. &amp;lt;br&amp;gt; &#039;&#039;value :&#039;&#039; the value to which the specified element, in the array, will be increased. This is of data type REAL.&#039;&#039; || &amp;quot;a.IncAt(3, 10)&amp;quot; is equivalent to:&amp;lt;br&amp;gt;temp = a.GetAt(3)&amp;lt;br&amp;gt;a.SetAt(3, temp + 10)&lt;br /&gt;
|-&lt;br /&gt;
||&#039;&#039;&#039;DecAt&#039;&#039;&#039;(&#039;&#039;Index, value&#039;&#039;) || This decreases the element of the array by the specified value. || || &#039;&#039;index :&#039;&#039; the index of the required entry in the array (&#039;&#039;&#039;Note:&#039;&#039;&#039; index starts at zero). This is of data type INTEGER. &amp;lt;br&amp;gt; &#039;&#039;value :&#039;&#039; the value to which the specified element, in the array, will be decreased. This is of data type REAL.&#039;&#039; || &amp;quot;a.DecAt(3, 5)&amp;quot; is equivalent to:&amp;lt;br&amp;gt;temp = a.GetAt(3)&amp;lt;br&amp;gt;a.SetAt(3, temp - 5)&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
||&#039;&#039;&#039;Sum&#039;&#039;&#039;() || This calculates the sum of all elements in the array. || Real || None || e = a.Sum()&lt;br /&gt;
|-&lt;br /&gt;
||&#039;&#039;&#039;Avg&#039;&#039;&#039;() || This calculates the average of all elements in the array. || Real || None || e = a.Avg()&lt;br /&gt;
|-&lt;br /&gt;
||&#039;&#039;&#039;Min&#039;&#039;&#039;() || This returns the minimum value of all elements in the array. || Real || None || e = a.Min()&lt;br /&gt;
|-&lt;br /&gt;
||&#039;&#039;&#039;MinIndex&#039;&#039;&#039;() || This returns the index of the minimum value in the array.  If multiple entries of equal minimum value, the first index is returned.  Return value is -1 for empty array. || integer || None || d = a.MinIndex()&lt;br /&gt;
|-&lt;br /&gt;
||&#039;&#039;&#039;Max&#039;&#039;&#039;() || This returns the maximum value of all elements in the array. || Real || None || e = a.Max()&lt;br /&gt;
|-&lt;br /&gt;
||&#039;&#039;&#039;MaxIndex&#039;&#039;&#039;() || This returns the index of the maximum value in the array.  If multiple entries of equal maximum value, the first index is returned.  Return value is -1 for empty array. || integer || None || d = a.MaxIndex()&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Norm&#039;&#039;&#039;() &amp;lt;br&amp;gt; {{Available139|30807}} || This normalises the contents of the array such that the sum is 1. Equivalent to a.OpDiv(a.Sum()). || || None || a.Norm() &lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Reverse&#039;&#039;&#039;() &amp;lt;br&amp;gt; {{Available139|30807}} || This reverses the sequence of all elements in the array. || || None || a.Reverse() &lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Sort&#039;&#039;&#039;(&#039;&#039;Ascending/Descending&#039;&#039;) || This re-arranges all elements in the array in ascending / descending order. || || 0: Descending order, &amp;lt;br&amp;gt; 1: Ascending order || a.Sort(1) &lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;IsSorted&#039;&#039;&#039;(&#039;&#039;Ascending/Descending&#039;&#039;) || This checks if the array is sorted in ascending / descending order. Returns True if array is sorted in the specified order. || Bit || 0: Descending order, &amp;lt;br&amp;gt; 1: Ascending order || SortOK = a.IsSorted(1)&lt;br /&gt;
|-&lt;br /&gt;
||&lt;br /&gt;
&#039;&#039;&#039;Load&#039;&#039;&#039;(&#039;&#039;arrayfilename&#039;&#039;)&lt;br /&gt;
||&lt;br /&gt;
This creates a new array from a file.&lt;br /&gt;
* The first element on each line, of the specified file, is read in as an element of the array, until either an empty line or end-of-file character is reached.&lt;br /&gt;
* The function returns the value, True if the file was read or, False if the file was not read.&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; if any elements exist in the array, prior to calling &#039;&#039;&#039;Load&#039;&#039;&#039;, these elements will be overridden.&#039;&#039; &lt;br /&gt;
||&lt;br /&gt;
Bit&lt;br /&gt;
||&lt;br /&gt;
&#039;&#039;arrayfileName :&#039;&#039; either the actual filename and path in quotations or a STR variable, which refers to the file. Use $Prj in the folder string for folders relative to the project folder.&lt;br /&gt;
||&lt;br /&gt;
ArrayFileName = &amp;quot;c:\SysCAD\array.csv&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
OK = b.Load(ArrayFileName)&amp;lt;br&amp;gt;&lt;br /&gt;
or&amp;lt;br&amp;gt;&lt;br /&gt;
OK = c.Load(&amp;quot;$Prj\data.txt&amp;quot;)&lt;br /&gt;
|-&lt;br /&gt;
||&lt;br /&gt;
&#039;&#039;&#039;Save&#039;&#039;&#039;(&#039;&#039;arrayfilename&#039;&#039;)&lt;br /&gt;
||&lt;br /&gt;
This saves the array data to a comma separated text file.&lt;br /&gt;
* If the specified file exists it is overwritten.&lt;br /&gt;
* The function returns, True if the file was saved or, False if the file was not saved.&lt;br /&gt;
* This could fail for any file access reason, for example: invalid folder, invalid filename, file access error, file already open in another application, etc.&lt;br /&gt;
||&lt;br /&gt;
Bit&lt;br /&gt;
||&lt;br /&gt;
&#039;&#039;arrayfileName :&#039;&#039; either the actual filename and path in quotations or a STR variable, which refers to the file. Use $Prj in the folder string for folders relative to the project folder.&lt;br /&gt;
||&lt;br /&gt;
OK = a.Save(&amp;quot;$Prj\data_output.txt&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
||&lt;br /&gt;
&#039;&#039;&#039;CopyToClipboard&#039;&#039;&#039;()&lt;br /&gt;
||&lt;br /&gt;
This saves the array data to the clipboard.&lt;br /&gt;
The function returns the value, True.&lt;br /&gt;
||&lt;br /&gt;
Bit&lt;br /&gt;
||&lt;br /&gt;
None&lt;br /&gt;
||&lt;br /&gt;
OK = a.CopyToClipboard()&lt;br /&gt;
|-&lt;br /&gt;
||&#039;&#039;&#039;SetAll&#039;&#039;&#039;(&#039;&#039;value&#039;&#039;) || This sets all the elements of the array to the specified &#039;&#039;value&#039;&#039;. || || &#039;&#039;value :&#039;&#039; the required initialising value. This is of data type REAL.&#039;&#039; || a.SetAll(0)&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Scale&#039;&#039;&#039;(&#039;&#039;value&#039;&#039;) || All the elements of the array are scaled by the specified &#039;&#039;value&#039;&#039; &amp;lt;br&amp;gt;(New value = original value * Scale). || || &#039;&#039;value :&#039;&#039; the required scaling factor. This is of data type REAL.&#039;&#039; || a.Scale(2) &amp;lt;br&amp;gt;-  Each value of the Array &amp;quot;a&amp;quot; will be increased by factor of 2.&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Offset&#039;&#039;&#039;(&#039;&#039;value&#039;&#039;) || All the elements of the array are offset by the specified &#039;&#039;value&#039;&#039; &amp;lt;br&amp;gt;(New value = original value + Offset). || || &#039;&#039;value :&#039;&#039; the required offset value. This is of data type REAL.&#039;&#039; || a.Offset(5) &amp;lt;br&amp;gt;- Each value of the Array &amp;quot;a&amp;quot; will be increased by 5.&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Copy&#039;&#039;&#039;(&#039;&#039;Array&#039;&#039;) || All the elements of the specified array are copied into the new array. || || &#039;&#039;Array:&#039;&#039; the name of the array to copy from. This is an ARRAY class.&#039;&#039; || PreVals.Copy(a) &amp;lt;br&amp;gt;- The values in Array &amp;quot;a&amp;quot; are copied into the Array &amp;quot;PreVals&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Append&#039;&#039;&#039;(&#039;&#039;Array&#039;&#039;) &amp;lt;br&amp;gt; {{Available139|30807}} || All the elements of the specified array are added to the end of the existing array. The new length of the array will be the sum of the original length plus the length of the specified array.|| || &#039;&#039;Array:&#039;&#039; the name of the array to append. This is an ARRAY class.&#039;&#039; || PreVals.Append(a) &amp;lt;br&amp;gt;- The values in Array &amp;quot;a&amp;quot; are appended to the end of the Array &amp;quot;PreVals&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;AppendItem&#039;&#039;&#039;(&#039;&#039;value&#039;&#039;) &amp;lt;br&amp;gt; {{Available139|30874}} || Increase the length of the array by one with the supplied value. || || &#039;&#039;value:&#039;&#039; the value to which the last element in the array will be set. || a.AppendItem(42)&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;InsertAt&#039;&#039;&#039;(&#039;&#039;index&#039;&#039;, &#039;&#039;value&#039;&#039;) &amp;lt;br&amp;gt; {{Available139|32112}} || Increase the length of the array by one inserting the supplied value at the specified &#039;&#039;index&#039;&#039;. || || &#039;&#039;index:&#039;&#039; the zero based index in array where the value must be inserted. Index data type is INTEGER and must be in range for Array length.&amp;lt;br&amp;gt; &#039;&#039;value:&#039;&#039; the value to be set at the new inserted element in the array. || a.InsertAt(0, 42)&amp;lt;br&amp;gt;- Inserts 42 at start of array.&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;RemoveAt&#039;&#039;&#039;(&#039;&#039;index&#039;&#039;, &#039;&#039;count&#039;&#039;) &amp;lt;br&amp;gt; {{Available139|32112}} || Decrease the length of the array by removing &#039;&#039;count&#039;&#039; (or less) values starting at the specified &#039;&#039;index&#039;&#039;. || || &#039;&#039;index:&#039;&#039; the zero based index in array where values must be deleted. Index data type is INTEGER and must be in range for Array length. &amp;lt;br&amp;gt; &#039;&#039;count:&#039;&#039; the number of elements to be removed. The value of &#039;&#039;count&#039;&#039; may be large, exceeding the current array length in which case all elements from the specified &#039;&#039;index&#039;&#039; are removed. Count data type is INTEGER. || a.RemoveAt(5, 1)&amp;lt;br&amp;gt;- Removes one element at index 5.&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;IsEqual&#039;&#039;&#039;(&#039;&#039;Array&#039;&#039;) || This compares the current array with the specified array data, if each element of the array are equal, the function returns the value, True. || Bit || &#039;&#039;Array:&#039;&#039; the name of the array to compare with. This is an ARRAY class.&#039;&#039; || EqualOK = PreVals.IsEqual(a) &amp;lt;br&amp;gt;- The values in array &amp;quot;PreVals&amp;quot; are compared to the values of the Array &amp;quot;a&amp;quot;.  Returns true if they are equal.&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Add&#039;&#039;&#039;(&#039;&#039;Array&#039;&#039;) || This function performs addition between current array and a specified array. New value for each element in current array = value in current array + specified array. &amp;lt;br&amp;gt; The two arrays must have the same length, otherwise value remains unchanged and error is returned. || Bit || &#039;&#039;Array:&#039;&#039; the name of the specified array. This is an ARRAY class. ||  AddOK = NewA.add(A1) &amp;lt;br&amp;gt; (each element in NewA = NewA + A1)&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Sub&#039;&#039;&#039;(&#039;&#039;Array&#039;&#039;) || This function performs subtraction between current array and a specified array. New value for each element in current array = value in current array - specified array. &amp;lt;br&amp;gt; The two arrays must have the same length, otherwise value remains unchanged and error is returned. || Bit ||&#039;&#039;Array:&#039;&#039; the name of the specified array. This is an ARRAY class. ||  SubOK = NewA.Sub(A1) &amp;lt;br&amp;gt; (each element in NewA = NewA - A1)&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Mult&#039;&#039;&#039;(&#039;&#039;Array&#039;&#039;) || This function performs multiplication between current array and a specified array. New value for each element in current array = value in current array x specified array. &amp;lt;br&amp;gt; The two arrays must have the same length, otherwise value remains unchanged and error is returned. || Bit || &#039;&#039;Array:&#039;&#039; the name of the specified array. This is an ARRAY class. ||  MultOK = NewA.Mult(A1)  &amp;lt;br&amp;gt; (each element in NewA = NewA * A1)&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Div&#039;&#039;&#039;(&#039;&#039;Array&#039;&#039;) || This function performs division between current array and a specified array. New value for each element in current array = value in current array / specified array.&amp;lt;br&amp;gt; The two arrays must have the same length, otherwise value remains unchanged and error is returned. || Bit ||&#039;&#039;Array:&#039;&#039; the name of the specified array. This is an ARRAY class. ||  DivOK = NewA.Div(A1) &amp;lt;br&amp;gt; (each element in NewA = NewA / A1)&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;CopyAdd&#039;&#039;&#039;(&#039;&#039;Array1, Array2&#039;&#039;) || This function performs addition between two arrays and stores the values in a new array (current array).   Value for each element in current array = value in array1 + array2. &amp;lt;br&amp;gt; The two arrays must have the same length, otherwise value remains unchanged and error is returned. || Bit || &#039;&#039;Array1:&#039;&#039; the name of the first specified array. This is an ARRAY class. &amp;lt;br&amp;gt; &#039;&#039;Array2:&#039;&#039; the name of the second specified array. This is an ARRAY class.&#039;&#039;||  AddOK = NewA.CopyAdd(A1, A2) &amp;lt;br&amp;gt; (each element in NewA = A1 + A2)&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;CopySub&#039;&#039;&#039;(&#039;&#039;Array1, Array2&#039;&#039;) || This function performs subtraction between two arrays and stores the values in a new array (current array).   Value for each element in current array = value in array1 - array2. &amp;lt;br&amp;gt; The two arrays must have the same length, otherwise value remains unchanged and error is returned. || Bit || &#039;&#039;Array1:&#039;&#039; the name of the first specified array. This is an ARRAY class. &amp;lt;br&amp;gt; &#039;&#039;Array2:&#039;&#039; the name of the second specified array. This is an ARRAY class.||  AddOK = NewA.CopySub(A1, A2) &amp;lt;br&amp;gt; (each element in NewA = A1 - A2)&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;CopyMult&#039;&#039;&#039;(&#039;&#039;Array1, Array2&#039;&#039;) || This function performs multiplication between two arrays and stores the values in a new array (current array).   Value for each element in current array = value in array1 x array2. &amp;lt;br&amp;gt; The two arrays must have the same length, otherwise value remains unchanged and error is returned. || Bit || &#039;&#039;Array1:&#039;&#039; the name of the first specified array. This is an ARRAY class. &amp;lt;br&amp;gt; &#039;&#039;Array2:&#039;&#039; the name of the second specified array. This is an ARRAY class. ||  AddOK = NewA.CopyMult(A1, A2) &amp;lt;br&amp;gt; (each element in NewA = A1 * A2)&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;CopyDiv&#039;&#039;&#039;(&#039;&#039;Array1, Array2&#039;&#039;) || This function performs division between two arrays and stores the values in a new array (current array).   Value for each element in current array = value in array1 / array2. &amp;lt;br&amp;gt; The two arrays must have the same length, otherwise value remains unchanged and error is returned. || Bit || &#039;&#039;Array1:&#039;&#039; the name of the first specified array. This is an ARRAY class. &amp;lt;br&amp;gt; &#039;&#039;Array2:&#039;&#039; the name of the second specified array. This is an ARRAY class.||  AddOK = NewA.CopyDiv(A1, A2)&amp;lt;br&amp;gt; (each element in NewA = A1 / A2)&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Inner&#039;&#039;&#039;(&#039;&#039;Array&#039;&#039;) || This returns the Sum of Element i (Current Array * Specified Array).  The two arrays must have the same length, otherwise error is returned. || REAL || &#039;&#039;Array:&#039;&#039; the name of the second array. This is an ARRAY class.&#039;&#039; || DotProduct = a.Inner(PreVals)&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;CircConv&#039;&#039;&#039;(&#039;&#039;Array&#039;&#039;) &amp;lt;br&amp;gt; {{Available139|30613}} || This function performs circular convolution calculation between the current array and a specified array. New value for each element in current array is calculated as the integral of the product of the two arrays after one is reversed and shifted.  The values in the current array will be replaced with the new value. &amp;lt;br&amp;gt; The two arrays are expected to have the same length. || Bit || &#039;&#039;Array:&#039;&#039; the name of the specified array. This is an ARRAY class. ||  AddOK = NewA.CirConv(A1) &amp;lt;br&amp;gt; (each element in NewA = circular convolution of NewA and A1)&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;CopyCircConv&#039;&#039;&#039;(&#039;&#039;Array1, Array2&#039;&#039;) &amp;lt;br&amp;gt; {{Available139|30613}} || This function performs circular convolution calculation between two arrays and stores the values in a new array (current array).   Value for each element in current array is calculated as the integral of the product of the two arrays after one is reversed and shifted. &amp;lt;br&amp;gt; The two arrays are expected to have the same length. || Bit || &#039;&#039;Array1:&#039;&#039; the name of the first specified array. This is an ARRAY class. &amp;lt;br&amp;gt; &#039;&#039;Array2:&#039;&#039; the name of the second specified array. This is an ARRAY class.&#039;&#039;||  AddOK = NewA.CopyCirConv(A1, A2) &amp;lt;br&amp;gt; (each element in NewA = circular convolution of A1 and A2)&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;SetFromStr&#039;&#039;&#039;(&#039;&#039;Str s, Str Separ&#039;&#039;) &amp;lt;br&amp;gt; {{Available139|35544}}|| This function enables the unpacking of a string into an array, converting each element into a number. It internally utilises the StrToFlt function. &amp;lt;br&amp;gt; The array’s length is determined by the number of items derived from unpacking the string.|| REAL || &#039;&#039;s&#039;&#039; is the string that requires unpacking. &amp;lt;br&amp;gt; &#039;&#039;Separ&#039;&#039; is the separator used within the string ‘s’ to define the divisions. ||x.SetFromStr(&amp;quot;35,4,30&amp;quot;, &amp;quot;,&amp;quot;) will unpack the three numbers into the array ‘x’, resulting in x[0]=35, x[1]=4, and x[2]=30. &lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;CopyToStr&#039;&#039;&#039;(&#039;&#039;Str Separ&#039;&#039;) &amp;lt;br&amp;gt; {{Available139|35544}}|| This function enables the consolidation of a ‘Array’ into a single string. || STRING|| &#039;&#039;Separ&#039;&#039; denotes the delimiter used within the string ‘s’ to demarcate its segments. ||x.CopyToStr(&amp;quot;,&amp;quot;) will combine the elements of the &#039;Array&#039; named &#039;x&#039; into the string &amp;quot;35,4,30&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;PushBack&#039;&#039;&#039;(&#039;&#039;value&#039;&#039;) &amp;lt;br&amp;gt; &#039;&#039;&#039;PushFront&#039;&#039;&#039;(&#039;&#039;value&#039;&#039;) &amp;lt;br&amp;gt; {{Available140}}|| These methods put &#039;&#039;value&#039;&#039; at the start or end of the array and increase the size. ||  || &#039;&#039;value&#039;&#039;: the value to be set. || Equivalent to InsertAt(0, value) &lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;PopBack&#039;&#039;&#039;() &amp;lt;br&amp;gt; &#039;&#039;&#039;PopFront&#039;&#039;&#039;() &amp;lt;br&amp;gt; {{Available140}}|| These functions return the value at the start or end, and decrease the size. || Real ||  || If A = [1., 2., 3.], then A.PopBack() returns 3.0 and A = [1, 2]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;PushFrontPopBack&#039;&#039;&#039;(&#039;&#039;value&#039;&#039;) &amp;lt;br&amp;gt; &#039;&#039;&#039;PushBackPopFront&#039;&#039;&#039;(&#039;&#039;value&#039;&#039;) &amp;lt;br&amp;gt; {{Available140}}|| These functions treat the array as a FIFO queue, adding an item at one end and removing and returning the item at the other end. All items are moved up or down in the array and the size is unchanged || Real || Real || &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Watch ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;Watch&#039;&#039;&#039; keyword can be used to display the Array values in the Access Window.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;u&amp;gt;Syntax&amp;lt;/u&amp;gt;&#039;&#039;&#039;:&lt;br /&gt;
* Individual elements in the array can be made visible - e.g. &amp;quot;Watch A[2]&amp;quot; or &amp;quot;Watch A@[2]&amp;quot;. &lt;br /&gt;
* A range of array elements can be made visible - e.g. &amp;quot;Watch A[All,5]&amp;quot; which would show the first 5 elements of the array. &lt;br /&gt;
* If the &amp;quot;@&amp;quot; symbol is included, then the array elements will be read only fields in the access window.&lt;br /&gt;
&lt;br /&gt;
=== Array with Constant Values ===&lt;br /&gt;
&lt;br /&gt;
The user may declare an array with a set of constant values.  This allows the user to set up an array with known values for direct use. It can be a useful alternative to reading values from a CSV file.  Once defined, the contents or size of this constant Array cannot be changed.  Where a number is not specified for an entry, 0 is assumed.  The contents of the array are not saved as they are defined in the code.  From {{Available139|32217||y}}, the list can include system constants (for example NAN or PI), or user defined constants.  From {{Available139|32325||y}}, the const keyword should be used, otherwise a load warning (or error) is given.&lt;br /&gt;
&lt;br /&gt;
The syntax is:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;pgm&amp;quot;&amp;gt;&lt;br /&gt;
const ARRAY a = {n1,n2,n3,....} ;Syntax from {{Available139|32325||y}}&lt;br /&gt;
ARRAY a = {n1,n2,n3,....} ;Syntax before {{Available139|32325||y}}&lt;br /&gt;
;where n1, n2 etc. are real numbers or constants.&lt;br /&gt;
;Example&lt;br /&gt;
const Array SomePrimes = {2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Caution ===&lt;br /&gt;
&lt;br /&gt;
Using a GetAt within a SetAt can sometimes fail. This may be for expressions with multiple array references.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;pgm&amp;quot;&amp;gt;&lt;br /&gt;
;For example:&lt;br /&gt;
a.SetAt(i, a.GetAt(i+1))  ;This can sometimes fail&lt;br /&gt;
&lt;br /&gt;
;The solution is to use a temporary variable to first retrieve the GetAt value and then call SetAt as follows:&lt;br /&gt;
Real   Tmp&lt;br /&gt;
Tmp = a.GetAt(i+1)&lt;br /&gt;
a.SetAt(i, Tmp)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;pgm&amp;quot;&amp;gt;&lt;br /&gt;
STRING      ArrayFileName&lt;br /&gt;
REAL        d, e, f, Total@, Average@, Minimum@, Maximum@, DotProduct@&lt;br /&gt;
BIT         OK@, CopyOK@, SortOK@, AddOK@, SubOK@&lt;br /&gt;
ARRAY       a                           ;declares array instance.&lt;br /&gt;
ARRAY       b{e}, c{e}                  ;declares array instances that are excluded from save (for efficiency).&lt;br /&gt;
const ARRAY x = {60,35,25,62,105}       ;declares an array z with constant values.&lt;br /&gt;
;ARRAY      x = {60,35,25,62,105}       ;Old syntax before {{Removed139|32325||y}}&lt;br /&gt;
ARRAY       y, y1, y2 &lt;br /&gt;
const ARRAY y3 = {20,35,45,62,105,150}  ;declares an array y3 with constant values.&lt;br /&gt;
const ARRAY z = {20,35,45,62,105}       ;declares an array z with constant values.&lt;br /&gt;
&lt;br /&gt;
Sub InitialiseSolution()&lt;br /&gt;
  ArrayFileName = &amp;quot;c:\SysCAD\array.csv&amp;quot;&lt;br /&gt;
  OK = b.Load(ArrayFileName)&lt;br /&gt;
  OK = c.Load(&amp;quot;$Prj\data.txt&amp;quot;)&lt;br /&gt;
  a.SetLen(5)                  ;sets the array length&lt;br /&gt;
  y.copy(x)                    ;array x is copied into array y, returns {60,35,25,62,105}&lt;br /&gt;
  CopyOK = y.isEqual(x)        ;compares array y with array x, returns true&lt;br /&gt;
  y.sort(1)                    ;sorts array y in ascending order, returns {25,35,60,62,105}&lt;br /&gt;
  SortOK = y.IsSorted(1)       ;checks if array y is sorted in ascending order, returns true&lt;br /&gt;
  y1.copy(y)                   ;copies y, returns {25,35,60,62,105}&lt;br /&gt;
  y1.scale(2)                  ;multiplies each element by scaling factor of 2, returns {50, 70, 120, 124, 210}&lt;br /&gt;
  y2.copy(y)                   ;copies y, returns {25,35,60,62,105}&lt;br /&gt;
  y2.offset(5)                 ;adds each element by offset factor of 5, returns {30, 40, 65, 67, 110}&lt;br /&gt;
  AddOK = y.add(y2)            ;Adds each element of y to elements of y2, y now becomes {55, 75, 125, 129, 215}, returns true &lt;br /&gt;
  SubOK = y1.sub(y3)           ;returns false since array length of y1 does not equal to y3. Array y1 unchanged.&lt;br /&gt;
  DotProduct = y.inner(y2)     ;sum of each element y_i * y2_i, returns 45068&lt;br /&gt;
EndSub&lt;br /&gt;
&lt;br /&gt;
;Logic   &lt;br /&gt;
d = a.GetLen()               ;gets the array length&lt;br /&gt;
a.SetAll(2.2/2)              ;sets all elements&lt;br /&gt;
a.IncAt(0, 7.0)              ;increments the first element&lt;br /&gt;
a[d-1] = 3.3                 ;sets last element &lt;br /&gt;
e = a[0]                     ;gets first element&lt;br /&gt;
f = z[3]                     ;gets the fourth element of array z, so f = 62&lt;br /&gt;
Total = z.Sum()              ;gets the sum of all the values in array z, Total = 267&lt;br /&gt;
Average = z.Avg()            ;gets the average of all the values in array z, Average = 53.4&lt;br /&gt;
Minimum = z.Min()            ;gets the minimum of all the values in array z, Minimum = 20&lt;br /&gt;
Maximum = z.Max()            ;gets the maximum of all the values in array z, Maximum = 105&lt;br /&gt;
$&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See also: [[Python Example - Optimization#Calculating_the_objective_error | Optimisation Example]] shows using these Array tools in a real example for plant tuning calculating an objective function.&lt;/div&gt;</summary>
		<author><name>Rod.Stephenson</name></author>
	</entry>
	<entry>
		<id>https://help.syscad.net/index.php?title=Array_Class&amp;diff=84624</id>
		<title>Array Class</title>
		<link rel="alternate" type="text/html" href="https://help.syscad.net/index.php?title=Array_Class&amp;diff=84624"/>
		<updated>2026-05-26T15:30:09Z</updated>

		<summary type="html">&lt;p&gt;Rod.Stephenson: /* Member Functions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:PGM]] [[Category:Examples]]&lt;br /&gt;
{{Navigation|[[PGMs]]|[[Class - Introduction|Classes]]}}&lt;br /&gt;
{{User Defined Classes Header Table |currentpage=4}}&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
{{TOC}}&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
The ARRAY class provides member functions to create a &amp;lt;u&amp;gt;dynamic array&amp;lt;/u&amp;gt; and manipulate its elements. &lt;br /&gt;
* The user may read in an array from a file.  The file may be either a CSV file, created using Excel, or a TXT file, created using a test editor such as Notepad++. &lt;br /&gt;
* The user may set constant values into an array when it is declared.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notes:&#039;&#039;&#039;&lt;br /&gt;
# The initial length of the array is zero.&lt;br /&gt;
# &#039;&#039;&#039;The array is zero indexed&#039;&#039;&#039;, i.e. the index of the first element in the array is zero, and NOT 1.  Therefore, the final element in an array of length &#039;&#039;n&#039;&#039; will have an index = &#039;&#039;n-1&#039;&#039;.&lt;br /&gt;
# If the index is out of range (0 &amp;lt;= &#039;&#039;index&#039;&#039; &amp;lt; &#039;&#039;length&#039;&#039;) then a runtime &amp;quot;PGM class execution error&amp;quot; will occur and the ARRAY operation will be ignored.&lt;br /&gt;
# The Array class allows user to Get / Set &#039;&#039;numeric values&#039;&#039; only.  Please see [[StrArray Class]] for getting/setting &#039;&#039;String values&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Data Members ==&lt;br /&gt;
&lt;br /&gt;
None&lt;br /&gt;
&lt;br /&gt;
== Member Functions ==&lt;br /&gt;
The examples in the table below is based on the following variables and array declarations.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;pgm&amp;quot;&amp;gt;&lt;br /&gt;
STRING   ArrayFileName&lt;br /&gt;
REAL     e, DotProduct&lt;br /&gt;
LONG     d&lt;br /&gt;
BIT      OK@, EqualOK@, SortOK@, AddOK@, SubOK@, MultOK@, DivOK@&lt;br /&gt;
ARRAY    a, b, c, NewA, A1, A2, PreVals, z ;declares array instances&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot; &lt;br /&gt;
| width=&amp;quot;15%&amp;quot; |&#039;&#039;&#039;Call &#039;&#039;&#039; || width=&amp;quot;35%&amp;quot; | &#039;&#039;&#039;Functionality&#039;&#039;&#039;|| width=&amp;quot;6%&amp;quot; |&#039;&#039;&#039;Return Type &#039;&#039;&#039; || width=&amp;quot;25%&amp;quot; |&#039;&#039;&#039;Parameters &#039;&#039;&#039; || width=&amp;quot;30%&amp;quot; | &#039;&#039;&#039;Example&#039;&#039;&#039; &lt;br /&gt;
|-&lt;br /&gt;
||&#039;&#039;&#039;SetLen&#039;&#039;&#039;(&#039;&#039;length&#039;&#039;) || Sets the size of the array to &#039;&#039;length&#039;&#039; || || &#039;&#039;length :&#039;&#039; the required length of the array, is of data type INTEGER || a.SetLen(5)&lt;br /&gt;
|-&lt;br /&gt;
||&#039;&#039;&#039;GetLen&#039;&#039;&#039;() || The function returns the length of the array. || integer || None || d = a.GetLen()&lt;br /&gt;
|-&lt;br /&gt;
||&#039;&#039;&#039;SetSize&#039;&#039;&#039;(&#039;&#039;length&#039;&#039;) &amp;lt;br&amp;gt; {{Available139|30807}} || Sets the size of the array to &#039;&#039;length&#039;&#039;. SetSize() function is an equivalent alternative to SetLen() || || &#039;&#039;length :&#039;&#039; the required size of the array, is of data type INTEGER || a.SetSize(5)&lt;br /&gt;
|-&lt;br /&gt;
||&#039;&#039;&#039;Size&#039;&#039;&#039;() &amp;lt;br&amp;gt; {{Available139|30807}} || The function returns the length of the array. Size() function is an equivalent alternative to GetLen(). || integer || None || d = a.Size()&lt;br /&gt;
|-&lt;br /&gt;
|| &#039;&#039;&#039;SetAt&#039;&#039;&#039;(&#039;&#039;index, value&#039;&#039;) || This sets the element of the array, which corresponds to the given &#039;&#039;index&#039;&#039; to the specified &#039;&#039;value&#039;&#039;. || || &#039;&#039;index&#039;&#039;: the index of the required entry in the array (&#039;&#039;&#039;Note:&#039;&#039;&#039; index starts at zero). This is of data type, INTEGER. &amp;lt;br&amp;gt; &#039;&#039;value :&#039;&#039; the value to which the specified element, in the array, will be set. This is of data type, REAL.&#039;&#039; || a.SetAt(0, 3)&amp;lt;br&amp;gt; OR:&amp;lt;br&amp;gt;a[0] = 3&lt;br /&gt;
|-&lt;br /&gt;
||&#039;&#039;&#039;GetAt&#039;&#039;&#039;(&#039;&#039;index&#039;&#039;) || This retrieves the value (type real) of the element from the array, which corresponds to the given &#039;&#039;index&#039;&#039;. || Real || &#039;&#039;index :&#039;&#039; the index of the required entry in the array (&#039;&#039;&#039;Note:&#039;&#039;&#039; index starts at zero). This is of data type INTEGER. || e = a.GetAt(0)&amp;lt;br&amp;gt; or: &amp;lt;br&amp;gt;e = a[0]&lt;br /&gt;
|-&lt;br /&gt;
||&#039;&#039;&#039;IncAt&#039;&#039;&#039;(&#039;&#039;Index, value&#039;&#039;) || This increases the element of the array by the specified value. || || &#039;&#039;index :&#039;&#039; the index of the required entry in the array (&#039;&#039;&#039;Note:&#039;&#039;&#039; index starts at zero). This is of data type INTEGER. &amp;lt;br&amp;gt; &#039;&#039;value :&#039;&#039; the value to which the specified element, in the array, will be increased. This is of data type REAL.&#039;&#039; || &amp;quot;a.IncAt(3, 10)&amp;quot; is equivalent to:&amp;lt;br&amp;gt;temp = a.GetAt(3)&amp;lt;br&amp;gt;a.SetAt(3, temp + 10)&lt;br /&gt;
|-&lt;br /&gt;
||&#039;&#039;&#039;DecAt&#039;&#039;&#039;(&#039;&#039;Index, value&#039;&#039;) || This decreases the element of the array by the specified value. || || &#039;&#039;index :&#039;&#039; the index of the required entry in the array (&#039;&#039;&#039;Note:&#039;&#039;&#039; index starts at zero). This is of data type INTEGER. &amp;lt;br&amp;gt; &#039;&#039;value :&#039;&#039; the value to which the specified element, in the array, will be decreased. This is of data type REAL.&#039;&#039; || &amp;quot;a.DecAt(3, 5)&amp;quot; is equivalent to:&amp;lt;br&amp;gt;temp = a.GetAt(3)&amp;lt;br&amp;gt;a.SetAt(3, temp - 5)&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
||&#039;&#039;&#039;Sum&#039;&#039;&#039;() || This calculates the sum of all elements in the array. || Real || None || e = a.Sum()&lt;br /&gt;
|-&lt;br /&gt;
||&#039;&#039;&#039;Avg&#039;&#039;&#039;() || This calculates the average of all elements in the array. || Real || None || e = a.Avg()&lt;br /&gt;
|-&lt;br /&gt;
||&#039;&#039;&#039;Min&#039;&#039;&#039;() || This returns the minimum value of all elements in the array. || Real || None || e = a.Min()&lt;br /&gt;
|-&lt;br /&gt;
||&#039;&#039;&#039;MinIndex&#039;&#039;&#039;() || This returns the index of the minimum value in the array.  If multiple entries of equal minimum value, the first index is returned.  Return value is -1 for empty array. || integer || None || d = a.MinIndex()&lt;br /&gt;
|-&lt;br /&gt;
||&#039;&#039;&#039;Max&#039;&#039;&#039;() || This returns the maximum value of all elements in the array. || Real || None || e = a.Max()&lt;br /&gt;
|-&lt;br /&gt;
||&#039;&#039;&#039;MaxIndex&#039;&#039;&#039;() || This returns the index of the maximum value in the array.  If multiple entries of equal maximum value, the first index is returned.  Return value is -1 for empty array. || integer || None || d = a.MaxIndex()&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Norm&#039;&#039;&#039;() &amp;lt;br&amp;gt; {{Available139|30807}} || This normalises the contents of the array such that the sum is 1. Equivalent to a.OpDiv(a.Sum()). || || None || a.Norm() &lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Reverse&#039;&#039;&#039;() &amp;lt;br&amp;gt; {{Available139|30807}} || This reverses the sequence of all elements in the array. || || None || a.Reverse() &lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Sort&#039;&#039;&#039;(&#039;&#039;Ascending/Descending&#039;&#039;) || This re-arranges all elements in the array in ascending / descending order. || || 0: Descending order, &amp;lt;br&amp;gt; 1: Ascending order || a.Sort(1) &lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;IsSorted&#039;&#039;&#039;(&#039;&#039;Ascending/Descending&#039;&#039;) || This checks if the array is sorted in ascending / descending order. Returns True if array is sorted in the specified order. || Bit || 0: Descending order, &amp;lt;br&amp;gt; 1: Ascending order || SortOK = a.IsSorted(1)&lt;br /&gt;
|-&lt;br /&gt;
||&lt;br /&gt;
&#039;&#039;&#039;Load&#039;&#039;&#039;(&#039;&#039;arrayfilename&#039;&#039;)&lt;br /&gt;
||&lt;br /&gt;
This creates a new array from a file.&lt;br /&gt;
* The first element on each line, of the specified file, is read in as an element of the array, until either an empty line or end-of-file character is reached.&lt;br /&gt;
* The function returns the value, True if the file was read or, False if the file was not read.&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; if any elements exist in the array, prior to calling &#039;&#039;&#039;Load&#039;&#039;&#039;, these elements will be overridden.&#039;&#039; &lt;br /&gt;
||&lt;br /&gt;
Bit&lt;br /&gt;
||&lt;br /&gt;
&#039;&#039;arrayfileName :&#039;&#039; either the actual filename and path in quotations or a STR variable, which refers to the file. Use $Prj in the folder string for folders relative to the project folder.&lt;br /&gt;
||&lt;br /&gt;
ArrayFileName = &amp;quot;c:\SysCAD\array.csv&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
OK = b.Load(ArrayFileName)&amp;lt;br&amp;gt;&lt;br /&gt;
or&amp;lt;br&amp;gt;&lt;br /&gt;
OK = c.Load(&amp;quot;$Prj\data.txt&amp;quot;)&lt;br /&gt;
|-&lt;br /&gt;
||&lt;br /&gt;
&#039;&#039;&#039;Save&#039;&#039;&#039;(&#039;&#039;arrayfilename&#039;&#039;)&lt;br /&gt;
||&lt;br /&gt;
This saves the array data to a comma separated text file.&lt;br /&gt;
* If the specified file exists it is overwritten.&lt;br /&gt;
* The function returns, True if the file was saved or, False if the file was not saved.&lt;br /&gt;
* This could fail for any file access reason, for example: invalid folder, invalid filename, file access error, file already open in another application, etc.&lt;br /&gt;
||&lt;br /&gt;
Bit&lt;br /&gt;
||&lt;br /&gt;
&#039;&#039;arrayfileName :&#039;&#039; either the actual filename and path in quotations or a STR variable, which refers to the file. Use $Prj in the folder string for folders relative to the project folder.&lt;br /&gt;
||&lt;br /&gt;
OK = a.Save(&amp;quot;$Prj\data_output.txt&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
||&lt;br /&gt;
&#039;&#039;&#039;CopyToClipboard&#039;&#039;&#039;()&lt;br /&gt;
||&lt;br /&gt;
This saves the array data to the clipboard.&lt;br /&gt;
The function returns the value, True.&lt;br /&gt;
||&lt;br /&gt;
Bit&lt;br /&gt;
||&lt;br /&gt;
None&lt;br /&gt;
||&lt;br /&gt;
OK = a.CopyToClipboard()&lt;br /&gt;
|-&lt;br /&gt;
||&#039;&#039;&#039;SetAll&#039;&#039;&#039;(&#039;&#039;value&#039;&#039;) || This sets all the elements of the array to the specified &#039;&#039;value&#039;&#039;. || || &#039;&#039;value :&#039;&#039; the required initialising value. This is of data type REAL.&#039;&#039; || a.SetAll(0)&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Scale&#039;&#039;&#039;(&#039;&#039;value&#039;&#039;) || All the elements of the array are scaled by the specified &#039;&#039;value&#039;&#039; &amp;lt;br&amp;gt;(New value = original value * Scale). || || &#039;&#039;value :&#039;&#039; the required scaling factor. This is of data type REAL.&#039;&#039; || a.Scale(2) &amp;lt;br&amp;gt;-  Each value of the Array &amp;quot;a&amp;quot; will be increased by factor of 2.&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Offset&#039;&#039;&#039;(&#039;&#039;value&#039;&#039;) || All the elements of the array are offset by the specified &#039;&#039;value&#039;&#039; &amp;lt;br&amp;gt;(New value = original value + Offset). || || &#039;&#039;value :&#039;&#039; the required offset value. This is of data type REAL.&#039;&#039; || a.Offset(5) &amp;lt;br&amp;gt;- Each value of the Array &amp;quot;a&amp;quot; will be increased by 5.&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Copy&#039;&#039;&#039;(&#039;&#039;Array&#039;&#039;) || All the elements of the specified array are copied into the new array. || || &#039;&#039;Array:&#039;&#039; the name of the array to copy from. This is an ARRAY class.&#039;&#039; || PreVals.Copy(a) &amp;lt;br&amp;gt;- The values in Array &amp;quot;a&amp;quot; are copied into the Array &amp;quot;PreVals&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Append&#039;&#039;&#039;(&#039;&#039;Array&#039;&#039;) &amp;lt;br&amp;gt; {{Available139|30807}} || All the elements of the specified array are added to the end of the existing array. The new length of the array will be the sum of the original length plus the length of the specified array.|| || &#039;&#039;Array:&#039;&#039; the name of the array to append. This is an ARRAY class.&#039;&#039; || PreVals.Append(a) &amp;lt;br&amp;gt;- The values in Array &amp;quot;a&amp;quot; are appended to the end of the Array &amp;quot;PreVals&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;AppendItem&#039;&#039;&#039;(&#039;&#039;value&#039;&#039;) &amp;lt;br&amp;gt; {{Available139|30874}} || Increase the length of the array by one with the supplied value. || || &#039;&#039;value:&#039;&#039; the value to which the last element in the array will be set. || a.AppendItem(42)&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;InsertAt&#039;&#039;&#039;(&#039;&#039;index&#039;&#039;, &#039;&#039;value&#039;&#039;) &amp;lt;br&amp;gt; {{Available139|32112}} || Increase the length of the array by one inserting the supplied value at the specified &#039;&#039;index&#039;&#039;. || || &#039;&#039;index:&#039;&#039; the zero based index in array where the value must be inserted. Index data type is INTEGER and must be in range for Array length.&amp;lt;br&amp;gt; &#039;&#039;value:&#039;&#039; the value to be set at the new inserted element in the array. || a.InsertAt(0, 42)&amp;lt;br&amp;gt;- Inserts 42 at start of array.&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;RemoveAt&#039;&#039;&#039;(&#039;&#039;index&#039;&#039;, &#039;&#039;count&#039;&#039;) &amp;lt;br&amp;gt; {{Available139|32112}} || Decrease the length of the array by removing &#039;&#039;count&#039;&#039; (or less) values starting at the specified &#039;&#039;index&#039;&#039;. || || &#039;&#039;index:&#039;&#039; the zero based index in array where values must be deleted. Index data type is INTEGER and must be in range for Array length. &amp;lt;br&amp;gt; &#039;&#039;count:&#039;&#039; the number of elements to be removed. The value of &#039;&#039;count&#039;&#039; may be large, exceeding the current array length in which case all elements from the specified &#039;&#039;index&#039;&#039; are removed. Count data type is INTEGER. || a.RemoveAt(5, 1)&amp;lt;br&amp;gt;- Removes one element at index 5.&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;IsEqual&#039;&#039;&#039;(&#039;&#039;Array&#039;&#039;) || This compares the current array with the specified array data, if each element of the array are equal, the function returns the value, True. || Bit || &#039;&#039;Array:&#039;&#039; the name of the array to compare with. This is an ARRAY class.&#039;&#039; || EqualOK = PreVals.IsEqual(a) &amp;lt;br&amp;gt;- The values in array &amp;quot;PreVals&amp;quot; are compared to the values of the Array &amp;quot;a&amp;quot;.  Returns true if they are equal.&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Add&#039;&#039;&#039;(&#039;&#039;Array&#039;&#039;) || This function performs addition between current array and a specified array. New value for each element in current array = value in current array + specified array. &amp;lt;br&amp;gt; The two arrays must have the same length, otherwise value remains unchanged and error is returned. || Bit || &#039;&#039;Array:&#039;&#039; the name of the specified array. This is an ARRAY class. ||  AddOK = NewA.add(A1) &amp;lt;br&amp;gt; (each element in NewA = NewA + A1)&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Sub&#039;&#039;&#039;(&#039;&#039;Array&#039;&#039;) || This function performs subtraction between current array and a specified array. New value for each element in current array = value in current array - specified array. &amp;lt;br&amp;gt; The two arrays must have the same length, otherwise value remains unchanged and error is returned. || Bit ||&#039;&#039;Array:&#039;&#039; the name of the specified array. This is an ARRAY class. ||  SubOK = NewA.Sub(A1) &amp;lt;br&amp;gt; (each element in NewA = NewA - A1)&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Mult&#039;&#039;&#039;(&#039;&#039;Array&#039;&#039;) || This function performs multiplication between current array and a specified array. New value for each element in current array = value in current array x specified array. &amp;lt;br&amp;gt; The two arrays must have the same length, otherwise value remains unchanged and error is returned. || Bit || &#039;&#039;Array:&#039;&#039; the name of the specified array. This is an ARRAY class. ||  MultOK = NewA.Mult(A1)  &amp;lt;br&amp;gt; (each element in NewA = NewA * A1)&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Div&#039;&#039;&#039;(&#039;&#039;Array&#039;&#039;) || This function performs division between current array and a specified array. New value for each element in current array = value in current array / specified array.&amp;lt;br&amp;gt; The two arrays must have the same length, otherwise value remains unchanged and error is returned. || Bit ||&#039;&#039;Array:&#039;&#039; the name of the specified array. This is an ARRAY class. ||  DivOK = NewA.Div(A1) &amp;lt;br&amp;gt; (each element in NewA = NewA / A1)&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;CopyAdd&#039;&#039;&#039;(&#039;&#039;Array1, Array2&#039;&#039;) || This function performs addition between two arrays and stores the values in a new array (current array).   Value for each element in current array = value in array1 + array2. &amp;lt;br&amp;gt; The two arrays must have the same length, otherwise value remains unchanged and error is returned. || Bit || &#039;&#039;Array1:&#039;&#039; the name of the first specified array. This is an ARRAY class. &amp;lt;br&amp;gt; &#039;&#039;Array2:&#039;&#039; the name of the second specified array. This is an ARRAY class.&#039;&#039;||  AddOK = NewA.CopyAdd(A1, A2) &amp;lt;br&amp;gt; (each element in NewA = A1 + A2)&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;CopySub&#039;&#039;&#039;(&#039;&#039;Array1, Array2&#039;&#039;) || This function performs subtraction between two arrays and stores the values in a new array (current array).   Value for each element in current array = value in array1 - array2. &amp;lt;br&amp;gt; The two arrays must have the same length, otherwise value remains unchanged and error is returned. || Bit || &#039;&#039;Array1:&#039;&#039; the name of the first specified array. This is an ARRAY class. &amp;lt;br&amp;gt; &#039;&#039;Array2:&#039;&#039; the name of the second specified array. This is an ARRAY class.||  AddOK = NewA.CopySub(A1, A2) &amp;lt;br&amp;gt; (each element in NewA = A1 - A2)&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;CopyMult&#039;&#039;&#039;(&#039;&#039;Array1, Array2&#039;&#039;) || This function performs multiplication between two arrays and stores the values in a new array (current array).   Value for each element in current array = value in array1 x array2. &amp;lt;br&amp;gt; The two arrays must have the same length, otherwise value remains unchanged and error is returned. || Bit || &#039;&#039;Array1:&#039;&#039; the name of the first specified array. This is an ARRAY class. &amp;lt;br&amp;gt; &#039;&#039;Array2:&#039;&#039; the name of the second specified array. This is an ARRAY class. ||  AddOK = NewA.CopyMult(A1, A2) &amp;lt;br&amp;gt; (each element in NewA = A1 * A2)&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;CopyDiv&#039;&#039;&#039;(&#039;&#039;Array1, Array2&#039;&#039;) || This function performs division between two arrays and stores the values in a new array (current array).   Value for each element in current array = value in array1 / array2. &amp;lt;br&amp;gt; The two arrays must have the same length, otherwise value remains unchanged and error is returned. || Bit || &#039;&#039;Array1:&#039;&#039; the name of the first specified array. This is an ARRAY class. &amp;lt;br&amp;gt; &#039;&#039;Array2:&#039;&#039; the name of the second specified array. This is an ARRAY class.||  AddOK = NewA.CopyDiv(A1, A2)&amp;lt;br&amp;gt; (each element in NewA = A1 / A2)&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Inner&#039;&#039;&#039;(&#039;&#039;Array&#039;&#039;) || This returns the Sum of Element i (Current Array * Specified Array).  The two arrays must have the same length, otherwise error is returned. || REAL || &#039;&#039;Array:&#039;&#039; the name of the second array. This is an ARRAY class.&#039;&#039; || DotProduct = a.Inner(PreVals)&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;CircConv&#039;&#039;&#039;(&#039;&#039;Array&#039;&#039;) &amp;lt;br&amp;gt; {{Available139|30613}} || This function performs circular convolution calculation between the current array and a specified array. New value for each element in current array is calculated as the integral of the product of the two arrays after one is reversed and shifted.  The values in the current array will be replaced with the new value. &amp;lt;br&amp;gt; The two arrays are expected to have the same length. || Bit || &#039;&#039;Array:&#039;&#039; the name of the specified array. This is an ARRAY class. ||  AddOK = NewA.CirConv(A1) &amp;lt;br&amp;gt; (each element in NewA = circular convolution of NewA and A1)&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;CopyCircConv&#039;&#039;&#039;(&#039;&#039;Array1, Array2&#039;&#039;) &amp;lt;br&amp;gt; {{Available139|30613}} || This function performs circular convolution calculation between two arrays and stores the values in a new array (current array).   Value for each element in current array is calculated as the integral of the product of the two arrays after one is reversed and shifted. &amp;lt;br&amp;gt; The two arrays are expected to have the same length. || Bit || &#039;&#039;Array1:&#039;&#039; the name of the first specified array. This is an ARRAY class. &amp;lt;br&amp;gt; &#039;&#039;Array2:&#039;&#039; the name of the second specified array. This is an ARRAY class.&#039;&#039;||  AddOK = NewA.CopyCirConv(A1, A2) &amp;lt;br&amp;gt; (each element in NewA = circular convolution of A1 and A2)&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;SetFromStr&#039;&#039;&#039;(&#039;&#039;Str s, Str Separ&#039;&#039;) &amp;lt;br&amp;gt; {{Available139|35544}}|| This function enables the unpacking of a string into an array, converting each element into a number. It internally utilises the StrToFlt function. &amp;lt;br&amp;gt; The array’s length is determined by the number of items derived from unpacking the string.|| REAL || &#039;&#039;s&#039;&#039; is the string that requires unpacking. &amp;lt;br&amp;gt; &#039;&#039;Separ&#039;&#039; is the separator used within the string ‘s’ to define the divisions. ||x.SetFromStr(&amp;quot;35,4,30&amp;quot;, &amp;quot;,&amp;quot;) will unpack the three numbers into the array ‘x’, resulting in x[0]=35, x[1]=4, and x[2]=30. &lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;CopyToStr&#039;&#039;&#039;(&#039;&#039;Str Separ&#039;&#039;) &amp;lt;br&amp;gt; {{Available139|35544}}|| This function enables the consolidation of a ‘Array’ into a single string. || STRING|| &#039;&#039;Separ&#039;&#039; denotes the delimiter used within the string ‘s’ to demarcate its segments. ||x.CopyToStr(&amp;quot;,&amp;quot;) will combine the elements of the &#039;Array&#039; named &#039;x&#039; into the string &amp;quot;35,4,30&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;PushBack&#039;&#039;&#039;(&#039;&#039;value&#039;&#039;) &amp;lt;br&amp;gt; &#039;&#039;&#039;PushFront&#039;&#039;&#039;(&#039;&#039;value&#039;&#039;) &amp;lt;br&amp;gt; {{Available140}}|| These methods put &#039;&#039;value&#039;&#039; at the start or end of the array and increase the size. ||  || &#039;&#039;value&#039;&#039;: the value to be set. || Equivalent to InsertAt(0, value) &lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;PopBack&#039;&#039;&#039;() &amp;lt;br&amp;gt; &#039;&#039;&#039;PopFront&#039;&#039;&#039;() &amp;lt;br&amp;gt; {{Available140}}|| These functions return the value at the start or end, and decrease the size. || Real ||  || &lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;PushFrontPopBack&#039;&#039;&#039;(&#039;&#039;value&#039;&#039;) &amp;lt;br&amp;gt; &#039;&#039;&#039;PushBackPopFront&#039;&#039;&#039;(&#039;&#039;value&#039;&#039;) &amp;lt;br&amp;gt; {{Available140}}|| These functions treat the array as a FIFO queue, adding an item at one end and removing and returning the item at the other end. || Real || Real || &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Watch ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;Watch&#039;&#039;&#039; keyword can be used to display the Array values in the Access Window.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;u&amp;gt;Syntax&amp;lt;/u&amp;gt;&#039;&#039;&#039;:&lt;br /&gt;
* Individual elements in the array can be made visible - e.g. &amp;quot;Watch A[2]&amp;quot; or &amp;quot;Watch A@[2]&amp;quot;. &lt;br /&gt;
* A range of array elements can be made visible - e.g. &amp;quot;Watch A[All,5]&amp;quot; which would show the first 5 elements of the array. &lt;br /&gt;
* If the &amp;quot;@&amp;quot; symbol is included, then the array elements will be read only fields in the access window.&lt;br /&gt;
&lt;br /&gt;
=== Array with Constant Values ===&lt;br /&gt;
&lt;br /&gt;
The user may declare an array with a set of constant values.  This allows the user to set up an array with known values for direct use. It can be a useful alternative to reading values from a CSV file.  Once defined, the contents or size of this constant Array cannot be changed.  Where a number is not specified for an entry, 0 is assumed.  The contents of the array are not saved as they are defined in the code.  From {{Available139|32217||y}}, the list can include system constants (for example NAN or PI), or user defined constants.  From {{Available139|32325||y}}, the const keyword should be used, otherwise a load warning (or error) is given.&lt;br /&gt;
&lt;br /&gt;
The syntax is:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;pgm&amp;quot;&amp;gt;&lt;br /&gt;
const ARRAY a = {n1,n2,n3,....} ;Syntax from {{Available139|32325||y}}&lt;br /&gt;
ARRAY a = {n1,n2,n3,....} ;Syntax before {{Available139|32325||y}}&lt;br /&gt;
;where n1, n2 etc. are real numbers or constants.&lt;br /&gt;
;Example&lt;br /&gt;
const Array SomePrimes = {2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Caution ===&lt;br /&gt;
&lt;br /&gt;
Using a GetAt within a SetAt can sometimes fail. This may be for expressions with multiple array references.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;pgm&amp;quot;&amp;gt;&lt;br /&gt;
;For example:&lt;br /&gt;
a.SetAt(i, a.GetAt(i+1))  ;This can sometimes fail&lt;br /&gt;
&lt;br /&gt;
;The solution is to use a temporary variable to first retrieve the GetAt value and then call SetAt as follows:&lt;br /&gt;
Real   Tmp&lt;br /&gt;
Tmp = a.GetAt(i+1)&lt;br /&gt;
a.SetAt(i, Tmp)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;pgm&amp;quot;&amp;gt;&lt;br /&gt;
STRING      ArrayFileName&lt;br /&gt;
REAL        d, e, f, Total@, Average@, Minimum@, Maximum@, DotProduct@&lt;br /&gt;
BIT         OK@, CopyOK@, SortOK@, AddOK@, SubOK@&lt;br /&gt;
ARRAY       a                           ;declares array instance.&lt;br /&gt;
ARRAY       b{e}, c{e}                  ;declares array instances that are excluded from save (for efficiency).&lt;br /&gt;
const ARRAY x = {60,35,25,62,105}       ;declares an array z with constant values.&lt;br /&gt;
;ARRAY      x = {60,35,25,62,105}       ;Old syntax before {{Removed139|32325||y}}&lt;br /&gt;
ARRAY       y, y1, y2 &lt;br /&gt;
const ARRAY y3 = {20,35,45,62,105,150}  ;declares an array y3 with constant values.&lt;br /&gt;
const ARRAY z = {20,35,45,62,105}       ;declares an array z with constant values.&lt;br /&gt;
&lt;br /&gt;
Sub InitialiseSolution()&lt;br /&gt;
  ArrayFileName = &amp;quot;c:\SysCAD\array.csv&amp;quot;&lt;br /&gt;
  OK = b.Load(ArrayFileName)&lt;br /&gt;
  OK = c.Load(&amp;quot;$Prj\data.txt&amp;quot;)&lt;br /&gt;
  a.SetLen(5)                  ;sets the array length&lt;br /&gt;
  y.copy(x)                    ;array x is copied into array y, returns {60,35,25,62,105}&lt;br /&gt;
  CopyOK = y.isEqual(x)        ;compares array y with array x, returns true&lt;br /&gt;
  y.sort(1)                    ;sorts array y in ascending order, returns {25,35,60,62,105}&lt;br /&gt;
  SortOK = y.IsSorted(1)       ;checks if array y is sorted in ascending order, returns true&lt;br /&gt;
  y1.copy(y)                   ;copies y, returns {25,35,60,62,105}&lt;br /&gt;
  y1.scale(2)                  ;multiplies each element by scaling factor of 2, returns {50, 70, 120, 124, 210}&lt;br /&gt;
  y2.copy(y)                   ;copies y, returns {25,35,60,62,105}&lt;br /&gt;
  y2.offset(5)                 ;adds each element by offset factor of 5, returns {30, 40, 65, 67, 110}&lt;br /&gt;
  AddOK = y.add(y2)            ;Adds each element of y to elements of y2, y now becomes {55, 75, 125, 129, 215}, returns true &lt;br /&gt;
  SubOK = y1.sub(y3)           ;returns false since array length of y1 does not equal to y3. Array y1 unchanged.&lt;br /&gt;
  DotProduct = y.inner(y2)     ;sum of each element y_i * y2_i, returns 45068&lt;br /&gt;
EndSub&lt;br /&gt;
&lt;br /&gt;
;Logic   &lt;br /&gt;
d = a.GetLen()               ;gets the array length&lt;br /&gt;
a.SetAll(2.2/2)              ;sets all elements&lt;br /&gt;
a.IncAt(0, 7.0)              ;increments the first element&lt;br /&gt;
a[d-1] = 3.3                 ;sets last element &lt;br /&gt;
e = a[0]                     ;gets first element&lt;br /&gt;
f = z[3]                     ;gets the fourth element of array z, so f = 62&lt;br /&gt;
Total = z.Sum()              ;gets the sum of all the values in array z, Total = 267&lt;br /&gt;
Average = z.Avg()            ;gets the average of all the values in array z, Average = 53.4&lt;br /&gt;
Minimum = z.Min()            ;gets the minimum of all the values in array z, Minimum = 20&lt;br /&gt;
Maximum = z.Max()            ;gets the maximum of all the values in array z, Maximum = 105&lt;br /&gt;
$&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See also: [[Python Example - Optimization#Calculating_the_objective_error | Optimisation Example]] shows using these Array tools in a real example for plant tuning calculating an objective function.&lt;/div&gt;</summary>
		<author><name>Rod.Stephenson</name></author>
	</entry>
	<entry>
		<id>https://help.syscad.net/index.php?title=Archive_Reporter&amp;diff=84103</id>
		<title>Archive Reporter</title>
		<link rel="alternate" type="text/html" href="https://help.syscad.net/index.php?title=Archive_Reporter&amp;diff=84103"/>
		<updated>2026-05-12T09:03:04Z</updated>

		<summary type="html">&lt;p&gt;Rod.Stephenson: /* Reporting Options */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Reports]]&lt;br /&gt;
{{Navigation|[[User Guide]]|[[Reports]]}}&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Width=300 font style=&amp;quot;background: #ebebeb&amp;quot;|[[Archive Reporter]]&lt;br /&gt;
!Width=300 |[[Archive Editor]]&lt;br /&gt;
!Width=300 |[[Archive (sac) File Text Format]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Related Links:&#039;&#039;&#039; [[Planning Example Project]], [[Tailings Dam Example Project]], [[Waste Handling with Batch Digestion Example Project]]&lt;br /&gt;
----&lt;br /&gt;
{{TOC|x=20%}} &lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;Archive Reporter&#039;&#039;&#039; is used with Dynamic projects to report data directly to a database, CSV or text file while a project is running. This has some similarities with the SysCAD [[Historian]], however the archiver has significantly greater functionality so the use of the historian for reporting is not recommended.&lt;br /&gt;
&lt;br /&gt;
The user specifies how many tables of data are required (maximum is 500), the frequency of reporting (each table may be reported at a user specified time) and the tags that are reported in each table.  These settings are recorded in a text file by the Archive Editor. The maximum number of Fields (including [[#Time_Fields|Time Fields]]) in a Table is 2000 (for DB-SQLITE .db3 format) and 3000 (for csv format).&lt;br /&gt;
&lt;br /&gt;
Please also note that this file is loaded (or reloaded) from the [[Project Settings]] Archive tab page, as shown in the sections below.&lt;br /&gt;
&lt;br /&gt;
== Archive Configuration ==&lt;br /&gt;
&lt;br /&gt;
To use the Archiver:&lt;br /&gt;
# Go to &#039;&#039;Edit - Project Settings&#039;&#039;&lt;br /&gt;
# The dialog box shown below will be displayed&lt;br /&gt;
# Go to the &#039;&#039;Archive&#039;&#039; page and tick the &#039;On&#039; box&lt;br /&gt;
# The SysCAD Archive Configuration (.sac) file will be created&lt;br /&gt;
# Click on the &#039;Edit&#039; button to edit the Archive.sac file&lt;br /&gt;
&lt;br /&gt;
[[Image:Project Settings-Archive.jpg]]&lt;br /&gt;
&lt;br /&gt;
The Settings are explained in the table below:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot; &lt;br /&gt;
|&#039;&#039;&#039;Setting / Tick Box&#039;&#039;&#039; || &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|  colspan=&amp;quot;2&amp;quot; font style=&amp;quot;background: #ebebeb&amp;quot;    | &lt;br /&gt;
=== Archive Reporter Configuration ===&lt;br /&gt;
|-&lt;br /&gt;
| On || The user must tick this box to enable the Archive Reporter.&lt;br /&gt;
|-&lt;br /&gt;
|| Name || This will be the name of the Archive Reporter file. The default name is Archive.sac and it is automatically created in the project folder when the user ticks the &#039;On&#039; box.  Users can choose to have a different file name but only one sac file can be used per project.&lt;br /&gt;
|-&lt;br /&gt;
| Browse ||  The user may browse for an alternative Archive file using this button.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Press the &#039;&#039;&#039;Edit&#039;&#039;&#039; button to launch the Archive Editor.&lt;br /&gt;
&lt;br /&gt;
Pressing the &#039;&#039;&#039;Reload&#039;&#039;&#039; button loads the Archive.sac file into SysCAD, which will check the file and display messages in the Messages window.&lt;br /&gt;
&lt;br /&gt;
== System Settings ==&lt;br /&gt;
&lt;br /&gt;
The Settings are explained in the table below:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot; &lt;br /&gt;
|&#039;&#039;&#039;Setting / Tick Box&#039;&#039;&#039; || &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|  colspan=&amp;quot;2&amp;quot; font style=&amp;quot;background: #ebebeb&amp;quot;    | &lt;br /&gt;
=== Time Fields ===&lt;br /&gt;
|-&lt;br /&gt;
| Date and Time ||  Every table will contain a column with the simulation time and date for the reported values.  The format for this column will be Date:Time&lt;br /&gt;
|-&lt;br /&gt;
| Date Only ||  Every table will contain a column with the simulation date for the reported values.&lt;br /&gt;
|-&lt;br /&gt;
| Time Only ||  Every table will contain a column with the simulation time for the reported values.&lt;br /&gt;
|-&lt;br /&gt;
| Elapsed as HMS ||  Every table will contain a column with the elapsed simulation time for the reported values.  The format for this column will be hh:mm:ss&lt;br /&gt;
|-&lt;br /&gt;
| Elapsed Time ||  Unless the user selects &#039;Off&#039;, every table will contain a column with the elapsed simulation time for the reported values.  The format for this column will be a single value, and will display the total elapsed time as seconds, minutes, hours or days, depending on the user selection.&lt;br /&gt;
|-&lt;br /&gt;
|  colspan=&amp;quot;2&amp;quot; font style=&amp;quot;background: #ebebeb&amp;quot;    |&lt;br /&gt;
&lt;br /&gt;
=== System Tables ===&lt;br /&gt;
|-&lt;br /&gt;
| Message Log ||  If the user ticks this box, all simulation messages will be written to a log file in the Archive folder.&lt;br /&gt;
|-&lt;br /&gt;
| Event Log ||  If the user ticks this box, all Events will be written to a log file in the Archive folder.&lt;br /&gt;
|-&lt;br /&gt;
|  colspan=&amp;quot;2&amp;quot; font style=&amp;quot;background: #ebebeb&amp;quot; | &#039;&#039;Standard Fields&#039;&#039;&amp;lt;br&amp;gt;These tick boxes determine what information is written to the Message Log file.&lt;br /&gt;
|-&lt;br /&gt;
| Source ||  The source of the message will be logged.&lt;br /&gt;
|-&lt;br /&gt;
| Tag    ||  The unit tag that is source of the message will be logged.&lt;br /&gt;
|-&lt;br /&gt;
| Command ||  All SysCAD commands will be logged, e.g. &#039;Stop&#039;, &#039;Run&#039;, etc.&lt;br /&gt;
|-&lt;br /&gt;
| Type ||  The type of message will be logged, i.e. Error, Warning, etc.&lt;br /&gt;
|-&lt;br /&gt;
| Message ||  Messages will be displayed.  If this is not ticked, then only Errors and Warnings will be logged.&lt;br /&gt;
|-&lt;br /&gt;
| ID No ||  The ID of the message will be logged.&lt;br /&gt;
|-&lt;br /&gt;
| Iteration ||  The Iteration of the message will be logged.&lt;br /&gt;
|-&lt;br /&gt;
| Call No ||  The Call number for the message will be logged.&lt;br /&gt;
|-&lt;br /&gt;
| Sequence No ||  The Sequence number of the message will be logged.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Reporting Options ==&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot; &lt;br /&gt;
||&#039;&#039;&#039;Field&#039;&#039;&#039; || &#039;&#039;&#039;Option&#039;&#039;&#039; || &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|colspan=2| On ||  If On = 1, the table will be created. If On = 0, the table will not be created.&lt;br /&gt;
|-&lt;br /&gt;
|colspan=2| Name || The name of the table (for DB formats) or name of the file for csv/txt file formats.&lt;br /&gt;
|-&lt;br /&gt;
| rowspan=&amp;quot;3&amp;quot; valign=&amp;quot;top&amp;quot; | Format ||   DB-SQLITE ||   Data will be saved in Archive.db3 SQ Lite database in the project folder  (Maximum fields per table is 2000)&lt;br /&gt;
|-&lt;br /&gt;
||   CSV ||  Data will be saved in a CSV file (Maximum fields per table is 3000)&lt;br /&gt;
|-&lt;br /&gt;
||  TXT ||   Data will be saved in a Text (txt) file&lt;br /&gt;
|-&lt;br /&gt;
| rowspan=&amp;quot;2&amp;quot; valign=&amp;quot;top&amp;quot;  | Clear ||   Rewind ||   Clear archive file on next run. &lt;br /&gt;
|-&lt;br /&gt;
||   False ||   Add to existing archive file on next run. This can be overridden by other settings on the [[Solver Setting - Scenario]] page such as the RestartArchive option.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; Each table can only have one format but within the same archive file, different tables can have different formats&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== CSV and TXT File Options ===&lt;br /&gt;
&lt;br /&gt;
If the Format chosen is CSV or TXT, then the following options are relevant.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot; &lt;br /&gt;
||&#039;&#039;&#039;Field&#039;&#039;&#039; || &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|Path || The path and folder name for storing CSV &amp;amp; TXT files (usually with the Project)&lt;br /&gt;
|-&lt;br /&gt;
|SigDigits ||  The number of significant digits for the tags that are reported to CSV &amp;amp; TXT files.  Recommendation is 16.  Accepted range is 2-17.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Period and Offset ===&lt;br /&gt;
&lt;br /&gt;
The Period and Offset for reporting can be specified. This is not required if the user specifies a Trigger, but note that both Periods and Triggers can be used for the same table.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot; &lt;br /&gt;
||&#039;&#039;&#039;Field&#039;&#039;&#039; ||   &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|| Period ||   Time frequency for reporting fields, where time zero is at start.&amp;lt;br&amp;gt;&#039;&#039;&#039;Note 1:&#039;&#039;&#039; The period is relative to midnight, not the simulation start time.&amp;lt;br&amp;gt;&#039;&#039;&#039;Note 2:&#039;&#039;&#039; If the period is not divisible by 24 hours, the reporting will not be at the same time each day.&lt;br /&gt;
|-&lt;br /&gt;
|| Offset     ||   Time offset within the specified period. This affects when the first set of data is recorded.&amp;lt;br&amp;gt;&#039;&#039;&#039;Note:&#039;&#039;&#039; The offset is relative to midnight, not the simulation start time.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notes:&#039;&#039;&#039; &lt;br /&gt;
* Use Period for reporting at fixed time intervals, OR use Triggers for reporting at irregular time intervals (i.e. report specified fields based on trigger logic).&lt;br /&gt;
* If one or more Triggers are used, a period &amp;amp; offset is not relevant or required.&lt;br /&gt;
* If no triggers or period are specified then the table will not accumulate data.&lt;br /&gt;
* Note that period and offset are relative to midnight. If your start time is not on a reporting period relative to midnight AND you want to report relative to the start time, then you need to specify an offset to achieve this. For example, if you want to report every 24 hours and the start time is 8:00am, then the offset should be 8 hours.&lt;br /&gt;
&lt;br /&gt;
== Trigger Options ==&lt;br /&gt;
&lt;br /&gt;
The user may specify one or more Triggers that will cause the values in the table to be reported. There can be any number of triggers. If the conditions of any of the triggers are met, then the fields will be reported.&lt;br /&gt;
&lt;br /&gt;
The triggers are numbered and include three terms as described below, a description, a SysCAD tag and the Trigger Test.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot; &lt;br /&gt;
||&#039;&#039;&#039;Term&#039;&#039;&#039; ||   &#039;&#039;&#039;Option&#039;&#039;&#039; ||   &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|colspan=2|Description  ||   A description of the trigger&lt;br /&gt;
|-&lt;br /&gt;
|colspan=2|SysCADTag ||   Any valid SysCAD tag. May have conversions.&lt;br /&gt;
|-&lt;br /&gt;
| rowspan=&amp;quot;6&amp;quot; valign=&amp;quot;top&amp;quot;  | TriggerTest||   Rise = Value ||  The trigger will be true if the value has &#039;&#039;&#039;increased&#039;&#039;&#039; by more than the specified amount since the &#039;&#039;&#039;last recorded value&#039;&#039;&#039;. The last recorded value will either be the first value or the value when the trigger was last true.&lt;br /&gt;
|-&lt;br /&gt;
||   StepRise = Value ||  The trigger will be true if the value has &#039;&#039;&#039;increased&#039;&#039;&#039; by more than the specified amount since the &#039;&#039;&#039;last step&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
||   Fall = Value ||  The trigger will be true if the value has &#039;&#039;&#039;decreased&#039;&#039;&#039; by more than the specified amount since the &#039;&#039;&#039;last recorded value&#039;&#039;&#039;. The last recorded value will either be the first value or the value when the trigger was last true. &lt;br /&gt;
|-&lt;br /&gt;
||   StepFall = Value ||  The trigger will be true if the value has &#039;&#039;&#039;decreased&#039;&#039;&#039; by more than the specified amount since the &#039;&#039;&#039;last step&#039;&#039;&#039;.  &lt;br /&gt;
|-&lt;br /&gt;
||   Delta = Value ||  The trigger will be true if the value has &#039;&#039;&#039;changed&#039;&#039;&#039; by more than the specified amount since the &#039;&#039;&#039;last recorded value&#039;&#039;&#039;. The last recorded value will either be the first value or the value when the trigger was last true.  &lt;br /&gt;
|-&lt;br /&gt;
||   StepDelta = Value ||  The trigger will be true if the value has &#039;&#039;&#039;changed&#039;&#039;&#039; by more than the specified amount since the &#039;&#039;&#039;last step&#039;&#039;&#039;.  &lt;br /&gt;
|}&lt;br /&gt;
where = Value = Test value used to see where there are sudden changes.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notes:&#039;&#039;&#039; &lt;br /&gt;
* Use Period for reporting at fixed time intervals, OR use Triggers for reporting at irregular time intervals (i.e. report specified fields based on trigger logic).&lt;br /&gt;
* If one or more Triggers are used, a period &amp;amp; offset is not relevant or required.&lt;br /&gt;
* If no triggers or period are specified then the table will not accumulate data.&lt;br /&gt;
* The smallest period that can be used is 1s.  If the Dynamic timestep is less than 1s, and you want to record values at every iteration, a workaround is to use a Trigger on a tag which is changing every step, for example &#039;&#039;&#039; $Solver.Dyn.Scenario.Elapsed.Time (ms)&#039;&#039;&#039;. Add the following line to the SAC file:&lt;br /&gt;
&lt;br /&gt;
 Trigger1   = Trigger1, $Solver.Dyn.Scenario.Elapsed.Time (ms), StepDelta=1e-05&lt;br /&gt;
&lt;br /&gt;
== Field Options ==&lt;br /&gt;
&lt;br /&gt;
The user may specify one or more fields in the table to be reported.&lt;br /&gt;
&lt;br /&gt;
The fields are numbered and include five terms as described below, a field name, a SysCAD tag, a function, measure point and first point options.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot; &lt;br /&gt;
||&#039;&#039;&#039;Term&#039;&#039;&#039; ||   &#039;&#039;&#039;Option&#039;&#039;&#039; ||   &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|colspan=2|FieldName  ||   Report column or field name. Should not contain characters: &#039;.,[] &lt;br /&gt;
|-&lt;br /&gt;
|colspan=2|SysCADTag ||   Any valid SysCAD tag. May have conversions. &#039;&#039;&#039;If the tag is a string (eg TNK_001.Condition), use the String function below to ensure it is reported correctly.&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| rowspan=&amp;quot;19&amp;quot; valign=&amp;quot;top&amp;quot;  | Function||   Current/Cur ||   Returns the current value.&lt;br /&gt;
|-&lt;br /&gt;
||   CurrentDiff/CurDiff ||   Returns the difference between current value and the current value at the end of the previous reporting period.&lt;br /&gt;
|-&lt;br /&gt;
||   Minimum/Min ||   Returns the minimum value for the chosen period.&lt;br /&gt;
|-&lt;br /&gt;
||   Maximum/Max ||   Returns the maximum value for the chosen period.&lt;br /&gt;
|-&lt;br /&gt;
||   Average/Avg ||   Returns the average value for the chosen period.&lt;br /&gt;
|-&lt;br /&gt;
||   AverageTotal/AvgTtl ||   Returns the average value since the beginning of the run.&lt;br /&gt;
|-&lt;br /&gt;
||   Sum ||   Returns the total of the reported tag for the report period. &#039;&#039;&#039;Note:&#039;&#039;&#039; The SysCAD tag MUST be on a per second basis (e.g. P_1.Qm (t/s)).&lt;br /&gt;
|-&lt;br /&gt;
||   SumTotal/SumTtl ||   Returns the total of the reported tag since the beginning of the run. &#039;&#039;&#039;Note:&#039;&#039;&#039; The SysCAD tag MUST be on a per second basis (e.g. P_1.Qm (t/s)).&lt;br /&gt;
|-&lt;br /&gt;
||   ReportTime ||   Returns the number of seconds for the report period. This will be equal to the number of steps in the report period multiplied by the timestep. Any valid SysCAD tag can be specified.&lt;br /&gt;
|-&lt;br /&gt;
||   SimulationTime ||   Returns the number of seconds since the beginning of the run. This will be equal to the total number of steps since the beginning of the run multiplied by the timestep. Any valid SysCAD tag can be specified.&lt;br /&gt;
|-&lt;br /&gt;
||  Time(operator,value,[timeunit]) || Returns the amount of time in the report period that the reported tag meets the condition specified using operator and value. Valid operators are &amp;lt;, &amp;lt;=, ==, &amp;lt;&amp;gt;, &amp;gt;= and &amp;gt;. Value can be any number. Timeunit is optional (default is seconds), options are s, m, h or d.&lt;br /&gt;
|-&lt;br /&gt;
||  TimeTotal(operator,value,[timeunit])&amp;lt;br&amp;gt;/TimeTtl(operator,value,[timeunit]) || Returns the amount of time since the beginning of the run that the reported tag meets the condition specified using operator and value. Valid operators are &amp;lt;, &amp;lt;=, ==, &amp;lt;&amp;gt;, &amp;gt;= and &amp;gt;. Value can be any number. Timeunit is optional (default is seconds), options are s, m, h or d.&lt;br /&gt;
|-&lt;br /&gt;
||   TimeInRange(low operator,low value,high operator,high value,[timeunit]) || Returns the amount of time in the report period that the reported tag is &#039;&#039;&#039;within&#039;&#039;&#039; the range specified.  Valid low operators are &amp;gt; and &amp;gt;=. Valid high operators are &amp;lt; and &amp;lt;=. Low value and high value can be any numbers. Timeunit is optional (default is seconds), options are s, m, h or d.&lt;br /&gt;
|-&lt;br /&gt;
||   TimeInRangeTotal(low operator,low value,high operator,high value,[timeunit]) || Returns the amount of time since the beginning of the run that the reported tag is &#039;&#039;&#039;within&#039;&#039;&#039; the range specified.  Valid low operators are &amp;gt; and &amp;gt;=. Valid high operators are &amp;lt; and &amp;lt;=. Low value and high value can be any numbers. Timeunit is optional (default is seconds), options are s, m, h or d.&lt;br /&gt;
|-&lt;br /&gt;
||   TimeOutRange(low operator,low value,high operator,high value,[timeunit])|| Returns the amount of time in the report period that the reported tag is &#039;&#039;&#039;outside&#039;&#039;&#039; the range specified.  Valid low operators are &amp;lt; and &amp;lt;=. Valid high operators are &amp;gt; and &amp;gt;=. Low value and high value can be any numbers. Timeunit is optional (default is seconds), options are s, m, h or d.&lt;br /&gt;
|-&lt;br /&gt;
||   TimeOutRangeTotal(low operator,low value,high operator,high value,[timeunit])|| Returns the amount of time since the beginning of the run that the reported tag is &#039;&#039;&#039;outside&#039;&#039;&#039; the range specified.  Valid low operators are &amp;lt; and &amp;lt;=. Valid high operators are &amp;gt; and &amp;gt;=. Low value and high value can be any numbers. Timeunit is optional (default is seconds), options are s, m, h or d.&lt;br /&gt;
|-&lt;br /&gt;
||   Count/Cnt ||   Returns the number of recorded values for the report period. This will be equal to the number of steps in the report period. Any valid SysCAD tag can be specified.&lt;br /&gt;
|-&lt;br /&gt;
||   ChangeCount/ChgCnt ||   Returns the number of times the reported tag changed by more than 0.001 (in SI Units) during the report period.&lt;br /&gt;
|-&lt;br /&gt;
||   String/Str ||   Returns the current value of a string. &#039;&#039;&#039;Note:&#039;&#039;&#039; the SysCAD tag must be a string.&lt;br /&gt;
|-&lt;br /&gt;
| rowspan=&amp;quot;3&amp;quot; valign=&amp;quot;top&amp;quot;  | MeasurePt  ||   StartPt  ||   The value of the SysCAD tag at the beginning of a step.&lt;br /&gt;
|-&lt;br /&gt;
||  EndPt  ||   The value of the SysCAD tag at the end of a step. &lt;br /&gt;
|-&lt;br /&gt;
||  MidPt  ||   The value of the SysCAD tag halfway through the step.&lt;br /&gt;
|-&lt;br /&gt;
| rowspan=&amp;quot;2&amp;quot; valign=&amp;quot;top&amp;quot;  | FirstPoint ||   IgnoreFirst ||   Ignores the first value at the start of the run. i.e if the first value for the tank is 0 and it goes to 29 at the end of the first step, 29 will be recorded as the first value if the IgnoreFirst option is used. &lt;br /&gt;
|-&lt;br /&gt;
||  UseFirst ||   Use the first value at the start of the run.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Archive Options ==&lt;br /&gt;
&lt;br /&gt;
To see the Archive Options dialog box, go to &#039;&#039;Tools - Archive Options&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The Archive Options dialog box shows the tables that have been created and their frequency of data recording. The following dialog box is generated using the example described above.&lt;br /&gt;
&lt;br /&gt;
[[Image:Archive Options.png]]&lt;br /&gt;
[[Image:Archive Options2.png]]&lt;br /&gt;
&lt;br /&gt;
== Example Archive Enabled Projects ==&lt;br /&gt;
&lt;br /&gt;
A few example projects with Archive enabled are included with the standard install.  These include:&lt;br /&gt;
&lt;br /&gt;
*[[Planning Example Project]]&lt;br /&gt;
*[[Tailings Dam Example Project]]&lt;br /&gt;
*[[Waste Handling with Batch Digestion Example Project]]&lt;/div&gt;</summary>
		<author><name>Rod.Stephenson</name></author>
	</entry>
	<entry>
		<id>https://help.syscad.net/index.php?title=Archive_Reporter&amp;diff=84102</id>
		<title>Archive Reporter</title>
		<link rel="alternate" type="text/html" href="https://help.syscad.net/index.php?title=Archive_Reporter&amp;diff=84102"/>
		<updated>2026-05-12T09:01:51Z</updated>

		<summary type="html">&lt;p&gt;Rod.Stephenson: /* Reporting Options */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Reports]]&lt;br /&gt;
{{Navigation|[[User Guide]]|[[Reports]]}}&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Width=300 font style=&amp;quot;background: #ebebeb&amp;quot;|[[Archive Reporter]]&lt;br /&gt;
!Width=300 |[[Archive Editor]]&lt;br /&gt;
!Width=300 |[[Archive (sac) File Text Format]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Related Links:&#039;&#039;&#039; [[Planning Example Project]], [[Tailings Dam Example Project]], [[Waste Handling with Batch Digestion Example Project]]&lt;br /&gt;
----&lt;br /&gt;
{{TOC|x=20%}} &lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;Archive Reporter&#039;&#039;&#039; is used with Dynamic projects to report data directly to a database, CSV or text file while a project is running. This has some similarities with the SysCAD [[Historian]], however the archiver has significantly greater functionality so the use of the historian for reporting is not recommended.&lt;br /&gt;
&lt;br /&gt;
The user specifies how many tables of data are required (maximum is 500), the frequency of reporting (each table may be reported at a user specified time) and the tags that are reported in each table.  These settings are recorded in a text file by the Archive Editor. The maximum number of Fields (including [[#Time_Fields|Time Fields]]) in a Table is 2000 (for DB-SQLITE .db3 format) and 3000 (for csv format).&lt;br /&gt;
&lt;br /&gt;
Please also note that this file is loaded (or reloaded) from the [[Project Settings]] Archive tab page, as shown in the sections below.&lt;br /&gt;
&lt;br /&gt;
== Archive Configuration ==&lt;br /&gt;
&lt;br /&gt;
To use the Archiver:&lt;br /&gt;
# Go to &#039;&#039;Edit - Project Settings&#039;&#039;&lt;br /&gt;
# The dialog box shown below will be displayed&lt;br /&gt;
# Go to the &#039;&#039;Archive&#039;&#039; page and tick the &#039;On&#039; box&lt;br /&gt;
# The SysCAD Archive Configuration (.sac) file will be created&lt;br /&gt;
# Click on the &#039;Edit&#039; button to edit the Archive.sac file&lt;br /&gt;
&lt;br /&gt;
[[Image:Project Settings-Archive.jpg]]&lt;br /&gt;
&lt;br /&gt;
The Settings are explained in the table below:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot; &lt;br /&gt;
|&#039;&#039;&#039;Setting / Tick Box&#039;&#039;&#039; || &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|  colspan=&amp;quot;2&amp;quot; font style=&amp;quot;background: #ebebeb&amp;quot;    | &lt;br /&gt;
=== Archive Reporter Configuration ===&lt;br /&gt;
|-&lt;br /&gt;
| On || The user must tick this box to enable the Archive Reporter.&lt;br /&gt;
|-&lt;br /&gt;
|| Name || This will be the name of the Archive Reporter file. The default name is Archive.sac and it is automatically created in the project folder when the user ticks the &#039;On&#039; box.  Users can choose to have a different file name but only one sac file can be used per project.&lt;br /&gt;
|-&lt;br /&gt;
| Browse ||  The user may browse for an alternative Archive file using this button.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Press the &#039;&#039;&#039;Edit&#039;&#039;&#039; button to launch the Archive Editor.&lt;br /&gt;
&lt;br /&gt;
Pressing the &#039;&#039;&#039;Reload&#039;&#039;&#039; button loads the Archive.sac file into SysCAD, which will check the file and display messages in the Messages window.&lt;br /&gt;
&lt;br /&gt;
== System Settings ==&lt;br /&gt;
&lt;br /&gt;
The Settings are explained in the table below:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot; &lt;br /&gt;
|&#039;&#039;&#039;Setting / Tick Box&#039;&#039;&#039; || &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|  colspan=&amp;quot;2&amp;quot; font style=&amp;quot;background: #ebebeb&amp;quot;    | &lt;br /&gt;
=== Time Fields ===&lt;br /&gt;
|-&lt;br /&gt;
| Date and Time ||  Every table will contain a column with the simulation time and date for the reported values.  The format for this column will be Date:Time&lt;br /&gt;
|-&lt;br /&gt;
| Date Only ||  Every table will contain a column with the simulation date for the reported values.&lt;br /&gt;
|-&lt;br /&gt;
| Time Only ||  Every table will contain a column with the simulation time for the reported values.&lt;br /&gt;
|-&lt;br /&gt;
| Elapsed as HMS ||  Every table will contain a column with the elapsed simulation time for the reported values.  The format for this column will be hh:mm:ss&lt;br /&gt;
|-&lt;br /&gt;
| Elapsed Time ||  Unless the user selects &#039;Off&#039;, every table will contain a column with the elapsed simulation time for the reported values.  The format for this column will be a single value, and will display the total elapsed time as seconds, minutes, hours or days, depending on the user selection.&lt;br /&gt;
|-&lt;br /&gt;
|  colspan=&amp;quot;2&amp;quot; font style=&amp;quot;background: #ebebeb&amp;quot;    |&lt;br /&gt;
&lt;br /&gt;
=== System Tables ===&lt;br /&gt;
|-&lt;br /&gt;
| Message Log ||  If the user ticks this box, all simulation messages will be written to a log file in the Archive folder.&lt;br /&gt;
|-&lt;br /&gt;
| Event Log ||  If the user ticks this box, all Events will be written to a log file in the Archive folder.&lt;br /&gt;
|-&lt;br /&gt;
|  colspan=&amp;quot;2&amp;quot; font style=&amp;quot;background: #ebebeb&amp;quot; | &#039;&#039;Standard Fields&#039;&#039;&amp;lt;br&amp;gt;These tick boxes determine what information is written to the Message Log file.&lt;br /&gt;
|-&lt;br /&gt;
| Source ||  The source of the message will be logged.&lt;br /&gt;
|-&lt;br /&gt;
| Tag    ||  The unit tag that is source of the message will be logged.&lt;br /&gt;
|-&lt;br /&gt;
| Command ||  All SysCAD commands will be logged, e.g. &#039;Stop&#039;, &#039;Run&#039;, etc.&lt;br /&gt;
|-&lt;br /&gt;
| Type ||  The type of message will be logged, i.e. Error, Warning, etc.&lt;br /&gt;
|-&lt;br /&gt;
| Message ||  Messages will be displayed.  If this is not ticked, then only Errors and Warnings will be logged.&lt;br /&gt;
|-&lt;br /&gt;
| ID No ||  The ID of the message will be logged.&lt;br /&gt;
|-&lt;br /&gt;
| Iteration ||  The Iteration of the message will be logged.&lt;br /&gt;
|-&lt;br /&gt;
| Call No ||  The Call number for the message will be logged.&lt;br /&gt;
|-&lt;br /&gt;
| Sequence No ||  The Sequence number of the message will be logged.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Reporting Options ==&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot; &lt;br /&gt;
||&#039;&#039;&#039;Field&#039;&#039;&#039; || &#039;&#039;&#039;Option&#039;&#039;&#039; || &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|colspan=2| On ||  If On = 1, the table will be created. If On = 0, the table will not be created.&lt;br /&gt;
|-&lt;br /&gt;
|colspan=2| Name || The name of the table (for DB formats) or name of the file for csv/txt file formats.&lt;br /&gt;
|-&lt;br /&gt;
| rowspan=&amp;quot;4&amp;quot; valign=&amp;quot;top&amp;quot; | Format ||   DB-SQLITE ||   Data will be saved in Archive.db3 SQ Lite database in the project folder  (Maximum fields per table is 2000)&lt;br /&gt;
|-&lt;br /&gt;
||   CSV ||  Data will be saved in a CSV file (Maximum fields per table is 3000)&lt;br /&gt;
|-&lt;br /&gt;
||  TXT ||   Data will be saved in a Text (txt) file&lt;br /&gt;
|-&lt;br /&gt;
| rowspan=&amp;quot;2&amp;quot; valign=&amp;quot;top&amp;quot;  | Clear ||   Rewind ||   Clear archive file on next run. &lt;br /&gt;
|-&lt;br /&gt;
||   False ||   Add to existing archive file on next run. This can be overridden by other settings on the [[Solver Setting - Scenario]] page such as the RestartArchive option.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; Each table can only have one format but within the same archive file, different tables can have different formats&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== CSV and TXT File Options ===&lt;br /&gt;
&lt;br /&gt;
If the Format chosen is CSV or TXT, then the following options are relevant.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot; &lt;br /&gt;
||&#039;&#039;&#039;Field&#039;&#039;&#039; || &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|Path || The path and folder name for storing CSV &amp;amp; TXT files (usually with the Project)&lt;br /&gt;
|-&lt;br /&gt;
|SigDigits ||  The number of significant digits for the tags that are reported to CSV &amp;amp; TXT files.  Recommendation is 16.  Accepted range is 2-17.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Period and Offset ===&lt;br /&gt;
&lt;br /&gt;
The Period and Offset for reporting can be specified. This is not required if the user specifies a Trigger, but note that both Periods and Triggers can be used for the same table.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot; &lt;br /&gt;
||&#039;&#039;&#039;Field&#039;&#039;&#039; ||   &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|| Period ||   Time frequency for reporting fields, where time zero is at start.&amp;lt;br&amp;gt;&#039;&#039;&#039;Note 1:&#039;&#039;&#039; The period is relative to midnight, not the simulation start time.&amp;lt;br&amp;gt;&#039;&#039;&#039;Note 2:&#039;&#039;&#039; If the period is not divisible by 24 hours, the reporting will not be at the same time each day.&lt;br /&gt;
|-&lt;br /&gt;
|| Offset     ||   Time offset within the specified period. This affects when the first set of data is recorded.&amp;lt;br&amp;gt;&#039;&#039;&#039;Note:&#039;&#039;&#039; The offset is relative to midnight, not the simulation start time.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notes:&#039;&#039;&#039; &lt;br /&gt;
* Use Period for reporting at fixed time intervals, OR use Triggers for reporting at irregular time intervals (i.e. report specified fields based on trigger logic).&lt;br /&gt;
* If one or more Triggers are used, a period &amp;amp; offset is not relevant or required.&lt;br /&gt;
* If no triggers or period are specified then the table will not accumulate data.&lt;br /&gt;
* Note that period and offset are relative to midnight. If your start time is not on a reporting period relative to midnight AND you want to report relative to the start time, then you need to specify an offset to achieve this. For example, if you want to report every 24 hours and the start time is 8:00am, then the offset should be 8 hours.&lt;br /&gt;
&lt;br /&gt;
== Trigger Options ==&lt;br /&gt;
&lt;br /&gt;
The user may specify one or more Triggers that will cause the values in the table to be reported. There can be any number of triggers. If the conditions of any of the triggers are met, then the fields will be reported.&lt;br /&gt;
&lt;br /&gt;
The triggers are numbered and include three terms as described below, a description, a SysCAD tag and the Trigger Test.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot; &lt;br /&gt;
||&#039;&#039;&#039;Term&#039;&#039;&#039; ||   &#039;&#039;&#039;Option&#039;&#039;&#039; ||   &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|colspan=2|Description  ||   A description of the trigger&lt;br /&gt;
|-&lt;br /&gt;
|colspan=2|SysCADTag ||   Any valid SysCAD tag. May have conversions.&lt;br /&gt;
|-&lt;br /&gt;
| rowspan=&amp;quot;6&amp;quot; valign=&amp;quot;top&amp;quot;  | TriggerTest||   Rise = Value ||  The trigger will be true if the value has &#039;&#039;&#039;increased&#039;&#039;&#039; by more than the specified amount since the &#039;&#039;&#039;last recorded value&#039;&#039;&#039;. The last recorded value will either be the first value or the value when the trigger was last true.&lt;br /&gt;
|-&lt;br /&gt;
||   StepRise = Value ||  The trigger will be true if the value has &#039;&#039;&#039;increased&#039;&#039;&#039; by more than the specified amount since the &#039;&#039;&#039;last step&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
||   Fall = Value ||  The trigger will be true if the value has &#039;&#039;&#039;decreased&#039;&#039;&#039; by more than the specified amount since the &#039;&#039;&#039;last recorded value&#039;&#039;&#039;. The last recorded value will either be the first value or the value when the trigger was last true. &lt;br /&gt;
|-&lt;br /&gt;
||   StepFall = Value ||  The trigger will be true if the value has &#039;&#039;&#039;decreased&#039;&#039;&#039; by more than the specified amount since the &#039;&#039;&#039;last step&#039;&#039;&#039;.  &lt;br /&gt;
|-&lt;br /&gt;
||   Delta = Value ||  The trigger will be true if the value has &#039;&#039;&#039;changed&#039;&#039;&#039; by more than the specified amount since the &#039;&#039;&#039;last recorded value&#039;&#039;&#039;. The last recorded value will either be the first value or the value when the trigger was last true.  &lt;br /&gt;
|-&lt;br /&gt;
||   StepDelta = Value ||  The trigger will be true if the value has &#039;&#039;&#039;changed&#039;&#039;&#039; by more than the specified amount since the &#039;&#039;&#039;last step&#039;&#039;&#039;.  &lt;br /&gt;
|}&lt;br /&gt;
where = Value = Test value used to see where there are sudden changes.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notes:&#039;&#039;&#039; &lt;br /&gt;
* Use Period for reporting at fixed time intervals, OR use Triggers for reporting at irregular time intervals (i.e. report specified fields based on trigger logic).&lt;br /&gt;
* If one or more Triggers are used, a period &amp;amp; offset is not relevant or required.&lt;br /&gt;
* If no triggers or period are specified then the table will not accumulate data.&lt;br /&gt;
* The smallest period that can be used is 1s.  If the Dynamic timestep is less than 1s, and you want to record values at every iteration, a workaround is to use a Trigger on a tag which is changing every step, for example &#039;&#039;&#039; $Solver.Dyn.Scenario.Elapsed.Time (ms)&#039;&#039;&#039;. Add the following line to the SAC file:&lt;br /&gt;
&lt;br /&gt;
 Trigger1   = Trigger1, $Solver.Dyn.Scenario.Elapsed.Time (ms), StepDelta=1e-05&lt;br /&gt;
&lt;br /&gt;
== Field Options ==&lt;br /&gt;
&lt;br /&gt;
The user may specify one or more fields in the table to be reported.&lt;br /&gt;
&lt;br /&gt;
The fields are numbered and include five terms as described below, a field name, a SysCAD tag, a function, measure point and first point options.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot; &lt;br /&gt;
||&#039;&#039;&#039;Term&#039;&#039;&#039; ||   &#039;&#039;&#039;Option&#039;&#039;&#039; ||   &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|colspan=2|FieldName  ||   Report column or field name. Should not contain characters: &#039;.,[] &lt;br /&gt;
|-&lt;br /&gt;
|colspan=2|SysCADTag ||   Any valid SysCAD tag. May have conversions. &#039;&#039;&#039;If the tag is a string (eg TNK_001.Condition), use the String function below to ensure it is reported correctly.&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| rowspan=&amp;quot;19&amp;quot; valign=&amp;quot;top&amp;quot;  | Function||   Current/Cur ||   Returns the current value.&lt;br /&gt;
|-&lt;br /&gt;
||   CurrentDiff/CurDiff ||   Returns the difference between current value and the current value at the end of the previous reporting period.&lt;br /&gt;
|-&lt;br /&gt;
||   Minimum/Min ||   Returns the minimum value for the chosen period.&lt;br /&gt;
|-&lt;br /&gt;
||   Maximum/Max ||   Returns the maximum value for the chosen period.&lt;br /&gt;
|-&lt;br /&gt;
||   Average/Avg ||   Returns the average value for the chosen period.&lt;br /&gt;
|-&lt;br /&gt;
||   AverageTotal/AvgTtl ||   Returns the average value since the beginning of the run.&lt;br /&gt;
|-&lt;br /&gt;
||   Sum ||   Returns the total of the reported tag for the report period. &#039;&#039;&#039;Note:&#039;&#039;&#039; The SysCAD tag MUST be on a per second basis (e.g. P_1.Qm (t/s)).&lt;br /&gt;
|-&lt;br /&gt;
||   SumTotal/SumTtl ||   Returns the total of the reported tag since the beginning of the run. &#039;&#039;&#039;Note:&#039;&#039;&#039; The SysCAD tag MUST be on a per second basis (e.g. P_1.Qm (t/s)).&lt;br /&gt;
|-&lt;br /&gt;
||   ReportTime ||   Returns the number of seconds for the report period. This will be equal to the number of steps in the report period multiplied by the timestep. Any valid SysCAD tag can be specified.&lt;br /&gt;
|-&lt;br /&gt;
||   SimulationTime ||   Returns the number of seconds since the beginning of the run. This will be equal to the total number of steps since the beginning of the run multiplied by the timestep. Any valid SysCAD tag can be specified.&lt;br /&gt;
|-&lt;br /&gt;
||  Time(operator,value,[timeunit]) || Returns the amount of time in the report period that the reported tag meets the condition specified using operator and value. Valid operators are &amp;lt;, &amp;lt;=, ==, &amp;lt;&amp;gt;, &amp;gt;= and &amp;gt;. Value can be any number. Timeunit is optional (default is seconds), options are s, m, h or d.&lt;br /&gt;
|-&lt;br /&gt;
||  TimeTotal(operator,value,[timeunit])&amp;lt;br&amp;gt;/TimeTtl(operator,value,[timeunit]) || Returns the amount of time since the beginning of the run that the reported tag meets the condition specified using operator and value. Valid operators are &amp;lt;, &amp;lt;=, ==, &amp;lt;&amp;gt;, &amp;gt;= and &amp;gt;. Value can be any number. Timeunit is optional (default is seconds), options are s, m, h or d.&lt;br /&gt;
|-&lt;br /&gt;
||   TimeInRange(low operator,low value,high operator,high value,[timeunit]) || Returns the amount of time in the report period that the reported tag is &#039;&#039;&#039;within&#039;&#039;&#039; the range specified.  Valid low operators are &amp;gt; and &amp;gt;=. Valid high operators are &amp;lt; and &amp;lt;=. Low value and high value can be any numbers. Timeunit is optional (default is seconds), options are s, m, h or d.&lt;br /&gt;
|-&lt;br /&gt;
||   TimeInRangeTotal(low operator,low value,high operator,high value,[timeunit]) || Returns the amount of time since the beginning of the run that the reported tag is &#039;&#039;&#039;within&#039;&#039;&#039; the range specified.  Valid low operators are &amp;gt; and &amp;gt;=. Valid high operators are &amp;lt; and &amp;lt;=. Low value and high value can be any numbers. Timeunit is optional (default is seconds), options are s, m, h or d.&lt;br /&gt;
|-&lt;br /&gt;
||   TimeOutRange(low operator,low value,high operator,high value,[timeunit])|| Returns the amount of time in the report period that the reported tag is &#039;&#039;&#039;outside&#039;&#039;&#039; the range specified.  Valid low operators are &amp;lt; and &amp;lt;=. Valid high operators are &amp;gt; and &amp;gt;=. Low value and high value can be any numbers. Timeunit is optional (default is seconds), options are s, m, h or d.&lt;br /&gt;
|-&lt;br /&gt;
||   TimeOutRangeTotal(low operator,low value,high operator,high value,[timeunit])|| Returns the amount of time since the beginning of the run that the reported tag is &#039;&#039;&#039;outside&#039;&#039;&#039; the range specified.  Valid low operators are &amp;lt; and &amp;lt;=. Valid high operators are &amp;gt; and &amp;gt;=. Low value and high value can be any numbers. Timeunit is optional (default is seconds), options are s, m, h or d.&lt;br /&gt;
|-&lt;br /&gt;
||   Count/Cnt ||   Returns the number of recorded values for the report period. This will be equal to the number of steps in the report period. Any valid SysCAD tag can be specified.&lt;br /&gt;
|-&lt;br /&gt;
||   ChangeCount/ChgCnt ||   Returns the number of times the reported tag changed by more than 0.001 (in SI Units) during the report period.&lt;br /&gt;
|-&lt;br /&gt;
||   String/Str ||   Returns the current value of a string. &#039;&#039;&#039;Note:&#039;&#039;&#039; the SysCAD tag must be a string.&lt;br /&gt;
|-&lt;br /&gt;
| rowspan=&amp;quot;3&amp;quot; valign=&amp;quot;top&amp;quot;  | MeasurePt  ||   StartPt  ||   The value of the SysCAD tag at the beginning of a step.&lt;br /&gt;
|-&lt;br /&gt;
||  EndPt  ||   The value of the SysCAD tag at the end of a step. &lt;br /&gt;
|-&lt;br /&gt;
||  MidPt  ||   The value of the SysCAD tag halfway through the step.&lt;br /&gt;
|-&lt;br /&gt;
| rowspan=&amp;quot;2&amp;quot; valign=&amp;quot;top&amp;quot;  | FirstPoint ||   IgnoreFirst ||   Ignores the first value at the start of the run. i.e if the first value for the tank is 0 and it goes to 29 at the end of the first step, 29 will be recorded as the first value if the IgnoreFirst option is used. &lt;br /&gt;
|-&lt;br /&gt;
||  UseFirst ||   Use the first value at the start of the run.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Archive Options ==&lt;br /&gt;
&lt;br /&gt;
To see the Archive Options dialog box, go to &#039;&#039;Tools - Archive Options&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The Archive Options dialog box shows the tables that have been created and their frequency of data recording. The following dialog box is generated using the example described above.&lt;br /&gt;
&lt;br /&gt;
[[Image:Archive Options.png]]&lt;br /&gt;
[[Image:Archive Options2.png]]&lt;br /&gt;
&lt;br /&gt;
== Example Archive Enabled Projects ==&lt;br /&gt;
&lt;br /&gt;
A few example projects with Archive enabled are included with the standard install.  These include:&lt;br /&gt;
&lt;br /&gt;
*[[Planning Example Project]]&lt;br /&gt;
*[[Tailings Dam Example Project]]&lt;br /&gt;
*[[Waste Handling with Batch Digestion Example Project]]&lt;/div&gt;</summary>
		<author><name>Rod.Stephenson</name></author>
	</entry>
	<entry>
		<id>https://help.syscad.net/index.php?title=Archive_Reporter&amp;diff=84064</id>
		<title>Archive Reporter</title>
		<link rel="alternate" type="text/html" href="https://help.syscad.net/index.php?title=Archive_Reporter&amp;diff=84064"/>
		<updated>2026-04-27T14:57:29Z</updated>

		<summary type="html">&lt;p&gt;Rod.Stephenson: /* Trigger Options */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Reports]]&lt;br /&gt;
{{Navigation|[[User Guide]]|[[Reports]]}}&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Width=300 font style=&amp;quot;background: #ebebeb&amp;quot;|[[Archive Reporter]]&lt;br /&gt;
!Width=300 |[[Archive Editor]]&lt;br /&gt;
!Width=300 |[[Archive (sac) File Text Format]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Related Links:&#039;&#039;&#039; [[Planning Example Project]], [[Tailings Dam Example Project]], [[Waste Handling with Batch Digestion Example Project]]&lt;br /&gt;
----&lt;br /&gt;
{{TOC|x=20%}} &lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;Archive Reporter&#039;&#039;&#039; is used with Dynamic projects to report data directly to a database, CSV or text file while a project is running. This has some similarities with the SysCAD [[Historian]], however the archiver has significantly greater functionality so the use of the historian for reporting is not recommended.&lt;br /&gt;
&lt;br /&gt;
The user specifies how many tables of data are required (maximum is 500), the frequency of reporting (each table may be reported at a user specified time) and the tags that are reported in each table.  These settings are recorded in a text file by the Archive Editor. The maximum number of Fields (including [[#Time_Fields|Time Fields]]) in a Table is 2000 (for DB-SQLITE .db3 format) and 3000 (for csv format).&lt;br /&gt;
&lt;br /&gt;
Please also note that this file is loaded (or reloaded) from the [[Project Settings]] Archive tab page, as shown in the sections below.&lt;br /&gt;
&lt;br /&gt;
== Archive Configuration ==&lt;br /&gt;
&lt;br /&gt;
To use the Archiver:&lt;br /&gt;
# Go to &#039;&#039;Edit - Project Settings&#039;&#039;&lt;br /&gt;
# The dialog box shown below will be displayed&lt;br /&gt;
# Go to the &#039;&#039;Archive&#039;&#039; page and tick the &#039;On&#039; box&lt;br /&gt;
# The SysCAD Archive Configuration (.sac) file will be created&lt;br /&gt;
# Click on the &#039;Edit&#039; button to edit the Archive.sac file&lt;br /&gt;
&lt;br /&gt;
[[Image:Project Settings-Archive.jpg]]&lt;br /&gt;
&lt;br /&gt;
The Settings are explained in the table below:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot; &lt;br /&gt;
|&#039;&#039;&#039;Setting / Tick Box&#039;&#039;&#039; || &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|  colspan=&amp;quot;2&amp;quot; font style=&amp;quot;background: #ebebeb&amp;quot;    | &lt;br /&gt;
=== Archive Reporter Configuration ===&lt;br /&gt;
|-&lt;br /&gt;
| On || The user must tick this box to enable the Archive Reporter.&lt;br /&gt;
|-&lt;br /&gt;
|| Name || This will be the name of the Archive Reporter file. The default name is Archive.sac and it is automatically created in the project folder when the user ticks the &#039;On&#039; box.  Users can choose to have a different file name but only one sac file can be used per project.&lt;br /&gt;
|-&lt;br /&gt;
| Browse ||  The user may browse for an alternative Archive file using this button.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Press the &#039;&#039;&#039;Edit&#039;&#039;&#039; button to launch the Archive Editor.&lt;br /&gt;
&lt;br /&gt;
Pressing the &#039;&#039;&#039;Reload&#039;&#039;&#039; button loads the Archive.sac file into SysCAD, which will check the file and display messages in the Messages window.&lt;br /&gt;
&lt;br /&gt;
== System Settings ==&lt;br /&gt;
&lt;br /&gt;
The Settings are explained in the table below:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot; &lt;br /&gt;
|&#039;&#039;&#039;Setting / Tick Box&#039;&#039;&#039; || &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|  colspan=&amp;quot;2&amp;quot; font style=&amp;quot;background: #ebebeb&amp;quot;    | &lt;br /&gt;
=== Time Fields ===&lt;br /&gt;
|-&lt;br /&gt;
| Date and Time ||  Every table will contain a column with the simulation time and date for the reported values.  The format for this column will be Date:Time&lt;br /&gt;
|-&lt;br /&gt;
| Date Only ||  Every table will contain a column with the simulation date for the reported values.&lt;br /&gt;
|-&lt;br /&gt;
| Time Only ||  Every table will contain a column with the simulation time for the reported values.&lt;br /&gt;
|-&lt;br /&gt;
| Elapsed as HMS ||  Every table will contain a column with the elapsed simulation time for the reported values.  The format for this column will be hh:mm:ss&lt;br /&gt;
|-&lt;br /&gt;
| Elapsed Time ||  Unless the user selects &#039;Off&#039;, every table will contain a column with the elapsed simulation time for the reported values.  The format for this column will be a single value, and will display the total elapsed time as seconds, minutes, hours or days, depending on the user selection.&lt;br /&gt;
|-&lt;br /&gt;
|  colspan=&amp;quot;2&amp;quot; font style=&amp;quot;background: #ebebeb&amp;quot;    |&lt;br /&gt;
&lt;br /&gt;
=== System Tables ===&lt;br /&gt;
|-&lt;br /&gt;
| Message Log ||  If the user ticks this box, all simulation messages will be written to a log file in the Archive folder.&lt;br /&gt;
|-&lt;br /&gt;
| Event Log ||  If the user ticks this box, all Events will be written to a log file in the Archive folder.&lt;br /&gt;
|-&lt;br /&gt;
|  colspan=&amp;quot;2&amp;quot; font style=&amp;quot;background: #ebebeb&amp;quot; | &#039;&#039;Standard Fields&#039;&#039;&amp;lt;br&amp;gt;These tick boxes determine what information is written to the Message Log file.&lt;br /&gt;
|-&lt;br /&gt;
| Source ||  The source of the message will be logged.&lt;br /&gt;
|-&lt;br /&gt;
| Tag    ||  The unit tag that is source of the message will be logged.&lt;br /&gt;
|-&lt;br /&gt;
| Command ||  All SysCAD commands will be logged, e.g. &#039;Stop&#039;, &#039;Run&#039;, etc.&lt;br /&gt;
|-&lt;br /&gt;
| Type ||  The type of message will be logged, i.e. Error, Warning, etc.&lt;br /&gt;
|-&lt;br /&gt;
| Message ||  Messages will be displayed.  If this is not ticked, then only Errors and Warnings will be logged.&lt;br /&gt;
|-&lt;br /&gt;
| ID No ||  The ID of the message will be logged.&lt;br /&gt;
|-&lt;br /&gt;
| Iteration ||  The Iteration of the message will be logged.&lt;br /&gt;
|-&lt;br /&gt;
| Call No ||  The Call number for the message will be logged.&lt;br /&gt;
|-&lt;br /&gt;
| Sequence No ||  The Sequence number of the message will be logged.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Reporting Options ==&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot; &lt;br /&gt;
||&#039;&#039;&#039;Field&#039;&#039;&#039; || &#039;&#039;&#039;Option&#039;&#039;&#039; || &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|colspan=2| On ||  If On = 1, the table will be created. If On = 0, the table will not be created.&lt;br /&gt;
|-&lt;br /&gt;
|colspan=2| Name || The name of the table (for DB formats) or name of the file for csv/txt file formats.&lt;br /&gt;
|-&lt;br /&gt;
| rowspan=&amp;quot;4&amp;quot; valign=&amp;quot;top&amp;quot; | Format ||   DB-SQLITE ||   Data will be saved in Archive.db3 SQ Lite database in the project folder  (Maximum fields per table is 2000)&lt;br /&gt;
|-&lt;br /&gt;
||   DB-MSACCESS ||   Data will be saved in Archive.mdb Microsoft Access database in the project folder&lt;br /&gt;
|-&lt;br /&gt;
||   CSV ||  Data will be saved in a CSV file (Maximum fields per table is 3000)&lt;br /&gt;
|-&lt;br /&gt;
||  TXT ||   Data will be saved in a Text (txt) file&lt;br /&gt;
|-&lt;br /&gt;
| rowspan=&amp;quot;2&amp;quot; valign=&amp;quot;top&amp;quot;  | Clear ||   Rewind ||   Clear archive file on next run. &lt;br /&gt;
|-&lt;br /&gt;
||   False ||   Add to existing archive file on next run. This can be overridden by other settings on the [[Solver Setting - Scenario]] page such as the RestartArchive option.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; Each table can only have one format but within the same archive file, different tables can have different formats&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== CSV and TXT File Options ===&lt;br /&gt;
&lt;br /&gt;
If the Format chosen is CSV or TXT, then the following options are relevant.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot; &lt;br /&gt;
||&#039;&#039;&#039;Field&#039;&#039;&#039; || &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|Path || The path and folder name for storing CSV &amp;amp; TXT files (usually with the Project)&lt;br /&gt;
|-&lt;br /&gt;
|SigDigits ||  The number of significant digits for the tags that are reported to CSV &amp;amp; TXT files.  Recommendation is 16.  Accepted range is 2-17.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Period and Offset ===&lt;br /&gt;
&lt;br /&gt;
The Period and Offset for reporting can be specified. This is not required if the user specifies a Trigger, but note that both Periods and Triggers can be used for the same table.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot; &lt;br /&gt;
||&#039;&#039;&#039;Field&#039;&#039;&#039; ||   &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|| Period ||   Time frequency for reporting fields, where time zero is at start.&amp;lt;br&amp;gt;&#039;&#039;&#039;Note 1:&#039;&#039;&#039; The period is relative to midnight, not the simulation start time.&amp;lt;br&amp;gt;&#039;&#039;&#039;Note 2:&#039;&#039;&#039; If the period is not divisible by 24 hours, the reporting will not be at the same time each day.&lt;br /&gt;
|-&lt;br /&gt;
|| Offset     ||   Time offset within the specified period. This affects when the first set of data is recorded.&amp;lt;br&amp;gt;&#039;&#039;&#039;Note:&#039;&#039;&#039; The offset is relative to midnight, not the simulation start time.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notes:&#039;&#039;&#039; &lt;br /&gt;
* Use Period for reporting at fixed time intervals, OR use Triggers for reporting at irregular time intervals (i.e. report specified fields based on trigger logic).&lt;br /&gt;
* If one or more Triggers are used, a period &amp;amp; offset is not relevant or required.&lt;br /&gt;
* If no triggers or period are specified then the table will not accumulate data.&lt;br /&gt;
* Note that period and offset are relative to midnight. If your start time is not on a reporting period relative to midnight AND you want to report relative to the start time, then you need to specify an offset to achieve this. For example, if you want to report every 24 hours and the start time is 8:00am, then the offset should be 8 hours.&lt;br /&gt;
&lt;br /&gt;
== Trigger Options ==&lt;br /&gt;
&lt;br /&gt;
The user may specify one or more Triggers that will cause the values in the table to be reported. There can be any number of triggers. If the conditions of any of the triggers are met, then the fields will be reported.&lt;br /&gt;
&lt;br /&gt;
The triggers are numbered and include three terms as described below, a description, a SysCAD tag and the Trigger Test.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot; &lt;br /&gt;
||&#039;&#039;&#039;Term&#039;&#039;&#039; ||   &#039;&#039;&#039;Option&#039;&#039;&#039; ||   &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|colspan=2|Description  ||   A description of the trigger&lt;br /&gt;
|-&lt;br /&gt;
|colspan=2|SysCADTag ||   Any valid SysCAD tag. May have conversions.&lt;br /&gt;
|-&lt;br /&gt;
| rowspan=&amp;quot;6&amp;quot; valign=&amp;quot;top&amp;quot;  | TriggerTest||   Rise = Value ||  The trigger will be true if the value has &#039;&#039;&#039;increased&#039;&#039;&#039; by more than the specified amount since the &#039;&#039;&#039;last recorded value&#039;&#039;&#039;. The last recorded value will either be the first value or the value when the trigger was last true.&lt;br /&gt;
|-&lt;br /&gt;
||   StepRise = Value ||  The trigger will be true if the value has &#039;&#039;&#039;increased&#039;&#039;&#039; by more than the specified amount since the &#039;&#039;&#039;last step&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
||   Fall = Value ||  The trigger will be true if the value has &#039;&#039;&#039;decreased&#039;&#039;&#039; by more than the specified amount since the &#039;&#039;&#039;last recorded value&#039;&#039;&#039;. The last recorded value will either be the first value or the value when the trigger was last true. &lt;br /&gt;
|-&lt;br /&gt;
||   StepFall = Value ||  The trigger will be true if the value has &#039;&#039;&#039;decreased&#039;&#039;&#039; by more than the specified amount since the &#039;&#039;&#039;last step&#039;&#039;&#039;.  &lt;br /&gt;
|-&lt;br /&gt;
||   Delta = Value ||  The trigger will be true if the value has &#039;&#039;&#039;changed&#039;&#039;&#039; by more than the specified amount since the &#039;&#039;&#039;last recorded value&#039;&#039;&#039;. The last recorded value will either be the first value or the value when the trigger was last true.  &lt;br /&gt;
|-&lt;br /&gt;
||   StepDelta = Value ||  The trigger will be true if the value has &#039;&#039;&#039;changed&#039;&#039;&#039; by more than the specified amount since the &#039;&#039;&#039;last step&#039;&#039;&#039;.  &lt;br /&gt;
|}&lt;br /&gt;
where = Value = Test value used to see where there are sudden changes.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notes:&#039;&#039;&#039; &lt;br /&gt;
* Use Period for reporting at fixed time intervals, OR use Triggers for reporting at irregular time intervals (i.e. report specified fields based on trigger logic).&lt;br /&gt;
* If one or more Triggers are used, a period &amp;amp; offset is not relevant or required.&lt;br /&gt;
* If no triggers or period are specified then the table will not accumulate data.&lt;br /&gt;
* The smallest period that can be used is 1s.  If the Dynamic timestep is less than 1s, and you want to record values at every iteration, a workaround is to use a Trigger on a tag which is changing every step, for example &#039;&#039;&#039; $Solver.Dyn.Scenario.Elapsed.Time (ms)&#039;&#039;&#039;. Add the following line to the SAC file:&lt;br /&gt;
&lt;br /&gt;
 Trigger1   = Trigger1, $Solver.Dyn.Scenario.Elapsed.Time (ms), StepDelta=1e-05&lt;br /&gt;
&lt;br /&gt;
== Field Options ==&lt;br /&gt;
&lt;br /&gt;
The user may specify one or more fields in the table to be reported.&lt;br /&gt;
&lt;br /&gt;
The fields are numbered and include five terms as described below, a field name, a SysCAD tag, a function, measure point and first point options.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot; &lt;br /&gt;
||&#039;&#039;&#039;Term&#039;&#039;&#039; ||   &#039;&#039;&#039;Option&#039;&#039;&#039; ||   &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|colspan=2|FieldName  ||   Report column or field name. Should not contain characters: &#039;.,[] &lt;br /&gt;
|-&lt;br /&gt;
|colspan=2|SysCADTag ||   Any valid SysCAD tag. May have conversions. &#039;&#039;&#039;If the tag is a string (eg TNK_001.Condition), use the String function below to ensure it is reported correctly.&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| rowspan=&amp;quot;19&amp;quot; valign=&amp;quot;top&amp;quot;  | Function||   Current/Cur ||   Returns the current value.&lt;br /&gt;
|-&lt;br /&gt;
||   CurrentDiff/CurDiff ||   Returns the difference between current value and the current value at the end of the previous reporting period.&lt;br /&gt;
|-&lt;br /&gt;
||   Minimum/Min ||   Returns the minimum value for the chosen period.&lt;br /&gt;
|-&lt;br /&gt;
||   Maximum/Max ||   Returns the maximum value for the chosen period.&lt;br /&gt;
|-&lt;br /&gt;
||   Average/Avg ||   Returns the average value for the chosen period.&lt;br /&gt;
|-&lt;br /&gt;
||   AverageTotal/AvgTtl ||   Returns the average value since the beginning of the run.&lt;br /&gt;
|-&lt;br /&gt;
||   Sum ||   Returns the total of the reported tag for the report period. &#039;&#039;&#039;Note:&#039;&#039;&#039; The SysCAD tag MUST be on a per second basis (e.g. P_1.Qm (t/s)).&lt;br /&gt;
|-&lt;br /&gt;
||   SumTotal/SumTtl ||   Returns the total of the reported tag since the beginning of the run. &#039;&#039;&#039;Note:&#039;&#039;&#039; The SysCAD tag MUST be on a per second basis (e.g. P_1.Qm (t/s)).&lt;br /&gt;
|-&lt;br /&gt;
||   ReportTime ||   Returns the number of seconds for the report period. This will be equal to the number of steps in the report period multiplied by the timestep. Any valid SysCAD tag can be specified.&lt;br /&gt;
|-&lt;br /&gt;
||   SimulationTime ||   Returns the number of seconds since the beginning of the run. This will be equal to the total number of steps since the beginning of the run multiplied by the timestep. Any valid SysCAD tag can be specified.&lt;br /&gt;
|-&lt;br /&gt;
||  Time(operator,value,[timeunit]) || Returns the amount of time in the report period that the reported tag meets the condition specified using operator and value. Valid operators are &amp;lt;, &amp;lt;=, ==, &amp;lt;&amp;gt;, &amp;gt;= and &amp;gt;. Value can be any number. Timeunit is optional (default is seconds), options are s, m, h or d.&lt;br /&gt;
|-&lt;br /&gt;
||  TimeTotal(operator,value,[timeunit])&amp;lt;br&amp;gt;/TimeTtl(operator,value,[timeunit]) || Returns the amount of time since the beginning of the run that the reported tag meets the condition specified using operator and value. Valid operators are &amp;lt;, &amp;lt;=, ==, &amp;lt;&amp;gt;, &amp;gt;= and &amp;gt;. Value can be any number. Timeunit is optional (default is seconds), options are s, m, h or d.&lt;br /&gt;
|-&lt;br /&gt;
||   TimeInRange(low operator,low value,high operator,high value,[timeunit]) || Returns the amount of time in the report period that the reported tag is &#039;&#039;&#039;within&#039;&#039;&#039; the range specified.  Valid low operators are &amp;gt; and &amp;gt;=. Valid high operators are &amp;lt; and &amp;lt;=. Low value and high value can be any numbers. Timeunit is optional (default is seconds), options are s, m, h or d.&lt;br /&gt;
|-&lt;br /&gt;
||   TimeInRangeTotal(low operator,low value,high operator,high value,[timeunit]) || Returns the amount of time since the beginning of the run that the reported tag is &#039;&#039;&#039;within&#039;&#039;&#039; the range specified.  Valid low operators are &amp;gt; and &amp;gt;=. Valid high operators are &amp;lt; and &amp;lt;=. Low value and high value can be any numbers. Timeunit is optional (default is seconds), options are s, m, h or d.&lt;br /&gt;
|-&lt;br /&gt;
||   TimeOutRange(low operator,low value,high operator,high value,[timeunit])|| Returns the amount of time in the report period that the reported tag is &#039;&#039;&#039;outside&#039;&#039;&#039; the range specified.  Valid low operators are &amp;lt; and &amp;lt;=. Valid high operators are &amp;gt; and &amp;gt;=. Low value and high value can be any numbers. Timeunit is optional (default is seconds), options are s, m, h or d.&lt;br /&gt;
|-&lt;br /&gt;
||   TimeOutRangeTotal(low operator,low value,high operator,high value,[timeunit])|| Returns the amount of time since the beginning of the run that the reported tag is &#039;&#039;&#039;outside&#039;&#039;&#039; the range specified.  Valid low operators are &amp;lt; and &amp;lt;=. Valid high operators are &amp;gt; and &amp;gt;=. Low value and high value can be any numbers. Timeunit is optional (default is seconds), options are s, m, h or d.&lt;br /&gt;
|-&lt;br /&gt;
||   Count/Cnt ||   Returns the number of recorded values for the report period. This will be equal to the number of steps in the report period. Any valid SysCAD tag can be specified.&lt;br /&gt;
|-&lt;br /&gt;
||   ChangeCount/ChgCnt ||   Returns the number of times the reported tag changed by more than 0.001 (in SI Units) during the report period.&lt;br /&gt;
|-&lt;br /&gt;
||   String/Str ||   Returns the current value of a string. &#039;&#039;&#039;Note:&#039;&#039;&#039; the SysCAD tag must be a string.&lt;br /&gt;
|-&lt;br /&gt;
| rowspan=&amp;quot;3&amp;quot; valign=&amp;quot;top&amp;quot;  | MeasurePt  ||   StartPt  ||   The value of the SysCAD tag at the beginning of a step.&lt;br /&gt;
|-&lt;br /&gt;
||  EndPt  ||   The value of the SysCAD tag at the end of a step. &lt;br /&gt;
|-&lt;br /&gt;
||  MidPt  ||   The value of the SysCAD tag halfway through the step.&lt;br /&gt;
|-&lt;br /&gt;
| rowspan=&amp;quot;2&amp;quot; valign=&amp;quot;top&amp;quot;  | FirstPoint ||   IgnoreFirst ||   Ignores the first value at the start of the run. i.e if the first value for the tank is 0 and it goes to 29 at the end of the first step, 29 will be recorded as the first value if the IgnoreFirst option is used. &lt;br /&gt;
|-&lt;br /&gt;
||  UseFirst ||   Use the first value at the start of the run.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Archive Options ==&lt;br /&gt;
&lt;br /&gt;
To see the Archive Options dialog box, go to &#039;&#039;Tools - Archive Options&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The Archive Options dialog box shows the tables that have been created and their frequency of data recording. The following dialog box is generated using the example described above.&lt;br /&gt;
&lt;br /&gt;
[[Image:Archive Options.png]]&lt;br /&gt;
[[Image:Archive Options2.png]]&lt;br /&gt;
&lt;br /&gt;
== Example Archive Enabled Projects ==&lt;br /&gt;
&lt;br /&gt;
A few example projects with Archive enabled are included with the standard install.  These include:&lt;br /&gt;
&lt;br /&gt;
*[[Planning Example Project]]&lt;br /&gt;
*[[Tailings Dam Example Project]]&lt;br /&gt;
*[[Waste Handling with Batch Digestion Example Project]]&lt;/div&gt;</summary>
		<author><name>Rod.Stephenson</name></author>
	</entry>
	<entry>
		<id>https://help.syscad.net/index.php?title=Archive_Reporter&amp;diff=84063</id>
		<title>Archive Reporter</title>
		<link rel="alternate" type="text/html" href="https://help.syscad.net/index.php?title=Archive_Reporter&amp;diff=84063"/>
		<updated>2026-04-27T14:56:18Z</updated>

		<summary type="html">&lt;p&gt;Rod.Stephenson: /* Trigger Options */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Reports]]&lt;br /&gt;
{{Navigation|[[User Guide]]|[[Reports]]}}&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Width=300 font style=&amp;quot;background: #ebebeb&amp;quot;|[[Archive Reporter]]&lt;br /&gt;
!Width=300 |[[Archive Editor]]&lt;br /&gt;
!Width=300 |[[Archive (sac) File Text Format]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Related Links:&#039;&#039;&#039; [[Planning Example Project]], [[Tailings Dam Example Project]], [[Waste Handling with Batch Digestion Example Project]]&lt;br /&gt;
----&lt;br /&gt;
{{TOC|x=20%}} &lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;Archive Reporter&#039;&#039;&#039; is used with Dynamic projects to report data directly to a database, CSV or text file while a project is running. This has some similarities with the SysCAD [[Historian]], however the archiver has significantly greater functionality so the use of the historian for reporting is not recommended.&lt;br /&gt;
&lt;br /&gt;
The user specifies how many tables of data are required (maximum is 500), the frequency of reporting (each table may be reported at a user specified time) and the tags that are reported in each table.  These settings are recorded in a text file by the Archive Editor. The maximum number of Fields (including [[#Time_Fields|Time Fields]]) in a Table is 2000 (for DB-SQLITE .db3 format) and 3000 (for csv format).&lt;br /&gt;
&lt;br /&gt;
Please also note that this file is loaded (or reloaded) from the [[Project Settings]] Archive tab page, as shown in the sections below.&lt;br /&gt;
&lt;br /&gt;
== Archive Configuration ==&lt;br /&gt;
&lt;br /&gt;
To use the Archiver:&lt;br /&gt;
# Go to &#039;&#039;Edit - Project Settings&#039;&#039;&lt;br /&gt;
# The dialog box shown below will be displayed&lt;br /&gt;
# Go to the &#039;&#039;Archive&#039;&#039; page and tick the &#039;On&#039; box&lt;br /&gt;
# The SysCAD Archive Configuration (.sac) file will be created&lt;br /&gt;
# Click on the &#039;Edit&#039; button to edit the Archive.sac file&lt;br /&gt;
&lt;br /&gt;
[[Image:Project Settings-Archive.jpg]]&lt;br /&gt;
&lt;br /&gt;
The Settings are explained in the table below:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot; &lt;br /&gt;
|&#039;&#039;&#039;Setting / Tick Box&#039;&#039;&#039; || &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|  colspan=&amp;quot;2&amp;quot; font style=&amp;quot;background: #ebebeb&amp;quot;    | &lt;br /&gt;
=== Archive Reporter Configuration ===&lt;br /&gt;
|-&lt;br /&gt;
| On || The user must tick this box to enable the Archive Reporter.&lt;br /&gt;
|-&lt;br /&gt;
|| Name || This will be the name of the Archive Reporter file. The default name is Archive.sac and it is automatically created in the project folder when the user ticks the &#039;On&#039; box.  Users can choose to have a different file name but only one sac file can be used per project.&lt;br /&gt;
|-&lt;br /&gt;
| Browse ||  The user may browse for an alternative Archive file using this button.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Press the &#039;&#039;&#039;Edit&#039;&#039;&#039; button to launch the Archive Editor.&lt;br /&gt;
&lt;br /&gt;
Pressing the &#039;&#039;&#039;Reload&#039;&#039;&#039; button loads the Archive.sac file into SysCAD, which will check the file and display messages in the Messages window.&lt;br /&gt;
&lt;br /&gt;
== System Settings ==&lt;br /&gt;
&lt;br /&gt;
The Settings are explained in the table below:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot; &lt;br /&gt;
|&#039;&#039;&#039;Setting / Tick Box&#039;&#039;&#039; || &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|  colspan=&amp;quot;2&amp;quot; font style=&amp;quot;background: #ebebeb&amp;quot;    | &lt;br /&gt;
=== Time Fields ===&lt;br /&gt;
|-&lt;br /&gt;
| Date and Time ||  Every table will contain a column with the simulation time and date for the reported values.  The format for this column will be Date:Time&lt;br /&gt;
|-&lt;br /&gt;
| Date Only ||  Every table will contain a column with the simulation date for the reported values.&lt;br /&gt;
|-&lt;br /&gt;
| Time Only ||  Every table will contain a column with the simulation time for the reported values.&lt;br /&gt;
|-&lt;br /&gt;
| Elapsed as HMS ||  Every table will contain a column with the elapsed simulation time for the reported values.  The format for this column will be hh:mm:ss&lt;br /&gt;
|-&lt;br /&gt;
| Elapsed Time ||  Unless the user selects &#039;Off&#039;, every table will contain a column with the elapsed simulation time for the reported values.  The format for this column will be a single value, and will display the total elapsed time as seconds, minutes, hours or days, depending on the user selection.&lt;br /&gt;
|-&lt;br /&gt;
|  colspan=&amp;quot;2&amp;quot; font style=&amp;quot;background: #ebebeb&amp;quot;    |&lt;br /&gt;
&lt;br /&gt;
=== System Tables ===&lt;br /&gt;
|-&lt;br /&gt;
| Message Log ||  If the user ticks this box, all simulation messages will be written to a log file in the Archive folder.&lt;br /&gt;
|-&lt;br /&gt;
| Event Log ||  If the user ticks this box, all Events will be written to a log file in the Archive folder.&lt;br /&gt;
|-&lt;br /&gt;
|  colspan=&amp;quot;2&amp;quot; font style=&amp;quot;background: #ebebeb&amp;quot; | &#039;&#039;Standard Fields&#039;&#039;&amp;lt;br&amp;gt;These tick boxes determine what information is written to the Message Log file.&lt;br /&gt;
|-&lt;br /&gt;
| Source ||  The source of the message will be logged.&lt;br /&gt;
|-&lt;br /&gt;
| Tag    ||  The unit tag that is source of the message will be logged.&lt;br /&gt;
|-&lt;br /&gt;
| Command ||  All SysCAD commands will be logged, e.g. &#039;Stop&#039;, &#039;Run&#039;, etc.&lt;br /&gt;
|-&lt;br /&gt;
| Type ||  The type of message will be logged, i.e. Error, Warning, etc.&lt;br /&gt;
|-&lt;br /&gt;
| Message ||  Messages will be displayed.  If this is not ticked, then only Errors and Warnings will be logged.&lt;br /&gt;
|-&lt;br /&gt;
| ID No ||  The ID of the message will be logged.&lt;br /&gt;
|-&lt;br /&gt;
| Iteration ||  The Iteration of the message will be logged.&lt;br /&gt;
|-&lt;br /&gt;
| Call No ||  The Call number for the message will be logged.&lt;br /&gt;
|-&lt;br /&gt;
| Sequence No ||  The Sequence number of the message will be logged.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Reporting Options ==&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot; &lt;br /&gt;
||&#039;&#039;&#039;Field&#039;&#039;&#039; || &#039;&#039;&#039;Option&#039;&#039;&#039; || &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|colspan=2| On ||  If On = 1, the table will be created. If On = 0, the table will not be created.&lt;br /&gt;
|-&lt;br /&gt;
|colspan=2| Name || The name of the table (for DB formats) or name of the file for csv/txt file formats.&lt;br /&gt;
|-&lt;br /&gt;
| rowspan=&amp;quot;4&amp;quot; valign=&amp;quot;top&amp;quot; | Format ||   DB-SQLITE ||   Data will be saved in Archive.db3 SQ Lite database in the project folder  (Maximum fields per table is 2000)&lt;br /&gt;
|-&lt;br /&gt;
||   DB-MSACCESS ||   Data will be saved in Archive.mdb Microsoft Access database in the project folder&lt;br /&gt;
|-&lt;br /&gt;
||   CSV ||  Data will be saved in a CSV file (Maximum fields per table is 3000)&lt;br /&gt;
|-&lt;br /&gt;
||  TXT ||   Data will be saved in a Text (txt) file&lt;br /&gt;
|-&lt;br /&gt;
| rowspan=&amp;quot;2&amp;quot; valign=&amp;quot;top&amp;quot;  | Clear ||   Rewind ||   Clear archive file on next run. &lt;br /&gt;
|-&lt;br /&gt;
||   False ||   Add to existing archive file on next run. This can be overridden by other settings on the [[Solver Setting - Scenario]] page such as the RestartArchive option.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; Each table can only have one format but within the same archive file, different tables can have different formats&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== CSV and TXT File Options ===&lt;br /&gt;
&lt;br /&gt;
If the Format chosen is CSV or TXT, then the following options are relevant.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot; &lt;br /&gt;
||&#039;&#039;&#039;Field&#039;&#039;&#039; || &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|Path || The path and folder name for storing CSV &amp;amp; TXT files (usually with the Project)&lt;br /&gt;
|-&lt;br /&gt;
|SigDigits ||  The number of significant digits for the tags that are reported to CSV &amp;amp; TXT files.  Recommendation is 16.  Accepted range is 2-17.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Period and Offset ===&lt;br /&gt;
&lt;br /&gt;
The Period and Offset for reporting can be specified. This is not required if the user specifies a Trigger, but note that both Periods and Triggers can be used for the same table.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot; &lt;br /&gt;
||&#039;&#039;&#039;Field&#039;&#039;&#039; ||   &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|| Period ||   Time frequency for reporting fields, where time zero is at start.&amp;lt;br&amp;gt;&#039;&#039;&#039;Note 1:&#039;&#039;&#039; The period is relative to midnight, not the simulation start time.&amp;lt;br&amp;gt;&#039;&#039;&#039;Note 2:&#039;&#039;&#039; If the period is not divisible by 24 hours, the reporting will not be at the same time each day.&lt;br /&gt;
|-&lt;br /&gt;
|| Offset     ||   Time offset within the specified period. This affects when the first set of data is recorded.&amp;lt;br&amp;gt;&#039;&#039;&#039;Note:&#039;&#039;&#039; The offset is relative to midnight, not the simulation start time.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notes:&#039;&#039;&#039; &lt;br /&gt;
* Use Period for reporting at fixed time intervals, OR use Triggers for reporting at irregular time intervals (i.e. report specified fields based on trigger logic).&lt;br /&gt;
* If one or more Triggers are used, a period &amp;amp; offset is not relevant or required.&lt;br /&gt;
* If no triggers or period are specified then the table will not accumulate data.&lt;br /&gt;
* Note that period and offset are relative to midnight. If your start time is not on a reporting period relative to midnight AND you want to report relative to the start time, then you need to specify an offset to achieve this. For example, if you want to report every 24 hours and the start time is 8:00am, then the offset should be 8 hours.&lt;br /&gt;
&lt;br /&gt;
== Trigger Options ==&lt;br /&gt;
&lt;br /&gt;
The user may specify one or more Triggers that will cause the values in the table to be reported. There can be any number of triggers. If the conditions of any of the triggers are met, then the fields will be reported.&lt;br /&gt;
&lt;br /&gt;
The triggers are numbered and include three terms as described below, a description, a SysCAD tag and the Trigger Test.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot; &lt;br /&gt;
||&#039;&#039;&#039;Term&#039;&#039;&#039; ||   &#039;&#039;&#039;Option&#039;&#039;&#039; ||   &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|colspan=2|Description  ||   A description of the trigger&lt;br /&gt;
|-&lt;br /&gt;
|colspan=2|SysCADTag ||   Any valid SysCAD tag. May have conversions.&lt;br /&gt;
|-&lt;br /&gt;
| rowspan=&amp;quot;6&amp;quot; valign=&amp;quot;top&amp;quot;  | TriggerTest||   Rise = Value ||  The trigger will be true if the value has &#039;&#039;&#039;increased&#039;&#039;&#039; by more than the specified amount since the &#039;&#039;&#039;last recorded value&#039;&#039;&#039;. The last recorded value will either be the first value or the value when the trigger was last true.&lt;br /&gt;
|-&lt;br /&gt;
||   StepRise = Value ||  The trigger will be true if the value has &#039;&#039;&#039;increased&#039;&#039;&#039; by more than the specified amount since the &#039;&#039;&#039;last step&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
||   Fall = Value ||  The trigger will be true if the value has &#039;&#039;&#039;decreased&#039;&#039;&#039; by more than the specified amount since the &#039;&#039;&#039;last recorded value&#039;&#039;&#039;. The last recorded value will either be the first value or the value when the trigger was last true. &lt;br /&gt;
|-&lt;br /&gt;
||   StepFall = Value ||  The trigger will be true if the value has &#039;&#039;&#039;decreased&#039;&#039;&#039; by more than the specified amount since the &#039;&#039;&#039;last step&#039;&#039;&#039;.  &lt;br /&gt;
|-&lt;br /&gt;
||   Delta = Value ||  The trigger will be true if the value has &#039;&#039;&#039;changed&#039;&#039;&#039; by more than the specified amount since the &#039;&#039;&#039;last recorded value&#039;&#039;&#039;. The last recorded value will either be the first value or the value when the trigger was last true.  &lt;br /&gt;
|-&lt;br /&gt;
||   StepDelta = Value ||  The trigger will be true if the value has &#039;&#039;&#039;changed&#039;&#039;&#039; by more than the specified amount since the &#039;&#039;&#039;last step&#039;&#039;&#039;.  &lt;br /&gt;
|}&lt;br /&gt;
where = Value = Test value used to see where there are sudden changes.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notes:&#039;&#039;&#039; &lt;br /&gt;
* Use Period for reporting at fixed time intervals, OR use Triggers for reporting at irregular time intervals (i.e. report specified fields based on trigger logic).&lt;br /&gt;
* If one or more Triggers are used, a period &amp;amp; offset is not relevant or required.&lt;br /&gt;
* If no triggers or period are specified then the table will not accumulate data.&lt;br /&gt;
* The smallest period that can be used is 1s.  If the Dynamic timestep is less than 1s, and you want to record values at every iteration, a workaround is to use a Trigger on a tag which is changing every step, for example &#039;&#039;&#039; $Solver.Dyn.Scenario.Elapsed.Time (ms)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Field Options ==&lt;br /&gt;
&lt;br /&gt;
The user may specify one or more fields in the table to be reported.&lt;br /&gt;
&lt;br /&gt;
The fields are numbered and include five terms as described below, a field name, a SysCAD tag, a function, measure point and first point options.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot; &lt;br /&gt;
||&#039;&#039;&#039;Term&#039;&#039;&#039; ||   &#039;&#039;&#039;Option&#039;&#039;&#039; ||   &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|colspan=2|FieldName  ||   Report column or field name. Should not contain characters: &#039;.,[] &lt;br /&gt;
|-&lt;br /&gt;
|colspan=2|SysCADTag ||   Any valid SysCAD tag. May have conversions. &#039;&#039;&#039;If the tag is a string (eg TNK_001.Condition), use the String function below to ensure it is reported correctly.&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| rowspan=&amp;quot;19&amp;quot; valign=&amp;quot;top&amp;quot;  | Function||   Current/Cur ||   Returns the current value.&lt;br /&gt;
|-&lt;br /&gt;
||   CurrentDiff/CurDiff ||   Returns the difference between current value and the current value at the end of the previous reporting period.&lt;br /&gt;
|-&lt;br /&gt;
||   Minimum/Min ||   Returns the minimum value for the chosen period.&lt;br /&gt;
|-&lt;br /&gt;
||   Maximum/Max ||   Returns the maximum value for the chosen period.&lt;br /&gt;
|-&lt;br /&gt;
||   Average/Avg ||   Returns the average value for the chosen period.&lt;br /&gt;
|-&lt;br /&gt;
||   AverageTotal/AvgTtl ||   Returns the average value since the beginning of the run.&lt;br /&gt;
|-&lt;br /&gt;
||   Sum ||   Returns the total of the reported tag for the report period. &#039;&#039;&#039;Note:&#039;&#039;&#039; The SysCAD tag MUST be on a per second basis (e.g. P_1.Qm (t/s)).&lt;br /&gt;
|-&lt;br /&gt;
||   SumTotal/SumTtl ||   Returns the total of the reported tag since the beginning of the run. &#039;&#039;&#039;Note:&#039;&#039;&#039; The SysCAD tag MUST be on a per second basis (e.g. P_1.Qm (t/s)).&lt;br /&gt;
|-&lt;br /&gt;
||   ReportTime ||   Returns the number of seconds for the report period. This will be equal to the number of steps in the report period multiplied by the timestep. Any valid SysCAD tag can be specified.&lt;br /&gt;
|-&lt;br /&gt;
||   SimulationTime ||   Returns the number of seconds since the beginning of the run. This will be equal to the total number of steps since the beginning of the run multiplied by the timestep. Any valid SysCAD tag can be specified.&lt;br /&gt;
|-&lt;br /&gt;
||  Time(operator,value,[timeunit]) || Returns the amount of time in the report period that the reported tag meets the condition specified using operator and value. Valid operators are &amp;lt;, &amp;lt;=, ==, &amp;lt;&amp;gt;, &amp;gt;= and &amp;gt;. Value can be any number. Timeunit is optional (default is seconds), options are s, m, h or d.&lt;br /&gt;
|-&lt;br /&gt;
||  TimeTotal(operator,value,[timeunit])&amp;lt;br&amp;gt;/TimeTtl(operator,value,[timeunit]) || Returns the amount of time since the beginning of the run that the reported tag meets the condition specified using operator and value. Valid operators are &amp;lt;, &amp;lt;=, ==, &amp;lt;&amp;gt;, &amp;gt;= and &amp;gt;. Value can be any number. Timeunit is optional (default is seconds), options are s, m, h or d.&lt;br /&gt;
|-&lt;br /&gt;
||   TimeInRange(low operator,low value,high operator,high value,[timeunit]) || Returns the amount of time in the report period that the reported tag is &#039;&#039;&#039;within&#039;&#039;&#039; the range specified.  Valid low operators are &amp;gt; and &amp;gt;=. Valid high operators are &amp;lt; and &amp;lt;=. Low value and high value can be any numbers. Timeunit is optional (default is seconds), options are s, m, h or d.&lt;br /&gt;
|-&lt;br /&gt;
||   TimeInRangeTotal(low operator,low value,high operator,high value,[timeunit]) || Returns the amount of time since the beginning of the run that the reported tag is &#039;&#039;&#039;within&#039;&#039;&#039; the range specified.  Valid low operators are &amp;gt; and &amp;gt;=. Valid high operators are &amp;lt; and &amp;lt;=. Low value and high value can be any numbers. Timeunit is optional (default is seconds), options are s, m, h or d.&lt;br /&gt;
|-&lt;br /&gt;
||   TimeOutRange(low operator,low value,high operator,high value,[timeunit])|| Returns the amount of time in the report period that the reported tag is &#039;&#039;&#039;outside&#039;&#039;&#039; the range specified.  Valid low operators are &amp;lt; and &amp;lt;=. Valid high operators are &amp;gt; and &amp;gt;=. Low value and high value can be any numbers. Timeunit is optional (default is seconds), options are s, m, h or d.&lt;br /&gt;
|-&lt;br /&gt;
||   TimeOutRangeTotal(low operator,low value,high operator,high value,[timeunit])|| Returns the amount of time since the beginning of the run that the reported tag is &#039;&#039;&#039;outside&#039;&#039;&#039; the range specified.  Valid low operators are &amp;lt; and &amp;lt;=. Valid high operators are &amp;gt; and &amp;gt;=. Low value and high value can be any numbers. Timeunit is optional (default is seconds), options are s, m, h or d.&lt;br /&gt;
|-&lt;br /&gt;
||   Count/Cnt ||   Returns the number of recorded values for the report period. This will be equal to the number of steps in the report period. Any valid SysCAD tag can be specified.&lt;br /&gt;
|-&lt;br /&gt;
||   ChangeCount/ChgCnt ||   Returns the number of times the reported tag changed by more than 0.001 (in SI Units) during the report period.&lt;br /&gt;
|-&lt;br /&gt;
||   String/Str ||   Returns the current value of a string. &#039;&#039;&#039;Note:&#039;&#039;&#039; the SysCAD tag must be a string.&lt;br /&gt;
|-&lt;br /&gt;
| rowspan=&amp;quot;3&amp;quot; valign=&amp;quot;top&amp;quot;  | MeasurePt  ||   StartPt  ||   The value of the SysCAD tag at the beginning of a step.&lt;br /&gt;
|-&lt;br /&gt;
||  EndPt  ||   The value of the SysCAD tag at the end of a step. &lt;br /&gt;
|-&lt;br /&gt;
||  MidPt  ||   The value of the SysCAD tag halfway through the step.&lt;br /&gt;
|-&lt;br /&gt;
| rowspan=&amp;quot;2&amp;quot; valign=&amp;quot;top&amp;quot;  | FirstPoint ||   IgnoreFirst ||   Ignores the first value at the start of the run. i.e if the first value for the tank is 0 and it goes to 29 at the end of the first step, 29 will be recorded as the first value if the IgnoreFirst option is used. &lt;br /&gt;
|-&lt;br /&gt;
||  UseFirst ||   Use the first value at the start of the run.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Archive Options ==&lt;br /&gt;
&lt;br /&gt;
To see the Archive Options dialog box, go to &#039;&#039;Tools - Archive Options&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The Archive Options dialog box shows the tables that have been created and their frequency of data recording. The following dialog box is generated using the example described above.&lt;br /&gt;
&lt;br /&gt;
[[Image:Archive Options.png]]&lt;br /&gt;
[[Image:Archive Options2.png]]&lt;br /&gt;
&lt;br /&gt;
== Example Archive Enabled Projects ==&lt;br /&gt;
&lt;br /&gt;
A few example projects with Archive enabled are included with the standard install.  These include:&lt;br /&gt;
&lt;br /&gt;
*[[Planning Example Project]]&lt;br /&gt;
*[[Tailings Dam Example Project]]&lt;br /&gt;
*[[Waste Handling with Batch Digestion Example Project]]&lt;/div&gt;</summary>
		<author><name>Rod.Stephenson</name></author>
	</entry>
	<entry>
		<id>https://help.syscad.net/index.php?title=Archive_Reporter&amp;diff=84062</id>
		<title>Archive Reporter</title>
		<link rel="alternate" type="text/html" href="https://help.syscad.net/index.php?title=Archive_Reporter&amp;diff=84062"/>
		<updated>2026-04-27T14:55:33Z</updated>

		<summary type="html">&lt;p&gt;Rod.Stephenson: /* Trigger Options */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Reports]]&lt;br /&gt;
{{Navigation|[[User Guide]]|[[Reports]]}}&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Width=300 font style=&amp;quot;background: #ebebeb&amp;quot;|[[Archive Reporter]]&lt;br /&gt;
!Width=300 |[[Archive Editor]]&lt;br /&gt;
!Width=300 |[[Archive (sac) File Text Format]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Related Links:&#039;&#039;&#039; [[Planning Example Project]], [[Tailings Dam Example Project]], [[Waste Handling with Batch Digestion Example Project]]&lt;br /&gt;
----&lt;br /&gt;
{{TOC|x=20%}} &lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;Archive Reporter&#039;&#039;&#039; is used with Dynamic projects to report data directly to a database, CSV or text file while a project is running. This has some similarities with the SysCAD [[Historian]], however the archiver has significantly greater functionality so the use of the historian for reporting is not recommended.&lt;br /&gt;
&lt;br /&gt;
The user specifies how many tables of data are required (maximum is 500), the frequency of reporting (each table may be reported at a user specified time) and the tags that are reported in each table.  These settings are recorded in a text file by the Archive Editor. The maximum number of Fields (including [[#Time_Fields|Time Fields]]) in a Table is 2000 (for DB-SQLITE .db3 format) and 3000 (for csv format).&lt;br /&gt;
&lt;br /&gt;
Please also note that this file is loaded (or reloaded) from the [[Project Settings]] Archive tab page, as shown in the sections below.&lt;br /&gt;
&lt;br /&gt;
== Archive Configuration ==&lt;br /&gt;
&lt;br /&gt;
To use the Archiver:&lt;br /&gt;
# Go to &#039;&#039;Edit - Project Settings&#039;&#039;&lt;br /&gt;
# The dialog box shown below will be displayed&lt;br /&gt;
# Go to the &#039;&#039;Archive&#039;&#039; page and tick the &#039;On&#039; box&lt;br /&gt;
# The SysCAD Archive Configuration (.sac) file will be created&lt;br /&gt;
# Click on the &#039;Edit&#039; button to edit the Archive.sac file&lt;br /&gt;
&lt;br /&gt;
[[Image:Project Settings-Archive.jpg]]&lt;br /&gt;
&lt;br /&gt;
The Settings are explained in the table below:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot; &lt;br /&gt;
|&#039;&#039;&#039;Setting / Tick Box&#039;&#039;&#039; || &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|  colspan=&amp;quot;2&amp;quot; font style=&amp;quot;background: #ebebeb&amp;quot;    | &lt;br /&gt;
=== Archive Reporter Configuration ===&lt;br /&gt;
|-&lt;br /&gt;
| On || The user must tick this box to enable the Archive Reporter.&lt;br /&gt;
|-&lt;br /&gt;
|| Name || This will be the name of the Archive Reporter file. The default name is Archive.sac and it is automatically created in the project folder when the user ticks the &#039;On&#039; box.  Users can choose to have a different file name but only one sac file can be used per project.&lt;br /&gt;
|-&lt;br /&gt;
| Browse ||  The user may browse for an alternative Archive file using this button.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Press the &#039;&#039;&#039;Edit&#039;&#039;&#039; button to launch the Archive Editor.&lt;br /&gt;
&lt;br /&gt;
Pressing the &#039;&#039;&#039;Reload&#039;&#039;&#039; button loads the Archive.sac file into SysCAD, which will check the file and display messages in the Messages window.&lt;br /&gt;
&lt;br /&gt;
== System Settings ==&lt;br /&gt;
&lt;br /&gt;
The Settings are explained in the table below:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot; &lt;br /&gt;
|&#039;&#039;&#039;Setting / Tick Box&#039;&#039;&#039; || &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|  colspan=&amp;quot;2&amp;quot; font style=&amp;quot;background: #ebebeb&amp;quot;    | &lt;br /&gt;
=== Time Fields ===&lt;br /&gt;
|-&lt;br /&gt;
| Date and Time ||  Every table will contain a column with the simulation time and date for the reported values.  The format for this column will be Date:Time&lt;br /&gt;
|-&lt;br /&gt;
| Date Only ||  Every table will contain a column with the simulation date for the reported values.&lt;br /&gt;
|-&lt;br /&gt;
| Time Only ||  Every table will contain a column with the simulation time for the reported values.&lt;br /&gt;
|-&lt;br /&gt;
| Elapsed as HMS ||  Every table will contain a column with the elapsed simulation time for the reported values.  The format for this column will be hh:mm:ss&lt;br /&gt;
|-&lt;br /&gt;
| Elapsed Time ||  Unless the user selects &#039;Off&#039;, every table will contain a column with the elapsed simulation time for the reported values.  The format for this column will be a single value, and will display the total elapsed time as seconds, minutes, hours or days, depending on the user selection.&lt;br /&gt;
|-&lt;br /&gt;
|  colspan=&amp;quot;2&amp;quot; font style=&amp;quot;background: #ebebeb&amp;quot;    |&lt;br /&gt;
&lt;br /&gt;
=== System Tables ===&lt;br /&gt;
|-&lt;br /&gt;
| Message Log ||  If the user ticks this box, all simulation messages will be written to a log file in the Archive folder.&lt;br /&gt;
|-&lt;br /&gt;
| Event Log ||  If the user ticks this box, all Events will be written to a log file in the Archive folder.&lt;br /&gt;
|-&lt;br /&gt;
|  colspan=&amp;quot;2&amp;quot; font style=&amp;quot;background: #ebebeb&amp;quot; | &#039;&#039;Standard Fields&#039;&#039;&amp;lt;br&amp;gt;These tick boxes determine what information is written to the Message Log file.&lt;br /&gt;
|-&lt;br /&gt;
| Source ||  The source of the message will be logged.&lt;br /&gt;
|-&lt;br /&gt;
| Tag    ||  The unit tag that is source of the message will be logged.&lt;br /&gt;
|-&lt;br /&gt;
| Command ||  All SysCAD commands will be logged, e.g. &#039;Stop&#039;, &#039;Run&#039;, etc.&lt;br /&gt;
|-&lt;br /&gt;
| Type ||  The type of message will be logged, i.e. Error, Warning, etc.&lt;br /&gt;
|-&lt;br /&gt;
| Message ||  Messages will be displayed.  If this is not ticked, then only Errors and Warnings will be logged.&lt;br /&gt;
|-&lt;br /&gt;
| ID No ||  The ID of the message will be logged.&lt;br /&gt;
|-&lt;br /&gt;
| Iteration ||  The Iteration of the message will be logged.&lt;br /&gt;
|-&lt;br /&gt;
| Call No ||  The Call number for the message will be logged.&lt;br /&gt;
|-&lt;br /&gt;
| Sequence No ||  The Sequence number of the message will be logged.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Reporting Options ==&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot; &lt;br /&gt;
||&#039;&#039;&#039;Field&#039;&#039;&#039; || &#039;&#039;&#039;Option&#039;&#039;&#039; || &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|colspan=2| On ||  If On = 1, the table will be created. If On = 0, the table will not be created.&lt;br /&gt;
|-&lt;br /&gt;
|colspan=2| Name || The name of the table (for DB formats) or name of the file for csv/txt file formats.&lt;br /&gt;
|-&lt;br /&gt;
| rowspan=&amp;quot;4&amp;quot; valign=&amp;quot;top&amp;quot; | Format ||   DB-SQLITE ||   Data will be saved in Archive.db3 SQ Lite database in the project folder  (Maximum fields per table is 2000)&lt;br /&gt;
|-&lt;br /&gt;
||   DB-MSACCESS ||   Data will be saved in Archive.mdb Microsoft Access database in the project folder&lt;br /&gt;
|-&lt;br /&gt;
||   CSV ||  Data will be saved in a CSV file (Maximum fields per table is 3000)&lt;br /&gt;
|-&lt;br /&gt;
||  TXT ||   Data will be saved in a Text (txt) file&lt;br /&gt;
|-&lt;br /&gt;
| rowspan=&amp;quot;2&amp;quot; valign=&amp;quot;top&amp;quot;  | Clear ||   Rewind ||   Clear archive file on next run. &lt;br /&gt;
|-&lt;br /&gt;
||   False ||   Add to existing archive file on next run. This can be overridden by other settings on the [[Solver Setting - Scenario]] page such as the RestartArchive option.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; Each table can only have one format but within the same archive file, different tables can have different formats&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== CSV and TXT File Options ===&lt;br /&gt;
&lt;br /&gt;
If the Format chosen is CSV or TXT, then the following options are relevant.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot; &lt;br /&gt;
||&#039;&#039;&#039;Field&#039;&#039;&#039; || &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|Path || The path and folder name for storing CSV &amp;amp; TXT files (usually with the Project)&lt;br /&gt;
|-&lt;br /&gt;
|SigDigits ||  The number of significant digits for the tags that are reported to CSV &amp;amp; TXT files.  Recommendation is 16.  Accepted range is 2-17.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Period and Offset ===&lt;br /&gt;
&lt;br /&gt;
The Period and Offset for reporting can be specified. This is not required if the user specifies a Trigger, but note that both Periods and Triggers can be used for the same table.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot; &lt;br /&gt;
||&#039;&#039;&#039;Field&#039;&#039;&#039; ||   &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|| Period ||   Time frequency for reporting fields, where time zero is at start.&amp;lt;br&amp;gt;&#039;&#039;&#039;Note 1:&#039;&#039;&#039; The period is relative to midnight, not the simulation start time.&amp;lt;br&amp;gt;&#039;&#039;&#039;Note 2:&#039;&#039;&#039; If the period is not divisible by 24 hours, the reporting will not be at the same time each day.&lt;br /&gt;
|-&lt;br /&gt;
|| Offset     ||   Time offset within the specified period. This affects when the first set of data is recorded.&amp;lt;br&amp;gt;&#039;&#039;&#039;Note:&#039;&#039;&#039; The offset is relative to midnight, not the simulation start time.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notes:&#039;&#039;&#039; &lt;br /&gt;
* Use Period for reporting at fixed time intervals, OR use Triggers for reporting at irregular time intervals (i.e. report specified fields based on trigger logic).&lt;br /&gt;
* If one or more Triggers are used, a period &amp;amp; offset is not relevant or required.&lt;br /&gt;
* If no triggers or period are specified then the table will not accumulate data.&lt;br /&gt;
* Note that period and offset are relative to midnight. If your start time is not on a reporting period relative to midnight AND you want to report relative to the start time, then you need to specify an offset to achieve this. For example, if you want to report every 24 hours and the start time is 8:00am, then the offset should be 8 hours.&lt;br /&gt;
&lt;br /&gt;
== Trigger Options ==&lt;br /&gt;
&lt;br /&gt;
The user may specify one or more Triggers that will cause the values in the table to be reported. There can be any number of triggers. If the conditions of any of the triggers are met, then the fields will be reported.&lt;br /&gt;
&lt;br /&gt;
The triggers are numbered and include three terms as described below, a description, a SysCAD tag and the Trigger Test.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot; &lt;br /&gt;
||&#039;&#039;&#039;Term&#039;&#039;&#039; ||   &#039;&#039;&#039;Option&#039;&#039;&#039; ||   &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|colspan=2|Description  ||   A description of the trigger&lt;br /&gt;
|-&lt;br /&gt;
|colspan=2|SysCADTag ||   Any valid SysCAD tag. May have conversions.&lt;br /&gt;
|-&lt;br /&gt;
| rowspan=&amp;quot;6&amp;quot; valign=&amp;quot;top&amp;quot;  | TriggerTest||   Rise = Value ||  The trigger will be true if the value has &#039;&#039;&#039;increased&#039;&#039;&#039; by more than the specified amount since the &#039;&#039;&#039;last recorded value&#039;&#039;&#039;. The last recorded value will either be the first value or the value when the trigger was last true.&lt;br /&gt;
|-&lt;br /&gt;
||   StepRise = Value ||  The trigger will be true if the value has &#039;&#039;&#039;increased&#039;&#039;&#039; by more than the specified amount since the &#039;&#039;&#039;last step&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
||   Fall = Value ||  The trigger will be true if the value has &#039;&#039;&#039;decreased&#039;&#039;&#039; by more than the specified amount since the &#039;&#039;&#039;last recorded value&#039;&#039;&#039;. The last recorded value will either be the first value or the value when the trigger was last true. &lt;br /&gt;
|-&lt;br /&gt;
||   StepFall = Value ||  The trigger will be true if the value has &#039;&#039;&#039;decreased&#039;&#039;&#039; by more than the specified amount since the &#039;&#039;&#039;last step&#039;&#039;&#039;.  &lt;br /&gt;
|-&lt;br /&gt;
||   Delta = Value ||  The trigger will be true if the value has &#039;&#039;&#039;changed&#039;&#039;&#039; by more than the specified amount since the &#039;&#039;&#039;last recorded value&#039;&#039;&#039;. The last recorded value will either be the first value or the value when the trigger was last true.  &lt;br /&gt;
|-&lt;br /&gt;
||   StepDelta = Value ||  The trigger will be true if the value has &#039;&#039;&#039;changed&#039;&#039;&#039; by more than the specified amount since the &#039;&#039;&#039;last step&#039;&#039;&#039;.  &lt;br /&gt;
|}&lt;br /&gt;
where = Value = Test value used to see where there are sudden changes.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notes:&#039;&#039;&#039; &lt;br /&gt;
* Use Period for reporting at fixed time intervals, OR use Triggers for reporting at irregular time intervals (i.e. report specified fields based on trigger logic).&lt;br /&gt;
* If one or more Triggers are used, a period &amp;amp; offset is not relevant or required.&lt;br /&gt;
* If no triggers or period are specified then the table will not accumulate data.&lt;br /&gt;
* The smallest period that can be used is 1s.  If the Dynamic timestep is less than 1s, a workaround is to use a Trigger on a tag which is changing every step, for example &#039;&#039;&#039; $Solver.Dyn.Scenario.Elapsed.Time (ms)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Field Options ==&lt;br /&gt;
&lt;br /&gt;
The user may specify one or more fields in the table to be reported.&lt;br /&gt;
&lt;br /&gt;
The fields are numbered and include five terms as described below, a field name, a SysCAD tag, a function, measure point and first point options.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot; &lt;br /&gt;
||&#039;&#039;&#039;Term&#039;&#039;&#039; ||   &#039;&#039;&#039;Option&#039;&#039;&#039; ||   &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|colspan=2|FieldName  ||   Report column or field name. Should not contain characters: &#039;.,[] &lt;br /&gt;
|-&lt;br /&gt;
|colspan=2|SysCADTag ||   Any valid SysCAD tag. May have conversions. &#039;&#039;&#039;If the tag is a string (eg TNK_001.Condition), use the String function below to ensure it is reported correctly.&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| rowspan=&amp;quot;19&amp;quot; valign=&amp;quot;top&amp;quot;  | Function||   Current/Cur ||   Returns the current value.&lt;br /&gt;
|-&lt;br /&gt;
||   CurrentDiff/CurDiff ||   Returns the difference between current value and the current value at the end of the previous reporting period.&lt;br /&gt;
|-&lt;br /&gt;
||   Minimum/Min ||   Returns the minimum value for the chosen period.&lt;br /&gt;
|-&lt;br /&gt;
||   Maximum/Max ||   Returns the maximum value for the chosen period.&lt;br /&gt;
|-&lt;br /&gt;
||   Average/Avg ||   Returns the average value for the chosen period.&lt;br /&gt;
|-&lt;br /&gt;
||   AverageTotal/AvgTtl ||   Returns the average value since the beginning of the run.&lt;br /&gt;
|-&lt;br /&gt;
||   Sum ||   Returns the total of the reported tag for the report period. &#039;&#039;&#039;Note:&#039;&#039;&#039; The SysCAD tag MUST be on a per second basis (e.g. P_1.Qm (t/s)).&lt;br /&gt;
|-&lt;br /&gt;
||   SumTotal/SumTtl ||   Returns the total of the reported tag since the beginning of the run. &#039;&#039;&#039;Note:&#039;&#039;&#039; The SysCAD tag MUST be on a per second basis (e.g. P_1.Qm (t/s)).&lt;br /&gt;
|-&lt;br /&gt;
||   ReportTime ||   Returns the number of seconds for the report period. This will be equal to the number of steps in the report period multiplied by the timestep. Any valid SysCAD tag can be specified.&lt;br /&gt;
|-&lt;br /&gt;
||   SimulationTime ||   Returns the number of seconds since the beginning of the run. This will be equal to the total number of steps since the beginning of the run multiplied by the timestep. Any valid SysCAD tag can be specified.&lt;br /&gt;
|-&lt;br /&gt;
||  Time(operator,value,[timeunit]) || Returns the amount of time in the report period that the reported tag meets the condition specified using operator and value. Valid operators are &amp;lt;, &amp;lt;=, ==, &amp;lt;&amp;gt;, &amp;gt;= and &amp;gt;. Value can be any number. Timeunit is optional (default is seconds), options are s, m, h or d.&lt;br /&gt;
|-&lt;br /&gt;
||  TimeTotal(operator,value,[timeunit])&amp;lt;br&amp;gt;/TimeTtl(operator,value,[timeunit]) || Returns the amount of time since the beginning of the run that the reported tag meets the condition specified using operator and value. Valid operators are &amp;lt;, &amp;lt;=, ==, &amp;lt;&amp;gt;, &amp;gt;= and &amp;gt;. Value can be any number. Timeunit is optional (default is seconds), options are s, m, h or d.&lt;br /&gt;
|-&lt;br /&gt;
||   TimeInRange(low operator,low value,high operator,high value,[timeunit]) || Returns the amount of time in the report period that the reported tag is &#039;&#039;&#039;within&#039;&#039;&#039; the range specified.  Valid low operators are &amp;gt; and &amp;gt;=. Valid high operators are &amp;lt; and &amp;lt;=. Low value and high value can be any numbers. Timeunit is optional (default is seconds), options are s, m, h or d.&lt;br /&gt;
|-&lt;br /&gt;
||   TimeInRangeTotal(low operator,low value,high operator,high value,[timeunit]) || Returns the amount of time since the beginning of the run that the reported tag is &#039;&#039;&#039;within&#039;&#039;&#039; the range specified.  Valid low operators are &amp;gt; and &amp;gt;=. Valid high operators are &amp;lt; and &amp;lt;=. Low value and high value can be any numbers. Timeunit is optional (default is seconds), options are s, m, h or d.&lt;br /&gt;
|-&lt;br /&gt;
||   TimeOutRange(low operator,low value,high operator,high value,[timeunit])|| Returns the amount of time in the report period that the reported tag is &#039;&#039;&#039;outside&#039;&#039;&#039; the range specified.  Valid low operators are &amp;lt; and &amp;lt;=. Valid high operators are &amp;gt; and &amp;gt;=. Low value and high value can be any numbers. Timeunit is optional (default is seconds), options are s, m, h or d.&lt;br /&gt;
|-&lt;br /&gt;
||   TimeOutRangeTotal(low operator,low value,high operator,high value,[timeunit])|| Returns the amount of time since the beginning of the run that the reported tag is &#039;&#039;&#039;outside&#039;&#039;&#039; the range specified.  Valid low operators are &amp;lt; and &amp;lt;=. Valid high operators are &amp;gt; and &amp;gt;=. Low value and high value can be any numbers. Timeunit is optional (default is seconds), options are s, m, h or d.&lt;br /&gt;
|-&lt;br /&gt;
||   Count/Cnt ||   Returns the number of recorded values for the report period. This will be equal to the number of steps in the report period. Any valid SysCAD tag can be specified.&lt;br /&gt;
|-&lt;br /&gt;
||   ChangeCount/ChgCnt ||   Returns the number of times the reported tag changed by more than 0.001 (in SI Units) during the report period.&lt;br /&gt;
|-&lt;br /&gt;
||   String/Str ||   Returns the current value of a string. &#039;&#039;&#039;Note:&#039;&#039;&#039; the SysCAD tag must be a string.&lt;br /&gt;
|-&lt;br /&gt;
| rowspan=&amp;quot;3&amp;quot; valign=&amp;quot;top&amp;quot;  | MeasurePt  ||   StartPt  ||   The value of the SysCAD tag at the beginning of a step.&lt;br /&gt;
|-&lt;br /&gt;
||  EndPt  ||   The value of the SysCAD tag at the end of a step. &lt;br /&gt;
|-&lt;br /&gt;
||  MidPt  ||   The value of the SysCAD tag halfway through the step.&lt;br /&gt;
|-&lt;br /&gt;
| rowspan=&amp;quot;2&amp;quot; valign=&amp;quot;top&amp;quot;  | FirstPoint ||   IgnoreFirst ||   Ignores the first value at the start of the run. i.e if the first value for the tank is 0 and it goes to 29 at the end of the first step, 29 will be recorded as the first value if the IgnoreFirst option is used. &lt;br /&gt;
|-&lt;br /&gt;
||  UseFirst ||   Use the first value at the start of the run.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Archive Options ==&lt;br /&gt;
&lt;br /&gt;
To see the Archive Options dialog box, go to &#039;&#039;Tools - Archive Options&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The Archive Options dialog box shows the tables that have been created and their frequency of data recording. The following dialog box is generated using the example described above.&lt;br /&gt;
&lt;br /&gt;
[[Image:Archive Options.png]]&lt;br /&gt;
[[Image:Archive Options2.png]]&lt;br /&gt;
&lt;br /&gt;
== Example Archive Enabled Projects ==&lt;br /&gt;
&lt;br /&gt;
A few example projects with Archive enabled are included with the standard install.  These include:&lt;br /&gt;
&lt;br /&gt;
*[[Planning Example Project]]&lt;br /&gt;
*[[Tailings Dam Example Project]]&lt;br /&gt;
*[[Waste Handling with Batch Digestion Example Project]]&lt;/div&gt;</summary>
		<author><name>Rod.Stephenson</name></author>
	</entry>
	<entry>
		<id>https://help.syscad.net/index.php?title=File:Ctrlvol.png&amp;diff=84059</id>
		<title>File:Ctrlvol.png</title>
		<link rel="alternate" type="text/html" href="https://help.syscad.net/index.php?title=File:Ctrlvol.png&amp;diff=84059"/>
		<updated>2026-04-27T12:23:53Z</updated>

		<summary type="html">&lt;p&gt;Rod.Stephenson: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Rod.Stephenson</name></author>
	</entry>
</feed>