Last active
October 29, 2023 07:12
-
-
Save 1CM69/fe92fed32b2143d5acfa64b6a648b1e5 to your computer and use it in GitHub Desktop.
Get the Current Gas Calorific Value for any LDZ in the UK, based on: https://gist.github.com/lwsrbrts/d96092b65f2f7b7952e2f7983a9ee527
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cls | |
$TodayDate = Get-Date -Format "yyyy-MM-dd" | |
#$TodayDate = "2023-08-15" #for testing | |
$LDZ = Read-Host -Prompt 'Enter the Local Distribution Zone (LDZ) that you require info for, see here: [https://www.xoserve.com/xoserve-search?term=Postcode%20Exit%20Zone/LDZ%20mapping%20list] ' | |
$Soap = @" | |
<?xml version="1.0" encoding="utf-8"?> | |
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope"> | |
<soap12:Body> | |
<GetPublicationDataWM xmlns="http://www.NationalGrid.com/MIPI/"> | |
<reqObject> | |
<LatestFlag>Y</LatestFlag> | |
<ApplicableForFlag>Y</ApplicableForFlag> | |
<FromDate>$($TodayDate)T00:00:00.000Z</FromDate> | |
<ToDate>$($TodayDate)T00:00:00.000Z</ToDate> | |
<DateType>NORMALDAY</DateType> | |
<PublicationObjectNameList> | |
<string>Calorific Value, LDZ($LDZ)</string> | |
</PublicationObjectNameList> | |
</reqObject> | |
</GetPublicationDataWM> | |
</soap12:Body> | |
</soap12:Envelope> | |
"@ | |
$Req = Invoke-WebRequest -Uri "http://marketinformation.natgrid.co.uk/MIPIws-public/public/publicwebservice.asmx" -Method 'Post' -ContentType 'application/soap+xml' -Body $Soap | |
[xml]$XML = $Req | |
$Value = $XML.Envelope.Body.GetPublicationDataWMResponse.GetPublicationDataWMResult.CLSMIPIPublicationObjectBE.PublicationObjectData.CLSPublicationObjectDataBE.Value | |
"`n`n`nThe current Calorific Value (CV) for LDZ ["+$LDZ.ToUpper()+"] for "+$TodayDate+" is {0:N2}" -f $Value | |
"`nMore data available at: [https://data.nationalgas.com/]`n`n`n" | |
read-host “Press ENTER to EXIT” | |
# Based on [https://gist.github.com/lwsrbrts/d96092b65f2f7b7952e2f7983a9ee527] by [https://gist.github.com/lwsrbrts] - thank you for your script. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment