Structural theory and thermoeconomic diagnosis: Part I. On malfunction and dysfunction analysis