Temperaturfeld in Chart darstellen

  • VB.NET

Es gibt 37 Antworten in diesem Thema. Der letzte Beitrag () ist von ErfinderDesRades.

    Temperaturfeld in Chart darstellen

    hallo leute,

    ich habe in kleines proggi geschrieben, wass temperaturfelder speziell bei erdverlegten rohrleitungen im boden berechnet und dass dann graphisch in einem chart darstellen soll.
    hier mal der code dazu:

    Spoiler anzeigen

    VB.NET-Quellcode

    1. Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    2. d = Double.Parse(TextBox1.Text)
    3. TM = Double.Parse(TextBox2.Text)
    4. s = Double.Parse(TextBox3.Text)
    5. Lambda = Double.Parse(TextBox4.Text)
    6. z = Double.Parse(TextBox5.Text)
    7. Chart1.Series.Add("Rohr")
    8. Chart1.Series.Add("Serie1")
    9. Chart1.Series("Rohr").ChartType = DataVisualization.Charting.SeriesChartType.Line
    10. Chart1.Series("Serie1").ChartType = DataVisualization.Charting.SeriesChartType.Point
    11. LR = Math.Log((d + 2 * s) / d) / (2 * Lambda * Math.PI)
    12. j = 0
    13. For Me.alpha = 0 To Math.Atan(12 / z)
    14. i = 0
    15. z1 = z / Math.Cos(alpha)
    16. LE = arcosh((2 * z1) / ((d + 2 * s) / 1000)) / (4 * Math.PI)
    17. q = (TM - 10) / (LR + LE)
    18. T0 = 10 + q * LE
    19. Do
    20. Tx = T0 - i * ((T0 - 10) / (z1 - (d / 2000) - (s / 1000)))
    21. x = z * Math.Tan(alpha)
    22. y = ((d / 2000) + (s / 1000) + i) * Math.Cos(alpha)
    23. Chart1.Series("Serie1").Points.AddXY(x, y)
    24. If Tx >= 45 Then
    25. Chart1.Series("Serie1").Points(j).Color = Color.Red
    26. Else
    27. If Tx >= 35 And Tx < 45 Then
    28. Chart1.Series("Serie1").Points(j).Color = Color.Violet
    29. Else
    30. Chart1.Series("Serie1").Points(j).Color = Color.Blue
    31. End If
    32. End If
    33. i = i + 0.001
    34. j = j + 1
    35. Loop Until i > (z1 - (d / 2000) - (s / 1000))
    36. Next
    37. For x As Double = -((d + 2 * s) / 1000) To ((d + 2 * s) / 1000) Step 0.001
    38. Chart1.Series("Rohr").Points.AddXY(x, Math.Sqrt((((d + 2 * s) / 1000) ^ 2) - (x ^ 2)))
    39. Chart1.Series("Rohr").Points.AddXY(x, -Math.Sqrt((((d + 2 * s) / 1000) ^ 2) - (x ^ 2)))
    40. Next
    41. Chart1.ChartAreas("ChartArea1").AxisX.Minimum = 0
    42. Chart1.ChartAreas("ChartArea1").AxisX.Maximum = 12
    43. Chart1.ChartAreas("ChartArea1").AxisY.Minimum = 0
    44. Chart1.ChartAreas("ChartArea1").AxisY.Maximum = 2
    45. End Sub



    die berechnung läuft auch super, aber die bei der punktweisen darstellung im chart gibt es probleme. die punkte werden nicht vollflächig verteilt sonder liegen nur als eine art balken in dem chart.

    hier mal ein bild, wie es aussieht:



    hat jemand ne idee was da schief läuft?

    affrop schrieb:

    weil ich ja dann für jede farbe ne eigene series machen müsste.
    So isses.
    Falls Du diesen Code kopierst, achte auf die C&P-Bremse.
    Jede einzelne Zeile Deines Programms, die Du nicht explizit getestet hast, ist falsch :!:
    Ein guter .NET-Snippetkonverter (der ist verfügbar).
    Programmierfragen über PN / Konversation werden ignoriert!
    so ich hab jetzt für jeden berechnungssektor ne eigene series erstellt. problem ist dies hier:

    Spoiler anzeigen

    Informationen über das Aufrufen von JIT-Debuggen
    anstelle dieses Dialogfelds finden Sie am Ende dieser Meldung.

    ************** Ausnahmetext **************
    System.OutOfMemoryException: Eine Ausnahme vom Typ "System.OutOfMemoryException" wurde ausgelöst.
    bei System.Collections.Hashtable.ValueCollection.GetEnumerator()
    bei System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
    bei System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
    bei System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
    bei System.Windows.Forms.Application.RunDialog(Form form)
    bei System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
    bei System.Windows.Forms.Form.ShowDialog()
    bei System.Windows.Forms.Application.ThreadContext.OnThreadException(Exception t)
    bei System.Windows.Forms.Control.WndProcException(Exception e)
    bei System.Windows.Forms.Control.ControlNativeWindow.OnThreadException(Exception e)
    bei System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
    bei System.Windows.Forms.UnsafeNativeMethods.CallWindowProc(IntPtr wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
    bei System.Windows.Forms.NativeWindow.DefWndProc(Message& m)
    bei System.Windows.Forms.Control.DefWndProc(Message& m)
    bei System.Windows.Forms.Control.WndProc(Message& m)
    bei System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
    bei System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
    bei System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


    ************** Geladene Assemblys **************
    mscorlib
    Assembly-Version: 4.0.0.0.
    Win32-Version: 4.0.30319.18052 built by: FX45RTMGDR.
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll.
    ----------------------------------------
    TempFeldTester
    Assembly-Version: 1.0.0.0.
    Win32-Version: 1.0.0.0.
    CodeBase: file:///C:/Users/Passion/Desktop/TempFeldTester/TempFeldTester/bin/Debug/TempFeldTester.exe.
    ----------------------------------------
    Microsoft.VisualBasic
    Assembly-Version: 10.0.0.0.
    Win32-Version: 11.0.50709.17929 built by: FX45RTMREL.
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.VisualBasic/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll.
    ----------------------------------------
    System
    Assembly-Version: 4.0.0.0.
    Win32-Version: 4.0.30319.18044 built by: FX45RTMGDR.
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll.
    ----------------------------------------
    System.Core
    Assembly-Version: 4.0.0.0.
    Win32-Version: 4.0.30319.17929 built by: FX45RTMREL.
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll.
    ----------------------------------------
    System.Windows.Forms
    Assembly-Version: 4.0.0.0.
    Win32-Version: 4.0.30319.18047 built by: FX45RTMGDR.
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll.
    ----------------------------------------
    System.Drawing
    Assembly-Version: 4.0.0.0.
    Win32-Version: 4.0.30319.18021 built by: FX45RTMGDR.
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll.
    ----------------------------------------
    System.Configuration
    Assembly-Version: 4.0.0.0.
    Win32-Version: 4.0.30319.18060 built by: FX45RTMGDR.
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll.
    ----------------------------------------
    System.Xml
    Assembly-Version: 4.0.0.0.
    Win32-Version: 4.0.30319.18060 built by: FX45RTMGDR.
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll.
    ----------------------------------------
    System.Runtime.Remoting
    Assembly-Version: 4.0.0.0.
    Win32-Version: 4.0.30319.17929 built by: FX45RTMREL.
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Runtime.Remoting/v4.0_4.0.0.0__b77a5c561934e089/System.Runtime.Remoting.dll.
    ----------------------------------------
    System.Windows.Forms.DataVisualization
    Assembly-Version: 4.0.0.0.
    Win32-Version: 4.0.30319.17929.
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms.DataVisualization/v4.0_4.0.0.0__31bf3856ad364e35/System.Windows.Forms.DataVisualization.dll.
    ----------------------------------------
    System.Windows.Forms.DataVisualization.resources
    Assembly-Version: 4.0.0.0.
    Win32-Version: 4.0.30319.17929.
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms.DataVisualization.resources/v4.0_4.0.0.0_de_31bf3856ad364e35/System.Windows.Forms.DataVisualization.resources.dll.
    ----------------------------------------
    System.Data
    Assembly-Version: 4.0.0.0.
    Win32-Version: 4.0.30319.18047 built by: FX45RTMGDR.
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_32/System.Data/v4.0_4.0.0.0__b77a5c561934e089/System.Data.dll.
    ----------------------------------------
    mscorlib.resources
    Assembly-Version: 4.0.0.0.
    Win32-Version: 4.0.30319.17929 built by: FX45RTMREL.
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/mscorlib.resources/v4.0_4.0.0.0_de_b77a5c561934e089/mscorlib.resources.dll.
    ----------------------------------------
    System.Windows.Forms.resources
    Assembly-Version: 4.0.0.0.
    Win32-Version: 4.0.30319.17929 built by: FX45RTMREL.
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms.resources/v4.0_4.0.0.0_de_b77a5c561934e089/System.Windows.Forms.resources.dll.
    ----------------------------------------

    ************** JIT-Debuggen **************
    Um das JIT-Debuggen (Just-In-Time) zu aktivieren, muss in der
    Konfigurationsdatei der Anwendung oder des Computers
    (machine.config) der jitDebugging-Wert im Abschnitt system.windows.forms festgelegt werden.
    Die Anwendung muss mit aktiviertem Debuggen kompiliert werden.

    Zum Beispiel:

    <configuration>
    <system.windows.forms jitDebugging="true" />
    </configuration>

    Wenn das JIT-Debuggen aktiviert ist, werden alle nicht behandelten
    Ausnahmen an den JIT-Debugger gesendet, der auf dem
    Computer registriert ist, und nicht in diesem Dialogfeld behandelt.


    das kommt so nach etwa 3,2 mio. datenpunkten, die in das chart geschrieben wurden. das ist nicht mal der komplette 1. sektor.
    wenn ich für jede farbe ne neue series mit datenpunkten füllen will geht es bis 3,8 mio. dann kotzt das framework ab und macht en schönes rotes kreuz durch das chart.
    hier mal en screenshot mit leistungsdaten:



    hat jemand ne idee wie man das problem lösen kann?
    hier mal der gesamte code mit den sektoren pro series dazu:
    Spoiler anzeigen

    VB.NET-Quellcode

    1. Public Class Form1
    2. Dim d As Double
    3. Dim TM As Double
    4. Dim s As Double
    5. Dim Lambda As Double
    6. Dim z As Double
    7. Dim z1 As Double
    8. Dim q As Double
    9. Dim T0 As Double
    10. Dim Tx As Double
    11. Dim x As Double
    12. Dim y As Double
    13. Dim i As Double
    14. Dim j As Int64
    15. Dim h As Double
    16. Dim LR As Double
    17. Dim LE As Double
    18. Dim alpha As Double
    19. Dim Tz As Double
    20. Dim TxListSektor1 As New ArrayList
    21. Dim TxListSektor2 As New ArrayList
    22. Dim TxListSektor3 As New ArrayList
    23. Dim TxListSektor4 As New ArrayList
    24. Dim xListSektor1 As New ArrayList
    25. Dim xListSektor2 As New ArrayList
    26. Dim xListSektor3 As New ArrayList
    27. Dim xListSektor4 As New ArrayList
    28. Dim yListSektor1 As New ArrayList
    29. Dim yListSektor2 As New ArrayList
    30. Dim yListSektor3 As New ArrayList
    31. Dim yListSektor4 As New ArrayList
    32. Dim PBValue1 As Double
    33. Dim PBValue2 As Double
    34. Dim PBValue3 As Double
    35. Dim PBValue4 As Double
    36. Dim PBValue5 As Double
    37. Delegate Sub ProgressBar(ByVal PBValue1 As Double, ByVal PBValue2 As Double, ByVal PBValue3 As Double, ByVal PBValue4 As Double, ByVal PBValue5 As Double)
    38. Delegate Sub Charting1(ByVal Tx As Double, ByVal x As Double, ByVal y As Double, ByVal j As Int64)
    39. Delegate Sub Charting2(ByVal Tx As Double, ByVal x As Double, ByVal y As Double, ByVal j As Int64)
    40. Delegate Sub Charting3(ByVal Tx As Double, ByVal x As Double, ByVal y As Double, ByVal j As Int64)
    41. Delegate Sub Charting4(ByVal Tx As Double, ByVal x As Double, ByVal y As Double, ByVal j As Int64)
    42. Delegate Sub Points(ByVal k As Int64)
    43. Dim Min As Integer = 0
    44. Dim Sek As Integer = 0
    45. Public Shared Function arcosh(ByVal x As Double) As Double
    46. arcosh = Math.Log(x + Math.Sqrt((x ^ 2) - 1))
    47. End Function
    48. Private Sub Form_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    49. Label11.Text = "Berechnungszeit: " & Min & " Min. " & Sek & " Sek."
    50. End Sub
    51. Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
    52. Application.Exit()
    53. End Sub
    54. Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    55. d = Double.Parse(TextBox1.Text)
    56. TM = Double.Parse(TextBox2.Text)
    57. s = Double.Parse(TextBox3.Text)
    58. Lambda = Double.Parse(TextBox4.Text)
    59. z = Double.Parse(TextBox5.Text)
    60. Chart1.Series.Add("Rohr")
    61. Chart1.Series.Add("Sektor1")
    62. Chart1.Series.Add("Sektor2")
    63. Chart1.Series.Add("Sektor3")
    64. Chart1.Series.Add("Sektor4")
    65. Chart1.Series("Rohr").ChartType = DataVisualization.Charting.SeriesChartType.Line
    66. Chart1.Series("Sektor1").ChartType = DataVisualization.Charting.SeriesChartType.Point
    67. Chart1.Series("Sektor2").ChartType = DataVisualization.Charting.SeriesChartType.Point
    68. Chart1.Series("Sektor3").ChartType = DataVisualization.Charting.SeriesChartType.Point
    69. Chart1.Series("Sektor4").ChartType = DataVisualization.Charting.SeriesChartType.Point
    70. Chart1.Visible = False
    71. Timer1.Start()
    72. BackgroundWorker1.RunWorkerAsync()
    73. End Sub
    74. Private Sub Backgroundworker1_DoWork(sender As Object, e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork
    75. Dim PBGel As New ProgressBar(AddressOf Me.ProgressBarChange)
    76. LR = Math.Log((d + 2 * s) / d) / (2 * Lambda * Math.PI)
    77. j = 0
    78. For Me.alpha = 0 To ((180 * Math.Atan(12 / z)) / Math.PI) Step 0.1
    79. i = 0
    80. z1 = z / Math.Cos(alpha * (Math.PI / 180))
    81. LE = arcosh((2 * z1) / ((d + 2 * s) / 1000)) / (4 * Math.PI)
    82. q = (TM - 104.1) / (LR + LE)
    83. T0 = 14.1 + q * LE
    84. Do
    85. Tx = T0 - i * ((T0 - 14.1) / (z1 - (d / 2000) - (s / 1000)))
    86. x = ((d / 2000) + (s / 1000) + i) * Math.Sin(alpha * (Math.PI / 180))
    87. y = ((d / 2000) + (s / 1000) + i) * Math.Cos(alpha * (Math.PI / 180))
    88. TxListSektor1.Add(Tx)
    89. xListSektor1.Add(x)
    90. yListSektor1.Add(y)
    91. i = i + 0.001
    92. j = j + 1
    93. Loop Until i > (z1 - (d / 2000) - (s / 1000))
    94. PBValue1 = (alpha / ((180 * Math.Atan(12 / z)) / Math.PI)) * 100
    95. Me.Invoke(PBGel, PBValue1, 0, 0, 0, 0)
    96. Next
    97. PBValue1 = 100
    98. Me.Invoke(PBGel, 100, 0, 0, 0, 0)
    99. For Me.alpha = 0 To ((180 * Math.Atan(z / 12)) / Math.PI) Step 0.1
    100. i = 0
    101. z1 = 12 / Math.Cos(alpha * (Math.PI / 180))
    102. LE = arcosh((2 * z1) / ((d + 2 * s) / 1000)) / (4 * Math.PI)
    103. h = 12 * Math.Tan(alpha * (Math.PI / 180))
    104. Tz = 9.78 + ((14.1 - 9.78) * Math.Exp((-h) / Math.Sqrt((2 * (2 / (1500 * 2000))) / ((2 * Math.PI) / (4 * 2592000)))) * Math.Cos(h / Math.Sqrt((2 * (2 / (1500 * 2000))) / ((2 * Math.PI) / (4 * 2592000))))) - (13.16 * Math.Exp((-h) / Math.Sqrt((2 * (2 / (1500 * 2000))) / ((2 * Math.PI) / (4 * 2592000)))) * Math.Sin(h / Math.Sqrt((2 * (2 / (1500 * 2000))) / ((2 * Math.PI) / (4 * 2592000)))))
    105. q = (TM - Tz) / (LR + LE)
    106. T0 = Tz + q * LE
    107. Do
    108. Tx = T0 - i * ((T0 - Tz) / (z1 - (d / 2000) - (s / 1000)))
    109. x = ((d / 2000) + (s / 1000) + i) * Math.Cos(alpha * (Math.PI / 180))
    110. y = ((d / 2000) + (s / 1000) + i) * Math.Sin(alpha * (Math.PI / 180))
    111. TxListSektor2.Add(Tx)
    112. xListSektor2.Add(x)
    113. yListSektor2.Add(y)
    114. i = i + 0.001
    115. j = j + 1
    116. Loop Until i > (z1 - (d / 2000) - (s / 1000))
    117. PBValue2 = (alpha / ((180 * Math.Atan(z / 12)) / Math.PI)) * 100
    118. Me.Invoke(PBGel, 100, PBValue2, 0, 0, 0)
    119. Next
    120. PBValue2 = 100
    121. Me.Invoke(PBGel, 100, 100, 0, 0, 0)
    122. For Me.alpha = 0 To ((180 * Math.Atan((12 - z) / 12)) / Math.PI) Step 0.1
    123. i = 0
    124. z1 = 12 / Math.Cos(alpha * (Math.PI / 180))
    125. LE = arcosh((2 * z1) / ((d + 2 * s) / 1000)) / (4 * Math.PI)
    126. h = 12 * Math.Tan(alpha * (Math.PI / 180)) + z
    127. Tz = 9.78 + ((14.1 - 9.78) * Math.Exp((0 - h) / Math.Sqrt((2 * (2 / (1500 * 2000))) / ((2 * Math.PI) / (4 * 2592000)))) * Math.Cos(h / Math.Sqrt((2 * (2 / (1500 * 2000))) / ((2 * Math.PI) / (4 * 2592000))))) - (13.16 * Math.Exp((0 - h) / Math.Sqrt((2 * (2 / (1500 * 2000))) / ((2 * Math.PI) / (4 * 2592000)))) * Math.Sin(h / Math.Sqrt((2 * (2 / (1500 * 2000))) / ((2 * Math.PI) / (4 * 2592000)))))
    128. q = (TM - Tz) / (LR + LE)
    129. T0 = Tz + q * LE
    130. Do
    131. Tx = T0 - i * ((T0 - Tz) / (z1 - (d / 2000) - (s / 1000)))
    132. x = ((d / 2000) + (s / 1000) + i) * Math.Cos(alpha * (Math.PI / 180))
    133. y = 0 - (((d / 2000) + (s / 1000) + i) * Math.Sin(alpha * (Math.PI / 180)))
    134. TxListSektor3.Add(Tx)
    135. xListSektor3.Add(x)
    136. yListSektor3.Add(y)
    137. i = i + 0.001
    138. j = j + 1
    139. Loop Until i > (z1 - (d / 2000) - (s / 1000))
    140. PBValue3 = (alpha / ((180 * Math.Atan((12 - z) / 12)) / Math.PI)) * 100
    141. Me.Invoke(PBGel, 100, 100, PBValue3, 0, 0)
    142. Next
    143. PBValue3 = 100
    144. Me.Invoke(PBGel, 100, 100, 100, 0, 0)
    145. For Me.alpha = 0 To (180 * (Math.Atan(12 / (12 - z)) / Math.PI)) Step 0.1
    146. i = 0
    147. z1 = (12 - z) / Math.Cos(alpha * (Math.PI / 180))
    148. LE = arcosh((2 * z1) / ((d + 2 * s) / 1000)) / (4 * Math.PI)
    149. q = (TM - 9.78) / (LR + LE)
    150. T0 = 9.78 + q * LE
    151. Do
    152. Tx = T0 - i * ((T0 - 9.78) / (z1 - (d / 2000) - (s / 1000)))
    153. x = ((d / 2000) + (s / 1000) + i) * Math.Sin(alpha * (Math.PI / 180))
    154. y = 0 - (((d / 2000) + (s / 1000) + i) * Math.Cos(alpha * (Math.PI / 180)))
    155. TxListSektor4.Add(Tx)
    156. xListSektor4.Add(x)
    157. yListSektor4.Add(y)
    158. i = i + 0.001
    159. j = j + 1
    160. Loop Until i > (z1 - (d / 2000) - (s / 1000))
    161. PBValue4 = (alpha / (180 * (Math.Atan(12 / (12 - z)) / Math.PI))) * 100
    162. Me.Invoke(PBGel, 100, 100, 100, PBValue4, 0)
    163. Next
    164. PBValue4 = 100
    165. Me.Invoke(PBGel, 100, 100, 100, 100, 0)
    166. End Sub
    167. Private Sub Backgroundworker1_RunWorkerCompleted(sender As Object, e As System.ComponentModel.RunWorkerCompletedEventArgs) Handles BackgroundWorker1.RunWorkerCompleted
    168. BackgroundWorker2.RunWorkerAsync()
    169. End Sub
    170. Private Sub Backgroundworker2_DoWork(sender As Object, e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker2.DoWork
    171. Dim ChartDel1 As New Charting1(AddressOf ChartFill1)
    172. Dim ChartDel2 As New Charting2(AddressOf ChartFill2)
    173. Dim ChartDel3 As New Charting3(AddressOf ChartFill3)
    174. Dim ChartDel4 As New Charting4(AddressOf ChartFill4)
    175. Dim PBGel As New ProgressBar(AddressOf Me.ProgressBarChange)
    176. Dim kDel As New Points(AddressOf Me.Point)
    177. Dim kges As Int64 = TxListSektor1.Count + TxListSektor2.Count + TxListSektor3.Count + TxListSektor4.Count
    178. Dim k As Int64 = 1
    179. Dim a As Int64
    180. a = TxListSektor1.Count - 1
    181. j = 0
    182. i = a
    183. Do
    184. Tx = Double.Parse(TxListSektor1.Item(i).ToString)
    185. x = Double.Parse(xListSektor1.Item(i).ToString)
    186. y = Double.Parse(yListSektor1.Item(i).ToString)
    187. PBValue5 = (Double.Parse(k.ToString) / Double.Parse(kges.ToString)) * 100
    188. Me.Invoke(ChartDel1, Tx, x, y, j)
    189. Me.Invoke(PBGel, 100, 100, 100, 100, PBValue5)
    190. Me.Invoke(kDel, k)
    191. TxListSektor1.RemoveAt(i)
    192. xListSektor1.RemoveAt(i)
    193. yListSektor1.RemoveAt(i)
    194. i = i - 1
    195. k = k + 1
    196. j = j + 1
    197. Loop Until j > a
    198. a = TxListSektor2.Count - 1
    199. j = 0
    200. i = a
    201. Do
    202. Tx = Double.Parse(TxListSektor2.Item(i).ToString)
    203. x = Double.Parse(xListSektor2.Item(i).ToString)
    204. y = Double.Parse(yListSektor2.Item(i).ToString)
    205. PBValue5 = (Double.Parse(k.ToString) / Double.Parse(kges.ToString)) * 100
    206. Me.Invoke(ChartDel2, Tx, x, y, j)
    207. Me.Invoke(PBGel, 100, 100, 100, 100, PBValue5)
    208. Me.Invoke(kDel, k)
    209. TxListSektor2.RemoveAt(i)
    210. xListSektor2.RemoveAt(i)
    211. yListSektor2.RemoveAt(i)
    212. i = i - 1
    213. k = k + 1
    214. j = j + 1
    215. Loop Until j > a
    216. a = TxListSektor3.Count - 1
    217. j = 0
    218. i = a
    219. Do
    220. Tx = Double.Parse(TxListSektor3.Item(i).ToString)
    221. x = Double.Parse(xListSektor3.Item(i).ToString)
    222. y = Double.Parse(yListSektor3.Item(i).ToString)
    223. PBValue5 = (Double.Parse(k.ToString) / Double.Parse(kges.ToString)) * 100
    224. Me.Invoke(ChartDel3, Tx, x, y, j)
    225. Me.Invoke(PBGel, 100, 100, 100, 100, PBValue5)
    226. Me.Invoke(kDel, k)
    227. TxListSektor3.RemoveAt(i)
    228. xListSektor3.RemoveAt(i)
    229. yListSektor3.RemoveAt(i)
    230. i = i - 1
    231. k = k + 1
    232. j = j + 1
    233. Loop Until j > a
    234. a = TxListSektor4.Count - 1
    235. j = 0
    236. i = a
    237. Do
    238. Tx = Double.Parse(TxListSektor4.Item(i).ToString)
    239. x = Double.Parse(xListSektor4.Item(i).ToString)
    240. y = Double.Parse(yListSektor4.Item(i).ToString)
    241. PBValue5 = (Double.Parse(k.ToString) / Double.Parse(kges.ToString)) * 100
    242. Me.Invoke(ChartDel4, Tx, x, y, j)
    243. Me.Invoke(PBGel, 100, 100, 100, 100, PBValue5)
    244. Me.Invoke(kDel, k)
    245. TxListSektor4.RemoveAt(i)
    246. xListSektor4.RemoveAt(i)
    247. yListSektor4.RemoveAt(i)
    248. i = i - 1
    249. k = k + 1
    250. j = j + 1
    251. Loop Until j > a
    252. Me.Invoke(PBGel, 100, 100, 100, 100, 100)
    253. End Sub
    254. Private Sub Backgroundworker2_RunWorkerCompleted(sender As Object, e As System.ComponentModel.RunWorkerCompletedEventArgs) Handles BackgroundWorker2.RunWorkerCompleted
    255. For x As Double = -((d + 2 * s) / 1000) To ((d + 2 * s) / 1000) Step 0.001
    256. Chart1.Series("Rohr").Points.AddXY(x, Math.Sqrt((((d + 2 * s) / 1000) ^ 2) - (x ^ 2)))
    257. Chart1.Series("Rohr").Points.AddXY(x, -Math.Sqrt((((d + 2 * s) / 1000) ^ 2) - (x ^ 2)))
    258. Next
    259. Chart1.ChartAreas("ChartArea1").AxisX.Minimum = 0
    260. Chart1.ChartAreas("ChartArea1").AxisX.Maximum = 12
    261. Chart1.ChartAreas("ChartArea1").AxisY.Minimum = z - 12
    262. Chart1.ChartAreas("ChartArea1").AxisY.Maximum = z
    263. Chart1.Visible = True
    264. Timer1.Stop()
    265. End Sub
    266. Public Sub ProgressBarChange(ByVal PBValue1 As Double, ByVal PBValue2 As Double, ByVal PBValue3 As Double, ByVal PBValue4 As Double, ByVal PBValue5 As Double)
    267. ProgressBar1.Value = PBValue1
    268. ProgressBar2.Value = PBValue2
    269. ProgressBar3.Value = PBValue3
    270. ProgressBar4.Value = PBValue4
    271. ProgressBar5.Value = PBValue5
    272. End Sub
    273. Public Sub ChartFill1(ByVal Tx As Double, ByVal x As Double, ByVal y As Double, ByVal j As Int64)
    274. Chart1.Series("Sektor1").Points.AddXY(x, y)
    275. If Tx >= 45 Then
    276. Chart1.Series("Sektor1").Points(j).Color = Color.Red
    277. Else
    278. If Tx >= 35 And Tx < 45 Then
    279. Chart1.Series("Sektor1").Points(j).Color = Color.Violet
    280. Else
    281. Chart1.Series("Sektor1").Points(j).Color = Color.Blue
    282. End If
    283. End If
    284. End Sub
    285. Public Sub ChartFill2(ByVal Tx As Double, ByVal x As Double, ByVal y As Double, ByVal j As Int64)
    286. Chart1.Series("Sektor2").Points.AddXY(x, y)
    287. If Tx >= 45 Then
    288. Chart1.Series("Sektor2").Points(j).Color = Color.Red
    289. Else
    290. If Tx >= 35 And Tx < 45 Then
    291. Chart1.Series("Sektor2").Points(j).Color = Color.Violet
    292. Else
    293. Chart1.Series("Sektor2").Points(j).Color = Color.Blue
    294. End If
    295. End If
    296. End Sub
    297. Public Sub ChartFill3(ByVal Tx As Double, ByVal x As Double, ByVal y As Double, ByVal j As Int64)
    298. Chart1.Series("Sektor3").Points.AddXY(x, y)
    299. If Tx >= 45 Then
    300. Chart1.Series("Sektor3").Points(j).Color = Color.Red
    301. Else
    302. If Tx >= 35 And Tx < 45 Then
    303. Chart1.Series("Sektor3").Points(j).Color = Color.Violet
    304. Else
    305. Chart1.Series("Sektor3").Points(j).Color = Color.Blue
    306. End If
    307. End If
    308. End Sub
    309. Public Sub ChartFill4(ByVal Tx As Double, ByVal x As Double, ByVal y As Double, ByVal j As Int64)
    310. Chart1.Series("Sektor4").Points.AddXY(x, y)
    311. If Tx >= 45 Then
    312. Chart1.Series("Sektor4").Points(j).Color = Color.Red
    313. Else
    314. If Tx >= 35 And Tx < 45 Then
    315. Chart1.Series("Sektor4").Points(j).Color = Color.Violet
    316. Else
    317. Chart1.Series("Sektor4").Points(j).Color = Color.Blue
    318. End If
    319. End If
    320. End Sub
    321. Public Sub Point(ByVal k As Int64)
    322. Label12.Text = "Anzahl Datenpunkte: " & k
    323. End Sub
    324. Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
    325. Sek = Sek + 1
    326. If Sek = 60 Then
    327. Min = Min + 1
    328. Sek = 0
    329. End If
    330. Label11.Text = "Berechnungszeit: " & Min & " Min. " & Sek & " Sek."
    331. End Sub
    332. End Class



    und hier die geänderte variante mit den farbweisen series:

    Spoiler anzeigen

    VB.NET-Quellcode

    1. Public Class Form1
    2. Dim d As Double
    3. Dim TM As Double
    4. Dim s As Double
    5. Dim Lambda As Double
    6. Dim z As Double
    7. Dim z1 As Double
    8. Dim q As Double
    9. Dim T0 As Double
    10. Dim Tx As Double
    11. Dim x As Double
    12. Dim y As Double
    13. Dim i As Double
    14. Dim j As Int64
    15. Dim h As Double
    16. Dim LR As Double
    17. Dim LE As Double
    18. Dim alpha As Double
    19. Dim Tz As Double
    20. Dim TxListSektor1 As New ArrayList
    21. Dim TxListSektor2 As New ArrayList
    22. Dim TxListSektor3 As New ArrayList
    23. Dim TxListSektor4 As New ArrayList
    24. Dim xListSektor1 As New ArrayList
    25. Dim xListSektor2 As New ArrayList
    26. Dim xListSektor3 As New ArrayList
    27. Dim xListSektor4 As New ArrayList
    28. Dim yListSektor1 As New ArrayList
    29. Dim yListSektor2 As New ArrayList
    30. Dim yListSektor3 As New ArrayList
    31. Dim yListSektor4 As New ArrayList
    32. Dim PBValue1 As Double
    33. Dim PBValue2 As Double
    34. Dim PBValue3 As Double
    35. Dim PBValue4 As Double
    36. Dim PBValue5 As Double
    37. Delegate Sub ProgressBar(ByVal PBValue1 As Double, ByVal PBValue2 As Double, ByVal PBValue3 As Double, ByVal PBValue4 As Double, ByVal PBValue5 As Double)
    38. Delegate Sub Charting1(ByVal Tx As Double, ByVal x As Double, ByVal y As Double, ByVal j As Int64)
    39. Delegate Sub Charting2(ByVal Tx As Double, ByVal x As Double, ByVal y As Double, ByVal j As Int64)
    40. Delegate Sub Charting3(ByVal Tx As Double, ByVal x As Double, ByVal y As Double, ByVal j As Int64)
    41. Delegate Sub Charting4(ByVal Tx As Double, ByVal x As Double, ByVal y As Double, ByVal j As Int64)
    42. Delegate Sub Points(ByVal k As Int64)
    43. Dim Min As Integer = 0
    44. Dim Sek As Integer = 0
    45. Public Shared Function arcosh(ByVal x As Double) As Double
    46. arcosh = Math.Log(x + Math.Sqrt((x ^ 2) - 1))
    47. End Function
    48. Private Sub Form_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    49. Label11.Text = "Berechnungszeit: " & Min & " Min. " & Sek & " Sek."
    50. End Sub
    51. Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
    52. Application.Exit()
    53. End Sub
    54. Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    55. d = Double.Parse(TextBox1.Text)
    56. TM = Double.Parse(TextBox2.Text)
    57. s = Double.Parse(TextBox3.Text)
    58. Lambda = Double.Parse(TextBox4.Text)
    59. z = Double.Parse(TextBox5.Text)
    60. Chart1.Series.Add("Rohr")
    61. Chart1.Series.Add("Red")
    62. Chart1.Series.Add("Violet")
    63. Chart1.Series.Add("Blue")
    64. Chart1.Series("Rohr").ChartType = DataVisualization.Charting.SeriesChartType.Line
    65. Chart1.Series("Red").ChartType = DataVisualization.Charting.SeriesChartType.Point
    66. Chart1.Series("Violet").ChartType = DataVisualization.Charting.SeriesChartType.Point
    67. Chart1.Series("Blue").ChartType = DataVisualization.Charting.SeriesChartType.Point
    68. Chart1.Visible = False
    69. Timer1.Start()
    70. BackgroundWorker1.RunWorkerAsync()
    71. End Sub
    72. Private Sub Backgroundworker1_DoWork(sender As Object, e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork
    73. Dim PBGel As New ProgressBar(AddressOf Me.ProgressBarChange)
    74. LR = Math.Log((d + 2 * s) / d) / (2 * Lambda * Math.PI)
    75. j = 0
    76. For Me.alpha = 0 To ((180 * Math.Atan(12 / z)) / Math.PI) Step 0.1
    77. i = 0
    78. z1 = z / Math.Cos(alpha * (Math.PI / 180))
    79. LE = arcosh((2 * z1) / ((d + 2 * s) / 1000)) / (4 * Math.PI)
    80. q = (TM - 104.1) / (LR + LE)
    81. T0 = 14.1 + q * LE
    82. Do
    83. Tx = T0 - i * ((T0 - 14.1) / (z1 - (d / 2000) - (s / 1000)))
    84. x = ((d / 2000) + (s / 1000) + i) * Math.Sin(alpha * (Math.PI / 180))
    85. y = ((d / 2000) + (s / 1000) + i) * Math.Cos(alpha * (Math.PI / 180))
    86. TxListSektor1.Add(Tx)
    87. xListSektor1.Add(x)
    88. yListSektor1.Add(y)
    89. i = i + 0.001
    90. j = j + 1
    91. Loop Until i > (z1 - (d / 2000) - (s / 1000))
    92. PBValue1 = (alpha / ((180 * Math.Atan(12 / z)) / Math.PI)) * 100
    93. Me.Invoke(PBGel, PBValue1, 0, 0, 0, 0)
    94. Next
    95. PBValue1 = 100
    96. Me.Invoke(PBGel, 100, 0, 0, 0, 0)
    97. For Me.alpha = 0 To ((180 * Math.Atan(z / 12)) / Math.PI) Step 0.1
    98. i = 0
    99. z1 = 12 / Math.Cos(alpha * (Math.PI / 180))
    100. LE = arcosh((2 * z1) / ((d + 2 * s) / 1000)) / (4 * Math.PI)
    101. h = 12 * Math.Tan(alpha * (Math.PI / 180))
    102. Tz = 9.78 + ((14.1 - 9.78) * Math.Exp((-h) / Math.Sqrt((2 * (2 / (1500 * 2000))) / ((2 * Math.PI) / (4 * 2592000)))) * Math.Cos(h / Math.Sqrt((2 * (2 / (1500 * 2000))) / ((2 * Math.PI) / (4 * 2592000))))) - (13.16 * Math.Exp((-h) / Math.Sqrt((2 * (2 / (1500 * 2000))) / ((2 * Math.PI) / (4 * 2592000)))) * Math.Sin(h / Math.Sqrt((2 * (2 / (1500 * 2000))) / ((2 * Math.PI) / (4 * 2592000)))))
    103. q = (TM - Tz) / (LR + LE)
    104. T0 = Tz + q * LE
    105. Do
    106. Tx = T0 - i * ((T0 - Tz) / (z1 - (d / 2000) - (s / 1000)))
    107. x = ((d / 2000) + (s / 1000) + i) * Math.Cos(alpha * (Math.PI / 180))
    108. y = ((d / 2000) + (s / 1000) + i) * Math.Sin(alpha * (Math.PI / 180))
    109. TxListSektor2.Add(Tx)
    110. xListSektor2.Add(x)
    111. yListSektor2.Add(y)
    112. i = i + 0.001
    113. j = j + 1
    114. Loop Until i > (z1 - (d / 2000) - (s / 1000))
    115. PBValue2 = (alpha / ((180 * Math.Atan(z / 12)) / Math.PI)) * 100
    116. Me.Invoke(PBGel, 100, PBValue2, 0, 0, 0)
    117. Next
    118. PBValue2 = 100
    119. Me.Invoke(PBGel, 100, 100, 0, 0, 0)
    120. For Me.alpha = 0 To ((180 * Math.Atan((12 - z) / 12)) / Math.PI) Step 0.1
    121. i = 0
    122. z1 = 12 / Math.Cos(alpha * (Math.PI / 180))
    123. LE = arcosh((2 * z1) / ((d + 2 * s) / 1000)) / (4 * Math.PI)
    124. h = 12 * Math.Tan(alpha * (Math.PI / 180)) + z
    125. Tz = 9.78 + ((14.1 - 9.78) * Math.Exp((0 - h) / Math.Sqrt((2 * (2 / (1500 * 2000))) / ((2 * Math.PI) / (4 * 2592000)))) * Math.Cos(h / Math.Sqrt((2 * (2 / (1500 * 2000))) / ((2 * Math.PI) / (4 * 2592000))))) - (13.16 * Math.Exp((0 - h) / Math.Sqrt((2 * (2 / (1500 * 2000))) / ((2 * Math.PI) / (4 * 2592000)))) * Math.Sin(h / Math.Sqrt((2 * (2 / (1500 * 2000))) / ((2 * Math.PI) / (4 * 2592000)))))
    126. q = (TM - Tz) / (LR + LE)
    127. T0 = Tz + q * LE
    128. Do
    129. Tx = T0 - i * ((T0 - Tz) / (z1 - (d / 2000) - (s / 1000)))
    130. x = ((d / 2000) + (s / 1000) + i) * Math.Cos(alpha * (Math.PI / 180))
    131. y = 0 - (((d / 2000) + (s / 1000) + i) * Math.Sin(alpha * (Math.PI / 180)))
    132. TxListSektor3.Add(Tx)
    133. xListSektor3.Add(x)
    134. yListSektor3.Add(y)
    135. i = i + 0.001
    136. j = j + 1
    137. Loop Until i > (z1 - (d / 2000) - (s / 1000))
    138. PBValue3 = (alpha / ((180 * Math.Atan((12 - z) / 12)) / Math.PI)) * 100
    139. Me.Invoke(PBGel, 100, 100, PBValue3, 0, 0)
    140. Next
    141. PBValue3 = 100
    142. Me.Invoke(PBGel, 100, 100, 100, 0, 0)
    143. For Me.alpha = 0 To (180 * (Math.Atan(12 / (12 - z)) / Math.PI)) Step 0.1
    144. i = 0
    145. z1 = (12 - z) / Math.Cos(alpha * (Math.PI / 180))
    146. LE = arcosh((2 * z1) / ((d + 2 * s) / 1000)) / (4 * Math.PI)
    147. q = (TM - 9.78) / (LR + LE)
    148. T0 = 9.78 + q * LE
    149. Do
    150. Tx = T0 - i * ((T0 - 9.78) / (z1 - (d / 2000) - (s / 1000)))
    151. x = ((d / 2000) + (s / 1000) + i) * Math.Sin(alpha * (Math.PI / 180))
    152. y = 0 - (((d / 2000) + (s / 1000) + i) * Math.Cos(alpha * (Math.PI / 180)))
    153. TxListSektor4.Add(Tx)
    154. xListSektor4.Add(x)
    155. yListSektor4.Add(y)
    156. i = i + 0.001
    157. j = j + 1
    158. Loop Until i > (z1 - (d / 2000) - (s / 1000))
    159. PBValue4 = (alpha / (180 * (Math.Atan(12 / (12 - z)) / Math.PI))) * 100
    160. Me.Invoke(PBGel, 100, 100, 100, PBValue4, 0)
    161. Next
    162. PBValue4 = 100
    163. Me.Invoke(PBGel, 100, 100, 100, 100, 0)
    164. End Sub
    165. Private Sub Backgroundworker1_RunWorkerCompleted(sender As Object, e As System.ComponentModel.RunWorkerCompletedEventArgs) Handles BackgroundWorker1.RunWorkerCompleted
    166. BackgroundWorker2.RunWorkerAsync()
    167. End Sub
    168. Private Sub Backgroundworker2_DoWork(sender As Object, e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker2.DoWork
    169. Dim ChartDel1 As New Charting1(AddressOf ChartFill1)
    170. Dim ChartDel2 As New Charting2(AddressOf ChartFill2)
    171. Dim ChartDel3 As New Charting3(AddressOf ChartFill3)
    172. Dim ChartDel4 As New Charting4(AddressOf ChartFill4)
    173. Dim PBGel As New ProgressBar(AddressOf Me.ProgressBarChange)
    174. Dim kDel As New Points(AddressOf Me.Point)
    175. Dim kges As Int64 = TxListSektor1.Count + TxListSektor2.Count + TxListSektor3.Count + TxListSektor4.Count
    176. Dim k As Int64 = 1
    177. Dim a As Int64
    178. a = TxListSektor1.Count - 1
    179. j = 0
    180. i = a
    181. Do
    182. Tx = Double.Parse(TxListSektor1.Item(i).ToString)
    183. x = Double.Parse(xListSektor1.Item(i).ToString)
    184. y = Double.Parse(yListSektor1.Item(i).ToString)
    185. PBValue5 = (Double.Parse(k.ToString) / Double.Parse(kges.ToString)) * 100
    186. Me.Invoke(ChartDel1, Tx, x, y, j)
    187. Me.Invoke(PBGel, 100, 100, 100, 100, PBValue5)
    188. Me.Invoke(kDel, k)
    189. TxListSektor1.RemoveAt(i)
    190. xListSektor1.RemoveAt(i)
    191. yListSektor1.RemoveAt(i)
    192. i = i - 1
    193. k = k + 1
    194. j = j + 1
    195. Loop Until j > a
    196. a = TxListSektor2.Count - 1
    197. j = 0
    198. i = a
    199. Do
    200. Tx = Double.Parse(TxListSektor2.Item(i).ToString)
    201. x = Double.Parse(xListSektor2.Item(i).ToString)
    202. y = Double.Parse(yListSektor2.Item(i).ToString)
    203. PBValue5 = (Double.Parse(k.ToString) / Double.Parse(kges.ToString)) * 100
    204. Me.Invoke(ChartDel2, Tx, x, y, j)
    205. Me.Invoke(PBGel, 100, 100, 100, 100, PBValue5)
    206. Me.Invoke(kDel, k)
    207. TxListSektor2.RemoveAt(i)
    208. xListSektor2.RemoveAt(i)
    209. yListSektor2.RemoveAt(i)
    210. i = i - 1
    211. k = k + 1
    212. j = j + 1
    213. Loop Until j > a
    214. a = TxListSektor3.Count - 1
    215. j = 0
    216. i = a
    217. Do
    218. Tx = Double.Parse(TxListSektor3.Item(i).ToString)
    219. x = Double.Parse(xListSektor3.Item(i).ToString)
    220. y = Double.Parse(yListSektor3.Item(i).ToString)
    221. PBValue5 = (Double.Parse(k.ToString) / Double.Parse(kges.ToString)) * 100
    222. Me.Invoke(ChartDel3, Tx, x, y, j)
    223. Me.Invoke(PBGel, 100, 100, 100, 100, PBValue5)
    224. Me.Invoke(kDel, k)
    225. TxListSektor3.RemoveAt(i)
    226. xListSektor3.RemoveAt(i)
    227. yListSektor3.RemoveAt(i)
    228. i = i - 1
    229. k = k + 1
    230. j = j + 1
    231. Loop Until j > a
    232. a = TxListSektor4.Count - 1
    233. j = 0
    234. i = a
    235. Do
    236. Tx = Double.Parse(TxListSektor4.Item(i).ToString)
    237. x = Double.Parse(xListSektor4.Item(i).ToString)
    238. y = Double.Parse(yListSektor4.Item(i).ToString)
    239. PBValue5 = (Double.Parse(k.ToString) / Double.Parse(kges.ToString)) * 100
    240. Me.Invoke(ChartDel4, Tx, x, y, j)
    241. Me.Invoke(PBGel, 100, 100, 100, 100, PBValue5)
    242. Me.Invoke(kDel, k)
    243. TxListSektor4.RemoveAt(i)
    244. xListSektor4.RemoveAt(i)
    245. yListSektor4.RemoveAt(i)
    246. i = i - 1
    247. k = k + 1
    248. j = j + 1
    249. Loop Until j > a
    250. Me.Invoke(PBGel, 100, 100, 100, 100, 100)
    251. End Sub
    252. Private Sub Backgroundworker2_RunWorkerCompleted(sender As Object, e As System.ComponentModel.RunWorkerCompletedEventArgs) Handles BackgroundWorker2.RunWorkerCompleted
    253. For x As Double = -((d + 2 * s) / 1000) To ((d + 2 * s) / 1000) Step 0.001
    254. Chart1.Series("Rohr").Points.AddXY(x, Math.Sqrt((((d + 2 * s) / 1000) ^ 2) - (x ^ 2)))
    255. Chart1.Series("Rohr").Points.AddXY(x, -Math.Sqrt((((d + 2 * s) / 1000) ^ 2) - (x ^ 2)))
    256. Next
    257. Chart1.Series("Red").Color = Color.Red
    258. Chart1.Series("Violet").Color = Color.Violet
    259. Chart1.Series("Blue").Color = Color.Blue
    260. Chart1.ChartAreas("ChartArea1").AxisX.Minimum = 0
    261. Chart1.ChartAreas("ChartArea1").AxisX.Maximum = 12
    262. Chart1.ChartAreas("ChartArea1").AxisY.Minimum = z - 12
    263. Chart1.ChartAreas("ChartArea1").AxisY.Maximum = z
    264. Chart1.Visible = True
    265. Timer1.Stop()
    266. End Sub
    267. Public Sub ProgressBarChange(ByVal PBValue1 As Double, ByVal PBValue2 As Double, ByVal PBValue3 As Double, ByVal PBValue4 As Double, ByVal PBValue5 As Double)
    268. ProgressBar1.Value = PBValue1
    269. ProgressBar2.Value = PBValue2
    270. ProgressBar3.Value = PBValue3
    271. ProgressBar4.Value = PBValue4
    272. ProgressBar5.Value = PBValue5
    273. End Sub
    274. Public Sub ChartFill1(ByVal Tx As Double, ByVal x As Double, ByVal y As Double, ByVal j As Int64)
    275. If Tx >= 45 Then
    276. Chart1.Series("Red").Points.AddXY(x, y)
    277. Else
    278. If Tx >= 35 And Tx < 45 Then
    279. Chart1.Series("Violet").Points.AddXY(x, y)
    280. Else
    281. Chart1.Series("Blue").Points.AddXY(x, y)
    282. End If
    283. End If
    284. End Sub
    285. Public Sub ChartFill2(ByVal Tx As Double, ByVal x As Double, ByVal y As Double, ByVal j As Int64)
    286. If Tx >= 45 Then
    287. Chart1.Series("Red").Points.AddXY(x, y)
    288. Else
    289. If Tx >= 35 And Tx < 45 Then
    290. Chart1.Series("Violet").Points.AddXY(x, y)
    291. Else
    292. Chart1.Series("Blue").Points.AddXY(x, y)
    293. End If
    294. End If
    295. End Sub
    296. Public Sub ChartFill3(ByVal Tx As Double, ByVal x As Double, ByVal y As Double, ByVal j As Int64)
    297. If Tx >= 45 Then
    298. Chart1.Series("Red").Points.AddXY(x, y)
    299. Else
    300. If Tx >= 35 And Tx < 45 Then
    301. Chart1.Series("Violet").Points.AddXY(x, y)
    302. Else
    303. Chart1.Series("Blue").Points.AddXY(x, y)
    304. End If
    305. End If
    306. End Sub
    307. Public Sub ChartFill4(ByVal Tx As Double, ByVal x As Double, ByVal y As Double, ByVal j As Int64)
    308. If Tx >= 45 Then
    309. Chart1.Series("Red").Points.AddXY(x, y)
    310. Else
    311. If Tx >= 35 And Tx < 45 Then
    312. Chart1.Series("Violet").Points.AddXY(x, y)
    313. Else
    314. Chart1.Series("Blue").Points.AddXY(x, y)
    315. End If
    316. End If
    317. End Sub
    318. Public Sub Point(ByVal k As Int64)
    319. Label12.Text = "Anzahl Datenpunkte: " & k
    320. End Sub
    321. Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
    322. Sek = Sek + 1
    323. If Sek = 60 Then
    324. Min = Min + 1
    325. Sek = 0
    326. End If
    327. Label11.Text = "Berechnungszeit: " & Min & " Min. " & Sek & " Sek."
    328. End Sub
    329. End Class

    Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von „affrop“ ()

    affrop schrieb:

    das kommt so nach etwa 3,2 mio. datenpunkten
    Das ist offensichtlich zu viel.
    Um einen Algorithmus zu entwickeln / zu testen nimm 30 Datensätze.
    Wenn alles läuft, versuch Dich an mehr Daten.
    Überlege, wieviel Pixel Dein Bildschirm breit und hoch ist, überlege, wie breit / hoch Dein ChartControl ist und überleg Dir dann, wieviel Datensätze überhaupt sinnvoll dargestellt werden können.
    Das Zauberwort heißt Datenvorverarbeitung.
    Falls Du diesen Code kopierst, achte auf die C&P-Bremse.
    Jede einzelne Zeile Deines Programms, die Du nicht explizit getestet hast, ist falsch :!:
    Ein guter .NET-Snippetkonverter (der ist verfügbar).
    Programmierfragen über PN / Konversation werden ignoriert!
    das problem liegt in der mathematik dahinter. stichwort finite-elemente-rechnung.
    das rechenbeispiel, was ich verwende kommt am ende etwa auf 20mio datenpunkte. das ist noch extrem wenig für ne fer.
    am ende muss eine darstellung rauskommen, die vollflächig farbverläufe darstellt. algorithmisch die daten zu filtern wird nahezu unmöglich, sonst gäbe es keine über den gesamten wertebereich der berechnung gültige lösung.
    das chart ist zu testzwecken erstmal fix auf 675x526px gesetzt. wenns dann mal irgendwann funktioniert soll der anwender die möglichkeit haben die form zu maximieren und was der dann für einen monitor oder grafikeinstellungen hat können nicht abgeschätzt werden. deshalb wäre es gut 20mio datenpunkte und mehr in eine chart-series prügeln zu können. es gibt ja auf der basis von cad diverse software die solche finite-elemente-rechnungen durchführt. also muss es ja irgendwie gehen diese vielzahl von datenpunkten in ein chart oder was ähnliches zu bringen.
    also ich kenne Charts nicht so, dass man da vollflächig ausmalt - millionen Punkte in allen möglichen Farben.

    Charts verstehe ich so, dass paar (< 100) Datenpunkte aufgenommen werden, und dann werden Linien dazwischen interpoliert.

    Bist du sicher, dass MS-ChartControl für dich das richtige ist?
    ich bin mir nicht sicher ob das chart das richtige control ist, aber auf jedenfall dass einzige was mir auf die schnelle einviel. ich bin gerne offen für alternative vorschläge.
    fakt ist jedenfalls, dass durch die finite-elemente-rechnung exakte datenpunkte durch mehrdimensionale matrizen ermittelt werden, die wesentlich für die analytische lösung sind. im zweifel müsste das chart zwischen jedem gebenenen datenpunkt eine linie zeichnen und auf der interpolieren.
    die anzahl der datenpunkte ist wesentlich durch die berechnung selbst definiert und nicht durch die eingabewerte. insofern kann mann daran nicht viel ändern. und da das ganze farbverläufe darstellen soll (sonst wäre es ja kein temperaturfeld) kanns unter umständen sein, dass jeder datenpunkt ne eigene farbe hat, je nach zugehöriger temperaur.
    zeichne dir doch erstmal alle Punkte in ein Usercontrol mittels GDI+. Das Control sollte die Punkte zum Beispiel in einem Dictionary verwalten (Location (Typ Point) und Value (Typ Color)). Du zeichnest die Punkte auf eine Bitmap, die du nur neu erstellst, wenn ein neuer Punkt hinzugefügt wird (oder sogar seltener). Im Paint Event deines Controls zeichnest du diese Bitmap, ggf verkleinert. So hast du alle Freiheiten und bist nicht durch das Chartcontrol limitiert.

    Skybird schrieb:

    Das sind ja Ubisoftmethoden hier !

    @ erfinder: die frage ist nur, wie die punkte in die picbox bringen, denn die berechneten datenpunkte sind x-y-relativ, also kartesisch. in ner picbox gibts ja kein koordinatensystem.

    @vb-checker: gibts da schon vorgefertigte controls oder müsste so ein ding selbst deklariert werden?
    @00yoshi: welchen bezuigpunkt haben deine x-y-koordinaten?
    die datenpunkte, die in meinem programm berechnet werden, beziehen sich auf ein standardisiertes kartesisches koordinatensystem dessen mittelpunkt (0;0) irgendwo liegen kann. währe dann also der mittelpuinkt des koordinatensystems in pixel in der bitmap die obere linke ecke wie in allen andren controls oder ist das variabel?

    affrop schrieb:

    finite-elemente-rechnung.
    FEM
    Solch unwichtige Information gehört in den 1. Post!
    Da ist ein ChartControl völlig daneben, da brauchst Du was dynamisches, was mit Hardwarebeschleunigung. DirectX & Co oder WPF.
    Falls Du diesen Code kopierst, achte auf die C&P-Bremse.
    Jede einzelne Zeile Deines Programms, die Du nicht explizit getestet hast, ist falsch :!:
    Ein guter .NET-Snippetkonverter (der ist verfügbar).
    Programmierfragen über PN / Konversation werden ignoriert!