Skip to content

Commit

Permalink
Merge branch 'DanWBR:windows' into windows
Browse files Browse the repository at this point in the history
  • Loading branch information
mersadk authored Feb 15, 2024
2 parents 7152b4c + 06e035e commit 07edcf7
Show file tree
Hide file tree
Showing 55 changed files with 2,553 additions and 3,089 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,11 @@ TCPServer/bin/Debug/*
/DWSIM.Inspector/.vs
/DWSIM.SharedClasses/.vs
/DWSIM.Thermodynamics.ReaktoroPropertyPackage/.vs
/DWSIM.DrawingTools.Point/.vs
/DWSIM.DrawingTools.SkiaSharp.Tests/.vs
/DWSIM.ExtensionMethods/.vs
/DWSIM.FlowsheetBase/.vs
/DWSIM.Math.SwarmOps/.vs
/DWSIM.Plugins.HeatOfCombustion/.vs
/DWSIM.ProFeatures/.vs
/DWSIM.Thermodynamics/.vs
250 changes: 156 additions & 94 deletions DWSIM.Drawing.SkiaSharp/GraphicObjects/Table/FloatingTable.vb

Large diffs are not rendered by default.

27 changes: 18 additions & 9 deletions DWSIM.DynamicsManager/Manager.vb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Imports OxyPlot.Axes
Imports DWSIM.SharedClasses.SystemsOfUnits
Imports interp = DWSIM.MathOps.MathEx.Interpolation
Imports cv = DWSIM.SharedClasses.SystemsOfUnits.Converter
Imports OxyPlot.Series

Public Class Manager

Expand Down Expand Up @@ -124,15 +125,6 @@ Public Class Manager
.Title = String.Format("Time ({0})", su.time)
})

model.Axes.Add(New LinearAxis() With {
.MajorGridlineStyle = LineStyle.Dash,
.MinorGridlineStyle = LineStyle.Dot,
.Position = AxisPosition.Left,
.FontSize = 10,
.Title = "",
.Key = "0"
})

model.LegendFontSize = 10
model.LegendPlacement = LegendPlacement.Outside
model.LegendOrientation = LegendOrientation.Horizontal
Expand All @@ -143,6 +135,21 @@ Public Class Manager
Return model
End If

i = 0
For Each item In integrator.MonitoredVariables
model.Axes.Add(New LinearAxis() With {
.MajorGridlineStyle = LineStyle.Dash,
.MinorGridlineStyle = LineStyle.Dot,
.Position = AxisPosition.Left,
.FontSize = 10,
.Key = item.ID,
.Title = integrator.MonitoredVariables(i).Description + If(item.PropertyUnits <> "", " (" + item.PropertyUnits + ")", ""),
.PositionTier = i,
.AxislineStyle = LineStyle.Solid
})
i += 1
Next

Dim values As New List(Of List(Of Double))
Dim names As New List(Of String)
For Each var In integrator.MonitoredVariables
Expand All @@ -165,6 +172,8 @@ Public Class Manager
i = 0
For Each l In values
model.AddLineSeries(xavals, l, names(i))
DirectCast(model.Series(model.Series.Count - 1), LineSeries).Tag = integrator.MonitoredVariables(i).ID
DirectCast(model.Series(model.Series.Count - 1), LineSeries).YAxisKey = integrator.MonitoredVariables(i).ID
i += 1
Next

Expand Down
14 changes: 14 additions & 0 deletions DWSIM.ExtensionMethods/General.vb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,20 @@ Public Module General

End Function

<System.Runtime.CompilerServices.Extension()>
Public Function Chunk(Of T)(ByVal locations As List(Of T), ByVal Optional nSize As Integer = 30) As List(Of List(Of T))

Dim list = New List(Of List(Of T))()
Dim i As Integer = 0
While i < locations.Count
list.Add(locations.GetRange(i, Math.Min(nSize, locations.Count - i)))
i += nSize
End While

Return list

End Function


<System.Runtime.CompilerServices.Extension()>
Public Sub RemoveVariable(exobj As System.Dynamic.ExpandoObject, varname As String)
Expand Down
32 changes: 31 additions & 1 deletion DWSIM.FlowsheetSolver/FlowsheetSolver.vb
Original file line number Diff line number Diff line change
Expand Up @@ -1079,6 +1079,22 @@ Public Delegate Sub CustomEvent2(ByVal objinfo As CalculationArgs)
listidx -= 1
Loop

'special loop for batch unit ops in dynamic mode

If fbag.DynamicMode Then
For Each baseobj In fbag.SimulationObjects.Values
If TypeOf baseobj Is IUnitOperation AndAlso baseobj.SupportsDynamicMode Then
Dim inletconnected = baseobj.GraphicObject.InputConnectors.Where(Function(c) c.IsAttached).Count
Dim outletconnected = baseobj.GraphicObject.OutputConnectors.Where(Function(c) c.IsAttached).Count
Dim n_inlets = baseobj.GraphicObject.InputConnectors.Count
Dim n_outlets = baseobj.GraphicObject.OutputConnectors.Count
If inletconnected = 0 And outletconnected = 0 And (n_inlets + n_outlets) > 0 Then
objstack.Add(baseobj.Name)
End If
End If
Next
End If

End If

Return New Object() {objstack, lists, filteredlist}
Expand Down Expand Up @@ -1186,11 +1202,25 @@ Public Delegate Sub CustomEvent2(ByVal objinfo As CalculationArgs)

Dim objl As Object()
Try

objl = GetSolvingList(fobj, frompgrid)

Catch ex As Exception

FinishAny?.Invoke()
GlobalSettings.Settings.CalculatorBusy = False
FinishWithErrors?.Invoke()

Settings.CalculatorBusy = False

Dim euid As String = Guid.NewGuid().ToString()
ExceptionProcessing.ExceptionList.Exceptions.Add(euid, ex)

fgui.ShowMessage(ex.Message, IFlowsheet.MessageType.GeneralError, euid)
IObj?.Paragraphs.Add(ex.Message)

RaiseEvent FlowsheetCalculationFinished(fobj, New System.EventArgs(), New List(Of Exception)({ex}))
Return New List(Of Exception)({ex})

End Try

'assign the list of objects, the filtered list (which contains no duplicate elements) and the object stack
Expand Down
2 changes: 2 additions & 0 deletions DWSIM.Interfaces/IFlowsheetOptions.vb
Original file line number Diff line number Diff line change
Expand Up @@ -146,4 +146,6 @@ Imports DWSIM.Interfaces.Enums.GraphicObjects

Property EnabledUndoRedo As Boolean

Property EnableGHGEmissionsSubsystem As Boolean

End Interface
20 changes: 12 additions & 8 deletions DWSIM.SharedClasses/BaseClass/SimulationObjectBaseClasses.vb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
' Flowsheet Object Base Classes
' Copyright 2008-2020 Daniel Wagner O. de Medeiros
' Copyright 2008-2024 Daniel Wagner O. de Medeiros
'
' This file is part of DWSIM.
'
Expand Down Expand Up @@ -719,13 +719,17 @@ Namespace UnitOperations
proplist.Add(item.Key)
Next

If proptype <> PropertyType.WR Then
proplist.Add("GHG Emission Factor")
proplist.Add("GHG Mass Emission")
proplist.Add("GHG Molar Emission")
proplist.Add("CO2eq GHG Mass Emission")
proplist.Add("CO2eq GHG Molar Emission")
proplist.Add("GHG Emission Reference Power Value")
If FlowSheet IsNot Nothing Then
If FlowSheet.FlowsheetOptions.EnableGHGEmissionsSubsystem Then
If proptype <> PropertyType.WR Then
proplist.Add("GHG Emission Factor")
proplist.Add("GHG Mass Emission")
proplist.Add("GHG Molar Emission")
proplist.Add("CO2eq GHG Mass Emission")
proplist.Add("CO2eq GHG Molar Emission")
proplist.Add("GHG Emission Reference Power Value")
End If
End If
End If

For Each item In AttachedUtilities
Expand Down
2 changes: 2 additions & 0 deletions DWSIM.SharedClasses/Flowsheet/FlowsheetClasses.vb
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,8 @@ Namespace DWSIM.Flowsheet

Public Property EnabledUndoRedo As Boolean = False Implements IFlowsheetOptions.EnabledUndoRedo

Public Property EnableGHGEmissionsSubsystem As Boolean = False Implements IFlowsheetOptions.EnableGHGEmissionsSubsystem

End Class

<System.Serializable()> Public Class FlowsheetResults
Expand Down
1 change: 1 addition & 0 deletions DWSIM.SharedClasses/Patrons/activepatrons.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
🌟 Roland Berger
🌟 Ronald J. Dunbar
🌟 Ronald Visness
🌟 Simone Vidille
🌟 Tech-Rudra
Alberto Baumeister
Alex Michinel
Expand Down
Loading

0 comments on commit 07edcf7

Please sign in to comment.