Communicating data between objects/blocks can be achieved by use of connector classes. Connector classes are kind of ports. Note that there are no equations allowed in the definition of connector classes.
Please refer to the book "Modelica by Example" to learn more about how to create and define a connector in Modelica.
Kindly go through the OpenModelica Connectors tutorial.