Activity for Nik

  • Nik Nik posted a comment on discussion Python Scripting

    Solved using "float" in the Set function: oms1.SetOverallCompoundMassFlow('Methane',float(outWFCH4))

  • Nik Nik posted a comment on discussion Python Scripting

    Hi again, I have tried with creating a project from scratch without involving Cantera and the function i.e. oms1.SetOverallCompoundMassFlow('Methane',outCH4) works as expected. Is there a way to print outputs from a Python script for debugging? thanks a lot

  • Nik Nik modified a comment on discussion Python Scripting

    Thanks, Daniel. I got another error saying "an integer is required". I can go around the issue by rounding the number but that would not be numerically correct. Something I should do to troubleshoot the code? Set the properties on the Outlet Material Stream connected to Port 1(oms1) oms1.Clear() Set operative conditions oms1.SetTemperature(T) oms1.SetPressure(P) oms1.SetMassFlow(WF) Read mass fractions from cantera mixture. See the original 'gri30.yaml' file to inspect compound indexes in the array...

  • Nik Nik modified a comment on discussion Python Scripting

    Thanks, Daniel. I will correct the calculations above to make sure mass and molar balances are respected. About the compound index, I guess it is the one defined in DWSIM: how can I get to know compound indexes? is there any function I could call? Anyhow, the note on the function says "String". see attached screenshot Thanks a lot

  • Nik Nik modified a comment on discussion Python Scripting

    Thanks, Daniel. I have corrected the typo "mass" with "molar" above for reference for future readers. About the compound index, I guess it is the one defined in DWSIM: how can I get to know compound indexes? is there any function I could call? Anyhow, the note on the function says "String". see attached screenshot Thanks a lot

  • Nik Nik posted a comment on discussion Python Scripting

    Thanks, Daniel. I have corrected the typo "mass" with "molar" above for reference for future readers. About the compound index, I guess it is the one defined in DWSIM: how can I get to know compound indexes? is there any function I could call?

  • Nik Nik modified a comment on discussion Python Scripting

    Thanks, Daniel. I got another error saying "an integer is required". I can go around the issue by rounding the number but that would not be numerically correct. Something I should do to troubleshoot the code? Read variables: MF = ims1.Phases[0].Properties.molarflow set macro variables: oms1.SetTemperature(T) oms1.SetPressure(P) oms1.SetMassFlow(WF) calculate molar fractions: outxCH4 = MFoutCH4 outxH2O = MFoutH2O outxCO = MFoutCO outxCO2 = MFoutCO2 outxH2 = MFoutH2 outxO2 = MFoutO2 set molar fractions:...

  • Nik Nik modified a comment on discussion Python Scripting

    Thanks, Daniel. I got another error saying "an integer is required". I can go around the issue by rounding the number but that would not be numerically correct. Something I should do to troubleshoot the code? set macro variables: oms1.SetTemperature(T) oms1.SetPressure(P) oms1.SetMassFlow(WF) calculate mass fractions: outxCH4 = MFoutCH4 outxH2O = MFoutH2O outxCO = MFoutCO outxCO2 = MFoutCO2 outxH2 = MFoutH2 outxO2 = MFoutO2 set mass fractions: oms1.SetOverallCompoundMolarFlow('Methane', outxCH4)...

  • Nik Nik posted a comment on discussion Python Scripting

    Thanks, Daniel. I got another error saying "an integer is required". I can go around the issue by rounding the number but that would not be numerically correct. Something I should do to troubleshoot the code? set macro variables: oms1.SetTemperature(T) oms1.SetPressure(P) oms1.SetMassFlow(WF) calculate mass fractions: outxCH4 = MFoutCH4 outxH2O = MFoutH2O outxCO = MFoutCO outxCO2 = MFoutCO2 outxH2 = MFoutH2 outxO2 = MFoutO2 set mass fractions: oms1.SetOverallCompoundMolarFlow('Methane', outxCH4)...

  • Nik Nik posted a comment on discussion Python Scripting

    Hi everyone, I am new to DWSIM and I am trying to set a model based on Cantera Interop. I am using python 3.9 (portable version as suggested by Daniel) and have checked already that Cantera is installed and functioning. All good till here. The issue I have is similar to what Pietro reported here above a couple of years back: when running: "oms1.Phases[0].Compounds['Methane'].MoleFraction = System.NullableSystem.Double" I get an error message saying: "Error in 'Python.Runtime': module 'System' has...

1