RC -Example model equations

Try thisi if you want to see all the equations

@named rnet_model = RNetModel()
rnet_model = complete(rnet_model)
julia> equations(expand_connections(rnet_model) )
44-element Vector{Equation}:
 R1₊v(t) ~ R1₊p₊v(t) - R1₊n₊v(t)
 0 ~ R1₊n₊i(t) + R1₊p₊i(t)
 R1₊i(t) ~ R1₊p₊i(t)
 R1₊v(t) ~ R1₊R*R1₊i(t)
 R2₊v(t) ~ R2₊p₊v(t) - R2₊n₊v(t)
 0 ~ R2₊n₊i(t) + R2₊p₊i(t)
 R2₊i(t) ~ R2₊p₊i(t)
 R2₊v(t) ~ R2₊R*R2₊i(t)
 R3₊v(t) ~ -R3₊n₊v(t) + R3₊p₊v(t)
 0 ~ R3₊n₊i(t) + R3₊p₊i(t)
 R3₊i(t) ~ R3₊p₊i(t)
 R3₊v(t) ~ R3₊R*R3₊i(t)
 R4₊v(t) ~ -R4₊n₊v(t) + R4₊p₊v(t)
 0 ~ R4₊p₊i(t) + R4₊n₊i(t)
 R4₊i(t) ~ R4₊p₊i(t)
 R4₊v(t) ~ R4₊R*R4₊i(t)
 R5₊v(t) ~ R5₊p₊v(t) - R5₊n₊v(t)
 0 ~ R5₊p₊i(t) + R5₊n₊i(t)
 R5₊i(t) ~ R5₊p₊i(t)
 R5₊v(t) ~ R5₊R*R5₊i(t)
 R6₊v(t) ~ -R6₊n₊v(t) + R6₊p₊v(t)
 0 ~ R6₊p₊i(t) + R6₊n₊i(t)
 R6₊i(t) ~ R6₊p₊i(t)
 R6₊v(t) ~ R6₊R*R6₊i(t)
 source₊v(t) ~ -source₊n₊v(t) + source₊p₊v(t)
 0 ~ source₊p₊i(t) + source₊n₊i(t)
 source₊i(t) ~ source₊p₊i(t)
 source₊V ~ source₊v(t)
 ground₊g₊v(t) ~ 0
 source₊p₊v(t) ~ R1₊p₊v(t)
 0 ~ source₊p₊i(t) + R1₊p₊i(t)
 R1₊n₊v(t) ~ R2₊p₊v(t)
 R1₊n₊v(t) ~ R3₊p₊v(t)
 0 ~ R1₊n₊i(t) + R3₊p₊i(t) + R2₊p₊i(t)
 ground₊g₊v(t) ~ R6₊n₊v(t)
 ground₊g₊v(t) ~ R2₊n₊v(t)
 ground₊g₊v(t) ~ source₊n₊v(t)
 ground₊g₊v(t) ~ R4₊n₊v(t)
 0 ~ source₊n₊i(t) + R2₊n₊i(t) + ground₊g₊i(t) + R6₊n₊i(t) + R4₊n₊i(t)
 R5₊p₊v(t) ~ R3₊n₊v(t)
 R5₊p₊v(t) ~ R4₊p₊v(t)
 0 ~ R3₊n₊i(t) + R5₊p₊i(t) + R4₊p₊i(t)
 R5₊n₊v(t) ~ R6₊p₊v(t)
 0 ~ R6₊p₊i(t) + R5₊n₊i(t)

ModelingToolkit can solve linear equations analytically and I think this is performed automatically by @mtkbuild. You’ll notice that the equations in observed are all on assignment form, i.e., the LHS is a single term. Once you have solved the two equations in equations(rnet_model), the rest of the equations appear solvable with simple substitution.

1 Like