Skip to content

Weight calculations don't take into account spool weight #119

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Sembazuru opened this issue Jan 31, 2021 · 14 comments
Closed

Weight calculations don't take into account spool weight #119

Sembazuru opened this issue Jan 31, 2021 · 14 comments

Comments

@Sembazuru
Copy link

Here is a screenshot in v1.3.3 with a made up spool:
2021-01-31 15_25_40-0% - (operational)
The imagined spool here was sold as a 1K spool that actually had 1014g of filament on the spool (not an entirely rare circumstance). The empty spool weighs 150g. So, after weighing the unused spool on a scale the user enters that total weight of 1164g into the "Total weight" field. The error shows up here, but for the example I also entered an imagined usage of 1kg, leaving 14g on the spool. But, the calculations for remaining are wrong. After using 1000.0g of filament the remaining should be 14g, not 164g.

Or am I misunderstanding the intended value for the "Total weight" field as gross weight of the brand new spool instead of net weight of the brand new spool?

@ndekker1
Copy link

ndekker1 commented Feb 1, 2021

Yes you are misunderstanding, The total weight is that of the filament, not the filament and spool. I do agree and think it should be just labeled as filament weight but its an easy fix once you understand what it means. Hope this helps!

@Sembazuru
Copy link
Author

If "Total Weight" is just the original Net Weight of the filament, what is the point of keeping track of the spool weight?

@ndekker1
Copy link

ndekker1 commented Feb 1, 2021

Well, if you just weigh your filament/spool all as one then you'll get the problem you have now where the software thinks you have an extra 150g of filament. This can mean that you think you have enough filament left in the roll to print a 70g part when in reality you only have enough filament to print ~1/4 of that part. You can just put the 1000g that the roll says it has but as you have found there is a percentage of error that could be seen which could be both positive or negative. So, in the end, it is just to keep a better eye on the total amount of filament.

@Sembazuru
Copy link
Author

But I can't weigh my filament separated from the spool, unless I want to pull all the filament off the spool and put it back on when I'm done. Not exactly practical... :-/ (Remember, 1kg of 1.75mm PLA filament is over 1000ft (over 300m)) Maybe relabel this as "Net Weight" instead of "Total Weight"...

I wonder if a "manual update" button would work. This button would pop up another window with two text entry boxes. One would be a current total weight box to enter in the weight from a scale of the current filament on the spool. This could be pre-populated from the database remaining added to the database spool weight. This allows the user to compare that number to what they see on the scale and either update it or think to themselves "Meh, that's close enough". The other text entry box would be the spool weight that is pre-populated from the database spool weight. This allows updating the spool weight if they get a better number here. (Either an update from the mfg, or an average of multiple spools that the user has already emptied,.) Maybe have on this update window a checkbox that is normally not selected labeled something like "initial entry". If this box is selected then the Total/Net Weight gets updated. If the box is not selected then the Remaining gets updated. (Spool weight is updated regardless, even if it means updating with the same value you don't need any logic to decide if to update it or not.)

(I don't know the GUI engine well enough to know if yet another pop-up window on top of the update/enter spool window would work.)

@stevegt
Copy link

stevegt commented Feb 12, 2021

Just ran into this myself -- the English word "total" means "everything" in any other context -- here this would mean "filament plus spool". I had to look at the code to prove to myself that the "Total Weight" field appears to be being used internally as filament-only weight instead. Appears to be related to #22, #29, #64, #79, #87, #99, and maybe a few others, so fixing this bug will likely clean up others and prevent many more in the future.

Implementation:

There are about 50 places in the code where variables, functions, and CSV headers are named some variation of "totalWeight", and there is currently no "filamentWeight" anywhere. We can't just change the name without breaking existing CSV format, so for backward compatibility I would do this:

  • Subtract spoolWeight from totalWeight at the time of web input or CSV load to calculate a new filamentWeight variable.
  • Find the places in the code where totalWeight is being used as filament weight, and change those to filamentWeight to fix calculation of remaining percentages etc.

If I'm thinking of this right, we don't even need to touch the db schema or CSV format to make this change, because filamentWeight can always be calculated from existing data.

Use cases:

The following looks more complicated than it really is -- the tl;dr is to just weigh the spool+filament, enter that into the "Total Weight" field, and enter your best estimate of a spool weight into "Spool Weight". Couldn't be simpler.

Exhausting all the permutations:

For existing users who have already entered filament + spool weight in the "Total Weight" field: This change will cause existing spools to report remaining filament accurately, and will prevent failed print jobs when they get near the end of a spool.

For existing users who have already entered filament weight in the "Total Weight" field: This change will cause existing spools to report "not enough filament" when they get near the end of a spool -- all they'll need to do is reweigh the filament+spool and enter that into the "Total Weight" field. They won't have failed print jobs.

For new users who only know filament+spool weight: They enter that into the "Total Weight" field, and enter a high estimate into the "Spool Weight" field -- we could perhaps default spool weight to 250g to stay safe.

For new users who only know filament weight: Get a scale, for gosh sakes. Weigh the full spool and enter filament+spool into the "Total Weight" field, then subtract the known filament weight from that total and enter spool weight. We might provide a UI tool to do the math, but only after fixing this bug.

@lightmaster
Copy link

My 2 cents on how this should be implemented:

  • Total weight = measured weight of filament + spool before any was used for printing
  • Spool weight = estimated weight of spool, calculated by weighting spool with all the original filament on it, so 1kg roll of filament actually weighs 1275g, so you know the spool should weigh 275g
  • Remaining Total Weight = weight of filament + spool as measured by a scale, editable so you can easily update your filaments when you weigh them
  • Remaining Filament Weight = weight of just the filament that's still available for printing
  • Used Filament Weight = weight of just the filament that already been printed (ie, current millage of that spool)

@abc2006
Copy link

abc2006 commented Feb 22, 2021

And i would appreciate a Button where i am able to enter the total Weigh (e.g. if i remove some Filament manually or ... ) so i am able to weigh my Spool completely and have SpoolManager calculate and modify the actual Values.

@melyux
Copy link

melyux commented Jun 19, 2021

This keeps tripping me up too. The program should do the calculation for you. Enter the actual total weight, spool + filament, and the empty spool weight, and it should subtract it for you and use it as the filament weight.

@Noggin01
Copy link

Noggin01 commented Jul 6, 2021

I just learned this one the hard way myself with a 20 hour print failed at the 18 hour mark. At the very least, the input page should be explicitly clear as to what it is asking for. Now that I've corrected the spool, it shows it at around -5% remaining.

At the very least, the data entry page should be obvious as to the data it is requesting. The entire point of this plugin is to track the filament usage, and I'm quite happy with the performance of the plugin.

If nothing else, a sanity check could be added using the total length. Prusament gives me the length of the spool. I entered that as 344000 mm. Given a diameter of 1.75mm, I can calculate the cross sectional area as pi * (1.75/2)^2 = 2.4041 mm^2. Multiplying by the length, 344000 mm gives me 826997.5 mm^3, or 826.9975 cm^3, for the volume of filament. Multiplying by the density of 1.27 g/cm^3 yields 1050 grams.

https://prusament.com/spool/?spoolId=e5e3e5b183

Prusament reports that this spool had 1046 grams on it, for a difference of 4 grams, or 0.38%, from the calculated percentage. Given that I had entered 1237g as the total weight (because that is what the total weight actually was) yields a difference of 187g from the calculated mass, or an apparent error 17.81%.

  1. User interfaces should be clear so idiots like me can still get it right
  2. If the UI isn't clear, the information should at least be visible so that people that read can get it right
  3. If the necessary information isn't visible, then the UI should use whatever information it is given it to try and protect the user from his own stupidity

@abc2006
Copy link

abc2006 commented Jul 6, 2021

actually, your print should not fail because of missing filament.. my Prusa pauses the print, and as i re-supply with another one, the Print is finished. But the basic problem is the same for me!

cheers,
stephan

@LeLocTai
Copy link

Just got tripped up by this. Looked at the code and the Spool field apparently to do nothing at all. The Total field would not be all that misleading if the Spool field isn't there in the first place.

@LeLocTai
Copy link

Quick UI mock up in Paint. Black outline is editable, gray fill is calculated. IMO this is very readable. The bar height don't have to be dynamic, they're just to visualize what each field mean. The unit selector implicitly signify whether length or weight is shown, which allow shortening of the label, so this is compact enough to be a drop in replacement to the existing UI.
image

@OllisGit
Copy link
Owner

Hi @LeLocTai,

thanks a lot for the mockup and looks good!

@TiziG already created a PullRequest #206 which change the weight calculation behaviour.

It will take some time to review, because I want to look into some PrintJobHistory Plugin-Issues.

@OllisGit OllisGit added status: inNextRelease Will be implemented/fixed in next release and removed status: analysing labels Jan 7, 2022
OllisGit added a commit that referenced this issue Jan 12, 2022
- E release-channles
- E stale-bot via github-actions
- E #79, #87, #99, #119, #157, #176, #202, weight calculation during editing PR #206, thx al lot @TiziG
- E #106 switching from travis to github-actions
- E #107, #215 database-settings in the log will only be shown, if sql-logging is enabled
- E #170 inform user about switching a spool already selected
- E #213 sort/filter options in spool selection dialog
- E Extrusion-Debugging: Show current extrusion during printing

- B #188 touchUI conflict
- B #193, #196 sorting/showing of remaining weight
- B #205 changed to "browser-native" date/time picker
- B #210 loadCatalogColors when color name is blank
- B #211 button text changed
- B #212 import CSV only if printer in idle-mode
- B #216 FilamentManager and SpoolManager used same viewmodel
- B #217 when print is paused the extruded filament is assigned to the spool and the counter is reseted
@OllisGit
Copy link
Owner

Hi !
The mentioned PR is now in the latest release!

Because I have a lot of issues related the weight calculation I close this issue to get a more "up to date overview" in the issue-tracker.
If you found an issue in the latest version feel free to raise a new issue!

@OllisGit OllisGit removed the status: inNextRelease Will be implemented/fixed in next release label Jan 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants