Thank you Daniel for replying
I want to create a batch reactor in DWSIM through User models-Python script. I will be taking input through scripting variables input section. I wanted to input a list of stoichometries of compounds involved in reaction. However, i am unable to input a list in the scripting varible section. The error that pops up is, "Conversion from type string to type double is not valid". I used the syntax [1,1] to input the stoichometries. Moreover, when i use syntax (2,2) for list in input column of scripting variables section, the software changes the variable value to -22. Can you explain how to input list in scripting variables section? I have attached the file. Here the variable i want to input as list is stoic.
Thank you.
Hi, I want to take a list as input through scripting variables in user model-python script. I am unable to do so. Can anyone help out?
Can you give more details? I didn't understand how you model would work.
Thank you Daniel for replying
I want to create a batch reactor in DWSIM through User models-Python script. I will be taking input through scripting variables input section. I wanted to input a list of stoichometries of compounds involved in reaction. However, i am unable to input a list in the scripting varible section. The error that pops up is, "Conversion from type string to type double is not valid". I used the syntax [1,1] to input the stoichometries. Moreover, when i use syntax (2,2) for list in input column of scripting variables section, the software changes the variable value to -22. Can you explain how to input list in scripting variables section? I have attached the file. Here the variable i want to input as list is stoic.
Thank you.
I see. The script unit only accepts single strings and numbers as input, but you could try [2, 2] and see if it works.
You also need to add the list as a STRING variable, not double.
I got error when used [2,2]: ,"Conversion from type string to type double is not valid"
I did not understand what you meant by adding list as string variable and not double. Can u tell the syntax to add list as string variable?
If you enter
And use this script
You should get
The trick is to use
eval
to convert the string to a python list.Thank you Daniel. This solved my problem.