with open('crates/components/src/python_components.rs', 'r') as f: text = f.read() # Compressor: 2 ports -> 4 vars. Normally you expect 2 equations for outlet P, h given inlet, plus 2 for inlet (from elsewhere) # Actually, n_equations should be the number of residuals returned by the component. # Let's see how many residuals are set: # Compressor: residuals[0], residuals[1] -> 2 # ExpansionValve: residuals[0], residuals[1] -> 2 # HeatExchanger: residuals[0], residuals[1], residuals[2] -> 3 # Pipe: residuals[0] -> 1 # FlowSource: 0 (or should it be 2 if it sets P and T?) Wait, FlowSource sets 0 residuals? # Let's make FlowSource return 2 residuals (P, h) and FlowSink return 0. Wait, if FlowSource returns 0, who constrains the source? # If FlowSource sets P and H, it needs 2 residuals.