1. Attachments are working again! Check out this thread for more details and to report any other bugs.

Old Newbie - and my re-animated PSD Demo

Discussion in 'Newbie Forum' started by Ichabod, Mar 14, 2022.

  1. Ichabod

    Ichabod Artist In Residence

    Joined:
    Jul 21, 2006
    1,794
    19
    0
    Location:
    Newton, MA
    Vehicle:
    2006 Prius
    Hi all, I'm an old member with a new bit of news: my old Prius Power Split Device or PSD demo that was made in Flash has been rewritten in javascript so you can view it in modern browsers. The numbers are old, info gleaned about the gen 2 Prius, but the demo of the epicyclic gear is as relevant as ever, so take a look:

    http://eahart.com/prius/psd

    It only works in desktop browsers at the moment but I'm adding support for mobile browsers soon.
     
  2. vvillovv

    vvillovv Senior Member

    Joined:
    Mar 19, 2013
    3,528
    1,241
    1
    Location:
    NY
    Vehicle:
    2017 Prius Prime
    Model:
    Prime Plus
    Thanks for the updated work. It's easier to get a perspective on how the Power Split Device operates inside the prius CVT and newer eCVT transmissions as well as the what the different gears in the PSD are connected to and most of all how they connect the electric motor generators (MG1 - MG2) and the engine (ICE) together to form the Toyota Hybrid Synergy Drive.

    Now all we need is an easier way to understand the way the ECU's control the various combinations that are possible while driving the car. And the animation helps with that too. :D
     
  3. PriusCamper

    PriusCamper Senior Member

    Joined:
    Mar 3, 2012
    10,891
    4,416
    0
    Location:
    Pacific Northwest, USA
    Vehicle:
    2007 Prius
    Model:
    Two
    Or better yet a way to control the ECU ourselves...
     
    vvillovv likes this.
  4. vvillovv

    vvillovv Senior Member

    Joined:
    Mar 19, 2013
    3,528
    1,241
    1
    Location:
    NY
    Vehicle:
    2017 Prius Prime
    Model:
    Prime Plus
    Thats a process that takes at least a fair bit of electronics knowledge to even be a beta tester for.
    A bunch of ECU hacks are being developed for early honda hybrids - mainly gen1 insight 2000-2009 by mudder and his team of beta testers. GitHub - doppelhub/Honda_Insight_LiBCM: Replacement BCM for G1 Honda Insight Lithium Conversion
    All the beta testers for the project are seasoned board builders. And it's been a few years in the making and testing just like @jacktheripper s' project. And mudder is an electronics engineer by trade who's trying to make the project plug n play much like MikeDebrows' insight mima project was back in the early part of this century.
    Yeah, I wish someone could do a project like that for my honda hybrid, but I'm also aware of how much trouble I could get into due to not fully understanding the electronics both in the car being manipulated or on the - project boards and in the software/firmware - doing the manipulation. .
     
    #4 vvillovv, Mar 14, 2022
    Last edited: Mar 14, 2022
  5. PriusCamper

    PriusCamper Senior Member

    Joined:
    Mar 3, 2012
    10,891
    4,416
    0
    Location:
    Pacific Northwest, USA
    Vehicle:
    2007 Prius
    Model:
    Two
    We could do amazing things with these cars if we passed legislation that adds on to the "right to repair" movement by requiring all auto makers to release their source code and allow us to use crowd-sourced firmware updates or else automakers have to forfeit their patent rights. It would lead to developers building apps that would give you total control of all your vehicle settings and even add way more settings.

    I remember when MP3 players first came out and Archos open-sourced their firmware and a whole community of coders rewrote everything and suddenly instead of just a crappy old MP3 player, every week I had new features, even game apps installed. This method drives innovation in huge ways and nullifies the broken captured-market capitalist racket that revolves around control and profits rather than meaningful advancement.
     
  6. Ichabod

    Ichabod Artist In Residence

    Joined:
    Jul 21, 2006
    1,794
    19
    0
    Location:
    Newton, MA
    Vehicle:
    2006 Prius
    If you follow links on my page above, you might see that another Prius owner had my software running on their builtin MFD using realtime information from the CAN bus to show operation of the PSD. I know this isn't the same as what you're saying and I'd love open-source car software. But I also would *not* love seeing people tune their Prius for highest performance/worst MPG because you know there's someone out there who would do it! I also know it would be really easy to break a car by fooling around with ECUs. But hey, that's why we have "void your warranty" stickers on things! Even the irresponsible ones can't convince me open source is a bad idea.
     
    #6 Ichabod, Mar 17, 2022
    Last edited: Mar 17, 2022
  7. PriusCamper

    PriusCamper Senior Member

    Joined:
    Mar 3, 2012
    10,891
    4,416
    0
    Location:
    Pacific Northwest, USA
    Vehicle:
    2007 Prius
    Model:
    Two
    I look forward to what you come up with as you develop your work with it... As for "risks" with hacked auto software, keep in mind the entire back bone of digital technology today has been supported by crowd sourcing bug fixes and preventing security breaches with bounty programs. As in the more people studying the code, the quicker problems get solved and advancements get developed.

    Capitalism on the other hand seeks to privatize and exclusify these efforts and have become the biggest most powerful corporations in history by doing that. Their is much ground to reclaim when it comes to this challenge and the "right to repair" movement needs to slaughter that army of greed and corruption!
     
  8. ChapmanF

    ChapmanF Senior Member

    Joined:
    Mar 30, 2008
    23,257
    15,060
    0
    Location:
    Indiana, USA
    Vehicle:
    2010 Prius
    Model:
    IV
    Do you think it would be very difficult to make the MG1 slider movable also? In my browser only MG2 and ICE are.

    I assume that's intentional, because the text only talks about varying those two speeds. And I understand there are only two degrees of freedom, so two movable handles are strictly enough. But it seems just kind of an unnecessary UI limitation that you can't just pick which handle you want to slide around. (I guess there would be the problem of deciding which of the other two to hold fixed, and which one to calculate. Maybe the rule could be the last one you touched tries to stay where you left it, you drag the one you're touching now, and the remaining one gets moved.

    It's kind of funny that the nomograph line bends if you keep dragging past an MG1 rev limit. Maybe that would be a good time to also recalculate and move the slider that was trying to stay where you left it, to keep the nomograph line from bending.
     
  9. vvillovv

    vvillovv Senior Member

    Joined:
    Mar 19, 2013
    3,528
    1,241
    1
    Location:
    NY
    Vehicle:
    2017 Prius Prime
    Model:
    Prime Plus
    I hear ya concerning the limits. I think there are plenty of other combinations of MG2 ICE MG1 rotations in the car that can't be duplicated in the demo. On the other hand there still look to me like there are at least a few combinations (where the connecting lines bend and turn red) that ar beyond the ECU limits and still show what woold be happening in the PSD beyond what the ECU would allow the motor generators and / or ice to rotate.
    I can only imagine the depth of the math involved to encompass all the variations the car gets exposed to or within the (Toyota Safe) programming limits of the ECU's and make them all visible on the demo. Both in the
    Code:
    ~$glxgears
    graphic and on the MPH / RPM gauges all being in sync.
     
    #9 vvillovv, Mar 17, 2022
    Last edited: Mar 17, 2022
  10. ChapmanF

    ChapmanF Senior Member

    Joined:
    Mar 30, 2008
    23,257
    15,060
    0
    Location:
    Indiana, USA
    Vehicle:
    2010 Prius
    Model:
    IV
    In the actual PSD, that nomograph line simply can't bend, without leaving chunks of steel where they're not wanted. So (while I have no expertise in UI design), I think I would design the app to keep the line straight at all times, and just kind of rubberband whichever knob is being dragged, and snap it back to a possible place when released.
     
  11. Ichabod

    Ichabod Artist In Residence

    Joined:
    Jul 21, 2006
    1,794
    19
    0
    Location:
    Newton, MA
    Vehicle:
    2006 Prius
    It's possible to redesign the UI to do all sorts of fancy things, but I made this a long time ago and my motivation to make very complex UI interactions is limited.

    The "bend" in the nomograph along with the bold red color was designed to demonstrate exactly that point: that you can't run an epicylclic gear that way without shearing off all the teeth. Yes it would be possible to rewrite code to prevent the line from ever bending, but for the purpose, it was a relatively simple and straightforward visual idea, and I think is still helpful for people to see that a straight line in the relationship is GOOD while a bent line is BAD. This leaves out any explanation of the math involved, the fixed ratios between speeds of the parts, and leaves it as a purely visual demonstration of the concept. Locking the line to straight and demonstrating the limitation visually in a different way could improve the tool, but the biggest limiting factor is my motivation to rewrite code for it :LOL:
     
  12. ChapmanF

    ChapmanF Senior Member

    Joined:
    Mar 30, 2008
    23,257
    15,060
    0
    Location:
    Indiana, USA
    Vehicle:
    2010 Prius
    Model:
    IV
    Yeah, everybody gets to decide how much code to write for free. :) Thanks for reimplementing it in JavaScript. I had been thinking of taking up that project myself at some point, so now I can write free code to do something else!
     
  13. krishay.baxte

    krishay.baxte New Member

    Joined:
    Feb 20, 2022
    4
    3
    0
    Location:
    Stockholm
    Vehicle:
    2012 Prius Plug-in
    Model:
    Plug-in Base
    I think I would design the app to keep the line straight at all times, and just kind of rubberband whichever knob is being dragged, and snap it back to a possible place when released.
     
  14. ChapmanF

    ChapmanF Senior Member

    Joined:
    Mar 30, 2008
    23,257
    15,060
    0
    Location:
    Indiana, USA
    Vehicle:
    2010 Prius
    Model:
    IV
    By the way, I think you'll reach a wider audience if you can:

    • Give an https address rather than http (say, https://eahart.com/prius/psd)
    • Arrange for the server certificate at that address to be valid for the link (at the moment, it supplies a certificate only valid for *.electricembers.net)
    • Move the inline JavaScript in the HTML page into a separate .js file and load it.

    In many browsers these days, even the default content security policy will block JavaScript that is coming from an insecure URL or embedded in the HTML itself.
     
  15. vvillovv

    vvillovv Senior Member

    Joined:
    Mar 19, 2013
    3,528
    1,241
    1
    Location:
    NY
    Vehicle:
    2017 Prius Prime
    Model:
    Prime Plus
    This link will give you an idea of what the https everywhere open source initiative is all about and full instructions how to deploy it easily? if you choose to add it.
    https://www.eff.org/https-everywhere

    Also, creating a link within the pages <head> tag to your .js script is a best practices, but it's also an extra step needed when wanting to make a change to the script and requires typically a hidden location on a server to help protect it from unwanted editing.
    IMO it's fine to leave it exposed, especially if you'd like other js reader/writers to comment on possible changes to the script you might like to consider in the future, not that that happens very often, anymore.

    I enjoyed playing with the demo. I hope I wasn't the only one that liked it the way you rebuilt it. Thanks for updating it.
     
  16. ChapmanF

    ChapmanF Senior Member

    Joined:
    Mar 30, 2008
    23,257
    15,060
    0
    Location:
    Indiana, USA
    Vehicle:
    2010 Prius
    Model:
    IV
    Absolutely, I like it too, or I wouldn't be offering suggestions.

    I was able to play with it on March 17th, but today I still can't (even after getting my browser to allow the untrusted script sources for experimental purposes). The remaining hangup seems to be this:

    comp.png

    It seems there is a handleFileLoad function that expects two arguments (evt and comp), and initpsdanim sets up a reference to that function when calling loadManifest. But when control reaches _sendFileComplete in the createjs library, that passes only one argument to the function.

    Curious why that might have worked before and not now. This is Firefox 97, if it matters.

    I see the plot thickens: there is another function named handleFileLoad, defined right in psdjsanim/init.js on line 55, that only takes one argument. Probably it is the one that is meant on line 50 of that same file, assigning handleFileLoad to loader.onFileLoad. But somehow the other handleFileLoad, defined in the main page inline script and expecting two arguments, is the one that has ended up getting called. I'm not an expert on JavaScript scoping rules, so I should probably just say I don't know why, and leave it at that.
     
  17. vvillovv

    vvillovv Senior Member

    Joined:
    Mar 19, 2013
    3,528
    1,241
    1
    Location:
    NY
    Vehicle:
    2017 Prius Prime
    Model:
    Prime Plus
    Yes it matters! and is excellent feedback for the author. Much better than just saying it doesn't work anymore or something like that. ;)

    After reading your post above I checked the Demo in Chrome ver. 100.xxxx.yy (stable) and it still works as it did the first time I viewed the Demo.

    edit: I tested the Demo in Firefox (stable ver 99) , Firefox-esr (ver. 91.0.8-esr) , Chromium (version 100.0.4xxx.yy) and it works in all of them. Both Firefox warn about the page not having https and gives a choice to Continue to the http site or Go Back to Safety or something similar.
    Both Chrome based browsers got directly to the page without issue or message.

    None of the browsers I tested have blockers or extensions of any kind enabled.
    Hope this helps.
     
    #17 vvillovv, Apr 22, 2022
    Last edited: Apr 23, 2022