Menu

Problem with correlations in Compound Creator

Stefan
2016-11-11
2016-11-14
  • Stefan

    Stefan - 2016-11-11

    Hi,

    First of all: WHAT A GREAT INITIATIVE! DWSIM ROCKS! (and Aspen Plus sucks! ;-) ).

    I'm currently creating a database with new compounds to be able to run some process simulations. I have access to the DIPPR database and am trying to implement the equations present there for different thermodynamic properties in DWSIM.
    When for example trying to define the solid heat capacity (ok, not the most important but the one that I certainly remember causing problems) for my component: I have data according to Eq. 102 (A = 1890, B = 0.79267 and C,D and E being equal to 0) from DIPPR.
    When entering the data in DWSIM, choosing the same equation, and pushing the button "View regression" it however seems that DWSIM is not able to calculate the data. This error also appeared for some other equations when some parameters were equal to zero.
    It can of course be worked around by fitting the data with another equation but maybe this is a bug? Or have I missed something?

    Comments welcome!

    Best regards,

    Stefan

     
  • Daniel Medeiros

    Daniel Medeiros - 2016-11-11

    Hi Stefan,

    I don't remember very well but I think that "view regression" only works if you input experimental data in the table and then do the actual regression to calculate coefficients. If you input the coefficients directly, then there's no "regression" to see. Of course we could make DWSIM display a chart with calculated values from current coefficients, but I think that isn't possible yet.

    If your coefficients produce a value of the property in the required units, then you can just input the numbers and save the compound. After loading the compound in a simulation you can check the calculated values in the Pure Compound Property Viewer.

    Regards
    Daniel

     
  • Gregor Reichert

    Gregor Reichert - 2016-11-11

    Hi Stefan,
    I would like to explain the working of regressions in a more detailed way to you:

    For every temperature dependent property you are able to regress parameters from experimental data.

    The experimental data are entered into the data table and have to be defined in the units depicted in the column heading of each row. These units depend on the unit system you defined within the component creator.

    With these experimental data, you can run a regression. This regression automatically selects the formula for which the parameters are regressed for. The formula ID depends on the property which is regressed. This is a formula which usually is appropriate for that type of property.
    Prior to regression, the experimental data are transfered internally to the physical units which are depicted below the parameter fields. The regressed parameters now express the property in units depicted below the parameter fields as well.
    For instance solid heat capacity:
    Selected unit system: C5 -> Experimental data have to be entered in °C and KJ/Kg/K
    The regression automatically sets formula ID=5 which is a polynome of grade 4 with 5 parameters.
    The result of that formula with regressed parameters is in "K" for temperature and "J/kmol/K" for heat capacity now.
    Sometimes you will become an error on running a regression. This usually happens if you don't deliver sufficient experimental datapoints for the regressed formula. Imagine you do have two data points. The automatic regression selects formula 5 where five parameters are to be regressed. This system is overdefined. You either enter additional artificially generated data points for regression or you do the regression outside of DWSIM (e.g. with Excel) for a different formula and enter them into parameter fields.

    If you do have a relation with it's parameters (e.g. from DIPPR database) you may enter these parameters and the formula ID directely without running a regression. But be aware of the units issue as explained above. If the parameters from literature are different to the units of DWSIM parameters you have to convert them prior to entering!

    If you defined Joback group definitions of your component, for many of those relations the parameters of the formula can be estimated via Joback relations. This procedure is recommended only if no real life data are available! In cases where UNIFAC groups are defined the Joback groups are generated automatically. But you can define Joback groups manually as well if no UNIFAC group definition is possible.

    And now eventually the working of the diagram:
    You always can press the "Diagramm" button and get a diagram containing all available informations.
    As soon as you enter experimental data these points are always displayed independently of any regression.
    If a regression is available, this curve is displayed. If a relation from Joback is available this curve is displayed additionally as well.
    In total you may have up to three curves: experimental points, regressed and Joback curve.

    You may also have a look into the user database. This is a xml file which may be inspected by you. You will find that the parameters and the formula ID from from compound creator parameter fields are stored in the component definition.

    Did it become clear to you? If you find a property which is not following the above explanations you should report it to us.

    Gregor

     
  • Stefan

    Stefan - 2016-11-14

    Hi Daniel & Gregor!
    Thanks for the prompt replies! I think I'm well aware of the way regression works and that I have to be careful when entering parameters to get things right with units. But always good with detailed explanations to make sure we're discussing the same thing :)

    As I wrote, I do have access to correlations for properties from DIPPR and am not entering experimental data to run a regression when entering my component. I am checking "insert equation parameters", chosing the correlation equation and entering parameters for each property of my components that I am adding. For each property, when entering paramters according to a certain correlation, I am able to display both the estimate from DWSIM (Joback, Rackett..or whatever depending on what property I'm looking at) and the "Formula" (that's what it is called in the legend) for my entered correlation parameters when clicking "View regression". I have checked the box "Insert equation parameters".
    Two things I stumbled across that I think might be erroneous in DWSIM (see attached example for butyraldehyde).
    1) When using eq. 100 (that basically is equal to eq. 5) for solid heat capacity and NOT entering one of the parameters C,D, E (second, third and fourth polynomial) it gives strange results. I attached an example for butyraldehyde (butanal) where I currently am using eq. 5 for the solid heat capacity => OK results. But when switching to eq.100 the graph (when clicking "View regression") is strange and the data below the graph doesn't contain any results for the calculated values.
    2) Eq. 107 is not correctly implemented I think. It is missing the fifth parameter "E"...In the same example that is attached I wanted to enter a correlation for ideal gas heat capacity that according to my source is based on eq.107 (A+B[C/T / sinh(C/T)]^2 + D[E/T / cosh(E/T)]^2). In DWSIM "E" is not present in eq. 107 but it's "D" instead and the results seem to indicate that the actual implementation does not account for "E" either...nothing changes when changing parameter E and the results from the correlation with my given parameters are not in accordance with the data I have.

    It's all not big things and I'm aware that there's workarounds such as fitting the curve with another equation....just wanted to point out and discuss :)

     
  • Stefan

    Stefan - 2016-11-14

    Hi again,

    Just realised that my example of butyraldehyde was not the best to publish as it already is present in the databases provided (butanal). Nevertheless I'm still suspecting the points I mentioned.
    I actually went on trying to calculate an equilibrium reaction:
    2 moles of 1-butanol <=> 1 mole of 2-ethylhexanol and 1 mole of water
    2 C4H9OH <=> 1 C8H18O + 1 H2O

    The component I created is 2-ethylhexanol (2-EH). I created an .xml database and entered the data. BUT I realised when checking the component properties for 2-EH that the enthalpy of formation and gibbs free energy of formation at 25°C (ideal gas) are set to zero!!!! When checking the text file the values I stored using the compound creator are well present. I changed manually in the simulation (not getting the equilibrium reactor to work either :( ). Am attaching my .xml file and the simulation based on it.
    Is something with my installation wrong maybe? Feel a bit stuck.

    Best regards and thanks a lot for any help in advance.

     
  • Gregor Reichert

    Gregor Reichert - 2016-11-14

    Hi Stefan,
    your assumption was right, parameter is not utilised in function E.
    You may find the actual implementation of the different formulas at the following code:
    https://github.com/DanWBR/dwsim4/blob/master/DWSIM.Thermodynamics/Base%20Classes/PropertyPackage.vb#L6891

    If you think that there are some formulas which are implemented in a wrong way Daniel should have a look into this issue.

    p.s. This component Butyraldehyde is already available in the Chemsep database and doen't need to be entered by you. Components may have different names. The best way to find out is to enter CAS-Number in the component selection field during simulation setup.

    Gregor

     
  • Daniel Medeiros

    Daniel Medeiros - 2016-11-14

    I'll take a look at the reported issues and return with a solution as soon as possible.

     
  • Daniel Medeiros

    Daniel Medeiros - 2016-11-14

    Hi Stefan,

    Open DWSIM with an active internet connection and you'll get Update 33, which fixes all reported issues. You may need to reload your user compound database or manually edit the compounds without formation data in the simulation using the Pure Compound Property Viewer.

    Regards
    Daniel

     
  • Gregor Reichert

    Gregor Reichert - 2016-11-14

    Hi Stefan,
    DWSIM is loading component data into memory on startup. If you add a new component to your simulation these data are copied from memory to the simulation and later stored into the file on disk. If you modify your data in the user database later you need to update your simulation with data from the database.
    For that end we have a button in the Pure Component Property Viewer "Restore Defaults". This button will replace the component data in the simulation with data from the database.

    There is an option in the DWSIM general settings which should have the same effect. But i find the way described above more convenient.

    Gregor

     
    • Daniel Medeiros

      Daniel Medeiros - 2016-11-14

      Yes! I'd forgot about this handy feature. :-)

       

Log in to post a comment.