Changed initial conditions to fixed.
Removed unrequired sum operator.
Corrected wrong StopTime annotation.
Changed assignment of X to avoid an error in OpenModelica.
Added missing each keyword.
Redesigned implementation to avoid mixing textual and graphical declaration in the equation section.

Restructured code. Moved non-essential models into the protected
section.
Changed initialization to FixedInitial, and cleaned up code.