Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Checkpoint 535 #28

Open
Mustafa19981903 opened this issue Jun 27, 2024 · 7 comments
Open

Checkpoint 535 #28

Mustafa19981903 opened this issue Jun 27, 2024 · 7 comments

Comments

@Mustafa19981903
Copy link

@uhi22 https://github.com/uhi22/pyPLC#example-flow I want to add an RFID or similar control at checkpoint 535, 536 and 538.
msg = addV2GTPHeader(exiEncode("EDl")) # EDl for Encode, Din, ContractAuthenticationResponse how do I update this line of code

@uhi22
Copy link
Owner

uhi22 commented Jun 27, 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.

@Mustafa19981903
Copy link
Author

Mustafa19981903 commented Jul 2, 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?

@uhi22
Copy link
Owner

uhi22 commented Jul 2, 2024

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

@Mustafa19981903
Copy link
Author

@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

@uhi22
Copy link
Owner

uhi22 commented Jul 9, 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.

@Mustafa19981903
Copy link
Author

Mustafa19981903 commented Jul 16, 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

@uhi22
Copy link
Owner

uhi22 commented Jul 23, 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants