• 1 Post
  • 46 Comments
Joined 2 years ago
cake
Cake day: June 20th, 2023

help-circle






  • The mentioned php file:

    <!DOCTYPE html>
    <html lang="en">
    <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>Charging Time Calculator (PHP)</title>
      <style>
        body { font-family: Arial, sans-serif; background: #f4f4f4; color: #333; display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; }
        .box { background: #fff; padding: 20px 30px; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.1); width: 100%; max-width: 400px; }
        h1 { margin-top: 0; text-align: center; }
        .field { margin-bottom: 15px; }
        label { display: block; margin-bottom: 5px; font-weight: bold; }
        input[type="number"] { width: 100%; padding: 8px; border: 1px solid #ccc; border-radius: 4px; }
        button { width: 100%; padding: 10px; background: #28a745; color: white; border: none; border-radius: 4px; cursor: pointer; }
        button:hover { background: #218838; }
        .result { margin-top: 20px; background: #e9ecef; padding: 15px; border-radius: 4px; }
      </style>
    </head>
    <body>
      <div class="box">
        <h1>Charging Time Calculator</h1>
    
        <?php
        // Default values at the top
        $default_capacity      = 52.0;   // kWh
        $default_current_pct   = 55.0;   // %
        $default_target_pct    = 80.0;   // %
        $default_power_kw      = 1.8;    // kW
        $default_loss_pct      = 15.2;   // Charging loss in %
    
        // I have extended the PHP script with the new field for charging loss (default 15.2%). 
        // The loss is applied immediately after calculating the net energy requirement, 
        // so the charging time is determined based on the inclusive energy requirement (net + loss). 
        // Additionally, the result view now shows the following values:
        // - Net energy required
        // - Configured charging loss
        // - Energy requirement including loss
    
        // Take from POST or use defaults
        $capacity = isset($_POST['capacity']) ? floatval($_POST['capacity']) : $default_capacity;
        $current  = isset($_POST['current'])  ? floatval($_POST['current'])  : $default_current_pct;
        $target   = isset($_POST['target'])   ? floatval($_POST['target'])   : $default_target_pct;
        $power    = isset($_POST['power'])    ? floatval($_POST['power'])    : $default_power_kw;
        $loss     = isset($_POST['loss'])     ? floatval($_POST['loss'])     : $default_loss_pct;
    
        if ($_SERVER['REQUEST_METHOD'] === 'POST') {
          // Calculation
          $percent_to_charge = max(0, $target - $current);
          // Net energy requirement
          $energy_needed_raw = ($percent_to_charge / 100) * $capacity;      // in kWh
          // Energy requirement including charging loss
          $energy_needed = $energy_needed_raw * (1 + $loss / 100);
          // Charging time based on the increased energy requirement
          $time_hours        = $power > 0 ? $energy_needed / $power : 0;    // in hours
          $hours             = floor($time_hours);
          $minutes           = round(($time_hours - $hours) * 60);
        ?>
          <div class="result">
            <p><strong>Remaining Charging Time:</strong> <?= $hours ?> h <?= $minutes ?> min</p>
            <p><strong>Percent to Charge:</strong> <?= number_format($percent_to_charge, 1) ?> %</p>
            <p><strong>Energy to Charge (net):</strong> <?= number_format($energy_needed_raw, 2) ?> kWh</p>
            <p><strong>Charging Loss:</strong> <?= number_format($loss, 1) ?> %</p>
            <p><strong>Energy to Charge (incl. loss):</strong> <?= number_format($energy_needed, 2) ?> kWh</p>
          </div>
        <?php } ?>
    
        <form method="post">
          <div class="field">
            <label for="capacity">Battery Capacity (kWh)</label>
            <input type="number" step="0.1" name="capacity" id="capacity" value="<?= htmlspecialchars($capacity) ?>" required>
          </div>
          <div class="field">
            <label for="current">Current Charge Level (%)</label>
            <input type="number" step="1" min="0" max="100" name="current" id="current" value="<?= htmlspecialchars($current) ?>" required>
          </div>
          <div class="field">
            <label for="target">Desired Charge Level (%)</label>
            <input type="number" step="1" min="0" max="100" name="target" id="target" value="<?= htmlspecialchars($target) ?>" required>
          </div>
          <div class="field">
            <label for="power">Charging Power (kW)</label>
            <input type="number" step="0.1" min="0.1" name="power" id="power" value="<?= htmlspecialchars($power) ?>" required>
          </div>
          <div class="field">
            <label for="loss">Charging Loss (%)</label>
            <input type="number" step="0.1" min="0" max="100" name="loss" id="loss" value="<?= htmlspecialchars($loss) ?>" required>
          </div>
          <button type="submit">Calculate</button>
        </form>
      </div>
    </body>
    </html>
    
    



  • […] and have been using various Linux distros as my main os for almost 20 years.

    Matey. Get into any company that has linux junior positions. You already have more experiance in linux than 90% of the average (windows) Sysadmin.

    For realzies now. Most will look weird at you if you ask them to edit a file in the shell or using a server VM that runs without graphical interface.

    Get into a linux junior position and get started.

    Learn lots and lots. After a few years moneywise you might be back your old job as experienced chemist.





  • I mostly use my dog as a way to introduce that I am near and mean no harm to anyone not expecting someone following the same path (mostly rather long streched bike&pedestrian roads with no exit but with park benches and geen patches for dogs and so on).

    Simply by saying “Dogs Name, are you coming sweety?”.

    Announces that I am nearby with a doggy and by no means any poser that wants to appear scary.

    At dark day times I mostly have a flashlight with me to shine on my dog and whatever she is currently sniffing (or sneakingly trying to eat…). Which has the sideeffect of her being better visible to others. (She’s a bigger dog with black fur - so some people would be scared of her anyhow. Especially in the dark if there is a barely visible big dog. Which is why I hope to make people not that uncomfortable by speaking softly and shining light on her. (And of couse because bicicle riders need to be able to see her, to not run her over))




  • Have alread uses:

    • openProject (though not that much since it was a one time occurance but the software was absolutely great!)
    • xwiki: since a few months (work migrating away from the atlassian clusterfuck). Migration a bit of work but a paid tool did the most part for us. Now using xwiki - most things work the same. Some though had to be realised in a different way (some rare edgecass confluence plugins that were missing in the xwiki store)
    • Mattermost. Using it for years. Its fucking great! Easily the best one on the market! Better than teams and whatnot.

    I’ll look into the rest of those alternatives! :D


  • Took this post as motivation to try some out.

    Here WeGo: actually pretty intuitive! Better than OSMand and Organic Maps in terms of Car Navigation (actual Voice and not TTS Voice from android) and 3D sounds that you have to get used to but coule make listening to instrucrions in stressfull sitations easier. Also optional: speeding warning ring sound and shield head up-sound effects (yield, stop, train crossing, etc.) Each with a special sound so you might get better prepared for the next yield or stop sign since your NAV app told ya already that one is coming up soon.

    Deezer: Well some usability things annoy me. Also some problems with the android tv client…

    Bit the flow mode (random shuffle in genres or moods (happy, party, chill…) that also has a toggle if you want the shuffle be based of songs you have in your playlists/liked already or if you want to go on a jurney to find new songs.

    Pretty geat so far!

    Qwant: well the search results hit good. Dark theme is a lil worse than DDG’s dark theme but thats just preference. Some !bang searches are not available though. DDG has many more listed than Qwant. But we’re getting there!




  • Sailing7@lemmy.mltoLemmy Shitpost@lemmy.worldAccommodating
    link
    fedilink
    arrow-up
    3
    arrow-down
    6
    ·
    5 months ago

    I know its a absolute wonky workaround but you could use a second phone and enable google speech input – or an FOSS alternative: FUTO Voice Input (Local LLM Model that works pretty great. Better than google imo. Is better finding the correct words and also putting logical punctiation. – as in when should a comma or dot appear.)

    Now you enable speech input on one phone and playback the voice message of the dude on the other end. Now you got all the text.