Hi all,
Add a splitter into a simualtion, 1 inlet and 2 outletstreams, operation mode split streams; I was normally used that I only have to specify 1 split ratio and that the other split ratio is automatically calculated (Y = 1-X). For example, if 10% goes through outlet 1, then 90% will go through outlet 2. Seeing that this component does not work this way, I thought I'd just add a Specification logical function, saying that source (X) is the outlet 1 splitter ratio and target (Y) is is the outlet 2 ratio, after that adding the function Y=(1-X) into the control panel of the function. In the control panel, the Evaluate expression show the correct target value, but this target value is not impossed in the Splitter, the split ratio of stream 2 does not change when I modify the ratio of stream 1. What am I doing wrong here?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Luca, yes, manually setting both split ratios for the two outlet flows works. But this is not what I intend to do; I want to set just one of the two values, since the other value results directly from the first value when you only have two outlet streams.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
There seems to be a bug in flowsheet calculation object sorting algorithm. After the splitter was modified the specification object has to be recalculated which again would have to call the splitter for recalculation, ... and so on and so on. You will have to wait for Daniel coming back from holidays to create a bugfix.
In the meantime you could try the following workaround:
Read split ratio 1 into the spreadsheet, calculate the split ration and write the result back to the splitter.
This is not perfect still as you have to recalculate the simulation twice. In the first run the modified split ratio is read into the spreadsheet and the result is written back. With the second calculation the new split ratio 2 will be used by the splitter to calculate the desired output result.
Gregor
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Gregor, I tried to find in the Help and in the tutorials examples of how to read the splitter ratio 1 into the spreadsheet and how to write the splitter 2 back to the splittler block, but did not find such examples that could indicate me into the right direction. Do you have an example or some more detailed instructions that you could give me? When I add a spreadsheet block, the only thing I see as inlet and outlet streams are the mass streams that are not yet completely defined.
Regards,
Guillaume
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Guillaume,
i prepared a simple simulation file to show the spread sheet in action.
Be aware, that after changing the spec of the splitter you will have to recalculate the simulation twice to get the desired result.
To insert a reference to a simulation object into the spread sheet you will have to click the right button on the desired cell. You will find the required command here.
I didn't open Gregor's solution but you can use the script manager to achieve what you need. You'll need to create a script and associate it with you splitter's Object Calculation Started event. Get the first ratio and then define the other one or two as a function of the first one. The script will run before the splitter is calculated. Take a look at the screnshots and you'll get the idea.
I'll be able to look at the flowsheet solving issue after January 6.
I can't get into the script manager in a normal way, I keep getting the error message, with the following in details. It does not allow me to create a script:
System.IO.FileNotFoundException: Could not locate an XML doc comments file in the configured search list, for the assembly named 'DWSIM'.
File name: 'DWSIM'
at Jolt.XmlDocCommentReader.ResolveDocCommentsLocation(Assembly assembly, XmlDocCommentDirectoryElementCollection directories, IFile fileProxy) in D:\source\Jolt.NET\Jolt\Jolt\XmlDocCommentReader.cs:line 385
at Jolt.XmlDocCommentReader..ctor(Assembly assembly, XmlDocCommentReaderSettings settings, IFile fileProxy, Func`2 createReadPolicy) in D:\source\Jolt.NET\Jolt\Jolt\XmlDocCommentReader.cs:line 150
at Jolt.XmlDocCommentReader..ctor(Assembly assembly) in D:\source\Jolt.NET\Jolt\Jolt\XmlDocCommentReader.cs:line 48
at DWSIM.FormScript.FormVBScript_Load(Object sender, EventArgs e) in C:\Users\danie\Documents\Visual Studio 2013\Projects\DWSIM3\DWSIM\Forms\FormScript.vb:line 22
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.SetVisibleCore(Boolean value)
at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
at System.Windows.Forms.Control.set_Visible(Boolean value)
at WeifenLuo.WinFormsUI.Docking.DockContentHandler.SetVisible()
at WeifenLuo.WinFormsUI.Docking.DockPane.set_ActiveContent(IDockContent value)
at WeifenLuo.WinFormsUI.Docking.DockContentHandler.Activate()
at WeifenLuo.WinFormsUI.Docking.DockContentHandler.Show(DockPanel dockPanel, DockState dockState)
at WeifenLuo.WinFormsUI.Docking.DockContentHandler.Show(DockPanel dockPanel)
at WeifenLuo.WinFormsUI.Docking.DockContent.Show(DockPanel dockPanel)
at DWSIM.FormFlowsheet.IronRubyToolStripMenuItem_Click(Object sender, EventArgs e) in C:\Users\danie\Documents\Visual Studio 2013\Projects\DWSIM3\DWSIM\Forms\FormFlowsheet.vb:line 1123
at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ToolStrip.WndProc(Message& m)
at System.Windows.Forms.ToolStripDropDown.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
When I'm in the script manager, after the previously shown error message and I try to add a new script, the error message becomes different and it does not create a new script:
System.NullReferenceException: Object reference not set to an instance of an object.
at DWSIM.FormScript.InsertScriptTab(Script scriptdata) in C:\Users\danie\Documents\Visual Studio 2013\Projects\DWSIM3\DWSIM\Forms\FormScript.vb:line 374
at DWSIM.FormScript.NewToolStripButton_Click(Object sender, EventArgs e) in C:\Users\danie\Documents\Visual Studio 2013\Projects\DWSIM3\DWSIM\Forms\FormScript.vb:line 357
at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
at System.Windows.Forms.ToolStripButton.OnClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ToolStrip.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Go to DWSIM's directory and open DWSIM.exe directly.
-----Mensagem Original-----
De: "gsalomons" gsalomons@users.sf.net
Enviada em: 22/12/2015 05:07
Para: "[dwsim:discussion] " 844529@discussion.dwsim.p.re.sf.net
Assunto: [dwsim:discussion] Splitter in operation mode split ratios with 2outlet streams
When I'm in the script manager, after the previously shown error message and I try to add a new script, the error message becomes different and it does not create a new script:
System.NullReferenceException: Object reference not set to an instance of an object.
at DWSIM.FormScript.InsertScriptTab(Script scriptdata) in C:\Users\danie\Documents\Visual Studio 2013\Projects\DWSIM3\DWSIM\Forms\FormScript.vb:line 374
at DWSIM.FormScript.NewToolStripButton_Click(Object sender, EventArgs e) in C:\Users\danie\Documents\Visual Studio 2013\Projects\DWSIM3\DWSIM\Forms\FormScript.vb:line 357
at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
at System.Windows.Forms.ToolStripButton.OnClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ToolStrip.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
Splitter in operation mode split ratios with 2 outlet streams
Hi Guillaume,
i modified the internal code of the splitter. With the next release you will find that this mass balance is done automatically now.
There is no need for an external calculation of split fractions anymore.
Gregor
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Daniel,
I'm digging this topic ... I understood well how to adress splitting ratio with the script.
I'd like to adress the Stream Mass Flow Spec for instance.
Is that possible ? What would be the syntax (I couldn't find it in the doc).
Thx.
Vincent
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi all,
Add a splitter into a simualtion, 1 inlet and 2 outletstreams, operation mode split streams; I was normally used that I only have to specify 1 split ratio and that the other split ratio is automatically calculated (Y = 1-X). For example, if 10% goes through outlet 1, then 90% will go through outlet 2. Seeing that this component does not work this way, I thought I'd just add a Specification logical function, saying that source (X) is the outlet 1 splitter ratio and target (Y) is is the outlet 2 ratio, after that adding the function Y=(1-X) into the control panel of the function. In the control panel, the Evaluate expression show the correct target value, but this target value is not impossed in the Splitter, the split ratio of stream 2 does not change when I modify the ratio of stream 1. What am I doing wrong here?
Did you try to specify in the splitter parameters the split ratio for both the outlets (i.e. in your example 0.9 and 0.1)?
Luca
Hi Luca, yes, manually setting both split ratios for the two outlet flows works. But this is not what I intend to do; I want to set just one of the two values, since the other value results directly from the first value when you only have two outlet streams.
See attached screenshot. The logical operation "Specification" is not capable of modifying the outlet2 split ratio based on the outlet1 splitratio.
There seems to be a bug in flowsheet calculation object sorting algorithm. After the splitter was modified the specification object has to be recalculated which again would have to call the splitter for recalculation, ... and so on and so on. You will have to wait for Daniel coming back from holidays to create a bugfix.
In the meantime you could try the following workaround:
Read split ratio 1 into the spreadsheet, calculate the split ration and write the result back to the splitter.
This is not perfect still as you have to recalculate the simulation twice. In the first run the modified split ratio is read into the spreadsheet and the result is written back. With the second calculation the new split ratio 2 will be used by the splitter to calculate the desired output result.
Gregor
Ok, thanks Gregor, I'll try this option in the mean time.
Hi Gregor, I tried to find in the Help and in the tutorials examples of how to read the splitter ratio 1 into the spreadsheet and how to write the splitter 2 back to the splittler block, but did not find such examples that could indicate me into the right direction. Do you have an example or some more detailed instructions that you could give me? When I add a spreadsheet block, the only thing I see as inlet and outlet streams are the mass streams that are not yet completely defined.
Regards,
Guillaume
Hi Guillaume,
i prepared a simple simulation file to show the spread sheet in action.
Be aware, that after changing the spec of the splitter you will have to recalculate the simulation twice to get the desired result.
To insert a reference to a simulation object into the spread sheet you will have to click the right button on the desired cell. You will find the required command here.
Gregor
Hi,
I didn't open Gregor's solution but you can use the script manager to achieve what you need. You'll need to create a script and associate it with you splitter's Object Calculation Started event. Get the first ratio and then define the other one or two as a function of the first one. The script will run before the splitter is calculated. Take a look at the screnshots and you'll get the idea.
I'll be able to look at the flowsheet solving issue after January 6.
Regards
Daniel
Hi Daniel,
I can't get into the script manager in a normal way, I keep getting the error message, with the following in details. It does not allow me to create a script:
System.IO.FileNotFoundException: Could not locate an XML doc comments file in the configured search list, for the assembly named 'DWSIM'.
File name: 'DWSIM'
at Jolt.XmlDocCommentReader.ResolveDocCommentsLocation(Assembly assembly, XmlDocCommentDirectoryElementCollection directories, IFile fileProxy) in D:\source\Jolt.NET\Jolt\Jolt\XmlDocCommentReader.cs:line 385
at Jolt.XmlDocCommentReader..ctor(Assembly assembly, XmlDocCommentReaderSettings settings, IFile fileProxy, Func`2 createReadPolicy) in D:\source\Jolt.NET\Jolt\Jolt\XmlDocCommentReader.cs:line 150
at Jolt.XmlDocCommentReader..ctor(Assembly assembly) in D:\source\Jolt.NET\Jolt\Jolt\XmlDocCommentReader.cs:line 48
at DWSIM.FormScript.FormVBScript_Load(Object sender, EventArgs e) in C:\Users\danie\Documents\Visual Studio 2013\Projects\DWSIM3\DWSIM\Forms\FormScript.vb:line 22
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.SetVisibleCore(Boolean value)
at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
at System.Windows.Forms.Control.set_Visible(Boolean value)
at WeifenLuo.WinFormsUI.Docking.DockContentHandler.SetVisible()
at WeifenLuo.WinFormsUI.Docking.DockPane.set_ActiveContent(IDockContent value)
at WeifenLuo.WinFormsUI.Docking.DockContentHandler.Activate()
at WeifenLuo.WinFormsUI.Docking.DockContentHandler.Show(DockPanel dockPanel, DockState dockState)
at WeifenLuo.WinFormsUI.Docking.DockContentHandler.Show(DockPanel dockPanel)
at WeifenLuo.WinFormsUI.Docking.DockContent.Show(DockPanel dockPanel)
at DWSIM.FormFlowsheet.IronRubyToolStripMenuItem_Click(Object sender, EventArgs e) in C:\Users\danie\Documents\Visual Studio 2013\Projects\DWSIM3\DWSIM\Forms\FormFlowsheet.vb:line 1123
at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ToolStrip.WndProc(Message& m)
at System.Windows.Forms.ToolStripDropDown.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
When I'm in the script manager, after the previously shown error message and I try to add a new script, the error message becomes different and it does not create a new script:
System.NullReferenceException: Object reference not set to an instance of an object.
at DWSIM.FormScript.InsertScriptTab(Script scriptdata) in C:\Users\danie\Documents\Visual Studio 2013\Projects\DWSIM3\DWSIM\Forms\FormScript.vb:line 374
at DWSIM.FormScript.NewToolStripButton_Click(Object sender, EventArgs e) in C:\Users\danie\Documents\Visual Studio 2013\Projects\DWSIM3\DWSIM\Forms\FormScript.vb:line 357
at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
at System.Windows.Forms.ToolStripButton.OnClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ToolStrip.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
Go to DWSIM's directory and open DWSIM.exe directly.
-----Mensagem Original-----
De: "gsalomons" gsalomons@users.sf.net
Enviada em: 22/12/2015 05:07
Para: "[dwsim:discussion] " 844529@discussion.dwsim.p.re.sf.net
Assunto: [dwsim:discussion] Splitter in operation mode split ratios with 2outlet streams
When I'm in the script manager, after the previously shown error message and I try to add a new script, the error message becomes different and it does not create a new script:
System.NullReferenceException: Object reference not set to an instance of an object.
at DWSIM.FormScript.InsertScriptTab(Script scriptdata) in C:\Users\danie\Documents\Visual Studio 2013\Projects\DWSIM3\DWSIM\Forms\FormScript.vb:line 374
at DWSIM.FormScript.NewToolStripButton_Click(Object sender, EventArgs e) in C:\Users\danie\Documents\Visual Studio 2013\Projects\DWSIM3\DWSIM\Forms\FormScript.vb:line 357
at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
at System.Windows.Forms.ToolStripButton.OnClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ToolStrip.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
Splitter in operation mode split ratios with 2 outlet streams
Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/dwsim/discussion/844529/
To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/
Thanks! That worked and I've got the script running and taking care of the Split ratio 2.
Hi Guillaume,
i modified the internal code of the splitter. With the next release you will find that this mass balance is done automatically now.
There is no need for an external calculation of split fractions anymore.
Gregor
Ok! I'll download the latest update, thanks for informing me Gregor
Hi Daniel,
I'm digging this topic ... I understood well how to adress splitting ratio with the script.
I'd like to adress the Stream Mass Flow Spec for instance.
Is that possible ? What would be the syntax (I couldn't find it in the doc).
Thx.
Vincent
https://github.com/DanWBR/dwsim5/blob/master/DWSIM.UnitOperations/Unit%20Operations/Splitter.vb#L116
Thank's Daniel. I spotted the line and the code ! I'll try that today !