Code Monkey home page Code Monkey logo

Comments (7)

uhi22 avatar uhi22 commented on August 20, 2024

At the moment, the EXI encoder does only support one type of ContractAuthenticationResponse: it says "authentication done". To support the RFID or similar check, we need two different cases, the "done" and the "ongoing" case.
This needs:

  • In the exi encoder (OpenV2Gx), between init_dinContractAuthenticationResType() and prepareGlobalStream(), set the field EVSEProcessing to dinEVSEProcessingType_Finished or dinEVSEProcessingType_Ongoing, depending on the first command line parameter. We get the first parameter by calling getIntParam(0).
  • In pyPLC, add a parameter to the exiEncode("EDl"), something like exiEncode("EDl_"+strAuthFinished), where strAuthFinished is a string with eigther "0" or "1" depending on the result of the RFID check.

from pyplc.

Mustafa19981903 avatar Mustafa19981903 commented on August 20, 2024

myprogs code update
void encodeContractAuthenticationResponse(void) {
init_dinMessageHeaderWithSessionID();
init_dinBodyType(&dinDoc.V2G_Message.Body);
dinDoc.V2G_Message.Body.ContractAuthenticationRes_isUsed = 1u;
init_dinContractAuthenticationResType(&dinDoc.V2G_Message.Body.ContractAuthenticationRes);
prepareGlobalStream();

int authStatus =getIntParam(0);
 if(authStatus==1){
      EVSEProcessing=dinEVSEProcessingType_Finished;
 }
else{
     EVSEProcessing=dinEVSEProcessingType_Ongoing;
}
g_errn = encode_dinExiDocument(&global_stream1, &dinDoc);
printGlobalStream();
sprintf(gInfoString, "encodeContractAuthenticationResponse finished");

}

fsmevse code uptade
if (strConverterResult.find("ContractAuthenticationReq")>0):
if self.rfid_check_successful:
self.strAuthFinished="1"
else:
self.strAuthFinished="0"
# todo: check the request content, and fill response parameters
msg = addV2GTPHeader(exiEncode("EDl"+self.strAuthFinished))

@uhi22 Are there any missteps?

from pyplc.

uhi22 avatar uhi22 commented on August 20, 2024

Looks good, only the underline is missing after the EDI, to separate the parameter.

from pyplc.

Mustafa19981903 avatar Mustafa19981903 commented on August 20, 2024

@uhi22 I am experiencing this issue every time I run the software. When I unplug and replug the Ethernet cable, the software continues to work. I have also changed my IP address within the software, but this issue persists.
starting in EvseMode, simulated environment
initializing pyPlcWorker
[addressManager] we have local MAC D8:3A:DD:7C:4B:59.
[addressManager] Found 0 link-local IPv6 addresses.
[addressManager] Error: No local Ipv6 address was found.
Exiting, because it does not make sense to continue without IPv6 address

from pyplc.

uhi22 avatar uhi22 commented on August 20, 2024

What is your plan? If you want to run pyPLC against an other machine, the precondition is that an active ethernet connection to the modem is present and the operating system cared for assigning an IP address. Loss of IP adress should be checked in the OS (ipconfig or ifconfig or such things).
If you want to run two instances of pyPLC at the same machine, without ethernet connected, you could try to comment-out the check in addressmanager, I'm not sure whether this solves the issue. Did not use this mode since a long time.

from pyplc.

Mustafa19981903 avatar Mustafa19981903 commented on August 20, 2024

@uhi22 ****FSMEVSE
if (strConverterResult.find("ContractAuthenticationReq")>0):
# todo: check the request content, and fill response parameters
self.value1, self.value2 = self.hardwareInterface.read_registers()
#print(self.value1)
if(self.value1==4):
self.strAuthFinished="1"
#print("1")
else:
self.strAuthFinished="0"
# print("0")
msg = addV2GTPHeader(exiEncode("EDl_"+self.strAuthFinished)) # EDl for Encode, Din, ContractAuthenticationResponse
if (testsuite_faultinjection_is_triggered(TC_EVSE_ResponseCode_SequenceError_for_ContractAuthenticationRes)):
# send a ContractAuthenticationResponse with Responsecode SequenceError
msg = addV2GTPHeader("809a021a3b7c417774813310c0A200")
self.addToTrace("responding " + prettyHexMessage(msg))
self.showDecodedTransmitMessage(msg)
self.publishStatus("ContractAuthentication")
self.Tcp.transmit(msg)
self.enterState(stateWaitForFlexibleRequest) # todo: not clear, what is specified in DIN

*****OpenV2Gx

int authStatus =getIntParam(0);
 if(authStatus==1){
      dinDoc.V2G_Message.Body.ContractAuthenticationRes.EVSEProcessing=dinEVSEProcessingType_Finished;
 }
else{
     dinDoc.V2G_Message.Body.ContractAuthenticationRes.EVSEProcessing=dinEVSEProcessingType_Ongoing;
}

I communicated with the fsmevse software with a different processor from the outside with uart. If the incoming value is 4, "EVSEProcessing": "Finished". If the incoming value is not 4, "EVSEProcessing": "Ongoing",. You can make changes to the software according to your need. It was tested with simulation software. The logs are in the file below. This control software only works with din iso15118 how do we integrate?

log.txt

from pyplc.

uhi22 avatar uhi22 commented on August 20, 2024

Great, thanks. I now added the authentication feature for both, DIN and ISO1, with these commits:
1171d34
uhi22/OpenV2Gx@0ee2d2a
For demonstration I just used a counter to give the response "ongoing" on the first try, and "finished" at the second try. For real-life usage, the function isUserAuthenticated() needs to be extended with the real RFID check (or whatever).
I tested only the DIN so far, so ISO1 is untested at the moment.

from pyplc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.