Matlab Simulink relation
Each configurable block in simulink can be configured with a unique or common variable.

Below is a simple workspace with 5 constant block. The constant block was chosen because the block mask updates with the configured variable.

Constant is set to 1
Constant1 is set to 10
Constant2 is set to variable foo
Constant3 is set to variable foo
Constant4 is set to variable bar 

The variables foo and bar can be set in the matlab workspace OR via a datadictionary. because constant2 and constant3 use the same variable they will output the same constant. 

This is the same for all configurable blocks so you can easily add two batteries and configure each one with a value of nominal_voltage1 &amp; nominal_voltage2, set these two variables in the matlab workspace (say via an m-file) and they will be independent.

As to underlying code... Simulink is proprietary, they do not show you the code. The Simscape area does use their new scripting language for physics base calculations and a lot of those blocks have viewable source