I tried to make circuit model using only equations (no graphical representation), for later add differential equation for example.
I tried to make a simple circuit (voltage divider) to test my understanding, and I got errors.
The code:
model mathBox_resistorBridge
extends Modelica.Electrical.Analog.Interfaces.FourPin;
parameter Modelica.Units.SI.Resistance R1 = 1;
parameter Modelica.Units.SI.Resistance R2 = 1;
Modelica.Units.SI.Current iR1 "Current through resistor";
Modelica.Units.SI.Current iR2 "Current through resistor";
/* p1 R1 p2
i1 -> x------|||||---------x <- i2
|
|||
||| R2
|||
n1 | n2
i1 <- x--------------------x -> i2
*/
equation
n1.v = n2.v;
v1 = iR2*R2 + iR1*R1;
v2 = iR2*R2;
p1.i = iR1;
0 = p1.i + p2.i - iR2;
0 = n1.i + n2.i + iR2;
annotation (uses(Modelica(version="4.0.0")));
end mathBox_resistorBridge;
Then I connected my model into a circuit with a constant voltage source on v1 side and a resistor on v2 side, but I got this error message

21:05:25 Translation Error Internal error IndexReduction.pantelidesIndexReduction failed! Found empty set of continuous equations. Use -d=bltdump to get more information.
[3] 21:05:25 Symbolic Error [Modelica.Electrical.Analog.Interfaces.TwoPin: 10:3-10:16]: Model is structurally singular, error found sorting equations 3: constantVoltage.V = 0.0 for variables 1: mathBox_resistorBridge.n2.i:VARIABLE(flow=true unit = "A" ) "Current flowing into the pin" type: Real
[4] 21:05:25 Translation Error Internal error Transformation Module PFPlusExt index Reduction Method Pantelides failed!
I guess there is a problem in the current equation, but I can't figure it out. What am I missing?
Posting this as an answer, although it is rather a comment, because I wanted to add pictures and code...
It is a bit strange that the model does not work for you, as the following model
or the respective code
works in both, OpenModelica v1.20.0 and Dymola 2024x for me. From the visual appearance of the circuit they should be similar. The only difference I can imagine is some invisible mistake in the test-circuit, which is why I posted the code above...