This discussion continued in the DWSIM forum
(
https://sourceforge.net/p/dwsim/discuss ... /3682f2f1/).
Here are my conclusions:
In the DWSIM socket we have/had
1) Validate()
2) RestorePorts() -> this invalidates the unit operation, because the "portConnectionChanged" event is fired and we cannot gurantee that the state is still valid.
3) Calculate() -> check for validation fails
The CO interface specification for Unit Operations (CO_Unit_Operations_v6.25) says, regarding 'Validate':
"However, Validate must be called before Calculate in case any (one or more) changes to the following
configuration aspects of the Unit Operation have changed since the last call to Calculate:
• ...
• connecting an object to a port
• disconnecting an object from a port
• ... "
So calling Validate() after RestorePorts() is fix to this particular problem.