function getCircuitPort(work, ref) {
    contact = getCircuitContact(work, ref);
    if (!contact.isPort()) {
        throw "Contact '" + ref + "' is not a port";
    }