Преглед на файлове

2020-02-04 / ct_chen

Actions:
1. Webservice 配合修改檢查MaxChargingPower,MaxChargingCurrent;SystemStatus配合define.h增加代碼

Files:
1. 如列表
ct_chen преди 5 години
родител
ревизия
3256903dd3
променени са 3 файла, в които са добавени 177 реда и са изтрити 55 реда
  1. 5 1
      EVSE/Modularization/WebService.c
  2. 167 22
      EVSE/rootfs/var/www/set_charging.php
  3. 5 32
      EVSE/rootfs/var/www/set_system.php

+ 5 - 1
EVSE/Modularization/WebService.c

@@ -637,7 +637,7 @@ int main(int argc, char *argv[]) {
 		if (strcmp(argv[1], "aaa") == 0) {
 			//struct SysConfigData 	SysConfig;
 		//system
-		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.ModelName, "AWLU770100T1P0D");
+		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.ModelName, "DWLU770100T1P0D");
 		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.SerialNumber, "SerialNumber");
 		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.SystemId, "1234567890");
 		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.SystemDateTime, "2019-12-31 23:59:59");
@@ -651,6 +651,7 @@ int main(int argc, char *argv[]) {
 		ShmSysConfigAndInfo->SysInfo.SystemFanRotaSpeed=0;
 		ShmSysConfigAndInfo->SysInfo.PsuFanRotaSpeed=0;
 		ShmSysConfigAndInfo->SysConfig.RfidCardNumEndian=0;
+		ShmSysConfigAndInfo->SysConfig.RatingCurrent=100;
 		ShmSysConfigAndInfo->SysConfig.PsuAcInputType=0;
 		ShmSysConfigAndInfo->SysInfo.AuxPower5V=0;
 		ShmSysConfigAndInfo->SysInfo.AuxPower12V=0;
@@ -846,6 +847,7 @@ int main(int argc, char *argv[]) {
 		struct json_object *PsuFanRotaSpeed;
 		struct json_object *RfidCardNumEndian;
 		struct json_object *PsuAcInputType;
+		struct json_object *RatingCurrent;
 		struct json_object *AuxPower5V;
 		struct json_object *AuxPower12V;
 		struct json_object *AuxPower24V;
@@ -977,6 +979,7 @@ int main(int argc, char *argv[]) {
 		PsuFanRotaSpeed = json_object_new_int(ShmSysConfigAndInfo->SysInfo.PsuFanRotaSpeed);
 		RfidCardNumEndian = json_object_new_int(ShmSysConfigAndInfo->SysConfig.RfidCardNumEndian);
 		PsuAcInputType = json_object_new_int(ShmSysConfigAndInfo->SysConfig.PsuAcInputType);
+		RatingCurrent = json_object_new_int(ShmSysConfigAndInfo->SysConfig.RatingCurrent);
 		AuxPower5V = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AuxPower5V);
 		AuxPower12V = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AuxPower12V);
 		AuxPower24V = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AuxPower24V);
@@ -1376,6 +1379,7 @@ int main(int argc, char *argv[]) {
 		json_object_object_add(jobj1,"PsuFanRotaSpeed",PsuFanRotaSpeed);
 		json_object_object_add(jobj1,"RfidCardNumEndian",RfidCardNumEndian);
 		json_object_object_add(jobj1,"PsuAcInputType",PsuAcInputType);
+		json_object_object_add(jobj1,"RatingCurrent",RatingCurrent);
 		json_object_object_add(jobj1,"AuxPower5V",AuxPower5V);
 		json_object_object_add(jobj1,"AuxPower12V",AuxPower12V);
 		json_object_object_add(jobj1,"AuxPower24V",AuxPower24V);

+ 167 - 22
EVSE/rootfs/var/www/set_charging.php

@@ -3,6 +3,10 @@
 	$tag_header = 'set';
 	include 'head.php';
 	$obj = json_decode(trim($output[1]),true);//var_dump($obj);
+	$system = json_decode(trim($output[0]),true);//var_dump($obj);
+	$RatingCurrent = $system['RatingCurrent'];
+	$ModelName = $system['ModelName'];
+	$RatingPower = substr($ModelName,4,2)*pow(10,-1+substr($ModelName,6,1));
 	$ChargingInfo3=$obj['ChargingInfo3'];//var_dump($ChargingInfo3);
 	$idx=0;
 	if($obj['ChargingInfo1']){
@@ -17,20 +21,59 @@
 				$SystemStatus1='authorizing';
 				break;
 			case 3:
-				$SystemStatus1='preparing';
+				$SystemStatus1='reassign check';
 				break;
 			case 4:
-				$SystemStatus1='charging';
+				$SystemStatus1='reassign';
 				break;
 			case 5:
-				$SystemStatus1='terminating';
+				$SystemStatus1='preparing';
 				break;
 			case 6:
-				$SystemStatus1='alarm';
+				$SystemStatus1='preparing for EV';
 				break;
 			case 7:
+				$SystemStatus1='preparing for evse';
+				break;
+			case 8:
+				$SystemStatus1='charging';
+				break;
+			case 9:
+				$SystemStatus1='terminating';
+				break;
+			case 10:
+				$SystemStatus1='complete';
+				break;
+			case 11:
+				$SystemStatus1='alarm';
+				break;
+			case 12:
 				$SystemStatus1='fault';
 				break;
+			case 13:
+				$SystemStatus1='reservation';
+				break;
+			case 14:
+				$SystemStatus1='booking';
+				break;
+			case 15:
+				$SystemStatus1='maintain';
+				break;
+			case 16:
+				$SystemStatus1='debug';
+				break;
+			case 17:
+				$SystemStatus1='precharge step 0';
+				break;
+			case 18:
+				$SystemStatus1='precharge step 1';
+				break;
+			case 19:
+				$SystemStatus1='single run';
+				break;
+			default:
+				$SystemStatus1='unknown';
+				break;
 		}
 	}
 	if($obj['ChargingInfo2']){
@@ -45,20 +88,59 @@
 				$SystemStatus2='authorizing';
 				break;
 			case 3:
-				$SystemStatus2='preparing';
+				$SystemStatus2='reassign check';
 				break;
 			case 4:
-				$SystemStatus2='charging';
+				$SystemStatus2='reassign';
 				break;
 			case 5:
-				$SystemStatus2='terminating';
+				$SystemStatus2='preparing';
 				break;
 			case 6:
-				$SystemStatus2='alarm';
+				$SystemStatus2='preparing for EV';
 				break;
 			case 7:
+				$SystemStatus2='preparing for evse';
+				break;
+			case 8:
+				$SystemStatus2='charging';
+				break;
+			case 9:
+				$SystemStatus2='terminating';
+				break;
+			case 10:
+				$SystemStatus2='complete';
+				break;
+			case 11:
+				$SystemStatus2='alarm';
+				break;
+			case 12:
 				$SystemStatus2='fault';
 				break;
+			case 13:
+				$SystemStatus2='reservation';
+				break;
+			case 14:
+				$SystemStatus2='booking';
+				break;
+			case 15:
+				$SystemStatus2='maintain';
+				break;
+			case 16:
+				$SystemStatus2='debug';
+				break;
+			case 17:
+				$SystemStatus2='precharge step 0';
+				break;
+			case 18:
+				$SystemStatus2='precharge step 1';
+				break;
+			case 19:
+				$SystemStatus2='single run';
+				break;
+			default:
+				$SystemStatus2='unknown';
+				break;
 		}
 	}
 	if($obj['ChargingInfo3']){
@@ -73,20 +155,59 @@
 				$SystemStatus3='authorizing';
 				break;
 			case 3:
-				$SystemStatus3='preparing';
+				$SystemStatus3='reassign check';
 				break;
 			case 4:
-				$SystemStatus3='charging';
+				$SystemStatus3='reassign';
 				break;
 			case 5:
-				$SystemStatus3='terminating';
+				$SystemStatus3='preparing';
 				break;
 			case 6:
-				$SystemStatus3='alarm';
+				$SystemStatus3='preparing for EV';
 				break;
 			case 7:
+				$SystemStatus3='preparing for evse';
+				break;
+			case 8:
+				$SystemStatus3='charging';
+				break;
+			case 9:
+				$SystemStatus3='terminating';
+				break;
+			case 10:
+				$SystemStatus3='complete';
+				break;
+			case 11:
+				$SystemStatus3='alarm';
+				break;
+			case 12:
 				$SystemStatus3='fault';
 				break;
+			case 13:
+				$SystemStatus3='reservation';
+				break;
+			case 14:
+				$SystemStatus3='booking';
+				break;
+			case 15:
+				$SystemStatus3='maintain';
+				break;
+			case 16:
+				$SystemStatus3='debug';
+				break;
+			case 17:
+				$SystemStatus3='precharge step 0';
+				break;
+			case 18:
+				$SystemStatus3='precharge step 1';
+				break;
+			case 19:
+				$SystemStatus3='single run';
+				break;
+			default:
+				$SystemStatus3='unknown';
+				break;
 		}
 	}
 ?>
@@ -134,10 +255,12 @@ img {
 										<div class="form-group" style="display:<?php echo $am001;?>">
 											<label>MaxChargingPower</label>
 											<input type="text" name="MaxChargingPower" id="MaxChargingPower" class="form-control" value="<?php echo $obj['MaxChargingPower'];?>">
+											<input type="hidden" name="RatingPower" id="RatingPower" value="<?php echo $RatingPower;?>">
 										</div>
 										<div class="form-group" style="display:<?php echo $am111;?>">
 											<label>MaxChargingCurrent</label>
 											<input type="text" name="MaxChargingCurrent" id="MaxChargingCurrent" class="form-control" value="<?php echo $obj['MaxChargingCurrent'];?>">
+											<input type="hidden" name="RatingCurrent" id="RatingCurrent" value="<?php echo $RatingCurrent;?>">
 										</div>
 										<div class="form-group" style="display:<?php echo $am111;?>">
 											<label>MaxChargingDuration</label>
@@ -536,6 +659,8 @@ img {
 	
 	function formCheck()
 	{
+		var RatingCurrent = document.getElementById("RatingCurrent").value;
+		var RatingPower = document.getElementById("RatingPower").value;
 		var MaxChargingEnergy = document.getElementById("MaxChargingEnergy").value;
 		var MaxChargingPower = document.getElementById("MaxChargingPower").value;
 		var MaxChargingCurrent = document.getElementById("MaxChargingCurrent").value;
@@ -553,11 +678,21 @@ img {
 			document.getElementById("MaxChargingEnergy").focus();
 			return false;
 		}
-		if(MaxChargingPower >65535)
-		{
-			alert("MaxChargingPower must <= 65535!");
-			document.getElementById("MaxChargingPower").focus();
-			return false;
+		if(RatingPower!="" && RatingPower!=0){
+			if(MaxChargingPower > RatingPower)
+			{
+				alert("MaxChargingPower must be less than RatingPower("+RatingPower+")!");
+				document.getElementById("MaxChargingPower").focus();
+				return false;
+			}
+		}
+		else{
+			if(MaxChargingPower >65535)
+			{
+				alert("MaxChargingPower must <= 65535!");
+				document.getElementById("MaxChargingPower").focus();
+				return false;
+			}
 		}
 		if(MaxChargingPower < 0)
 		{
@@ -565,11 +700,21 @@ img {
 			document.getElementById("MaxChargingPower").focus();
 			return false;
 		}
-		if(MaxChargingCurrent >65535)
-		{
-		    alert("MaxChargingCurrent must <= 65535!");
-			document.getElementById("MaxChargingCurrent").focus();
-			return false;
+		if(RatingCurrent!="" && RatingCurrent!=0){
+			if(MaxChargingCurrent > RatingCurrent)
+			{
+				alert("MaxChargingCurrent must be less than RatingCurrent("+RatingCurrent+")!");
+				document.getElementById("MaxChargingCurrent").focus();
+				return false;
+			}
+		}
+		else{
+			if(MaxChargingCurrent >65535)
+			{
+				alert("MaxChargingCurrent must <= 65535!");
+				document.getElementById("MaxChargingCurrent").focus();
+				return false;
+			}
 		}
 		if(MaxChargingCurrent < 0)
 		{

+ 5 - 32
EVSE/rootfs/var/www/set_system.php

@@ -3,33 +3,6 @@
 	$tag_header = 'set';
 	include 'head.php';
 	$obj = json_decode(trim($output[0]));//var_dump($obj);
-	$SystemStatus='';
-	switch ($obj->{'SystemStatus'}){
-		case 0:
-			$SystemStatus='Booting';
-			break;
-		case 1:
-			$SystemStatus='idle';
-			break;
-		case 2:
-			$SystemStatus='authorizing';
-			break;
-		case 3:
-			$SystemStatus='preparing';
-			break;
-		case 4:
-			$SystemStatus='charging';
-			break;
-		case 5:
-			$SystemStatus='terminating';
-			break;
-		case 6:
-			$SystemStatus='alarm';
-			break;
-		case 7:
-			$SystemStatus='fault';
-			break;
-	}
 ?>
 <style>
 img {
@@ -100,11 +73,6 @@ img {
 												<option value="3" <?php echo $obj->{'AcPhaseCount'}=="3"?"selected":""?>>Three phase</option>
 											</select>
 										</div>
-<?php /*										<div class="form-group" style="display:<?php echo $am111;?>">
-											<label>System Status</label>
-											<input type="text" readonly class="form-control" placeholder="<?php echo $SystemStatus;?>">
-											<input type="hidden" name="SystemStatus" id="SystemStatus" value="<?php echo $SystemStatus;?>">
-										</div>*/?>
 										<div class="form-group" style="display:<?php echo $am111;?>">
 											<label>Factory Configuration</label>
 											<select class="form-control" id="FactoryConfiguration" name="FactoryConfiguration">
@@ -177,6 +145,11 @@ img {
 												<option value="1" <?php echo $obj->{'PsuAcInputType'}=="1"?"selected":""?>>277 +10%/-15%</option>
 											</select>
 										</div>
+										<div class="form-group" style="display:<?php echo $am111;?>">
+											<label>RatingCurrent</label>
+											<input type="text" readonly class="form-control" placeholder="<?php echo $obj->{'RatingCurrent'};?> amp">
+											<input type="hidden" name="RatingCurrent" id="RatingCurrent" value="<?php echo $obj->{'RatingCurrent'};?>">
+										</div>
 									</section>
 								</article>
 								<!--Aux. power Information-->