DummyDCEVSEController.java 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. /*******************************************************************************
  2. * The MIT License (MIT)
  3. *
  4. * Copyright (c) 2015-207 V2G Clarity (Dr.-Ing. Marc Mültin)
  5. *
  6. * Permission is hereby granted, free of charge, to any person obtaining a copy
  7. * of this software and associated documentation files (the "Software"), to deal
  8. * in the Software without restriction, including without limitation the rights
  9. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  10. * copies of the Software, and to permit persons to whom the Software is
  11. * furnished to do so, subject to the following conditions:
  12. *
  13. * The above copyright notice and this permission notice shall be included in
  14. * all copies or substantial portions of the Software.
  15. *
  16. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  19. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  20. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  21. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  22. * THE SOFTWARE.
  23. *******************************************************************************/
  24. package com.v2gclarity.risev2g.secc.evseController;
  25. import java.math.BigInteger;
  26. import javax.xml.bind.JAXBElement;
  27. import javax.xml.namespace.QName;
  28. import com.v2gclarity.risev2g.secc.session.V2GCommunicationSessionSECC;
  29. import com.v2gclarity.risev2g.shared.v2gMessages.msgDef.DCEVSEChargeParameterType;
  30. import com.v2gclarity.risev2g.shared.v2gMessages.msgDef.DCEVSEStatusCodeType;
  31. import com.v2gclarity.risev2g.shared.v2gMessages.msgDef.DCEVSEStatusType;
  32. import com.v2gclarity.risev2g.shared.v2gMessages.msgDef.EVSENotificationType;
  33. import com.v2gclarity.risev2g.shared.v2gMessages.msgDef.IsolationLevelType;
  34. import com.v2gclarity.risev2g.shared.v2gMessages.msgDef.MeterInfoType;
  35. import com.v2gclarity.risev2g.shared.v2gMessages.msgDef.PhysicalValueType;
  36. import com.v2gclarity.risev2g.shared.v2gMessages.msgDef.UnitSymbolType;
  37. public class DummyDCEVSEController implements IDCEVSEController {
  38. private V2GCommunicationSessionSECC commSessionContext;
  39. private PhysicalValueType targetCurrent;
  40. private PhysicalValueType targetVoltage;
  41. private PhysicalValueType maximumEVVoltageLimit;
  42. private PhysicalValueType maximumEVCurrentLimit;
  43. private PhysicalValueType maximumEVPowerLimit;
  44. private IsolationLevelType isolationLevel;
  45. public DummyDCEVSEController(V2GCommunicationSessionSECC commSessionContext) {
  46. setCommSessionContext(commSessionContext);
  47. setIsolationLevel(IsolationLevelType.INVALID);
  48. }
  49. @Override
  50. public String getEvseID() {
  51. return "DE*V2G*E12345";
  52. }
  53. @Override
  54. public JAXBElement<DCEVSEChargeParameterType> getDCEVSEChargeParameter() {
  55. DCEVSEChargeParameterType dcEVSEChargeParameter = new DCEVSEChargeParameterType();
  56. dcEVSEChargeParameter.setDCEVSEStatus(getDCEVSEStatus(EVSENotificationType.NONE));
  57. dcEVSEChargeParameter.setEVSEMaximumCurrentLimit(getEVSEMaximumCurrentLimit());
  58. dcEVSEChargeParameter.setEVSEMaximumPowerLimit(getEVSEMaximumPowerLimit());
  59. dcEVSEChargeParameter.setEVSEMaximumVoltageLimit(getEVSEMaximumVoltageLimit());
  60. dcEVSEChargeParameter.setEVSEMinimumCurrentLimit(getEVSEMinimumCurrentLimit());
  61. dcEVSEChargeParameter.setEVSEMinimumVoltageLimit(getEVSEMinimumVoltageLimit());
  62. dcEVSEChargeParameter.setEVSEPeakCurrentRipple(getEVSEPeakCurrentRipple());
  63. return new JAXBElement<DCEVSEChargeParameterType>(
  64. new QName("urn:iso:15118:2:2013:MsgDataTypes", "DC_EVSEChargeParameter"),
  65. DCEVSEChargeParameterType.class,
  66. dcEVSEChargeParameter);
  67. }
  68. public V2GCommunicationSessionSECC getCommSessionContext() {
  69. return commSessionContext;
  70. }
  71. public void setCommSessionContext(V2GCommunicationSessionSECC commSessionContext) {
  72. this.commSessionContext = commSessionContext;
  73. }
  74. @Override
  75. public boolean closeContactor() {
  76. // A check for CP state B would be necessary
  77. return true;
  78. }
  79. @Override
  80. public boolean openContactor() {
  81. return true;
  82. }
  83. @Override
  84. public DCEVSEStatusType getDCEVSEStatus(EVSENotificationType notification) {
  85. DCEVSEStatusType dcEvseStatus = new DCEVSEStatusType();
  86. dcEvseStatus.setNotificationMaxDelay(0);
  87. dcEvseStatus.setEVSENotification((notification != null) ? notification : EVSENotificationType.NONE);
  88. dcEvseStatus.setEVSEStatusCode(DCEVSEStatusCodeType.EVSE_READY);
  89. dcEvseStatus.setEVSEIsolationStatus(getIsolationLevel());
  90. return dcEvseStatus;
  91. }
  92. @Override
  93. public void setTargetVoltage(PhysicalValueType targetVoltage) {
  94. this.targetVoltage = targetVoltage;
  95. }
  96. @Override
  97. public void setTargetCurrent(PhysicalValueType targetCurrent) {
  98. this.targetCurrent = targetCurrent;
  99. }
  100. @Override
  101. public PhysicalValueType getPresentVoltage() {
  102. return this.targetVoltage;
  103. }
  104. @Override
  105. public PhysicalValueType getPresentCurrent() {
  106. return this.targetCurrent;
  107. }
  108. @Override
  109. public void setEVMaximumVoltageLimit(PhysicalValueType maximumVoltageLimit) {
  110. this.maximumEVVoltageLimit = maximumVoltageLimit;
  111. }
  112. @Override
  113. public void setEVMaximumCurrentLimit(PhysicalValueType maximumCurrentLimit) {
  114. this.maximumEVCurrentLimit = maximumCurrentLimit;
  115. }
  116. @Override
  117. public void setEVMaximumPowerLimit(PhysicalValueType maximumPowerLimit) {
  118. this.maximumEVPowerLimit = maximumPowerLimit;
  119. }
  120. @Override
  121. public PhysicalValueType getEVSEMaximumVoltageLimit() {
  122. PhysicalValueType evseMaxVoltageLimit = new PhysicalValueType();
  123. evseMaxVoltageLimit.setMultiplier(new Byte("0"));
  124. evseMaxVoltageLimit.setUnit(UnitSymbolType.V);
  125. evseMaxVoltageLimit.setValue((short) 400);
  126. return evseMaxVoltageLimit;
  127. }
  128. @Override
  129. public PhysicalValueType getEVSEMinimumVoltageLimit() {
  130. PhysicalValueType evseMinVoltageLimit = new PhysicalValueType();
  131. evseMinVoltageLimit.setMultiplier(new Byte("0"));
  132. evseMinVoltageLimit.setUnit(UnitSymbolType.V);
  133. evseMinVoltageLimit.setValue((short) 230);
  134. return evseMinVoltageLimit;
  135. }
  136. @Override
  137. public PhysicalValueType getEVSEMaximumCurrentLimit() {
  138. PhysicalValueType evseMaxCurrentLimit = new PhysicalValueType();
  139. evseMaxCurrentLimit.setMultiplier(new Byte("0"));
  140. evseMaxCurrentLimit.setUnit(UnitSymbolType.A);
  141. evseMaxCurrentLimit.setValue((short) 32);
  142. return evseMaxCurrentLimit;
  143. }
  144. @Override
  145. public PhysicalValueType getEVSEMinimumCurrentLimit() {
  146. PhysicalValueType evseMinCurrentLimit = new PhysicalValueType();
  147. evseMinCurrentLimit.setMultiplier(new Byte("0"));
  148. evseMinCurrentLimit.setUnit(UnitSymbolType.A);
  149. evseMinCurrentLimit.setValue((short) 16);
  150. return evseMinCurrentLimit;
  151. }
  152. @Override
  153. public PhysicalValueType getEVSEMaximumPowerLimit() {
  154. PhysicalValueType evseMaxPowerLimit = new PhysicalValueType();
  155. evseMaxPowerLimit.setMultiplier(new Byte("3"));
  156. evseMaxPowerLimit.setUnit(UnitSymbolType.W);
  157. evseMaxPowerLimit.setValue((short) 63);
  158. return evseMaxPowerLimit;
  159. }
  160. @Override
  161. public boolean isEVSECurrentLimitAchieved() {
  162. return false;
  163. }
  164. @Override
  165. public boolean isEVSEVoltageLimitAchieved() {
  166. return false;
  167. }
  168. @Override
  169. public boolean isEVSEPowerLimitAchieved() {
  170. return false;
  171. }
  172. @Override
  173. public MeterInfoType getMeterInfo() {
  174. MeterInfoType meterInfo = new MeterInfoType();
  175. meterInfo.setMeterID("1");
  176. meterInfo.setMeterReading(BigInteger.valueOf(32000));
  177. meterInfo.setTMeter(System.currentTimeMillis() / 1000);
  178. return meterInfo;
  179. }
  180. @Override
  181. public PhysicalValueType getEVSEPeakCurrentRipple() {
  182. PhysicalValueType peakCurrentRipple = new PhysicalValueType();
  183. peakCurrentRipple.setMultiplier(new Byte("0"));
  184. peakCurrentRipple.setUnit(UnitSymbolType.A);
  185. peakCurrentRipple.setValue((short) 0); // what is a peak-to-peak current ripple??
  186. return peakCurrentRipple;
  187. }
  188. @Override
  189. public IsolationLevelType getIsolationLevel() {
  190. return isolationLevel;
  191. }
  192. @Override
  193. public void setIsolationLevel(IsolationLevelType isolationLevel) {
  194. this.isolationLevel = isolationLevel;
  195. }
  196. }