sap-labs-france / ev-simulator

e-Mobility OCPP-J Charging Stations simulator

Home Page:https://open-e-mobility.fr/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MeterValuesRequest does not follow OCPP 1.6 Schema

lucvht opened this issue · comments

Hi,

Running some test using the simulator and it seems the output of the MeterValuesRequest message does not follow the ocpp 1.6 schema, which specifies that meterValue should be an array.

Schema:

{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "id": "urn:OCPP:1.6:2019:12:MeterValuesRequest",
    "title": "MeterValuesRequest",
    "type": "object",
    "properties": {
        "connectorId": {
            "type": "integer"
        },
        "transactionId": {
            "type": "integer"
        },
        "meterValue": {
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "timestamp": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "sampledValue": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "value": {
                                    "type": "string"
                                },
                                "context": {
                                    "type": "string",
                                    "additionalProperties": false,
                                    "enum": [
                                        "Interruption.Begin",
                                        "Interruption.End",
                                        "Sample.Clock",
                                        "Sample.Periodic",
                                        "Transaction.Begin",
                                        "Transaction.End",
                                        "Trigger",
                                        "Other"
                                    ]
                                },
                                "format": {
                                    "type": "string",
                                    "additionalProperties": false,
                                    "enum": [
                                        "Raw",
                                        "SignedData"
                                    ]
                                },
                                "measurand": {
                                    "type": "string",
                                    "additionalProperties": false,
                                    "enum": [
                                        "Energy.Active.Export.Register",
                                        "Energy.Active.Import.Register",
                                        "Energy.Reactive.Export.Register",
                                        "Energy.Reactive.Import.Register",
                                        "Energy.Active.Export.Interval",
                                        "Energy.Active.Import.Interval",
                                        "Energy.Reactive.Export.Interval",
                                        "Energy.Reactive.Import.Interval",
                                        "Power.Active.Export",
                                        "Power.Active.Import",
                                        "Power.Offered",
                                        "Power.Reactive.Export",
                                        "Power.Reactive.Import",
                                        "Power.Factor",
                                        "Current.Import",
                                        "Current.Export",
                                        "Current.Offered",
                                        "Voltage",
                                        "Frequency",
                                        "Temperature",
                                        "SoC",
                                        "RPM"
                                    ]
                                },
                                "phase": {
                                    "type": "string",
                                    "additionalProperties": false,
                                    "enum": [
                                        "L1",
                                        "L2",
                                        "L3",
                                        "N",
                                        "L1-N",
                                        "L2-N",
                                        "L3-N",
                                        "L1-L2",
                                        "L2-L3",
                                        "L3-L1"
                                    ]
                                },
                                "location": {
                                    "type": "string",
                                    "additionalProperties": false,
                                    "enum": [
                                        "Cable",
                                        "EV",
                                        "Inlet",
                                        "Outlet",
                                        "Body"
                                    ]
                                },
                                "unit": {
                                    "type": "string",
                                    "additionalProperties": false,
                                    "enum": [
                                        "Wh",
                                        "kWh",
                                        "varh",
                                        "kvarh",
                                        "W",
                                        "kW",
                                        "VA",
                                        "kVA",
                                        "var",
                                        "kvar",
                                        "A",
                                        "V",
                                        "K",
                                        "Celcius",
                                        "Celsius",
                                        "Fahrenheit",
                                        "Percent"
                                    ]
                                }
                            },
                            "additionalProperties": false,
                            "required": [
                                "value"
                            ]
                        }
                    }
                },
                "additionalProperties": false,
                "required": [
                    "timestamp",
                    "sampledValue"
                ]       
            }
        }
    },
    "additionalProperties": false,
    "required": [
        "connectorId",
        "meterValue"
    ]
}

Received output:

{'connectorId': 1, 
    'transactionId': 5555, 
    'meterValue': 
        {'timestamp': '2021-08-15T17:17:41.305Z', 
        'sampledValue': 
            [{'unit': 'V', 'measurand': 'Voltage', 'value': '239.14'}, 
             {'unit': 'V', 'measurand': 'Voltage', 'value': '239.14', 'phase': 'L1-N'}, 
             {'unit': 'V', 'measurand': 'Voltage', 'value': '239.14', 'phase': 'L2-N'}, 
             {'unit': 'V', 'measurand': 'Voltage', 'value': '239.14', 'phase': 'L3-N'}, 
             {'unit': 'W', 'measurand': 'Power.Active.Import', 'value': '17232.22'}, 
             {'unit': 'W', 'measurand': 'Power.Active.Import', 'value': '3799.31', 'phase': 'L1-N'}, 
             {'unit': 'W', 'measurand': 'Power.Active.Import', 'value': '7107.15', 'phase': 'L2-N'}, 
             {'unit': 'W', 'measurand': 'Power.Active.Import', 'value': '6325.76', 'phase': 'L3-N'}, 
             {'unit': 'A', 'measurand': 'Current.Import', 'value': '12.47'}, 
             {'unit': 'A', 'measurand': 'Current.Import', 'value': '8.8', 'phase': 'L1'}, 
             {'unit': 'A', 'measurand': 'Current.Import', 'value': '25.19', 'phase': 'L2'}, 
             {'unit': 'A', 'measurand': 'Current.Import', 'value': '3.42', 'phase': 'L3'}, 
             {'unit': 'Wh', 'value': '163'}
            ]
        }
}

Expected output:

{'connectorId': 1, 
    'transactionId': 5555, 
    'meterValue': 
        [{'timestamp': '2021-08-15T17:17:41.305Z', 
        'sampledValue': 
            [{'unit': 'V', 'measurand': 'Voltage', 'value': '239.14'}, 
             {'unit': 'V', 'measurand': 'Voltage', 'value': '239.14', 'phase': 'L1-N'}, 
             {'unit': 'V', 'measurand': 'Voltage', 'value': '239.14', 'phase': 'L2-N'}, 
             {'unit': 'V', 'measurand': 'Voltage', 'value': '239.14', 'phase': 'L3-N'}, 
             {'unit': 'W', 'measurand': 'Power.Active.Import', 'value': '17232.22'}, 
             {'unit': 'W', 'measurand': 'Power.Active.Import', 'value': '3799.31', 'phase': 'L1-N'}, 
             {'unit': 'W', 'measurand': 'Power.Active.Import', 'value': '7107.15', 'phase': 'L2-N'}, 
             {'unit': 'W', 'measurand': 'Power.Active.Import', 'value': '6325.76', 'phase': 'L3-N'}, 
             {'unit': 'A', 'measurand': 'Current.Import', 'value': '12.47'}, 
             {'unit': 'A', 'measurand': 'Current.Import', 'value': '8.8', 'phase': 'L1'}, 
             {'unit': 'A', 'measurand': 'Current.Import', 'value': '25.19', 'phase': 'L2'}, 
             {'unit': 'A', 'measurand': 'Current.Import', 'value': '3.42', 'phase': 'L3'}, 
             {'unit': 'Wh', 'value': '163'}
            ]
        }]
}

Welcome to your first issue in e-Mobility software

ev-simulator is now officially maintained under https://github.com/jerome-benoit/ev-simulator

No it's not.

Yes it is. The fork is the officially maintained one by the facts. The one here is only a leftover that the Open e-Mobility project is not able to maintain anymore.
And the code made under my fork have not been made during my working hours, so belongs to me and is not under the SAP CLA, so not mergeable here without my consent through CLA signing.

You have absolutely not the right to say in this repo that it is now officially maintained in yours when we will continue to use this one officially.

You have absolutely not the right to say in this repo that it is now officially maintained in yours when we will continue to use this one officially.

I have the right to state a fact where I want, it's called freedom of speech: that ev-simulator repository is not maintained and my forked one is officially maintained. That's a fact that everybody can check. That's not because you say the sky is green that it's in fact green: the sky is still blue.
That what happened when people maintaining a repository are asked to left a team in the FOSS world: they fork it and maintain their fork while upstream is not.

This repo is still maintained until I say otherwise and you'll talk to the boss and explain your wrong behavior as usual.

This repo is still maintained until I say otherwise and you'll talk to the boss and explain your wrong behavior as usual.

The definition of a maintained and supported repository is that people are dedicated to its maintenance. That repository does not fulfill that definition, hence it's not maintained. It's easy to understand and easily checkable.
The speech I've written here is not under my employer responsibilities nor done during my working hours and express my own views. And my own views are not under my employer endorsement. In a free country, the enterprise you work for have no rights to control what you think, do, write, ... during your free time (happily). It's a simple concept to understand, so I will not explain anything to anyone at the employer workplace.
But I guess that a management that ask an employer that is not even part of its team to account on its free time activities do have some explanations to give about the unacceptable private life intrusion.

As I wrote, this repository is still maintained by my team in SAP Labs France.

As I wrote you have no authority in these GitHub repositories and you are no longer a contributor of them.
Then, you cannot take any decisions on my behalf, state that this repo is no longer maintained and you cannot submit comments the way you do.
Your behaviour has be reported to your manager,

@lucvht We'll provide a fix.
@mahdibenromdhane Could you check this issue?

@lucvht It seems that commit b02ab21 should fix your problem.
Could you confirm?

Fixed