コード例 #1
0
ファイル: ChargingSchedule.cs プロジェクト: xrjob/WWCP_OCPP
        /// <summary>
        /// Return a XML representation of this object.
        /// </summary>
        /// <param name="XName">An alternative XML element name [default: "OCPPv1_6_CP:chargingSchedule"]</param>
        public XElement ToXML(XName XName = null)

        => new XElement(XName ?? OCPPNS.OCPPv1_6_CP + "chargingSchedule",

                        Duration.HasValue
                       ? new XElement(OCPPNS.OCPPv1_6_CP + "duration", Duration.Value)
                       : null,

                        StartSchedule.HasValue
                       ? new XElement(OCPPNS.OCPPv1_6_CP + "startSchedule", StartSchedule.Value.ToIso8601())
                       : null,

                        new XElement(OCPPNS.OCPPv1_6_CP + "chargingRateUnit", ChargingRateUnit.AsText()),

                        ChargingSchedulePeriods.Select(value => value.ToXML()),

                        Duration.HasValue
                       ? new XElement(OCPPNS.OCPPv1_6_CP + "minChargingRate", MinChargingRate.Value.ToString("0.#"))
                       : null

                        );