Advertisement
mikalmo

Javascript for funksjonsnode man kan sette inn mellom Price Receiver-node og nettleie i Powersaver

Oct 10th, 2023 (edited)
829
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var input = msg.payload.priceData;
  2.  
  3. // Innslagspunkt for strømstøtte
  4. var minimumPrice = 0.875;
  5.  
  6. // Kalkuler priser med strømstøtte
  7. var pricesWithSubsidy = input.map(function (item) {
  8.     var price = item.value;
  9.     var priceWithSubsidy = price >= minimumPrice ? minimumPrice + 0.1 * (price - minimumPrice) : price;
  10.     return {
  11.         value: priceWithSubsidy,
  12.         start: item.start
  13.     };
  14. });
  15.  
  16. msg.payload.priceData = pricesWithSubsidy;
  17.  
  18. return msg;
Advertisement
Comments
  • mikalmo
    255 days
    Comment was deleted
Add Comment
Please, Sign In to add comment
Advertisement