Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login

    Strange numerics

    Scheduled Pinned Locked Moved
    Gcode meta commands
    3
    7
    542
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • wschadowundefined
      wschadow
      last edited by wschadow

      I stumbled across this issue

      var dnozzle1 = heat.heaters[1].model.deadTime
      var dnozzle2 = (10.0* heat.heaters[1].model.deadTime) / 10.0
      
      echo {var.dnozzle1}^"  "^{var.dnozzle2}
      

      9fbd3188-c78a-48ae-a42c-20a69aa2c58d-image.png

      Rounding is done in a mysterious way.

      o_lampeundefined 1 Reply Last reply Reply Quote 0
      • o_lampeundefined
        o_lampe @wschadow
        last edited by

        @wschadow Do you know for sure, that the true value is 5.7 ? It might just be truncated in a different way when echo prints OM-values directly?

        wschadowundefined 1 Reply Last reply Reply Quote 0
        • wschadowundefined
          wschadow @o_lampe
          last edited by

          @o_lampe here is another example:

          var enozzle1 = heat.heaters[1].model.coolingExp
          var enozzle2 = (10.0 * heat.heaters[1].model.coolingExp) / 10.0 
          
          echo {var.enozzle1}^"  "^{var.enozzle2}
          

          c4ac6970-907f-46f4-a439-080e680e64d1-image.png

          According to the documentation the default value is 1.35. There is something wrong with the assignment / rounding of variables.

          wschadowundefined 1 Reply Last reply Reply Quote 0
          • wschadowundefined
            wschadow @wschadow
            last edited by wschadow

            To me this looks like a bug in the assignment / conversion / rounding:

            var enozzle1 = 1.0*heat.heaters[1].model.coolingExp
            var enozzle2 = 1.00000001*heat.heaters[1].model.coolingExp
            var enozzle3 = (10.0 * heat.heaters[1].model.coolingExp) / 10.0 
            
            echo {var.enozzle1}^"  "^{var.enozzle2}^"  "^{var.enozzle3}
            

            96a6f31d-3b8b-41b3-b15f-765f247d85c1-image.png

            dc42undefined 1 Reply Last reply Reply Quote 0
            • dc42undefined
              dc42 administrators @wschadow
              last edited by dc42

              @wschadow each object model value has a default number of decimal places, which is the number of decimal places that is provided when you enquire of that value. This is done because if we represented all floating point values to the full 7 decimal places, the volume of text returned by the object model to DWC, PanelDue and other user interfaces would be a lot larger for no gain. Also it would look silly if user messages gave e.g a selected temperature as 205.5000 rather than 205.5.

              If you perform maths on object model values then the result is always provided to 7 decimal places.

              Duet WiFi hardware designer and firmware engineer
              Please do not ask me for Duet support via PM or email, use the forum
              http://www.escher3d.com, https://miscsolutions.wordpress.com

              wschadowundefined 2 Replies Last reply Reply Quote 0
              • wschadowundefined
                wschadow @dc42
                last edited by

                @dc42 ok, thanks for the explanation. Of course it makes to display only the significant digits or a certain number of digits. The problem here is that too few digits are displayed. When I write these variable to a file I get wrong numbers (1.4 will be written). When reading them and assigning them to variables in the object model, they are set to the wrong values.

                1 Reply Last reply Reply Quote 0
                • wschadowundefined
                  wschadow @dc42
                  last edited by

                  @dc42 This brings me also to another request: https://github.com/Duet3D/PanelDueFirmware/issues/317

                  The object model seems to change the number of digits for x and y depending on the number it cuts off trailing zeros, which is fine. DWC and Paneldue show for x and y only one digit after the ".". It would be very helpful, e.g. the x y offset calibration of an ODEX machine, to display to digits. There is enough room for that.

                  wschadow created this issue in Duet3D/PanelDueFirmware

                  closed Two digits for the display of x and y coordinates #317

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post
                  Unless otherwise noted, all forum content is licensed under CC-BY-SA