C++ block allows modeling current at input output pins?

I wish to create a very simple model for a buck converter. I want the input to sink current based on the input voltage (so Iin = Pin/Vin) and Pin = Pout/Eff, where Pout = -Iout * Vout. I am under the impression that C++ blocks are great for inputting and outputting VOLTAGES, but can’t model current flow. There is no such command as “get_current” or “set_current”. Am I right?

Hi, Robert.

That is correct; the C-Block component port values are voltages on the ports. There’s no way to read or set currents into/out of the ports from within the component.

–robert