|
| 1 | +package api |
| 2 | + |
| 3 | +import ( |
| 4 | + "github.com/enbility/eebus-go/api" |
| 5 | + "github.com/enbility/spine-go/model" |
| 6 | + "time" |
| 7 | +) |
| 8 | + |
| 9 | +// Actor: Monitoring Unit |
| 10 | +// UseCase: Monitoring of Power Consumption |
| 11 | +type MuMPCInterface interface { |
| 12 | + // ------------------------- Getters ------------------------- // |
| 13 | + |
| 14 | + // Scenario 1 |
| 15 | + |
| 16 | + // get the momentary active power consumption or production |
| 17 | + // |
| 18 | + // possible errors: |
| 19 | + // - ErrMissingData if the id is not available |
| 20 | + // - and others |
| 21 | + Power() (float64, error) |
| 22 | + |
| 23 | + // get the momentary active power consumption or production per phase |
| 24 | + // |
| 25 | + // possible errors: |
| 26 | + // - ErrMissingData if the id is not available |
| 27 | + // - and others |
| 28 | + PowerPerPhase() ([]float64, error) |
| 29 | + |
| 30 | + // Scenario 2 |
| 31 | + |
| 32 | + // get the total feed in energy |
| 33 | + // |
| 34 | + // - negative values are used for production |
| 35 | + // |
| 36 | + // possible errors: |
| 37 | + // - ErrMissingData if the id is not available |
| 38 | + // - and others |
| 39 | + EnergyProduced() (float64, error) |
| 40 | + |
| 41 | + // get the total feed in energy |
| 42 | + // |
| 43 | + // - negative values are used for production |
| 44 | + // |
| 45 | + // possible errors: |
| 46 | + // - ErrMissingData if the id is not available |
| 47 | + // - and others |
| 48 | + EnergyConsumed() (float64, error) |
| 49 | + |
| 50 | + // Scenario 3 |
| 51 | + |
| 52 | + // get the momentary phase specific current consumption or production |
| 53 | + // |
| 54 | + // - positive values are used for consumption |
| 55 | + // - negative values are used for production |
| 56 | + // |
| 57 | + // possible errors: |
| 58 | + // - ErrMissingData if the id is not available |
| 59 | + // - and others |
| 60 | + CurrentPerPhase() ([]float64, error) |
| 61 | + |
| 62 | + // Scenario 4 |
| 63 | + |
| 64 | + // get the phase specific voltage details |
| 65 | + // |
| 66 | + // possible errors: |
| 67 | + // - ErrMissingData if the id is not available |
| 68 | + // - and others |
| 69 | + VoltagePerPhase() ([]float64, error) |
| 70 | + |
| 71 | + // Scenario 5 |
| 72 | + |
| 73 | + // get frequency |
| 74 | + // |
| 75 | + // possible errors: |
| 76 | + // - ErrMissingData if the id is not available |
| 77 | + // - and others |
| 78 | + Frequency() (float64, error) |
| 79 | + |
| 80 | + // ------------------------- Setters ------------------------- // |
| 81 | + |
| 82 | + // use Update to update the measurement data |
| 83 | + // use it like this: |
| 84 | + // |
| 85 | + // mpc.Update( |
| 86 | + // mpc.UpdateDataPowerTotal(1000, nil, nil), |
| 87 | + // mpc.UpdateDataPowerPhaseA(500, nil, nil), |
| 88 | + // ... |
| 89 | + // ) |
| 90 | + // |
| 91 | + // possible errors: |
| 92 | + // - ErrMissingData if the id is not available |
| 93 | + // - and others |
| 94 | + Update(data ...api.MeasurementDataForID) error |
| 95 | + |
| 96 | + // Scenario 1 |
| 97 | + |
| 98 | + // use UpdateDataPowerTotal in Update to set the momentary active power consumption or production |
| 99 | + // The timestamp is optional and can be nil |
| 100 | + // The valueState shall be set if it differs from the normal valueState otherwise it can be nil |
| 101 | + UpdateDataPowerTotal(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.MeasurementDataForID |
| 102 | + |
| 103 | + // use UpdateDataPowerPhaseA in Update to set the momentary active power consumption or production per phase |
| 104 | + // The timestamp is optional and can be nil |
| 105 | + // The valueState shall be set if it differs from the normal valueState otherwise it can be nil |
| 106 | + UpdateDataPowerPhaseA(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.MeasurementDataForID |
| 107 | + |
| 108 | + // use UpdateDataPowerPhaseB in Update to set the momentary active power consumption or production per phase |
| 109 | + // The timestamp is optional and can be nil |
| 110 | + // The valueState shall be set if it differs from the normal valueState otherwise it can be nil |
| 111 | + UpdateDataPowerPhaseB(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.MeasurementDataForID |
| 112 | + |
| 113 | + // use UpdateDataPowerPhaseC in Update to set the momentary active power consumption or production per phase |
| 114 | + // The timestamp is optional and can be nil |
| 115 | + // The valueState shall be set if it differs from the normal valueState otherwise it can be nil |
| 116 | + UpdateDataPowerPhaseC(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.MeasurementDataForID |
| 117 | + |
| 118 | + // Scenario 2 |
| 119 | + |
| 120 | + // use UpdateDataEnergyConsumed in Update to set the total feed in energy |
| 121 | + // The timestamp is optional and can be nil |
| 122 | + // The valueState shall be set if it differs from the normal valueState otherwise it can be nil |
| 123 | + // The evaluationStart and End are optional and can be nil (both must be set to be used) |
| 124 | + UpdateDataEnergyConsumed( |
| 125 | + value float64, |
| 126 | + timestamp *time.Time, |
| 127 | + valueState *model.MeasurementValueStateType, |
| 128 | + evaluationStart *time.Time, |
| 129 | + evaluationEnd *time.Time, |
| 130 | + ) api.MeasurementDataForID |
| 131 | + |
| 132 | + // use UpdateDataEnergyProduced in Update to set the total feed in energy |
| 133 | + // The timestamp is optional and can be nil |
| 134 | + // The valueState shall be set if it differs from the normal valueState otherwise it can be nil |
| 135 | + // The evaluationStart and End are optional and can be nil (both must be set to be used) |
| 136 | + UpdateDataEnergyProduced( |
| 137 | + value float64, |
| 138 | + timestamp *time.Time, |
| 139 | + valueState *model.MeasurementValueStateType, |
| 140 | + evaluationStart *time.Time, |
| 141 | + evaluationEnd *time.Time, |
| 142 | + ) api.MeasurementDataForID |
| 143 | + |
| 144 | + // Scenario 3 |
| 145 | + |
| 146 | + // use UpdateDataCurrentPhaseA in Update to set the momentary phase specific current consumption or production |
| 147 | + // The timestamp is optional and can be nil |
| 148 | + // The valueState shall be set if it differs from the normal valueState otherwise it can be nil |
| 149 | + UpdateDataCurrentPhaseA(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.MeasurementDataForID |
| 150 | + |
| 151 | + // use UpdateDataCurrentPhaseB in Update to set the momentary phase specific current consumption or production |
| 152 | + // The timestamp is optional and can be nil |
| 153 | + // The valueState shall be set if it differs from the normal valueState otherwise it can be nil |
| 154 | + UpdateDataCurrentPhaseB(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.MeasurementDataForID |
| 155 | + |
| 156 | + // use UpdateDataCurrentPhaseC in Update to set the momentary phase specific current consumption or production |
| 157 | + // The timestamp is optional and can be nil |
| 158 | + // The valueState shall be set if it differs from the normal valueState otherwise it can be nil |
| 159 | + UpdateDataCurrentPhaseC(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.MeasurementDataForID |
| 160 | + |
| 161 | + // Scenario 4 |
| 162 | + |
| 163 | + // use UpdateDataVoltagePhaseA in Update to set the phase specific voltage details |
| 164 | + // The timestamp is optional and can be nil |
| 165 | + // The valueState shall be set if it differs from the normal valueState otherwise it can be nil |
| 166 | + UpdateDataVoltagePhaseA(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.MeasurementDataForID |
| 167 | + |
| 168 | + // use UpdateDataVoltagePhaseB in Update to set the phase specific voltage details |
| 169 | + // The timestamp is optional and can be nil |
| 170 | + // The valueState shall be set if it differs from the normal valueState otherwise it can be nil |
| 171 | + UpdateDataVoltagePhaseB(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.MeasurementDataForID |
| 172 | + |
| 173 | + // use UpdateDataVoltagePhaseC in Update to set the phase specific voltage details |
| 174 | + // The timestamp is optional and can be nil |
| 175 | + // The valueState shall be set if it differs from the normal valueState otherwise it can be nil |
| 176 | + UpdateDataVoltagePhaseC(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.MeasurementDataForID |
| 177 | + |
| 178 | + // use UpdateDataVoltagePhaseAToB in Update to set the phase specific voltage details |
| 179 | + // The timestamp is optional and can be nil |
| 180 | + // The valueState shall be set if it differs from the normal valueState otherwise it can be nil |
| 181 | + UpdateDataVoltagePhaseAToB(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.MeasurementDataForID |
| 182 | + |
| 183 | + // use UpdateDataVoltagePhaseBToC in Update to set the phase specific voltage details |
| 184 | + // The timestamp is optional and can be nil |
| 185 | + // The valueState shall be set if it differs from the normal valueState otherwise it can be nil |
| 186 | + UpdateDataVoltagePhaseBToC(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.MeasurementDataForID |
| 187 | + |
| 188 | + // use UpdateDataVoltagePhaseCToA in Update to set the phase specific voltage details |
| 189 | + // The timestamp is optional and can be nil |
| 190 | + // The valueState shall be set if it differs from the normal valueState otherwise it can be nil |
| 191 | + UpdateDataVoltagePhaseCToA(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.MeasurementDataForID |
| 192 | + |
| 193 | + // Scenario 5 |
| 194 | + |
| 195 | + // use AcFrequency in Update to set the frequency |
| 196 | + // The timestamp is optional and can be nil |
| 197 | + // The valueState shall be set if it differs from the normal valueState otherwise it can be nil |
| 198 | + UpdateDataFrequency(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.MeasurementDataForID |
| 199 | +} |
0 commit comments