Skip to content

Refactor AssetAbstract to include a check_setpoints method #330

@vanmeerkerk

Description

@vanmeerkerk

In #328 a comment was raised to implement a check_setpoints method for all assets and implement it in the AssetAbstract.

Main question: How to get the necessary setpoints per asset? Would that be a call to a _variable also defined in AssetAbstract?

`
def check_setpoints(self, setpoints: Dict) -> None:
"""Check if all necessary setpoints are provided.

    :param Dict setpoints: The setpoints that should be set for the asset.
    """
    # Default keys required
    necessary_setpoints = {
        PROPERTY_TEMPERATURE_IN,
        PROPERTY_TEMPERATURE_OUT,
        PROPERTY_HEAT_DEMAND,
    }
    # Create set of keys in the provided setpoints
    setpoints_set = set(setpoints.keys())
    # Check if all setpoints are in the setpoints
    if any(necessary_setpoints.difference(setpoints_set)):
        # Print missing setpoints
        raise ValueError(
            f"The setpoints {necessary_setpoints.difference(setpoints_set)} are missing."
        )`

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions