Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@alheimsins/calculate-cheapest-charging-schedule

Package Overview
Dependencies
Maintainers
2
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@alheimsins/calculate-cheapest-charging-schedule

Simple module for calculating the cheapest charging schedule for your EV

  • 1.1.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

js-standard-style

calculate-cheapest-charging-schedule

Simple module for calculating the cheapest charging schedule for your EV

Usage


import calculateCheapestChargingSchedule from '@alheimsins/calculate-cheapest-charging-schedule'
import priceArray from './data/pricelist.mjs'
const batteryCapacity = 38
const batteryCurrentLevel = 0.75
const chargingPower = 3.5

console.log(calculateCheapestChargingSchedule({ batteryCapacity, batteryCurrentLevel, chargingPower, priceArray }))

// returns ['2022-04-24T04:00:00.000+02:00', '2022-04-24T13:00:00.000+02:00', '2022-04-24T14:00:00.000+02:00']

priceArray format

The module expects an array of objects with the following properties as priceArray:

[
  {
    "startsAt": "2020-04-24T04:00:00.000+02:00",
    "total": 0.5
  },
  {
    "startsAt": "2020-04-24T13:00:00.000+02:00",
    "total": 0.6
  }
]

if your priceArray is not in this format you can supply a propertyMap


import calculateCheapestChargingSchedule from '@alheimsins/calculate-cheapest-charging-schedule'

const batteryCapacity = 38
const batteryCurrentLevel = 0.75
const chargingPower = 3.5

const priceArray = [
  {
    "starttid": "2020-04-24T04:00:00.000+02:00",
    "pris": 0.5
  },
  {
    "starttid": "2020-04-24T13:00:00.000+02:00",
    "pris": 0.6
  }
]

const propertyMap = {
  startsAt: 'starttid',
  total: 'pris'
}

console.log(calculateCheapestChargingSchedule({ batteryCapacity, batteryCurrentLevel, chargingPower, priceArray, propertyMap }))

// returns ['2022-04-24T04:00:00.000+02:00', '2022-04-24T13:00:00.000+02:00']

License

MIT

About

Created with ❤ for Alheimsins

FAQs

Package last updated on 08 Oct 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc