/* SPDX-License-Identifier: BSD-3-Clause */
/*
 * Copyright 2009 Raritan Inc. All rights reserved.
 */

#ifndef __PDUMODEL_POLE_IDL__
#define __PDUMODEL_POLE_IDL__

#include <NumericSensor.idl>
#include <ResidualCurrentStateSensor.idl>

/**
 * PDU Model
 */
module pdumodel {

    /** Power line */
    enumeration PowerLine_3_0_0 {
        L1,                             ///< Line 1
        L2,                             ///< Line 2
        L3,                             ///< Line 3
        NEUTRAL,                        ///< Neutral
        EARTH,                          ///< Earth
        PLUS,                           ///< Positive (DC)
        MINUS                           ///< Negative (DC)
    };

    /** An inlet or outlet pole */
    structure Pole_9_0_0 {
        string label;                                        ///< %Pole label
        PowerLine_3_0_0 line;                                ///< Power line
        int nodeId;                                          ///< Circuit node id
        sensors.NumericSensor_4_0_6 voltage;                 ///< RMS voltage sensor, L-L, may be a VoltageMonitoringSensor
        sensors.NumericSensor_4_0_6 voltageLN;               ///< RMS voltage sensor, L-N (Wye) or L-PE (Delta), may be a VoltageMonitoringSensor
        sensors.NumericSensor_4_0_6 current;                 ///< RMS current sensor
        sensors.NumericSensor_4_0_6 peakCurrent;             ///< Peak current sensor
        sensors.NumericSensor_4_0_6 activePower;             ///< Active power sensor
        sensors.NumericSensor_4_0_6 reactivePower;           ///< Reactive power sensor
        sensors.NumericSensor_4_0_6 apparentPower;           ///< Apparent power sensor
        sensors.NumericSensor_4_0_6 powerFactor;             ///< Power factor sensor
        sensors.NumericSensor_4_0_6 phaseAngle;              ///< Phase angle sensor
        sensors.NumericSensor_4_0_6 displacementPowerFactor; ///< Displacement power factor sensor
        sensors.NumericSensor_4_0_6 activeEnergy;            ///< Active energy sensor
        sensors.NumericSensor_4_0_6 apparentEnergy;          ///< Apparent energy sensor
        sensors.NumericSensor_4_0_6 residualCurrent;         ///< Residual current sensor
        sensors.NumericSensor_4_0_6 residualACCurrent;       ///< AC Residual current sensor
                                                             ///< (AC portion of residual operating current)
        sensors.NumericSensor_4_0_6 residualDCCurrent;       ///< DC Residual current sensor
                                                             ///< (DC portion of residual operating current)
        sensors.NumericSensor_4_0_6 crestFactor;             ///< Crest factor sensor
        sensors.NumericSensor_4_0_6 voltageThd;              ///< Voltage total harmonic distortion sensor
        sensors.NumericSensor_4_0_6 currentThd;              ///< Current total harmonic distortion sensor
        ResidualCurrentStateSensor_2_0_5 residualCurrentStatus; ///< Residual current monitor state sensor
    };

    /** An inlet line pair */
    structure MeteredLinePair_2_0_0 {
        PowerLine_3_0_0 leftLine;                            ///< Power line of left node
        PowerLine_3_0_0 rightLine;                           ///< Power line of right node
        int leftNodeId;                                      ///< Left node id
        int rightNodeId;                                     ///< Right node id
        sensors.NumericSensor_4_0_6 voltage;                 ///< RMS voltage sensor, L-L, may be a VoltageMonitoringSensor
        sensors.NumericSensor_4_0_6 current;                 ///< RMS current sensor
        sensors.NumericSensor_4_0_6 peakCurrent;             ///< Peak current sensor
        sensors.NumericSensor_4_0_6 activePower;             ///< Active power sensor
        sensors.NumericSensor_4_0_6 reactivePower;           ///< Reactive power sensor
        sensors.NumericSensor_4_0_6 apparentPower;           ///< Apparent power sensor
        sensors.NumericSensor_4_0_6 powerFactor;             ///< Power factor sensor
        sensors.NumericSensor_4_0_6 phaseAngle;              ///< Phase angle sensor
        sensors.NumericSensor_4_0_6 displacementPowerFactor; ///< Displacement power factor sensor
        sensors.NumericSensor_4_0_6 activeEnergy;            ///< Active energy sensor
        sensors.NumericSensor_4_0_6 apparentEnergy;          ///< Apparent energy sensor
        sensors.NumericSensor_4_0_6 crestFactor;             ///< Crest factor sensor
        sensors.NumericSensor_4_0_6 voltageThd;              ///< Voltage total harmonic distortion sensor
        sensors.NumericSensor_4_0_6 currentThd;              ///< Current total harmonic distortion sensor
    };

    /** for OCP */
    structure DoublePole_8_0_0 {
        string label;                              ///< %Pole label
        PowerLine_3_0_0 line;                      ///< Power line
        int inNodeId;                              ///< Upstream (inlet-side) circuit node id
        int outNodeId;                             ///< Downstream (outlet-side) circuit node id
        sensors.NumericSensor_4_0_6 voltage;               ///< RMS voltage sensor, L-L
        sensors.NumericSensor_4_0_6 voltageLN;             ///< RMS voltage sensor, L-N
        sensors.NumericSensor_4_0_6 current;               ///< RMS current sensor
        sensors.NumericSensor_4_0_6 peakCurrent;           ///< Peak current sensor
        sensors.NumericSensor_4_0_6 activePower;           ///< Active power sensor
        sensors.NumericSensor_4_0_6 apparentPower;         ///< Apparent power sensor
        sensors.NumericSensor_4_0_6 powerFactor;           ///< Power factor sensor
        sensors.NumericSensor_4_0_6 activeEnergy;          ///< Active energy sensor
        sensors.NumericSensor_4_0_6 apparentEnergy;        ///< Apparent energy sensor
    };

    /** A pole that can select one of multiple inputs */
    structure ThrowPole_3_0_0 {
        string label;                              ///< %Pole label
        PowerLine_3_0_0 line;                      ///< Power line
        vector<int> inNodeIds;                     ///< Upstream node ids
        int outNodeId;                             ///< Downstream node id
    };

}

#endif
