def get_value(component, name):
    """ Get a variable from a component """

    variable = component.variables[name]
    vr = [variable.valueReference]

    if variable.type == 'Real':
        return component.fmu.getReal(vr)[0]
    elif variable.type in ['Integer', 'Enumeration']:
        return component.fmu.getInteger(vr)[0]
    elif variable.type == 'Boolean':
        value = component.fmu.getBoolean(vr)[0]
        return value != 0
    else:
        raise Exception("Unsupported type: %s" % variable.type)