0% found this document useful (0 votes)
183 views23 pages

CSTR Calculation Routines

This document describes code for calculating chemical reactor simulations. It defines variables and functions for a continuous stirred tank reactor model, including properties of reactions, streams, and thermodynamic calculations.

Uploaded by

Sanjiv Ch
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
183 views23 pages

CSTR Calculation Routines

This document describes code for calculating chemical reactor simulations. It defines variables and functions for a continuous stirred tank reactor model, including properties of reactions, streams, and thermodynamic calculations.

Uploaded by

Sanjiv Ch
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

' ' ' ' ' ' ' ' ' ' ' ' ' ' '

' '

CSTR Calculation Routines Copyright 2008 Daniel Wagner O. de Medeiros This file is part of DWSIM. DWSIM is it under the Free (at your free software: you can redistribute it and/or modify the terms of the GNU General Public License as published by Software Foundation, either version 3 of the License, or option) any later version.

DWSIM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with DWSIM. If not, see <[Link] [Link] [Link] [Link] [Link] [Link] [Link]

Imports Imports Imports Imports Imports Imports

Namespace [Link] <[Link]()> Public Class Reactor_CSTR Inherits Reactor Protected m_vol As Double Protected m_isotemp As Double Dim Dim Dim Dim Dim Dim Dim Dim C0 As Dictionary(Of String, Double) C As Dictionary(Of String, Double) Ri As Dictionary(Of String, Double) Kf, Kr As ArrayList DN As Dictionary(Of String, Double) N00 As Dictionary(Of String, Double) Rxi As Dictionary(Of String, Double) DHRi As Dictionary(Of String, Double)

Dim activeAL As Integer = 0 <[Link]()> Dim form As FormFlowsheet <[Link]()> Dim ims As [Link] <[Link]()> Dim pp As [Link] <[Link]()> Dim ppr As New [Link]() Public Property IsothermalTemperature() As Double Get Return m_isotemp End Get Set(ByVal value As Double) m_isotemp = value End Set End Property

Public Property Volume() As Double Get Return m_vol End Get Set(ByVal value As Double) m_vol = value End Set End Property Public Sub New(ByVal nome As String, ByVal descricao As String) [Link]() Me.m_ComponentName = nome Me.m_ComponentDescription = descricao [Link]() [Link]() [Link] = False N00 = New Dictionary(Of String, Double) DN = New Dictionary(Of String, Double) C0 = New Dictionary(Of String, Double) C = New Dictionary(Of String, Double) Ri = New Dictionary(Of String, Double) Rxi = New Dictionary(Of String, Double) DHRi = New Dictionary(Of String, Double) Kf = New ArrayList Kr = New ArrayList End Sub Public Sub ODEFunc(ByVal y As Double(), ByRef dy As Double()) Dim Dim Dim Dim i As Integer = j As Integer = scBC As Double BC As String = 0 0 = 0 ""

'loop through reactions Dim rxn As Reaction Dim ar As ArrayList = [Link](activeAL) i = 0 Do 'process reaction i rxn = [Link](ar(i)) For Each sb As ReactionStoichBase In [Link] Ri([Link]) = 0 Next i += 1 Loop Until i = [Link] i = 0 Do 'process reaction i rxn = [Link](ar(i)) BC = [Link] scBC = [Link](BC).StoichCoeff j = 1 For Each sb As ReactionStoichBase In [Link]

C([Link]) = y(j) j = j + 1 Next Dim T As Double = [Link](0).[Link] Dim kxf As Double = rxn.A_Forward * Exp(-rxn.E_Forward / (8.314 * T)) Dim kxr As Double = rxn.A_Reverse * Exp(-rxn.E_Reverse / (8.314 * T)) If T < [Link] Or T > [Link] Then kxf = 0 kxr = 0 End If Dim rx As Double = 0 Dim rxf As Double = 1 Dim rxr As Double = 1 'kinetic expression For Each sb As ReactionStoichBase In [Link] rxf *= C([Link]) ^ [Link] rxr *= C([Link]) ^ [Link] Next rx = kxf * rxf - kxr * rxr Rxi([Link]) = rx Kf(i) = kxf Kr(i) = kxr For Each sb As ReactionStoichBase In [Link] Ri([Link]) += rx * [Link] / [Link](BC).StoichCoeff Next i += 1 Loop Until i = [Link] j = 1 For Each kv As KeyValuePair(Of String, Double) In Ri dy(j) = -[Link] * [Link] j += 1 Next End Sub Public Overrides Function Calculate(Optional ByVal args As Object = Nothing) As Integer If Rxi Is Nothing Then Rxi = New Dictionary(Of String, Double) If DHRi Is Nothing Then DHRi = New Dictionary(Of String, Double) If DN Is Nothing Then DN = New Dictionary(Of String, Double)

If N00 Is Nothing Then N00 = New Dictionary(Of String, Double) If [Link] Is Nothing Then Me.m_conversions = New Dictionary(Of String, Double) If [Link] Is Nothing Then Me.m_componentconversions = New Dictionary(Of String, Double) form = [Link] Dim objargs As New [Link] If Not [Link](0).IsAttached Then 'Call function to calculate flowsheet With objargs .Calculado = False .Nome = [Link] .Tipo = TipoObjeto.RCT_CSTR End With CalculateFlowsheet(FlowSheet, objargs, Nothing) Throw New Exception([Link]("Nohcorrentedematriac16")) ElseIf Not [Link](0).IsAttached Then 'Call function to calculate flowsheet With objargs .Calculado = False .Nome = [Link] .Tipo = TipoObjeto.RCT_CSTR End With CalculateFlowsheet(FlowSheet, objargs, Nothing) Throw New Exception([Link]("Nohcorrentedematriac15")) ElseIf Not [Link](1).IsAttached Then 'Call function to calculate flowsheet With objargs .Calculado = False .Nome = [Link] .Tipo = TipoObjeto.RCT_CSTR End With CalculateFlowsheet(FlowSheet, objargs, Nothing) Throw New Exception([Link]("Nohcorrentedeenerg17")) End If ims = [Link].CLCS_MaterialStreamCollection([Link] tors(0).[Link]).Clone pp = [Link] ppr = New [Link]() [Link]() [Link]() [Link]() [Link]() [Link] = 0 [Link] = 0 [Link]() 'check active reactions (kinetic only) in the reaction set For Each rxnsb As ReactionSetBase In [Link]([Link]).[Link]

If [Link]([Link]).ReactionType = [Link] And [Link] Then [Link]([Link]) End If Next 'order reactions Dim i As Integer i = 0 Dim maxrank As Integer = 0 For Each rxnsb As ReactionSetBase In [Link]([Link]).[Link] If [Link] > maxrank And [Link]([Link]) Then maxrank = [Link] Next 'ordering of parallel reactions i = 0 Dim arr As New ArrayList Do arr = New ArrayList For Each rxnsb As ReactionSetBase In [Link]([Link]).[Link] If [Link] = i And [Link]([Link]) Then [Link]([Link]) Next If [Link] > 0 Then [Link](i, arr) i = i + 1 Loop Until i = maxrank + 1 [Link] = ims [Link] = ims Dim N0 As New Dictionary(Of String, Double) Dim N As New Dictionary(Of String, Double) Dim DNT As New Dictionary(Of String, Double) C = New Dictionary(Of String, Double) C0 = New Dictionary(Of String, Double) Kf = New ArrayList([Link]) Kr = New ArrayList([Link]) Dim scBC, DHr, Hid_r, Hid_p, Hr, Hr0, Hp, Tin, Tin0, Pin, Pout, T As Double Dim BC As String = "" Dim tmp As Object Dim maxXarr As New ArrayList Select Case [Link] Case [Link] 'Reactants Enthalpy before temperature change (kJ/kg * kg/s = kW) Hr0 = [Link](0).[Link] * [Link](0).[Link] Tin0 = [Link](0).[Link]

If [Link] = 0.0# Then [Link] = [Link](0).[Link] [Link](0).[Link] = [Link] With pp .DW_CalcEquilibrium([Link].T, [Link].P) If [Link](3).[Link] > 0 Then .DW_CalcPhaseProps([Link].Liquid1) Else .DW_ZerarPhaseProps([Link].Liquid1) End If If [Link](4).[Link] > 0 Then .DW_CalcPhaseProps([Link].Liquid2) Else .DW_ZerarPhaseProps([Link].Liquid2) End If If [Link](5).[Link] > 0 Then .DW_CalcPhaseProps([Link].Liquid3) Else .DW_ZerarPhaseProps([Link].Liquid3) End If If [Link](6).[Link] > 0 Then .DW_CalcPhaseProps([Link]) Else .DW_ZerarPhaseProps([Link]) End If If [Link](7).[Link] > 0 Then .DW_CalcPhaseProps([Link]) Else .DW_ZerarPhaseProps([Link]) End If If [Link](2).[Link] > 0 Then .DW_CalcPhaseProps([Link]) Else .DW_ZerarPhaseProps([Link]) End If

If [Link](2).[Link] >= 0 And [Link](2).[Link] < 1 Then .DW_CalcPhaseProps([Link]) Else .DW_ZerarPhaseProps([Link]) End If .DW_CalcCompMolarFlow(-1) .DW_CalcCompMassFlow(-1) .DW_CalcCompVolFlow(-1) .DW_CalcOverallProps() .DW_CalcTwoPhaseProps([Link], [Link]) .DW_CalcVazaoVolumetrica() .DW_CalcKvalue() End With End Select Tin = [Link](0).[Link] Pin = [Link](0).[Link] Pout = [Link](0).[Link] [Link] [Link](0).[Link] = Pout 'Reactants Enthalpy (kJ/kg * kg/s = kW) Hr = [Link](0).[Link] * [Link](0).[Link] [Link]() 'loop through reactions Dim rxn As Reaction For Each ar As ArrayList In [Link] i = 0 DHr = 0 Hid_r = 0 Hid_p = 0 Do 'process reaction i rxn = [Link](ar(i)) 'initial mole flows For Each sb As ReactionStoichBase In [Link] Select Case [Link] Case [Link] If Not [Link]([Link]) Then [Link]([Link], [Link](3).Componentes([Link]).[Link]) [Link]([Link], N0([Link])) [Link]([Link], N0([Link]))

[Link]([Link], N0([Link]) / [Link](3).SPMProperties.volumetric_flow.GetValueOrDefault) Else N0([Link]) = [Link](3).Componentes([Link]).[Link] N([Link]) = N0([Link]) C0([Link]) = N0([Link]) / [Link](3).SPMProperties.volumetric_flow.GetValueOrDefault End If Case [Link] If Not [Link]([Link]) Then [Link]([Link], [Link](2).Componentes([Link]).[Link]) [Link]([Link], N0([Link])) [Link]([Link], N0([Link])) [Link]([Link], N0([Link]) / [Link](2).SPMProperties.volumetric_flow.GetValueOrDefault) Else N0([Link]) = [Link](2).Componentes([Link]).[Link] N([Link]) = N0([Link]) C0([Link]) = N0([Link]) / [Link](2).SPMProperties.volumetric_flow.GetValueOrDefault End If Case [Link] If Not [Link]([Link]) Then [Link]([Link], [Link](0).Componentes([Link]).[Link]) [Link]([Link], N0([Link])) [Link]([Link], N0([Link])) [Link]([Link], N0([Link]) / [Link](0).SPMProperties.volumetric_flow.GetValueOrDefault) Else N0([Link]) = [Link](0).Componentes([Link]).[Link] N([Link]) = N0([Link]) C0([Link]) = N0([Link]) / [Link](0).SPMProperties.volumetric_flow.GetValueOrDefault End If End Select Next i += 1 Loop Until i = [Link] [Link]() [Link]() [Link]() i = 0 Do 'process reaction i rxn = [Link](ar(i)) BC = [Link] scBC = [Link](BC).StoichCoeff For Each sb As ReactionStoichBase In [Link]

C([Link]) = C0([Link]) Next T = [Link](0).[Link] Dim kxf As Double = rxn.A_Forward * Exp(-rxn.E_Forward / (8.314 * T)) Dim kxr As Double = rxn.A_Reverse * Exp(-rxn.E_Reverse / (8.314 * T)) Dim rx As Double = 0 Dim rxf As Double = 1 Dim rxr As Double = 1 'kinetic expression For Each sb As ReactionStoichBase In [Link] rxf *= C([Link]) ^ [Link] rxr *= C([Link]) ^ [Link] Next rx = kxf * rxf - kxr * rxr If Not [Link]([Link]) Then [Link]([Link], rx) Else Rxi([Link]) = rx End If If [Link] - 1 <= i Then [Link](kxf) [Link](kxf) Else Kf(i) = kxf Kr(i) = kxr End If For Each sb As ReactionStoichBase In [Link] If Not [Link]([Link]) Then [Link]([Link], 0) End If Next For Each sb As ReactionStoichBase In [Link] Ri([Link]) += rx * [Link] / [Link](BC).StoichCoeff Next i += 1 Loop Until i = [Link] ' ' SOLVE ODEs

' [Link] = [Link](ar) Dim vc([Link]) As Double 'vc(1) = [Link] i = 1 For Each d As Double In [Link] vc(i) = d i = i + 1 Next Dim bs As New [Link] [Link](AddressOf ODEFunc) [Link](0, [Link], vc, [Link], 0.05 * [Link], 0.000001, True) [Link]() i = 1 For Each sb As KeyValuePair(Of String, Double) In C0 C([Link]) = CDbl(vc(i)) i = i + 1 Next i = 0 Do 'process reaction i rxn = [Link](ar(i)) BC = [Link] scBC = [Link](BC).StoichCoeff For Each sb As ReactionStoichBase In [Link] ''comp. conversions If Not [Link]([Link]) Then [Link]([Link], 0) End If Next i += 1 Loop Until i = [Link] For Each sb As String In [Link] If N0(sb) <> 0.0# Then N(sb) = N0(sb) * (1 - (C0(sb) C(sb)) / C0(sb)) Else N(sb) = 0.0# Next For Each sb As String In [Link] If Not [Link](sb) Then [Link](sb, N(sb) - N0(sb)) Else DN(sb) = N(sb) - N0(sb) End If Next For Each sb As String In [Link]

If Not [Link](sb) Then [Link](sb, DN(sb)) Else DNT(sb) += DN(sb) End If Next 'Ideal Gas Reactants Enthalpy (kJ/kg * kg/s = kW) Hid_r += 0 'ppr.RET_Hid(298.15, [Link](0).[Link], [Link]) * [Link](0).[Link] 'update mole flows/fractions Dim Nsum As Double = 0 'compute new mole flows 'Nsum = [Link](0).[Link] For Each s2 As Substancia In [Link](0).[Link] If [Link]([Link]) Then Nsum += N([Link]) Else Nsum += [Link] End If Next For Each s2 As Substancia In [Link](0).[Link] If [Link]([Link]) Then [Link] = ([Link](0).Componentes([Link]).[Link] + DN([Link])) / Nsum [Link] = [Link](0).Componentes([Link]).[Link] + DN([Link]) Else [Link] = [Link](0).Componentes([Link]).[Link] / Nsum [Link] = [Link](0).Componentes([Link]).[Link] End If Next [Link](0).[Link] = Nsum Dim mmm As Double = 0 Dim mf As Double = 0 For Each s3 As Substancia In [Link](0).[Link] mmm += [Link] * [Link].Molar_Weight Next For Each s3 As Substancia In [Link](0).[Link] [Link] = [Link] * [Link].Molar_Weight / mmm [Link] = [Link] * [Link](0).[Link] mf += [Link] Next

'Ideal Gas Products Enthalpy (kJ/kg * kg/s = kW) Hid_p += 0 'ppr.RET_Hid(298.15, [Link](0).[Link], [Link]) * [Link](0).[Link] Dim NS As New Dictionary(Of String, Double) i = 0 Do 'process reaction i rxn = [Link](ar(i)) If [Link]([Link]) Then NS([Link]) += Rxi([Link]) Else [Link]([Link], Rxi([Link])) End If i += 1 Loop Until i = [Link] i = 0 Do 'process reaction i rxn = [Link](ar(i)) 'Heat released (or absorbed) (kJ/s = kW) (Ideal Gas) Select Case [Link] Case [Link] DHr = [Link] * Abs(DN([Link])) / 1000 * Rxi([Link]) / Ri([Link]) Case [Link] DHr += [Link] * Abs(DN([Link])) / 1000 * Rxi([Link]) / Ri([Link]) End Select [Link]([Link], DHr) i += 1 Loop Until i = [Link] ' comp. conversions For Each sb As Substancia In [Link](0).[Link] If [Link]([Link]) Then [Link]([Link]) += -DNT([Link]) / N00([Link]) End If Next 'do a flash calc (calculate final temperature/enthalpy) Select Case [Link] Case [Link]

[Link] = [Link].CLCS_EnergyStreamCollection([Link] rs(1).[Link]).[Link] 'Products Enthalpy (kJ/kg * kg/s = kW) Hp = [Link] + Hr + Hid_p Hid_r - DHr tmp = [Link].DW_CalcEquilibrio_ISOL([Link].P, [Link].H, Pout, Hp / [Link](0).[Link], Tin) Dim Tout As Double = tmp(2) [Link] = Tout - Tin [Link](0).[Link] = Tout With pp .DW_CalcEquilibrium([Link].T, [Link].P) If [Link](3).[Link] > 0 Then .DW_CalcPhaseProps([Link].Liquid1) Else .DW_ZerarPhaseProps([Link].Liquid1) End If If [Link](4).[Link] > 0 Then .DW_CalcPhaseProps([Link].Liquid2) Else .DW_ZerarPhaseProps([Link].Liquid2) End If If [Link](5).[Link] > 0 Then .DW_CalcPhaseProps([Link].Liquid3) Else .DW_ZerarPhaseProps([Link].Liquid3) End If If [Link](6).[Link] > 0 Then .DW_CalcPhaseProps([Link]) Else .DW_ZerarPhaseProps([Link]) End If If [Link](7).[Link] > 0 Then .DW_CalcPhaseProps([Link]) Else .DW_ZerarPhaseProps([Link])

End If If [Link](2).[Link] > 0 Then .DW_CalcPhaseProps([Link]) Else .DW_ZerarPhaseProps([Link]) End If If [Link](2).[Link] >= 0 And [Link](2).[Link] < 1 Then .DW_CalcPhaseProps([Link]) Else .DW_ZerarPhaseProps([Link]) End If .DW_CalcCompMolarFlow(-1) .DW_CalcCompMassFlow(-1) .DW_CalcCompVolFlow(-1) .DW_CalcOverallProps() .DW_CalcTwoPhaseProps([Link], [Link]) .DW_CalcVazaoVolumetrica() .DW_CalcKvalue() End With Case [Link] With pp .DW_CalcEquilibrium([Link].T, [Link].P) If [Link](3).[Link] > 0 Then .DW_CalcPhaseProps([Link].Liquid1) Else .DW_ZerarPhaseProps([Link].Liquid1) End If If [Link](4).[Link] > 0 Then .DW_CalcPhaseProps([Link].Liquid2) Else .DW_ZerarPhaseProps([Link].Liquid2) End If If [Link](5).[Link] > 0 Then .DW_CalcPhaseProps([Link].Liquid3) Else .DW_ZerarPhaseProps([Link].Liquid3)

End If If [Link](6).[Link] > 0 Then .DW_CalcPhaseProps([Link]) Else .DW_ZerarPhaseProps([Link]) End If If [Link](7).[Link] > 0 Then .DW_CalcPhaseProps([Link]) Else .DW_ZerarPhaseProps([Link]) End If If [Link](2).[Link] > 0 Then .DW_CalcPhaseProps([Link]) Else .DW_ZerarPhaseProps([Link]) End If If [Link](2).[Link] >= 0 And [Link](2).[Link] < 1 Then .DW_CalcPhaseProps([Link]) Else .DW_ZerarPhaseProps([Link]) End If .DW_CalcCompMolarFlow(-1) .DW_CalcCompMassFlow(-1) .DW_CalcCompVolFlow(-1) .DW_CalcOverallProps() .DW_CalcTwoPhaseProps([Link], [Link]) .DW_CalcVazaoVolumetrica() .DW_CalcKvalue() End With End Select Next If [Link] = [Link] Then 'Products Enthalpy (kJ/kg * kg/s = kW) Hp = [Link](0).[Link] * [Link](0).[Link] 'Heat (kW) [Link] = DHr + Hp - Hr0 [Link] = Tin - Tin0 End If

Dim ms As [Link] Dim cp As ConnectionPoint Dim mtotal, wtotal As Double cp = [Link](0) If [Link] Then ms = [Link].CLCS_MaterialStreamCollection([Link] [Link]) With ms .Fases(0).[Link] = [Link](0).[Link] .Fases(0).[Link] = 1 .Fases(0).[Link] = [Link](0).[Link] .Fases(0).[Link] = [Link](0).[Link] .Fases(0).[Link] = [Link](0).[Link] Dim comp As [Link] mtotal = 0 wtotal = 0 For Each comp In .Fases(0).[Link] mtotal += [Link](0).Componentes([Link]).[Link] wtotal += [Link](0).Componentes([Link]).[Link] Next For Each comp In .Fases(0).[Link] [Link] = [Link](0).Componentes([Link]).[Link] / mtotal [Link] = [Link](0).Componentes([Link]).[Link] / wtotal [Link] = [Link] * .Fases(0).[Link] [Link] = [Link] * .Fases(0).[Link] Next End With End If 'Corrente de energia - atualizar valor da potncia (kJ/s) With [Link].CLCS_EnergyStreamCollection([Link] rs(1).[Link]) .Energia = [Link] .[Link] = True End With 'Call function to calculate flowsheet With objargs .Calculado = True .Nome = [Link] .Tag = [Link] .Tipo = TipoObjeto.RCT_CSTR End With [Link](objargs)

End Function Public Overrides Function DeCalculate() As Integer 'If Not [Link](0).IsAttached Then Throw New Exception([Link]("Nohcorrentedematriac10")) 'If Not [Link](0).IsAttached Then Throw New Exception([Link]("Nohcorrentedematriac11")) 'If Not [Link](1).IsAttached Then Throw New Exception([Link]("Nohcorrentedematriac11")) Dim form As [Link] = [Link] 'Dim ems As [Link] = [Link].CLCS_MaterialStreamCollection([Link] tors(0).[Link]) 'Dim W As Double = [Link](0).[Link] Dim j As Integer = 0 Dim ms As [Link] Dim cp As ConnectionPoint cp = [Link](0) If [Link] Then ms = [Link].CLCS_MaterialStreamCollection([Link] [Link]) With ms .Fases(0).[Link] = Nothing .Fases(0).[Link] = Nothing .Fases(0).[Link] = Nothing Dim comp As [Link] j = 0 For Each comp In .Fases(0).[Link] [Link] = 0 [Link] = 0 j += 1 Next .Fases(0).[Link] = Nothing .Fases(0).[Link] = 1 .Fases(0).[Link] = 1 .[Link] = False End With End If 'Call function to calculate flowsheet Dim objargs As New [Link] With objargs .Calculado = False .Nome = [Link] .Tipo = TipoObjeto.RCT_CSTR End With [Link](objargs) End Function

Public Overrides Sub QTFillNodeItems() End Sub Public Overrides Sub UpdatePropertyNodes(ByVal su As [Link], ByVal nf As String) End Sub Public Overrides Sub PopulatePropertyGrid(ByRef pgrid As [Link], ByVal su As [Link]) Dim Conversor As New [Link] With pgrid .PropertySort = [Link] .ShowCustomProperties = True .[Link]() [Link](pgrid, su) Dim ent, saida, energ As String If [Link](0).IsAttached = True Then ent = [Link](0).[Link] Else ent = "" End If If [Link](0).IsAttached = True Then saida = [Link](0).[Link] Else saida = "" End If If [Link](1).IsAttached = True Then energ = [Link](1).[Link] Else energ = "" End If .[Link]([Link]("Correntedeentrada"), ent, False, [Link]("Conexes1"), "", True) With .Item(.[Link] - 1) .DefaultValue = Nothing .CustomEditor = New [Link] End With .[Link]([Link]("Correntedesada"), saida, False, [Link]("Conexes1"), "", True) With .Item(.[Link] - 1) .DefaultValue = Nothing .CustomEditor = New [Link]

End With .[Link]([Link]("Correntedeenergia"), energ, False, [Link]("Conexes1"), "", True) With .Item(.[Link] - 1) .DefaultValue = Nothing .CustomEditor = New [Link] End With .[Link]([Link]("RConvPGridItem1"), [Link]([Link]).Name, False, [Link]("Parmetrosdeclculo2"), [Link]("RConvPGridItem1Help"), True) With .Item(.[Link] - 1) .CustomEditor = New [Link] .IsDropdownResizable = True End With .[Link]([Link]("RConvPGridItem2"), Me, "ReactorOperationMode", False, [Link]("Parmetrosdeclculo2"), [Link]("RConvPGridItem2Help"), True) With .Item(.[Link] - 1) .IsBrowsable = False End With Dim valor As String If [Link] = [Link] Then valor = Format([Link](su.spmp_temperature, [Link]), [Link]) .[Link](FT([Link]("RSCTRIsothermalTemperature"), su.spmp_temperature), valor, False, [Link]("Parmetrosdeclculo2"), [Link]("RCSTRPGridItem1Help"), True) End If valor = Format([Link](su.spmp_deltaP, [Link]), [Link]) .[Link](FT([Link]("Quedadepresso"), su.spmp_deltaP), valor, False, [Link]("Parmetrosdeclculo2"), [Link]("Quedadepressoaplicad6"), True) With .Item(.[Link] - 1) .DefaultValue = Nothing .DefaultType = GetType(Nullable(Of Double)) End With valor = Format([Link]([Link], [Link]), [Link]) .[Link](FT([Link]("RCSTRPGridItem1"), [Link]), valor, False, [Link]("Parmetrosdeclculo2"), [Link]("RCSTRPGridItem1Help"), True) With .Item(.[Link] - 1) .DefaultValue = Nothing .DefaultType = GetType(Nullable(Of Double)) End With

If [Link] Then .[Link](FT([Link]("DeltaT2"), su.spmp_deltaT), Format([Link](su.spmp_deltaT, [Link]), [Link]), True, [Link]("Resultados3"), [Link]("Diferenadetemperatur"), True) With .Item(.[Link] - 1) .DefaultValue = Nothing .DefaultType = GetType(Nullable(Of Double)) End With .[Link](FT([Link]("RConvPGridItem3"), su.spmp_heatflow), Format([Link](su.spmp_heatflow, [Link]), [Link]), True, [Link]("Resultados3"), "", True) With .Item(.[Link] - 1) .DefaultValue = Nothing .DefaultType = GetType(Nullable(Of Double)) End With 'CustomPropertyCollection Dim m As New [Link]() For Each dbl As KeyValuePair(Of String, Double) In [Link] valor = Format([Link] * 100, [Link]) If [Link] >= 0 Then [Link]([Link]([Link]), valor, False, [Link]("ComponentesConversoes"), [Link]("RCSTRPGridItem3Help"), True) [Link]([Link] - 1).IsReadOnly = True [Link]([Link] - 1).DefaultValue = Nothing [Link]([Link] - 1).DefaultType = GetType(Nullable(Of Double)) End If Next .[Link]([Link]("ComponentesConversoes") & " (%)", m, True, [Link]("Resultados3"), [Link]("RCSTRPGridItem2Help"), True) With .Item(.[Link] - 1) .IsReadOnly = True .IsBrowsable = True .BrowsableLabelStyle = [Link] .CustomEditor = New [Link] End With 'CustomPropertyCollection Dim m2 As New [Link]() For Each dbl As KeyValuePair(Of String, Double) In Rxi [Link]([Link]([Link]).Name, Format([Link] / C([Link]([Link]).BaseReactant), [Link]), False, [Link]("ReactionExtents"), [Link](""), True)

[Link]([Link] - 1).IsReadOnly = True [Link]([Link] - 1).DefaultValue = Nothing [Link]([Link] - 1).DefaultType = GetType(Nullable(Of Double)) Next .[Link](FT([Link]("ReactionExtents"), su.spmp_molarflow), m2, True, [Link]("Resultados3"), [Link](""), True) With .Item(.[Link] - 1) .IsReadOnly = True .IsBrowsable = True .BrowsableLabelStyle = [Link] .CustomEditor = New [Link] End With 'CustomPropertyCollection Dim m3 As New [Link]() For Each dbl As KeyValuePair(Of String, Double) In Rxi [Link]([Link]([Link]).Name, Format([Link] / C([Link]([Link]).BaseReactant) / [Link], [Link]), False, [Link]("ReactionExtents"), [Link](""), True) [Link]([Link] - 1).IsReadOnly = True [Link]([Link] - 1).DefaultValue = Nothing [Link]([Link] - 1).DefaultType = GetType(Nullable(Of Double)) Next .[Link](FT([Link]("ReactionRates"), su.reac_rate), m3, True, [Link]("Resultados3"), [Link](""), True) With .Item(.[Link] - 1) .IsReadOnly = True .IsBrowsable = True .BrowsableLabelStyle = [Link] .CustomEditor = New [Link] End With 'CustomPropertyCollection Dim m4 As New [Link]() For Each dbl As KeyValuePair(Of String, Double) In DHRi [Link]([Link]([Link]).Name, Format([Link](su.spmp_heatflow, [Link]), [Link]), False, [Link]("ReactionHeats"), [Link](""), True) [Link]([Link] - 1).IsReadOnly = True [Link]([Link] - 1).DefaultValue = Nothing [Link]([Link] - 1).DefaultType = GetType(Nullable(Of Double)) Next

.[Link](FT([Link]("ReactionHeats"), su.spmp_heatflow), m4, True, [Link]("Resultados3"), [Link](""), True) With .Item(.[Link] - 1) .IsReadOnly = True .IsBrowsable = True .BrowsableLabelStyle = [Link] .CustomEditor = New [Link] End With End If End With End Sub Public Overrides Function GetPropertyValue(ByVal prop As String, Optional ByVal su As [Link] = Nothing) As Object If su Is Nothing Then su = New [Link] Dim cv As New [Link] Dim value As Double = 0 Dim propidx As Integer = CInt([Link]("_")(2)) Select Case propidx Case 0 'PROP_HT_0 Pressure Drop value = [Link](su.spmp_deltaP, [Link]) End Select Return value End Function Public Overloads Overrides Function GetProperties(ByVal proptype As SimulationObjects_BaseClass.PropertyType) As String() Dim i As Integer = 0 Dim proplist As New ArrayList Select Case proptype Case [Link] For i = 0 To 0 [Link]("PROP_CS_" + CStr(i)) Next Case [Link] For i = 0 To 0 [Link]("PROP_CS_" + CStr(i)) Next Case [Link] For i = 0 To 0 [Link]("PROP_CS_" + CStr(i)) Next End Select Return [Link](GetType([Link])) proplist = Nothing End Function

Public Overrides Function SetPropertyValue(ByVal prop As String, ByVal propval As Object, Optional ByVal su As [Link] = Nothing) As Object If su Is Nothing Then su = New [Link] Dim cv As New [Link] Dim propidx As Integer = CInt([Link]("_")(2)) Select Case propidx Case 0 'PROP_HT_0 Pressure Drop [Link] = [Link](su.spmp_deltaP, propval) End Select Return 1 End Function Public Overrides Function GetPropertyUnit(ByVal prop As String, Optional ByVal su As [Link] = Nothing) As Object If su Is Nothing Then su = New [Link] Dim cv As New [Link] Dim value As String = "" Dim propidx As Integer = CInt([Link]("_")(2)) Select Case propidx Case 0 'PROP_HT_0 Pressure Drop value = su.spmp_deltaP End Select Return value End Function End Class End Namespace

You might also like