The extra variables come from the declaration extends Modelica.Electrical.Analog.Interfaces.TwoPort;
.
The TwoPort model adds four pins but also the corresponding voltages and variables (v1, i1, v2, i2). In your case, you are defining the behavior using components, so you don't need the extra variables and equations that TwoPort provides.
Just replace the extends by a declaration of four independent pins.
Modelica.Electrical.Analog.Interfaces.Pin p1;
Modelica.Electrical.Analog.Interfaces.Pin p2;
Modelica.Electrical.Analog.Interfaces.NegativePin n1;
Modelica.Electrical.Analog.Interfaces.NegativePin n2;
If you want to have an icon and the pins located in the correct position, you can create your own component based on TwoPort and remove the variables that are not needed. For example (notice that I removed the annotations to make it more readable here):
partial model FourPin
Modelica.Electrical.Analog.Interfaces.PositivePin p1;
Modelica.Electrical.Analog.Interfaces.NegativePin n1;
Modelica.Electrical.Analog.Interfaces.PositivePin p2;
Modelica.Electrical.Analog.Interfaces.NegativePin n2;
end FourPin;