[R] Fwd: Extract time and state of charge (Start and End) and Count
Jim Lemon
drj|m|emon @end|ng |rom gm@||@com
Tue Jul 19 00:48:08 CEST 2022
---------- Forwarded message ---------
From: Jim Lemon <drjimlemon using gmail.com>
Date: Tue, Jul 19, 2022 at 8:46 AM
Subject: Re: [R] Extract time and state of charge (Start and End) and Count
To: roslinazairimah zakaria <roslinaump using gmail.com>
Hi Roslina,
If I understand your query, you want something like what is plotted in
the attached code and image. The red points mark the beginning of a
charging session, the green points the end. The orange lines represent
linear approximations of charging and the blue lines that of
discharging. It is a bit messy, but you can obtain numeric values
along these lines using the approx function at each half hour. Given
your data, that is about the best guess you can make.
Jim
On Mon, Jul 18, 2022 at 2:04 PM roslinazairimah zakaria
<roslinaump using gmail.com> wrote:
>
> Dear all,
>
> I have data of Battery Electric vehicle (BEV). I would like to extract data
> from every hour starting from 0.00 to 0.59, 1:00-1:59 for SOC(state of
> charge) start to end.
>
> Some examples:
> I can extract data from SOC=0 and SOC=12
> dt_2014[which(dt_2014$Starting_SoC_of_12==0 &
> dt_2014$Ending_SoC_of_12==12),]
>
> I can extract data from SOC=1 and SOC=12
> dt_2014[which(dt_2014$Starting_SoC_of_12==1 &
> dt_2014$Ending_SoC_of_12==12),]
>
> and I would like to further categorise the data by hour and count how many
> cars from 0 state charge to 12 state charge at in that particular hour.
>
> Thank you so much for any help given.
>
> Some data
> > dput(dt_2014[1:10,])
> structure(list(ï..CarID = c("GC10", "GC10", "GC10", "GC10", "GC10",
> "GC10", "GC10", "GC10", "GC10", "GC10"), BatteryChargeStartDate =
> c("16/2/2014 16:05",
> "16/2/2014 18:20", "17/2/2014 8:10", "18/2/2014 7:41", "18/2/2014 15:36",
> "18/2/2014 16:36", "18/2/2014 21:26", "19/2/2014 8:57", "19/2/2014 21:08",
> "20/2/2014 18:11"), BCStartTime = c("16:05", "18:20", "8:10",
> "7:41", "15:36", "16:36", "21:26", "8:57", "21:08", "18:11"),
> Year = c(2014L, 2014L, 2014L, 2014L, 2014L, 2014L, 2014L,
> 2014L, 2014L, 2014L), Month = c(2L, 2L, 2L, 2L, 2L, 2L, 2L,
> 2L, 2L, 2L), Day = c(16L, 16L, 17L, 18L, 18L, 18L, 18L, 19L,
> 19L, 20L), BatteryChargeStopDate = c("16/2/2014 17:05", "16/2/2014
> 19:00",
> "17/2/2014 15:57", "18/2/2014 9:52", "18/2/2014 15:39", "18/2/2014
> 17:36",
> "19/2/2014 1:55", "19/2/2014 14:25", "20/2/2014 5:17", "20/2/2014 23:20"
> ), BCStopTime = c("17:05", "19:00", "15:57", "9:52", "15:39",
> "17:36", "1:55", "14:25", "5:17", "23:20"), Year2 = c(2014L,
> 2014L, 2014L, 2014L, 2014L, 2014L, 2014L, 2014L, 2014L, 2014L
> ), Month2 = c(2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L), Day2 = c(16L,
> 16L, 17L, 18L, 18L, 18L, 19L, 19L, 20L, 20L), Starting_SoC_of_12 =
> c(1L,
> 2L, 4L, 5L, 4L, 2L, 8L, 8L, 4L, 8L), Ending_SoC_of_12 = c(11L,
> 11L, 12L, 8L, 4L, 10L, 12L, 12L, 12L, 12L)), row.names = c(NA,
> 10L), class = "data.frame")
>
>
> --
> *Roslinazairimah Zakaria*
> *Tel: +609-5492370; Fax. No.+609-5492766*
>
> *Email: roslinaump using gmail.com <roslinaump using gmail.com>*
> University Malaysia Pahang
> Lebuhraya Tun Razak, 26300 Gambang, Pahang, Malaysia
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rz_19_7_2022.png
Type: image/png
Size: 26780 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20220719/a62f2fba/attachment.png>
More information about the R-help
mailing list