assembling machine network problem

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
PascalDUFOUR
Burner Inserter
Burner Inserter
Posts: 14
Joined: Sat Dec 07, 2019 1:35 pm
Contact:

assembling machine network problem

Post by PascalDUFOUR »

We all know that the assembling machine now can be in circuit net work, so I want to use it in some big mod, such as pY.
But there's a problem now I need to face, the fraction. For exmaple, when I want to know how many iron plates need for 40 gear wheels, I can send the 40 gear wheels signals to assembling machine, the assembling machine give me 2 iron plates, and I change the 40 gear wheels signals to 40 N signals, then I multiply N with 2 iron plate, great, now I know I need 80 iron plates.
Now let's see another recipe, copper cable, we all know 1 copper plate makes 2 copper cables, and when we send copper cabke signal to assembling machine, because factorio cannot do anything to fraction or decimal signals, it will not give you 0.5 or 1/2 copper plates, but 1 copper plates instead. Using the circuit I mentioned above, now we get 40 copper plate, and we know it's wrong, we only needs 20 copper plates.
You may ask that why I just make it so complicated, going to production directly and it will be very intuitive. But it's pY mod, sometimes I just want to know how many iron plate I need for some very difficult recipe, so I need to use the circuit network to analyse it first, that I can prepare the ingredients before production. And you know such as 1 ingredient makes 5 productions is really common in pY mod, the iron plates we need due to the problem I mentioned above will be multiply many times, once I even get I need more than 100,000 plates for 1 machine.
See, that is weird, so can anyone tell me how to solve this problem, or tell me if there's any mod in 2.0 can output the signal of the number of products in the recipe now using in assembling machine?

By the way, don't tell me to prepare circuit networks for all exceptions, if you have any knowlegdge about pY mod, you know how impossible it would be.

You can see my network below, it's really cute, I don't want to make it too big...
11-29-2024, 20-36-07.png
11-29-2024, 20-36-07.png (1.94 MiB) Viewed 602 times
Maybe you can find some place need to be updated, yes it's still in updating, but I need to fix this first...
FunMaker
Fast Inserter
Fast Inserter
Posts: 112
Joined: Wed Jun 08, 2016 8:43 pm
Contact:

Re: assembling machine network problem

Post by FunMaker »

You can get fractions if you multiply the devisor by 10 before dividing and will get 5 instead of 0.5 - it is limited by precision and will not work for huge numbers, but in many cases this worked for me
PascalDUFOUR
Burner Inserter
Burner Inserter
Posts: 14
Joined: Sat Dec 07, 2019 1:35 pm
Contact:

Re: assembling machine network problem

Post by PascalDUFOUR »

FunMaker wrote: ↑Sat Nov 30, 2024 1:32 pm You can get fractions if you multiply the devisor by 10 before dividing and will get 5 instead of 0.5 - it is limited by precision and will not work for huge numbers, but in many cases this worked for me
OK I think you did not understand my problem. For example, I require 12 basic underground belt, AKA the yellow ones, using the system I made above, firstly I can get 10 iron plates, 5 yellow belts as ingredients, than multiply 12, I then get 120 iron plates and 60 yellow belts, secondly the yellow belts can be also devide into more ingredients in assembling machines, now we get 1 iron plate and 1 gear wheel, then multiply 60, great now we get 60 iron plate and 60 gear wheel. There's nothing weird about gear wheel, and finally we get 120+60+120=300 iron plates to make 12 yellow underground belts.
How about the reality? We only need 105 iron plates, that is the problem.

And if we only use the vanilla game mode, we could use some exception to control the network, but when mods are used, can you remember all the exceptions, especially for the big mods? Well now we only have pY, but I think later we could get angel, bob, SE, K2 and so on, I hope my circuit network can work in all system, not just for vanilla game.
FunMaker
Fast Inserter
Fast Inserter
Posts: 112
Joined: Wed Jun 08, 2016 8:43 pm
Contact:

Re: assembling machine network problem

Post by FunMaker »

PascalDUFOUR wrote: ↑Sat Nov 30, 2024 2:53 pm
FunMaker wrote: ↑Sat Nov 30, 2024 1:32 pm You can get fractions if you multiply the devisor by 10 before dividing and will get 5 instead of 0.5 - it is limited by precision and will not work for huge numbers, but in many cases this worked for me
OK I think you did not understand my problem. For example, I require 12 basic underground belt, AKA the yellow ones, using the system I made above, firstly I can get 10 iron plates, 5 yellow belts as ingredients, than multiply 12, I then get 120 iron plates and 60 yellow belts, secondly the yellow belts can be also devide into more ingredients in assembling machines, now we get 1 iron plate and 1 gear wheel, then multiply 60, great now we get 60 iron plate and 60 gear wheel. There's nothing weird about gear wheel, and finally we get 120+60+120=300 iron plates to make 12 yellow underground belts.
How about the reality? We only need 105 iron plates, that is the problem.

And if we only use the vanilla game mode, we could use some exception to control the network, but when mods are used, can you remember all the exceptions, especially for the big mods? Well now we only have pY, but I think later we could get angel, bob, SE, K2 and so on, I hope my circuit network can work in all system, not just for vanilla game.
Ah, well. I don't know how you solved the recursiveness of the problem and the depth of the recursiveness(may be the left combinators of the screenshot) , but i think going with multiplies of the original value might do the trick. You could multiply the initial item by 10000 so you could divide all occurences while keeping some precision. At the end you divide the result by 10000 and get the raw inputs (truncated in the end, but you don't loose precision while recursing the prdouction hierarchy).
mrvn
Smart Inserter
Smart Inserter
Posts: 5969
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: assembling machine network problem

Post by mrvn »

First thought:
The problem would be solved if the assembler had an option to multiply the ingredients with the recipe signal. So you send it a 20 copper cable signal and it outputs 10 copper plates.

This also solves the problem with productivity where you might only need 7 copper plates for 20 copper cables.

Second thought:
The assembler should also output an recipe count signal. Meaning the number of recipe cycles needed to produce those 20 copper cables. When dealing with productivity you want to know it is 7 cycles and make it run 8 cycles.

But if it outputs 7 cycles then you can multiply the ingredients counts by the number of cycles (8 in this case instead of 7) and get the real amount of ingredients you want. So no need for the assembler to multiply ingredients by recipe count, better to do that yourself. So maybe the multiply option isn't needed at all. Just the cycles count.
PascalDUFOUR
Burner Inserter
Burner Inserter
Posts: 14
Joined: Sat Dec 07, 2019 1:35 pm
Contact:

Re: assembling machine network problem

Post by PascalDUFOUR »

FunMaker wrote: ↑Sat Nov 30, 2024 7:24 pm
PascalDUFOUR wrote: ↑Sat Nov 30, 2024 2:53 pm
FunMaker wrote: ↑Sat Nov 30, 2024 1:32 pm You can get fractions if you multiply the devisor by 10 before dividing and will get 5 instead of 0.5 - it is limited by precision and will not work for huge numbers, but in many cases this worked for me
OK I think you did not understand my problem. For example, I require 12 basic underground belt, AKA the yellow ones, using the system I made above, firstly I can get 10 iron plates, 5 yellow belts as ingredients, than multiply 12, I then get 120 iron plates and 60 yellow belts, secondly the yellow belts can be also devide into more ingredients in assembling machines, now we get 1 iron plate and 1 gear wheel, then multiply 60, great now we get 60 iron plate and 60 gear wheel. There's nothing weird about gear wheel, and finally we get 120+60+120=300 iron plates to make 12 yellow underground belts.
How about the reality? We only need 105 iron plates, that is the problem.

And if we only use the vanilla game mode, we could use some exception to control the network, but when mods are used, can you remember all the exceptions, especially for the big mods? Well now we only have pY, but I think later we could get angel, bob, SE, K2 and so on, I hope my circuit network can work in all system, not just for vanilla game.
Ah, well. I don't know how you solved the recursiveness of the problem and the depth of the recursiveness(may be the left combinators of the screenshot) , but i think going with multiplies of the original value might do the trick. You could multiply the initial item by 10000 so you could divide all occurences while keeping some precision. At the end you divide the result by 10000 and get the raw inputs (truncated in the end, but you don't loose precision while recursing the prdouction hierarchy).
True the large structue in the left is the place where I can save all the ingredients in each layer of production, and that cause the problem, a small number of requirement at the first will become something incredibly enormous at the end, escpecially when we use some mod which have many recipes which has a similar structure like 1 ingredients 2 products.
As for the layers of production by assembling machine, according to my testing, for the most difficult products in pY mod, though I am not fully sure, but I believe it won't be more than 12.
The problem is as my testing, the circuit system of assembling machine cannot identify the number of products we need, no matter how many products signal we send, it will regard it as only ONE time producing process, and give the ingredients to run the production once. You can have a try, give the assembling machine 1 copper cable, 2 copper cables, 3 copper cables and so on, you will find the signals it gave out are the same, 1 copper plate.
And as I said, to memorize the exception recipes in vanilla game is easy, I can make them recognize all the exceptions and let it be divided by the correct number every time, but it's really difficult in some big mod, the exceptions are too many, pY is just an example.
PascalDUFOUR
Burner Inserter
Burner Inserter
Posts: 14
Joined: Sat Dec 07, 2019 1:35 pm
Contact:

Re: assembling machine network problem

Post by PascalDUFOUR »

mrvn wrote: ↑Sat Nov 30, 2024 7:46 pm First thought:
The problem would be solved if the assembler had an option to multiply the ingredients with the recipe signal. So you send it a 20 copper cable signal and it outputs 10 copper plates.

This also solves the problem with productivity where you might only need 7 copper plates for 20 copper cables.

Second thought:
The assembler should also output an recipe count signal. Meaning the number of recipe cycles needed to produce those 20 copper cables. When dealing with productivity you want to know it is 7 cycles and make it run 8 cycles.

But if it outputs 7 cycles then you can multiply the ingredients counts by the number of cycles (8 in this case instead of 7) and get the real amount of ingredients you want. So no need for the assembler to multiply ingredients by recipe count, better to do that yourself. So maybe the multiply option isn't needed at all. Just the cycles count.
I used to use some another mods named rusty locale and crafting combinator, it actually solved this problem it can at least send the number of ingredients and products in one producing process, I can make the whole ingredient number be divided by the products number of one producing process, maybe i need to plus an extra recipe or something else to avoid the rounddown system in game, but I can get a more accurate number.
Well this mod did not get updated in 2.0, and the worse is, in this mod the time it analyse the recipe is not fixed, it will make the analysing process become something uncontrollable.
And it's an analysizing system, especially to solve the products which has many layers of production, the analysizing-producing system also need to face this problem, thus to count the number in producing only can solve the easy recipe in vanilla one, it does not have many layers, maybe 4 or 5 is the most( at least I check the rocket silo). But see, I just give some mk4 buildings in pY mod to have a test, and it goes something weird. By the way mk1 or 2 buildings is also not good when facing this problem.
mrvn
Smart Inserter
Smart Inserter
Posts: 5969
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: assembling machine network problem

Post by mrvn »

PascalDUFOUR wrote: ↑Sun Dec 01, 2024 8:47 am The problem is as my testing, the circuit system of assembling machine cannot identify the number of products we need, no matter how many products signal we send, it will regard it as only ONE time producing process, and give the ingredients to run the production once. You can have a try, give the assembling machine 1 copper cable, 2 copper cables, 3 copper cables and so on, you will find the signals it gave out are the same, 1 copper plate.
And as I said, to memorize the exception recipes in vanilla game is easy, I can make them recognize all the exceptions and let it be divided by the correct number every time, but it's really difficult in some big mod, the exceptions are too many, pY is just an example.
That really is the problem. There are also recipes with multiple outputs: 2 of X and 3 of Y. Or percentages.

How would it output the results of the basic recycler recipe?

There should either be a input to specify a multiplyer, e.g. input 100 and 7% turns into 7, or the game has use fractions and output a denominator as well as the output counts / percentages multiplied by the denominator.

So for copper wire it would say: Ingredients: 1 copper plate, Results: 2 copper cable, Denominator: 2. Meaning 1/2 copper plate gives 2/2 copper cable.


I'm working on updating the recipe combinator from a 1.1 mod for 2.0 to have this feature but it might take some time. It's something of a rainy day project.
PascalDUFOUR
Burner Inserter
Burner Inserter
Posts: 14
Joined: Sat Dec 07, 2019 1:35 pm
Contact:

Re: assembling machine network problem

Post by PascalDUFOUR »

mrvn wrote: ↑Mon Dec 02, 2024 6:06 pm
PascalDUFOUR wrote: ↑Sun Dec 01, 2024 8:47 am The problem is as my testing, the circuit system of assembling machine cannot identify the number of products we need, no matter how many products signal we send, it will regard it as only ONE time producing process, and give the ingredients to run the production once. You can have a try, give the assembling machine 1 copper cable, 2 copper cables, 3 copper cables and so on, you will find the signals it gave out are the same, 1 copper plate.
And as I said, to memorize the exception recipes in vanilla game is easy, I can make them recognize all the exceptions and let it be divided by the correct number every time, but it's really difficult in some big mod, the exceptions are too many, pY is just an example.
That really is the problem. There are also recipes with multiple outputs: 2 of X and 3 of Y. Or percentages.

How would it output the results of the basic recycler recipe?

There should either be a input to specify a multiplyer, e.g. input 100 and 7% turns into 7, or the game has use fractions and output a denominator as well as the output counts / percentages multiplied by the denominator.

So for copper wire it would say: Ingredients: 1 copper plate, Results: 2 copper cable, Denominator: 2. Meaning 1/2 copper plate gives 2/2 copper cable.


I'm working on updating the recipe combinator from a 1.1 mod for 2.0 to have this feature but it might take some time. It's something of a rainy day project.
Oh i am really looking forward to your recipe combinator!
mrvn
Smart Inserter
Smart Inserter
Posts: 5969
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: assembling machine network problem

Post by mrvn »

PascalDUFOUR wrote: ↑Tue Dec 03, 2024 7:18 am
mrvn wrote: ↑Mon Dec 02, 2024 6:06 pm
PascalDUFOUR wrote: ↑Sun Dec 01, 2024 8:47 am The problem is as my testing, the circuit system of assembling machine cannot identify the number of products we need, no matter how many products signal we send, it will regard it as only ONE time producing process, and give the ingredients to run the production once. You can have a try, give the assembling machine 1 copper cable, 2 copper cables, 3 copper cables and so on, you will find the signals it gave out are the same, 1 copper plate.
And as I said, to memorize the exception recipes in vanilla game is easy, I can make them recognize all the exceptions and let it be divided by the correct number every time, but it's really difficult in some big mod, the exceptions are too many, pY is just an example.
That really is the problem. There are also recipes with multiple outputs: 2 of X and 3 of Y. Or percentages.

How would it output the results of the basic recycler recipe?

There should either be a input to specify a multiplyer, e.g. input 100 and 7% turns into 7, or the game has use fractions and output a denominator as well as the output counts / percentages multiplied by the denominator.

So for copper wire it would say: Ingredients: 1 copper plate, Results: 2 copper cable, Denominator: 2. Meaning 1/2 copper plate gives 2/2 copper cable.


I'm working on updating the recipe combinator from a 1.1 mod for 2.0 to have this feature but it might take some time. It's something of a rainy day project.
Oh i am really looking forward to your recipe combinator!
I still hope I can just make it some combinator logic with some constant combinators programmed by the mod to programatically handle all the special recipes. Should be possible to have constant combinators giving a multiplier and denominator for each recipe that needs fractions and then it's just a comparison and multiplications. Would mean it would update on every change within ticks without much time cost.
PascalDUFOUR
Burner Inserter
Burner Inserter
Posts: 14
Joined: Sat Dec 07, 2019 1:35 pm
Contact:

Re: assembling machine network problem

Post by PascalDUFOUR »

mrvn wrote: ↑Tue Dec 03, 2024 7:47 am
PascalDUFOUR wrote: ↑Tue Dec 03, 2024 7:18 am
mrvn wrote: ↑Mon Dec 02, 2024 6:06 pm
PascalDUFOUR wrote: ↑Sun Dec 01, 2024 8:47 am The problem is as my testing, the circuit system of assembling machine cannot identify the number of products we need, no matter how many products signal we send, it will regard it as only ONE time producing process, and give the ingredients to run the production once. You can have a try, give the assembling machine 1 copper cable, 2 copper cables, 3 copper cables and so on, you will find the signals it gave out are the same, 1 copper plate.
And as I said, to memorize the exception recipes in vanilla game is easy, I can make them recognize all the exceptions and let it be divided by the correct number every time, but it's really difficult in some big mod, the exceptions are too many, pY is just an example.
That really is the problem. There are also recipes with multiple outputs: 2 of X and 3 of Y. Or percentages.

How would it output the results of the basic recycler recipe?

There should either be a input to specify a multiplyer, e.g. input 100 and 7% turns into 7, or the game has use fractions and output a denominator as well as the output counts / percentages multiplied by the denominator.

So for copper wire it would say: Ingredients: 1 copper plate, Results: 2 copper cable, Denominator: 2. Meaning 1/2 copper plate gives 2/2 copper cable.


I'm working on updating the recipe combinator from a 1.1 mod for 2.0 to have this feature but it might take some time. It's something of a rainy day project.
Oh i am really looking forward to your recipe combinator!
I still hope I can just make it some combinator logic with some constant combinators programmed by the mod to programatically handle all the special recipes. Should be possible to have constant combinators giving a multiplier and denominator for each recipe that needs fractions and then it's just a comparison and multiplications. Would mean it would update on every change within ticks without much time cost.
Well, i just tried to make a exception area (to seperate all the 2/3/5, and you know, pY even has a 20 products recipe) before every signal being saved, not only the length of each analysing became longer (maybe about 6~10 ticks for each, i did not count it accurately), but the both the area and the connection got something really messy, at least maybe one week or two in the future, i would not try to understand what i am making...REALLY A HUGE MESS I DID
Lighthouse
Burner Inserter
Burner Inserter
Posts: 13
Joined: Wed Nov 20, 2024 3:09 am
Contact:

Re: assembling machine network problem

Post by Lighthouse »

How about multiplying all your numbers in your network e.g. with e^10 first and divide it by that afterwards, so your decimal problem only happens after the e.g. tenth digit?

Could you use the Airthmetic combinator's Modulo function (likely with %10) to check whether you might need calculations for additional digits?

Just two thoughts - I don't have a solution out of the box.
User avatar
Khagan
Filter Inserter
Filter Inserter
Posts: 267
Joined: Mon Mar 25, 2019 9:40 pm
Contact:

Re: assembling machine network problem

Post by Khagan »

Lighthouse wrote: ↑Wed Dec 11, 2024 6:09 pm How about multiplying all your numbers in your network e.g. with e^10 first and divide it by that afterwards, so your decimal problem only happens after the e.g. tenth digit?
e^10 is an ... interesting suggestion. I think you meant 10^10, which is probably too much. My instinct would be to go Babylonian, and multiply everything by 60 (or even 3600).
Post Reply

Return to β€œGameplay Help”