Sfoglia il codice sorgente

[Add][Modularization][Module_PowerSharing / Webservice]

2022.05.09 / Folus Wen

Actions:
1. Module_PowerSharing consider AC 3 phase logic.
3. Webpage add local power sharing capacity configuration item.

Files:
1. As follow commit history

Image version: D0.00.XX.XXXX.XX
Image checksum: XXXXXXXX

Hardware PWB P/N : XXXXXXX
Hardware Version : XXXXXXX
FolusWen 2 anni fa
parent
commit
4502c1583b

+ 4 - 4
EVSE/Modularization/Module_PowerSharing.c

@@ -273,7 +273,7 @@ uint16_t checkChargingProfileLimit()
 	 * 	TODO:
 	 * 	1. Default capacity check
 	 */
-	uint16_t targetMaxCurrent = modelnameInfo.ratedPower/220;
+	uint16_t targetMaxCurrent = ((ShmSysConfigAndInfo->SysConfig.PowerSharingCapacityPower==0)?(modelnameInfo.ratedPower/220):(ShmSysConfigAndInfo->SysConfig.PowerSharingCapacityPower/220));
 
 	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
 	{
@@ -716,7 +716,7 @@ int conn_getOnHandCurrent(void)
 		{
 			for(uint8_t gun_index=0;gun_index<ShmPowerSharing->Connection_Info[idx].connectorCount;gun_index++)
 			{
-				result += ShmPowerSharing->Connection_Info[idx].connectorInfo[gun_index].availableSharingCurrent;
+				result += (ShmPowerSharing->Connection_Info[idx].connectorInfo[gun_index].connectorType == CONNECTOR_TYPE_AC_THREE?ShmPowerSharing->Connection_Info[idx].connectorInfo[gun_index].availableSharingCurrent*3:ShmPowerSharing->Connection_Info[idx].connectorInfo[gun_index].availableSharingCurrent);
 			}
 		}
 	}
@@ -1021,7 +1021,7 @@ int tcpSocketClient(void)
 						{
 							uint8_t tempIndex;
 
-							output.buffer[4+(gun_index*6)] = (gunType[gun_index]==GUN_TYPE_AC?CONNECTOR_TYPE_AC:CONNECTOR_TYPE_DC);
+							output.buffer[4+(gun_index*6)] = (gunType[gun_index]==GUN_TYPE_AC?(ShmSysConfigAndInfo->SysConfig.AcPhaseCount==3?CONNECTOR_TYPE_AC_THREE:CONNECTOR_TYPE_AC):CONNECTOR_TYPE_DC);
 
 							switch(gunType[gun_index])
 							{
@@ -1284,7 +1284,7 @@ int balance_check_loop(void)
 								(ShmPowerSharing->onHandCurrent > 0))
 
 						{
-							ShmPowerSharing->Connection_Info[idx].connectorInfo[gun_index].availableSharingCurrent += ShmPowerSharing->onHandCurrent/(ShmPowerSharing->connectedConnectorQty==0?1:ShmPowerSharing->connectedConnectorQty);
+							ShmPowerSharing->Connection_Info[idx].connectorInfo[gun_index].availableSharingCurrent += (ShmPowerSharing->Connection_Info[idx].connectorInfo[gun_index].connectorType==CONNECTOR_TYPE_AC_THREE?ShmPowerSharing->onHandCurrent/(ShmPowerSharing->connectedConnectorQty==0?1:ShmPowerSharing->connectedConnectorQty)/3:ShmPowerSharing->onHandCurrent/(ShmPowerSharing->connectedConnectorQty==0?1:ShmPowerSharing->connectedConnectorQty));
 						}
 						else
 						{}

+ 1 - 0
EVSE/Modularization/Module_PowerSharing.h

@@ -103,6 +103,7 @@ enum GUN_TYPE
 enum CONNECTOR_TYPE
 {
 	CONNECTOR_TYPE_AC=0,
+	CONNECTOR_TYPE_AC_THREE,
 	CONNECTOR_TYPE_DC
 };
 

+ 8 - 0
EVSE/Modularization/WebService.c

@@ -1071,6 +1071,7 @@ int main(int argc, char *argv[]) {
 			char *OcppSecurityPassword=NULL;
 			char *MaintainServerSecurityPassword=NULL;
 			int isEnableLocalPowerSharging=0;
+			int PowerSharingCapacity=0;
 			char *PowerSharingServerIP=NULL;
 			char *OcppReceiptrURL=NULL;
 			char *MaintainServerURL=NULL;
@@ -1132,6 +1133,10 @@ int main(int argc, char *argv[]) {
 				isEnableLocalPowerSharging = json_object_get_int(val_obj);
 				ShmSysConfigAndInfo->SysConfig.isEnableLocalPowerSharing = isEnableLocalPowerSharging;
 			}
+			if( json_object_object_get_ex(jobj, "PowerSharingCapacity", &val_obj) ) {
+				PowerSharingCapacity = json_object_get_int(val_obj);
+				ShmSysConfigAndInfo->SysConfig.PowerSharingCapacityPower = PowerSharingCapacity;
+			}
 			if( json_object_object_get_ex(jobj, "PowerSharingServerIP", &val_obj) ) {
 				PowerSharingServerIP = (char*)json_object_get_string(val_obj);
 				strcpy((char *)&ShmSysConfigAndInfo->SysConfig.PowerSharingServerIP,PowerSharingServerIP);
@@ -1881,6 +1886,7 @@ int main(int argc, char *argv[]) {
 		struct json_object *MaintainServerSecurityProfile;
 		struct json_object *MaintainServerSecurityPassword;
 		struct json_object *isEnableLocalPowerSharging;
+		struct json_object *PowerSharingCapacity;
 		struct json_object *PowerSharingServerIP;
 		struct json_object *OcppReceiptrURL;
 		struct json_object *MaintainServerURL;
@@ -2568,6 +2574,7 @@ int main(int argc, char *argv[]) {
 		MaintainServerURL = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.MaintainServerURL);
 		if(strcmp(IsDO, "AX") == 0 ){
 			isEnableLocalPowerSharging = json_object_new_int(ShmSysConfigAndInfo->SysConfig.isEnableLocalPowerSharing);
+			PowerSharingCapacity = json_object_new_int(ShmSysConfigAndInfo->SysConfig.PowerSharingCapacityPower);
 			PowerSharingServerIP = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.PowerSharingServerIP);
 		}
 		if(strcmp(IsDO, "AX") == 0|| strcmp(IsAcDc, "D") == 0){
@@ -2999,6 +3006,7 @@ int main(int argc, char *argv[]) {
 		json_object_object_add(jobj4,"MaintainServerURL",MaintainServerURL);
 		if(strcmp(IsDO, "AX") == 0){
 			json_object_object_add(jobj4,"isEnableLocalPowerSharging",isEnableLocalPowerSharging);
+			json_object_object_add(jobj4,"PowerSharingCapacity",PowerSharingCapacity);
 			json_object_object_add(jobj4,"PowerSharingServerIP",PowerSharingServerIP);
 		}
 		if(strcmp(IsDO, "AX") == 0 || strcmp(IsAcDc, "D") == 0){

+ 1 - 0
EVSE/Projects/define.h

@@ -592,6 +592,7 @@ struct SysConfigData
     unsigned char           MaintainServerSecurityProfile;      // Maintain server security profile 0~3
     unsigned char           MaintainServerSecurityPassword[41]; // Maintain server AuthorizationKey for security profile
     unsigned char           PowerSharingServerIP[512];          // Local power sharing server ip address
+    unsigned int			PowerSharingCapacityPower;			// Local power sharing capacity power
 };
 
 struct ChargingInfoData

+ 22 - 6
EVSE/rootfs/var/www/set_backend.php

@@ -200,7 +200,7 @@ CORE STYLES ABOVE - NO TOUCHY
 									<section>
 										<div class="form-group" style="display:<?php echo $am101;?>">
 											<label>Backend Connection Timeout</label>
-											<input type="text" name="BackendConnTimeout" id="BackendConnTimeout" class="form-control" value="<?php echo $obj->{'BackendConnTimeout'};?>">
+											<input type="number" name="BackendConnTimeout" id="BackendConnTimeout" class="form-control" value="<?php echo $obj->{'BackendConnTimeout'};?>">
 											<small class="form-text text-muted-red">seconds</small>
 										</div>
 										<div class="form-group" style="display:<?php echo $am101;?>">
@@ -215,12 +215,12 @@ CORE STYLES ABOVE - NO TOUCHY
 										<div class="form-group" style="display:<?php echo $am101;?>">
 											<label>Offline Max Charge Energy</label>
 											<small class="form-text text-muted-red">kWh</small>
-											<input type="text" name="OfflineMaxChargeEnergy" id="OfflineMaxChargeEnergy" class="form-control" value="<?php echo $obj->{'OfflineMaxChargeEnergy'};?>">
+											<input type="number" name="OfflineMaxChargeEnergy" id="OfflineMaxChargeEnergy" class="form-control" value="<?php echo $obj->{'OfflineMaxChargeEnergy'};?>">
 										</div>
 										<div class="form-group" style="display:<?php echo $am101;?>">
 											<label>Offline Max Charge Duration</label>
 											<small class="form-text text-muted-red">minutes</small>
-											<input type="text" name="OfflineMaxChargeDuration" id="OfflineMaxChargeDuration" class="form-control" value="<?php echo $obj->{'OfflineMaxChargeDuration'};?>">
+											<input type="number" name="OfflineMaxChargeDuration" id="OfflineMaxChargeDuration" class="form-control" value="<?php echo $obj->{'OfflineMaxChargeDuration'};?>">
 										</div>
 									</section>
 								</article>
@@ -271,10 +271,16 @@ CORE STYLES ABOVE - NO TOUCHY
 												<option value="2" <?php echo $obj->{'isEnableLocalPowerSharging'}=="2"?"selected":""?>>slave</option>
 											</select>
 										</div>
+										<div id="PowerSharingCapacityDiv" class="form-group" style="display:<?php echo $am101;?>">
+											<label>Power Sharing Capacity</label><small class="form-text text-muted-red"> W</small>
+											<input type="number" min="0" max="5000000" name="PowerSharingCapacity" id="PowerSharingCapacity" class="form-control" value="<?php echo $obj->{'PowerSharingCapacity'};?>">											
+											<small class="form-text text-muted-red">'0' means follow rating power from model name</small>
+										</div>
 										<div id="PowerSharingServerIPDiv" class="form-group" style="display:<?php echo $am101;?>">
 											<label>Power Sharing Server Ip</label>
 											<input type="text" name="PowerSharingServerIP" id="PowerSharingServerIP" class="form-control" value="<?php echo $obj->{'PowerSharingServerIP'};?>">
 										</div>
+
 <?php } ?>
 										<div class="form-group" style="display:<?php echo $am101;?>">
 											<label>Maintain Server Connection Status</label>
@@ -399,6 +405,7 @@ CORE STYLES ABOVE - NO TOUCHY
 <?php if(substr($ModelName,0,2)=="AX"){?>
 				data += "&isEnableLocalPowerSharging=" + document.getElementById("isEnableLocalPowerSharging").value;
 				data += "&PowerSharingServerIP=" + document.getElementById("PowerSharingServerIP").value;
+				data += "&PowerSharingCapacity=" + document.getElementById("PowerSharingCapacity").value;
 <?php } if(substr($ModelName,0,2)=="AX" || substr($ModelName,0,1)=="D"){?>
 				data += "&OcppReceiptrURL=" + document.getElementById("OcppReceiptrURL").value;
 <?php } ?>
@@ -553,10 +560,19 @@ CORE STYLES ABOVE - NO TOUCHY
 			document.getElementById("chargePointVendor").removeAttribute("readOnly");
 		}*/
 
-		if(document.getElementById("isEnableLocalPowerSharging").selectedIndex==2){
-			document.getElementById("PowerSharingServerIPDiv").style.display="block";
+		if(document.getElementById("isEnableLocalPowerSharging").selectedIndex==1)
+		{
+			document.getElementById("PowerSharingCapacityDiv").style.display="block";	
+			document.getElementById("PowerSharingServerIPDiv").style.display="none";	
 		}
-		else{
+		else if(document.getElementById("isEnableLocalPowerSharging").selectedIndex==2)
+		{
+			document.getElementById("PowerSharingCapacityDiv").style.display="none";	
+			document.getElementById("PowerSharingServerIPDiv").style.display="block";				
+		}
+		else
+		{
+			document.getElementById("PowerSharingCapacityDiv").style.display="none";	
 			document.getElementById("PowerSharingServerIPDiv").style.display="none";
 		}
 	}

+ 3 - 0
EVSE/rootfs/var/www/set_backend_action.php

@@ -74,6 +74,9 @@
 			checkValue("isEnableLocalPowerSharging");
 			$json['isEnableLocalPowerSharging']	= (int)$_REQUEST['isEnableLocalPowerSharging'];
 		}
+		if(isset($_REQUEST['PowerSharingCapacity'])){
+			$json['PowerSharingCapacity']	= str_replace("&amp;","&",str_replace("&quot;",'"',str_replace("&#039;","'",str_replace("&lt;","<",str_replace("&gt;",">",$_REQUEST['PowerSharingCapacity'])))));
+		}
 		if(isset($_REQUEST['PowerSharingServerIP'])){
 			$json['PowerSharingServerIP']	= str_replace("&amp;","&",str_replace("&quot;",'"',str_replace("&#039;","'",str_replace("&lt;","<",str_replace("&gt;",">",$_REQUEST['PowerSharingServerIP'])))));
 		}