對於一個監測設施之監測數據 (Monitoring Data),有許多計算處理規範 (Computing Regulations) 需要遵守,像是粒狀污染物、氣狀污染物、稀釋氣體、排放流率中,其量測頻率、紀錄值計算、全幅設定、無效或遺失數據之認定、無效或遺失數據時數之認定、紀錄值替代計算之處理及系統偏移之校正計算,在各領域中都各有其固定標準,所以需要作設計通用化,才能成就軟體循環經濟。
[TestMethod]
public void TestSamplingFrequency()
{
// Arrange
CAMS_ParticulateMatters CAMS_PM = new CAMS_ParticulateMatters();
XDocument doc = XDocument.Load("CAMS_SamplingItemList.xml");
var query =
from c in doc.Descendants("CAMS_SamplingItem")
where (string)c.Attribute("CAMS") == "CAMS_ParticulateMatters"
select c;
foreach (XElement e in query)
{
SamplingItemBase item = SamplingItemFactory.CreateSamplingItem(
(string)e.Attribute("SamplingItem"));
item.SamplingFreqBySeconds = (int)e.Attribute("SamplingFrequency");
CAMS_PM.SamplingItemList.Add(item);
}
// Act
foreach (SamplingItem.SamplingItemBase item in CAMS_PM.SamplingItemList)
{
var stopwatch = System.Diagnostics.Stopwatch.StartNew();
item.Sampling();
item.Analyzing();
item.Recording();
stopwatch.Stop();
Assert.IsTrue(
stopwatch.Elapsed.TotalSeconds < item.SamplingFreqBySeconds,
"The actualCount was not less than the spec.");
}
}