示例#1
0
        /// <summary>
        /// Create a charge detail record for the given charging session (identification).
        /// </summary>
        /// <param name="SessionId">The unique charging session identification.</param>
        /// <param name="SessionTime">The timestamps when the charging session started and ended.</param>
        /// <param name="Duration">The duration of the charging session, whenever it is more than the time span between its start- and endtime, e.g. caused by a tariff granularity of 15 minutes.</param>
        ///
        /// <param name="EVSE">The EVSE used for charging.</param>
        /// <param name="EVSEId">The identification of the EVSE used for charging.</param>
        /// <param name="ChargingStation">The charging station of the charging station used for charging.</param>
        /// <param name="ChargingStationId">The identification of the charging station used for charging.</param>
        /// <param name="ChargingPool">The charging pool of the charging pool used for charging.</param>
        /// <param name="ChargingPoolId">The identification of the charging pool used for charging.</param>
        /// <param name="ChargingStationOperator">The charging station operator used for charging.</param>
        /// <param name="ChargingStationOperatorId">The identification of the charging station operator used for charging.</param>
        /// <param name="ChargingProduct">The consumed charging product.</param>
        /// <param name="ChargingPrice">The charging price.</param>
        ///
        /// <param name="AuthenticationStart">The authentication used for starting this charging process.</param>
        /// <param name="AuthenticationStop">The authentication used for stopping this charging process.</param>
        /// <param name="ProviderIdStart">The identification of the e-mobility provider used for starting this charging process.</param>
        /// <param name="ProviderIdStop">The identification of the e-mobility provider used for stopping this charging process.</param>
        ///
        /// <param name="Reservation">The optional charging reservation used before charging.</param>
        /// <param name="ReservationId">The optional charging reservation identification used before charging.</param>
        /// <param name="ReservationTime">Optional timestamps when the reservation started and ended.</param>
        ///
        /// <param name="ParkingSpaceId">The optional identification of the parkging space.</param>
        /// <param name="ParkingTime">Optional timestamps when the parking started and ended.</param>
        /// <param name="ParkingFee">The optional fee for parking.</param>
        ///
        /// <param name="EnergyMeterId">An optional unique identification of the energy meter.</param>
        /// <param name="EnergyMeteringValues">An optional enumeration of intermediate energy metering values.</param>
        ///
        /// <param name="CustomData">An optional dictionary of customer-specific data.</param>
        public ChargeDetailRecord(ChargingSession_Id SessionId,
                                  StartEndDateTime?SessionTime,
                                  TimeSpan?Duration = null,

                                  EVSE EVSE      = null,
                                  EVSE_Id?EVSEId = null,
                                  ChargingStation ChargingStation                      = null,
                                  ChargingStation_Id?ChargingStationId                 = null,
                                  ChargingPool ChargingPool                            = null,
                                  ChargingPool_Id?ChargingPoolId                       = null,
                                  ChargingStationOperator ChargingStationOperator      = null,
                                  ChargingStationOperator_Id?ChargingStationOperatorId = null,
                                  ChargingProduct ChargingProduct                      = null,
                                  Decimal?ChargingPrice = null,

                                  AAuthentication AuthenticationStart  = null,
                                  AAuthentication AuthenticationStop   = null,
                                  eMobilityProvider_Id?ProviderIdStart = null,
                                  eMobilityProvider_Id?ProviderIdStop  = null,

                                  ChargingReservation Reservation      = null,
                                  ChargingReservation_Id?ReservationId = null,
                                  StartEndDateTime?ReservationTime     = null,

                                  ParkingSpace_Id?ParkingSpaceId = null,
                                  StartEndDateTime?ParkingTime   = null,
                                  Decimal?ParkingFee             = null,

                                  EnergyMeter_Id?EnergyMeterId = null,
                                  IEnumerable <Timestamped <Single> > EnergyMeteringValues = null,
                                  IEnumerable <SignedMeteringValue> SignedMeteringValues   = null,
                                  IEnumerable <String> Signatures = null,

                                  IReadOnlyDictionary <String, Object> CustomData = null)

            : base(CustomData)

        {
            this.SessionId   = SessionId;
            this.SessionTime = SessionTime;
            this.Duration    = Duration;

            this.EVSE                      = EVSE;
            this.EVSEId                    = EVSEId ?? EVSE?.Id;
            this.ChargingStation           = ChargingStation;
            this.ChargingStationId         = ChargingStationId ?? ChargingStation?.Id;
            this.ChargingPool              = ChargingPool;
            this.ChargingPoolId            = ChargingPoolId ?? ChargingPool?.Id;
            this.ChargingStationOperator   = ChargingStationOperator;
            this.ChargingStationOperatorId = ChargingStationOperatorId ?? ChargingStationOperator?.Id;
            this.ChargingProduct           = ChargingProduct;
            this.ChargingPrice             = ChargingPrice;

            this.IdentificationStart = AuthenticationStart;
            this.IdentificationStop  = AuthenticationStop;
            this.ProviderIdStart     = ProviderIdStart;
            this.ProviderIdStop      = ProviderIdStop;

            this.Reservation     = Reservation;
            this.ReservationId   = ReservationId ?? Reservation?.Id;
            this.ReservationTime = ReservationTime;

            this.ParkingSpaceId = ParkingSpaceId;
            this.ParkingTime    = ParkingTime;
            this.ParkingFee     = ParkingFee;

            this.EnergyMeterId        = EnergyMeterId;
            this.EnergyMeteringValues = EnergyMeteringValues ?? new Timestamped <Single> [0];
            this.SignedMeteringValues = SignedMeteringValues ?? new SignedMeteringValue[0];
            this._Signatures          = Signatures.SafeAny()  ? new HashSet <String>(Signatures) : new HashSet <String>();

            if (SignedMeteringValues.SafeAny() && !EnergyMeteringValues.SafeAny())
            {
                this.EnergyMeteringValues = SignedMeteringValues.Select(svalue => new Timestamped <Single>(svalue.Timestamp,
                                                                                                           (Single)svalue.MeterValue));
            }
        }
        /// <summary>
        /// Take a snapshot of the current charging station status.
        /// </summary>
        /// <param name="ChargingStation">A charging station.</param>
        public static ChargingStationAdminStatusUpdate Snapshot(ChargingStation ChargingStation)

        => new ChargingStationAdminStatusUpdate(ChargingStation.Id,
                                                ChargingStation.AdminStatus,
                                                ChargingStation.AdminStatusSchedule().Skip(1).FirstOrDefault());
示例#3
0
 /// <summary>
 /// Take a snapshot of the current charging station admin status.
 /// </summary>
 /// <param name="ChargingStation">An charging station.</param>
 public static ChargingStationAdminStatus Snapshot(ChargingStation ChargingStation)
 {
     return(new ChargingStationAdminStatus(ChargingStation.Id,
                                           ChargingStation.AdminStatus.Value,
                                           ChargingStation.AdminStatus.Timestamp));
 }
示例#4
0
 /// <summary>
 /// Check if the given charging station is member of this charging station group.
 /// </summary>
 /// <param name="ChargingStation">A charging station.</param>
 public Boolean Contains(ChargingStation ChargingStation)
 => _ChargingStations.ContainsKey(ChargingStation.Id);
示例#5
0
 public Task <Acknowledgement> PushEVSEData(ChargingStation ChargingStation, ActionType ActionType = ActionType.fullLoad, EVSEOperator_Id OperatorId = null, string OperatorName = null, Func <EVSE, bool> IncludeEVSEs = null, TimeSpan?QueryTimeout = default(TimeSpan?))
 {
     throw new NotImplementedException();
 }
示例#6
0
 public Task <Acknowledgement> PushEVSEStatus(ChargingStation ChargingStation, ActionType ActionType = ActionType.update, EVSEOperator_Id OperatorId = null, string OperatorName = null, Func <EVSE, bool> IncludeEVSEs = null, TimeSpan?QueryTimeout = default(TimeSpan?))
 {
     return(Task.FromResult(new Acknowledgement(true)));
 }
示例#7
0
 public Task <PushEVSEDataResult> UpdateStaticData(ChargingStation ChargingStation, string PropertyName = null, object OldValue = null, object NewValue = null, TransmissionTypes TransmissionType = TransmissionTypes.Enqueue, DateTime?Timestamp = null, CancellationToken?CancellationToken = null, EventTracking_Id EventTrackingId = null, TimeSpan?RequestTimeout = null)
 {
     throw new NotImplementedException();
 }
示例#8
0
        public static JObject ToFeature(this ChargingStation ChargingStation,
                                        JObject Properties = null)

        {
            #region Initial checks

            if (ChargingStation == null)
            {
                throw new ArgumentNullException(nameof(ChargingStation), "The given charging station must not be null!");
            }

            #endregion

            #region Documentation

            // {
            //
            //   [...]
            //
            //   {
            //     "type": "Feature",
            //     "properties": {},
            //     "geometry": {
            //       "type": "Point",
            //       "coordinates": [
            //         10.579833984375,
            //         50.48197825997291
            //       ]
            //     }
            //   }
            //
            // }

            #endregion

            return(JSONObject.Create(

                       new JProperty("type", "Feature"),

                       new JProperty("properties", Properties ?? JSONObject.Create(

                                         new JProperty("@id", ChargingStation.Id.ToString()),
                                         new JProperty("@context", "https://open.charging.cloud/contexts/wwcp+geojson/ChargingStation"),
                                         new JProperty("name", ChargingStation.Name.ToJSON()),
                                         new JProperty("description", ChargingStation.Description.ToJSON()),
                                         new JProperty("lastChange", ChargingStation.LastChange),
                                         new JProperty("adminStatus", ChargingStation.AdminStatus.ToJSON()),
                                         new JProperty("status", ChargingStation.Status.ToJSON()),
                                         new JProperty("brand", ChargingStation.Brand != null ? ChargingStation.Brand.ToJSON(): new JObject()),
                                         new JProperty("address", ChargingStation.Address.ToJSON()),
                                         new JProperty("openingTimes", ChargingStation.OpeningTimes.ToJSON()),
                                         new JProperty("accessibility", ChargingStation.Accessibility.ToString()),
                                         new JProperty("authenticationModes", new JArray(ChargingStation.AuthenticationModes.Select(mode => mode.ToString()))),
                                         new JProperty("paymentOptions", new JArray(ChargingStation.PaymentOptions.Select(option => option.ToString()))),

                                         new JProperty("EVSEs", new JArray(
                                                           ChargingStation.EVSEs.Select(evse => JSONObject.Create(
                                                                                            new JProperty("Id", evse.Id.ToString()),
                                                                                            new JProperty("AdminStatus", evse.AdminStatus.ToJSON()),
                                                                                            new JProperty("Status", evse.Status.ToJSON()),
                                                                                            new JProperty("AverageVoltage", evse.AverageVoltage.ToString()),
                                                                                            new JProperty("MaxCurrent", evse.MaxCurrent.ToString()),
                                                                                            new JProperty("MaxPower", evse.MaxPower.ToString())
                                                                                            //new JProperty("ChargingModes",       new JArray(evse.ChargingModes.Select(mode => mode.ToString())))
                                                                                            )
                                                                                        )))

                                         )),

                       new JProperty("geometry", JSONObject.Create(
                                         new JProperty("type", "Point"),
                                         new JProperty("coordinates", new JArray(
                                                           ChargingStation.GeoLocation.Value.Longitude.Value,
                                                           ChargingStation.GeoLocation.Value.Latitude.Value
                                                           ))
                                         ))
                       ));
        }
示例#9
0
 public EVSEException(ChargingStation ChargingStation, String Message, Exception InnerException)
     : base(ChargingStation.ChargingPool, Message, InnerException)
 {
 }
示例#10
0
 public Task <PushEVSEDataResult> SetStaticData(ChargingStation ChargingStation, TransmissionTypes TransmissionType = TransmissionTypes.Enqueue, DateTime?Timestamp = null, CancellationToken?CancellationToken = null, EventTracking_Id EventTrackingId = null, TimeSpan?RequestTimeout = null)
 {
     throw new NotImplementedException();
 }
示例#11
0
 public EVSEException(ChargingStation ChargingStation, String Message)
     : base(ChargingStation.ChargingPool, Message)
 {
 }
示例#12
0
 public Boolean Remove(ChargingStation ChargingStation)
 {
     return(_AllowedChargingStationIds.Remove(ChargingStation.Id));
 }
示例#13
0
 /// <summary>
 /// Check if the given ChargingStation is already present within the charging pool.
 /// </summary>
 /// <param name="ChargingStation">A charging station.</param>
 public Boolean Contains(ChargingStation ChargingStation)
 {
     return(_AllowedChargingStationIds.Contains(ChargingStation.Id));
 }
示例#14
0
 public Boolean Add(ChargingStation ChargingStation)
 {
     return(_AllowedChargingStationIds.Add(ChargingStation.Id));
 }
示例#15
0
        /// <summary>
        /// Take a snapshot of the current charging station status.
        /// </summary>
        /// <param name="ChargingStation">A charging station.</param>
        public static ChargingStationStatus Snapshot(ChargingStation ChargingStation)

        => new ChargingStationStatus(ChargingStation.Id,
                                     ChargingStation.Status);