Per Qualunque info sul Software
http://photosimpianti.blogspot.com/2009/03/informazioni.html
http://photosimpianti.blogspot.com/2009/03/informazioni.html
Imports Microsoft.VisualBasic Imports System.IO Imports System.Net Imports System.Text Imports System.Data Public Class pvest Public Function GetDataTable(ByVal pvtechchoice As String, ByVal peakpower As String, ByVal efficiency As String, ByVal mountingplace As String, ByVal angle As String, ByVal _ aspectangle As String, ByVal latitude As String, ByVal longitude As String) As DataTable Dim encoding As ASCIIEncoding = New ASCIIEncoding() ' PARAM: pvtechchoice ' crystSi ' CIS ' CdTe ' CdTe ' Unknown ' PARAM: peakpower (pv kwp ) ' PARAM: efficiency (value from 0 to 14: best 8) ' PARAM: mountingplace ' free (Free-standing) ' building (Building integrated) ' PARAM: angle (Slope is the angle of the modules relative to the ground: 0 to x) ' PARAM: aspectangle (Azimuth is the angle around the horizon) (Azimuth angle from -180 to 180. East=-90, South=0) Dim postData As String = "pvtechchoice=" + pvtechchoice postData += ("&peakpower=" + peakpower) postData += ("&efficiency=" + efficiency) postData += ("&mountingplace=" + mountingplace) postData += ("&angle=" + angle) postData += ("&aspectangle=" + aspectangle) postData += ("&outputchoicebuttons=window") postData += ("&sbutton=Calculate") postData += ("&outputformatchoice=csv") postData += ("&optimalchoice=") postData += ("&latitude=" + latitude) postData += ("&longitude=" + longitude) postData += ("®ionname=europe") postData += ("&language=en_en") Dim request As System.Net.WebRequest = System.Net.WebRequest.Create("http://re.jrc.ec.europa.eu/pvgis/apps3/PVcalc.php") CType(request, HttpWebRequest).UserAgent = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)" CType(request, HttpWebRequest).Referer = "http://re.jrc.ec.europa.eu/pvgis/apps3/pvest.php" request.Method = "POST" Dim byteArray As Byte() = System.Text.Encoding.UTF8.GetBytes(postData) request.ContentType = "application/x-www-form-urlencoded" request.ContentLength = byteArray.Length Dim dataStream As Stream = request.GetRequestStream() dataStream.Write(byteArray, 0, byteArray.Length) dataStream.Close() Dim myresponse As System.Net.WebResponse = request.GetResponse() dataStream = myresponse.GetResponseStream() Dim reader As New StreamReader(dataStream) Dim responseFromServer As String = reader.ReadToEnd() reader.Close() dataStream.Close() myresponse.Close() dataStream.Dispose() reader.Dispose() responseFromServer = responseFromServer.Substring(responseFromServer.IndexOf("Hm") + 2) responseFromServer = responseFromServer.Substring(0, responseFromServer.IndexOf("Year")) responseFromServer = responseFromServer.Replace(Chr(9), "-"c) responseFromServer = responseFromServer.Replace("--", ";"c) responseFromServer = responseFromServer.Replace(".", ","c) Dim a As Byte() = System.Text.Encoding.UTF8.GetBytes(responseFromServer) Dim ms As System.IO.MemoryStream = New System.IO.MemoryStream(a) Dim dt As New DataTable dt.Columns.Add("Month") dt.Columns.Add("Ed") dt.Columns.Add("Em") dt.Columns.Add("Hd") dt.Columns.Add("Hm") Using sr As New StreamReader(ms) While Not sr.EndOfStream dt.Rows.Add(sr.ReadLine.Split(";")) End While End Using dt.Rows(0).Delete() ms.Close() ms.Dispose() Return dt End Function End Class
Commenta