Emc.SewPlus.Nems.Models
1.12.0
dotnet add package Emc.SewPlus.Nems.Models --version 1.12.0
NuGet\Install-Package Emc.SewPlus.Nems.Models -Version 1.12.0
<PackageReference Include="Emc.SewPlus.Nems.Models" Version="1.12.0" />
<PackageVersion Include="Emc.SewPlus.Nems.Models" Version="1.12.0" />
<PackageReference Include="Emc.SewPlus.Nems.Models" />
paket add Emc.SewPlus.Nems.Models --version 1.12.0
#r "nuget: Emc.SewPlus.Nems.Models, 1.12.0"
#:package Emc.SewPlus.Nems.Models@1.12.0
#addin nuget:?package=Emc.SewPlus.Nems.Models&version=1.12.0
#tool nuget:?package=Emc.SewPlus.Nems.Models&version=1.12.0
EMC NEMS Data Services Model Definitions
Model definitions for data services provided by the National Electricity Market of Singapore (NEMS) system of the Energy Market Company (EMC) of Singapore.
Definitions are based on the Data Services Specification for NEMS System document.
📦 Installation
Install the package via the NuGet Package Manager Console, the Nuget Package Manager UI, the .NET CLI or by adding a package reference.
.NET CLI
dotnet add package Emc.SewPlus.Nems.Models.x.x.x.nupkg
Package Manager
Install-Package Emc.SewPlus.Nems.Models.x.x.x.nupkg
🛠️ Usage
All classes representing data elements in the EMC Data Services are marked as Serializable, thereby allowing themselves to participate in XML serialisation and deserialisation.
Deserialising XML Data Received From an EMC Web Service
Suppose the following real time price data is returned (as a XML string) and saved in a file RTP.xml:
<?xml version="1.0" encoding="UTF-8"?>
<list>
<RealTimePrice>
<period>25</period>
<reportType>REP</reportType>
<tradingDate>31-Jul-2022</tradingDate>
<demand>6101.455</demand>
<tcl>0.000</tcl>
<USEP>183.08</USEP>
<lcp>0.00</lcp>
<regulation>28.15</regulation>
<primaryReserve>1</primaryReserve>
<secondaryReserve/>
<contingencyReserve>20.16</contingencyReserve>
<eheur>-0.76</eheur>
<solar>22.540</solar>
<RUSEP>659.52</RUSEP>
<MAP>236.65</MAP>
<MAPT>591.75.00</MAPT>
<tpcApplied>N</tpcApplied>
<referenceRegulation>22.22</referenceRegulation>
<referencePrimaryReserve>69.69</referencePrimaryReserve>
<referenceContingencyReserve>50.44</referenceContingencyReserve>
</RealTimePrice>
<RealTimePrice>
<period>26</period>
<reportType>REP</reportType>
<tradingDate>31-Jul-2022</tradingDate>
<demand>6069.125</demand>
<tcl>0.000</tcl>
<USEP>160.15</USEP>
<lcp>0.00</lcp>
<regulation>10</regulation>
<primaryReserve>.14</primaryReserve>
<secondaryReserve/>
<contingencyReserve>2</contingencyReserve>
<eheur>-0.66</eheur>
<solar>22.540</solar>
<RUSEP>659.52</RUSEP>
<MAP>236.65</MAP>
<MAPT>591.75.00</MAPT>
<tpcApplied>N</tpcApplied>
<referenceRegulation>22.22</referenceRegulation>
<referencePrimaryReserve>69.69</referencePrimaryReserve>
<referenceContingencyReserve>50.44</referenceContingencyReserve>
</RealTimePrice>
</list>
To deserialise the XML data into a RealTimePrice object:
using Emc.SewPlus.Nems.Models.Reports.Cwr;
using System.Xml;
using System.Xml.Serialization;
public List<RealTimePrice> DeserializeRealTimePriceXml(string xmlFile)
{
XmlSerializer serializer = new XmlSerializer(typeof(List<RealTimePrice>), new XmlRootAttribute("list"));
using (FileStream fileStream = new FileStream(xmlFile, FileMode.Open, FileAccess.Read))
{
using (XmlReader xmlReader = XmlReader.Create(fileStream))
{
var results = serializer.Deserialize(xmlReader) as List<RealTimePrice>;
return results;
}
}
}
To deserialise the same data into the same object using the child elements:
using Emc.SewPlus.Nems.Models.Reports.Cwr;
using System.Linq;
using System.Xml.Linq;
public List<RealTimePrice> DeserializeRealTimePriceXml(string xmlFile)
{
XDocument doc = XDocument.Load(xmlFile);
var results = doc.Element("list").Elements("RealTimePrice")
.Select(n => new RealTimePrice()
{
Period = byte.Parse(n.Element("period").Value),
ReportType = n.Element("reportType").Value,
TradingDateString = n.Element("tradingDate").Value,
Demand = decimal.Parse(n.Element("demand").Value),
TotalCurtailedLoad = decimal.Parse(n.Element("tcl").Value),
Usep = decimal.Parse(n.Element("USEP").Value),
LoadCurtailmentPrice = decimal.Parse(n.Element("lcp").Value),
RegulationPrice = decimal.Parse(n.Element("regulation").Value),
PrimaryReservePrice = decimal.Parse(n.Element("primaryReserve").Value),
// property is nullable (defined as nillable in XSD)
SecondaryReservePrice = (n.Element("secondaryReserve").Value == null)? null : n.Element("secondaryReserve").Value,
ContingencyReservePrice = n.Element("contingencyReserve").Value,
Eheur = decimal.Parse(n.Element("eheur").Value),
SolarGenerationForecast = decimal.Parse(n.Element("solar").Value),
ReferenceUniformSingaporeEnergyPrice = decimal.Parse(n.Element("RUSEP").Value),
MovingAveragePrice = decimal.Parse(n.Element("MAP").Value),
MovingAveragePriceThreshold = decimal.Parse(n.Element("MAPT").Value),
TpcApplied = n.Element("tpcApplied").Value.Equals("Y") ? YesNoResponse.Yes
: (n.Element("tpcApplied").Value.Equals("N") ? YesNoResponse.No : YesNoResponse.NotDefined),
ReferenceRegulation = decimal.Parse(n.Element("referenceRegulation").Value),
ReferencePrimaryReserve = decimal.Parse(n.Element("referencePrimaryReserve").Value),
ReferenceContingencyReserve = decimal.Parse(n.Element("referenceContingencyReserve").Value)
}).ToList();
return results;
}
EMC Download Reports Category Classes
This package also offers a set of classes under the Emc.SewPlus.Nems.Models.Reports namespace that simplifies the deserialisation of XML data without having to specify the exact report class. Their names end with Reports:
Emc.SewPlus.Nems.Models.Reports.Cwr.CorporateWebsiteReportsrepresenting the set of Corporate Website Reports.Emc.SewPlus.Nems.Models.Reports.Mcr.MarketClearingRunReportsrepresenting the set of Market Clearing Run Reports.Emc.SewPlus.Nems.Models.Reports.Stl.SettlementReportsrepresenting the set of Settlement Reports.Emc.SewPlus.Nems.Models.Reports.Tsr.TradeSummaryReportsrepresenting the set of Trade Summary Reports.Emc.SewPlus.Nems.Models.Reports.Opr.OtherPublishedReportsrepresenting the set of Other Published Reports.
Using the same file RTP.xml, its contents can be deserialised using the CorporateWebsiteReports class since the corresponding Real Time Price report comes under the set of Corporate Website reports:
using Emc.SewPlus.Nems.Models.Reports.Cwr;
using System.Xml;
using System.Xml.Serialization;
public List<RealTimePrice> DeserializeRealTimePriceXml(string xmlFile)
{
// use the CorporateWebsiteReports class to deserialise the XML data instead of the RealTimePrice class
XmlSerializer serializer = new XmlSerializer(typeof(CorporateWebsiteReports));
using (FileStream fileStream = new FileStream(xmlFile, FileMode.Open, FileAccess.Read))
{
using (XmlReader xmlReader = XmlReader.Create(fileStream))
{
var results = serializer.Deserialize(xmlReader) as CorporateWebsiteReports;
return results.Items.Cast<Emc.SewPlus.Nems.Models.Reports.Cwr.RealTimePrice>().ToList();
}
}
}
Serialising XML Data for an EMC Web Service
To serialise an object of a class e.g. BidSubmission into XML to submit to EMC web services:
using Emc.SewPlus.Nems.Models.Submissions.Bids;
using System.Xml;
using System.Xml.Serialization;
public string SerializeBidSubmissionToXml(BidSubmission bidSubmission)
{
XmlSerializer serializer = new XmlSerializer(typeof(BidSubmission));
using (StringWriter writer = new StringWriter())
{
serializer.Serialize(writer, bidSubmission);
return writer.ToString();
}
}
🚀 Target Frameworks
- .NET: Core 3.0, Core 3.1, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0
- .NET Framework: 4.0, 4.5, 4.5.2, 4.6.1, 4.6.2, 4.7.2, 4.8, 4.8.1
- .NET Standard: 2.0, 2.1
👨💻 Author and Contact
- Maintainer: Jonathan Bong
- E-mail: jonbong1607@hotmail.com
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 is compatible. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 is compatible. netcoreapp3.1 is compatible. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
| .NET Framework | net40 is compatible. net403 was computed. net45 is compatible. net451 was computed. net452 is compatible. net46 was computed. net461 is compatible. net462 is compatible. net463 was computed. net47 was computed. net471 was computed. net472 is compatible. net48 is compatible. net481 is compatible. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETCoreApp 3.0
- No dependencies.
-
.NETCoreApp 3.1
- No dependencies.
-
.NETFramework 4.0
- No dependencies.
-
.NETFramework 4.5
- No dependencies.
-
.NETFramework 4.5.2
- No dependencies.
-
.NETFramework 4.6.1
- No dependencies.
-
.NETFramework 4.6.2
- No dependencies.
-
.NETFramework 4.7.2
- No dependencies.
-
.NETFramework 4.8
- No dependencies.
-
.NETFramework 4.8.1
- No dependencies.
-
.NETStandard 2.0
- No dependencies.
-
.NETStandard 2.1
- No dependencies.
-
net10.0
- No dependencies.
-
net5.0
- No dependencies.
-
net6.0
- No dependencies.
-
net7.0
- No dependencies.
-
net8.0
- No dependencies.
-
net9.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Changes in v1.12.0 (2026-09-02):
- [Added] "RiskExposureReport" class under the "Emc.SewPlus.Nems.Models.Reports.Opr" namespace.