DanWBR / dwsim

DWSIM is a Steady-State and Dynamic Sequential Modular Chemical Process Simulator for Windows, Linux and macOS.
https://dwsim.org
GNU General Public License v3.0
262 stars 89 forks source link

[Bug] Kinetics expression not interpreted correctly #629

Closed andr1976 closed 1 week ago

andr1976 commented 2 weeks ago

Describe the bug Entering a kinetics expression engineering/scientific notation is not read properly:

The following expression for the nominator gives wrong results:

(17900*exp(-10475/T) * (R2*R1^1.5)/P1 - 2.57*10^16*EXP(-23871/T)*P1/(R1^1.5))

This gives the right results

((17900*EXP(-10475/T) * (R2 * R1^1.5)/P1) - (2.57*10000000000000000*EXP(-23871/T)*P1/(R1^1.5)))

When the notation

e16

is used an error is thrown, since it is not interpreted, but no error is given for

10^16

To Reproduce See screenshots and attached simulation file

Expected behavior The two PFR reactors should give identical results

Screenshots image

This expression gives wrong results (backward rate) image

This expression gives correct results: image

Desktop (please complete the following information):

Kinetics.zip

DanWBR commented 2 weeks ago

@andr1976 the correct expression for 10^14 is 10E14

andr1976 commented 2 weeks ago

RIght, of course works fine. Maybe an error message to be shown when using ^? The error message for "1e4" like notation is also not very informative. Thanks a lot. I will close this one shortly

DanWBR commented 2 weeks ago

@andr1976 the parser is an external library (Ciloci.Flee)