simonjackson1964 Geschrieben 21. Mai 2021 Geschrieben 21. Mai 2021 I am probably trying to be too clever, but there must be a way of doing this... What I want to happen: My freight train pulls into the depot, and the cranes get to work unloading the containers, stacking them neatly alongside the roadway where a stream of trucks arrive one after the other and as soon as the train is unloaded the containers are loaded onto the trucks, and off they go, to the other end of the layout where the reverse happens. What actually happens - The story so far: The trucks are just pootling backwards and forwards at the moment because I haven't got to them yet, I want to get the bit that unloads the train working first... So the train arrives in the depot, and the three cranes get to work. I couldn't find a decent container crane that would do the whole of a twelve wagon freight train, so I have three cranes that handle four wagons each. So far, cranes 2 and three successfully pick up the first container on their bit of the train. Crane 1 goes a bit further. after picking up the container it selects one of ten "container floors", and places the container there. But herein lies the problem: If the floor already has one or two containers on it, the crane is supposed to stack the containers. It does so when I operate it manually. But when the event is triggered by the arrival of the train, the crane neatly drops the container inside the one already there! I know why it is doing it, I'm just wondering if there is a better solution than the one I have in mind. ================== When the train arrives it loads the object references of four containers into a list on each crane. The crane so far only gets the first one but it should be easy enough to get the other three. There is a pre-loaded list of ten tables in Crane 1, each table holds the object ID of the crane floor, and the number of containers already on that floor. If the number is 3, the floor won't be selected. So when the crane has finished lifting a container it generates a random index to find which floor to put the container on. What I think I might have to do is add a third item to the table to hold the ID of the floor, and put the id of the topmost container or the floor if empty into the "target" field. Is there something I'm missing, or have I just got to bite the bullet and code that?
simonjackson1964 Geschrieben 21. Mai 2021 Autor Geschrieben 21. Mai 2021 Adding the following: The above solution might work when stacking the containers, but when it comes to taking them off the stack, it definitely won't, because I won't have a reference to the container underneath. The only solution I can see is to store the IDs of the containers against the container floor, and somehow get that information into the crane. It ought to be possible, but I'm going to have to seriously think about it. Any suggestions that will make it easier would be appreciated!
Herman Geschrieben 22. Mai 2021 Geschrieben 22. Mai 2021 Hello, It is difficult to see only in your text what is going on, and even then, I'm not an expert, but there ary many experts among the members. Probably I cannot help with your specific question , but maybe ( just maybe ... ) you can find something in 911459D6-84DF-439B-AD37-E5E19B2EDE63 , a layout I published recently in the catalog. I hope somebody can give you a solution. Feel free to ask questions about my own layout, if you think it might help. Kind regards, Herman (BE)
Herman Geschrieben 22. Mai 2021 Geschrieben 22. Mai 2021 Hello, I'm back here, just take it as it is : When testing my container handling, I had also the problem that sometimes the container goes trough the other one when stacking. I alsways used an object from the list to give actions to the crane. Those objects are : a place ( on a train, on the ground ) or another container. I looked to an error in my code first, but it was only a mistake in the list : the ground position was activated (or a lower container), instead of the actual container. And of course .... . The cronological order in my list is import to find what action, so a mistake is easy there. KInd regards, Herman
simonjackson1964 Geschrieben 22. Mai 2021 Autor Geschrieben 22. Mai 2021 (bearbeitet) Hi Herman Thanks, I think that the solution I have in mind is probably the way I need to do this. It's just the thought of storing all those container IDs is killing me... My own fault for wanting the stacks to look realistic... So far I have "finished" one layout, that is, I got it working the way I wanted and published it... maybe I will eventually "finish" another. Cheers Simon PS: I just thought. If I delete all the containers at the "unload end", get the unload events working, and then manually load the trains at the other end I can build the stacks automatically! *Is sneaky* Bearbeitet 22. Mai 2021 von simonjackson1964 A sudden thought
Herman Geschrieben 22. Mai 2021 Geschrieben 22. Mai 2021 Hello Simon, "storing all those container IDs is killing me ..." Do you really use ID's ? Why not the reference to the object. But still a time consuming option. Succes with your project. Greetings, Herman
hubert.visschedijk Geschrieben 22. Mai 2021 Geschrieben 22. Mai 2021 Simon, id like to see your layout, allthough not finished yet perhaps. Can you load it to the catolog ? Many regards,
Goetz Geschrieben 22. Mai 2021 Geschrieben 22. Mai 2021 Containerchaos is a layout from @fzonk which does what you plan to do too, @simonjackson1964 Content ID: 4C772DEB-7521-43F5-A612-C705AC4D9C56 He's not using lists, from what I can see. Only variables. But maybe it still holds some inspiration for you?
simonjackson1964 Geschrieben 22. Mai 2021 Autor Geschrieben 22. Mai 2021 6 hours ago, Herman said: Hello Simon, "storing all those container IDs is killing me ..." Do you really use ID's ? Why not the reference to the object. But still a time consuming option. Succes with your project. Greetings, Herman I meant referencing the object.... Putting the object reference (or ID) into the object item on the object that stores it. 20 minutes ago, hubert.visschedijk said: Simon, id like to see your layout, allthough not finished yet perhaps. Can you load it to the catolog ? Many regards, Actually I've managed to solve the problem, but it's fiddly, and I'm still trying to make it work all the time in the same way...
simonjackson1964 Geschrieben 23. Mai 2021 Autor Geschrieben 23. Mai 2021 This is why I never got a job doing data entry... I just had to check the content of the container stack lists, because one of the cranes was getting suck. Also why I'm not ready to upload it yet, even as a work in progress. Sorry Hubert. I think I fixed it, but it was a palava. And I've only done the bit that unloads the trains. I still have to do the bit to load the lorries, and then both bits in reverse at the other end. @Goetz and @Herman Thanks for the suggestions. I think I'll have a look at both layouts when I have mine to a point where I'm happy with it, unless I get totally stuck. On a separate but related note I discovered that when using a separate event to decouple the loco and start it's run-around, from the event that uses an iteration to load the cargo of the train into the crane's target list, it is unwise to decouple the loco as soon as it arrives...! I've currently got a 10s delay on the decouple, but hoping to decrease that. Strictly speaking a 1-second delay should be fine, that should be more than enough time for the other event to parse 12 times around the loop... Maybe give it 2 to be safe?
hubert.visschedijk Geschrieben 24. Mai 2021 Geschrieben 24. Mai 2021 Am 23.5.2021 um 16:36 schrieb simonjackson1964: even as a work in progress. Sorry Hubert No worries !
220hotwheels Geschrieben 25. Mai 2021 Geschrieben 25. Mai 2021 Hi Simon Just been reading through some of suggestions regarding solving your initial container stacking problem. Although it would seem that you have now sorted this, I wondered whether the following would be of any interest. Much of my approach to problem solving with my layouts falls into the category of the “Heath Robinson”, a bit long winded as my expertise, whilst improving, still has a long way to go but this solution was given to me by another member who has helped me enormously with many problems that I have encountered. I have used this system for loading and unloading containers onto trains and trucks as well as more recently for discharging them from a ship to quayside and trucks alike. The basic principle is very straight forward. Every container is allocated a cargo pad. If one container is stacked on top of another then the one on the bottom has a cargo pad placed on it’s top, locked to said container but referenced to the one to be placed on it. As an example therefore if I have 20 containers loaded on my ships deck each one will be allocated it’s own cargo pad. Container ‘A’ will be located on cargo pad ‘MV vessel bottom A’ and so on. If I then double stack these I simple place another cargo pad on top of each container, lock it to that container but give it the reference name for the container to be placed on top, lets say ‘MV vessel top A’. It’s then simply a matter of telling which crane, if you are using more that one, which container it should lift and where it must be placed. On my current layout I am discharging from ship to truck and quay so have allocated cargo pads to both the trucks and quayside giving each an individual name, the trucks get, for example ‘truck 1 front pad or rear pad’ and the quayside gets ‘quayside ‘A’ etc. As long as you take care during the programming then all works fine. I then execute a script which after a given time will return all items to their original start point ready to start all over again. So far, all containers have relocated in exactly the right places. All cargo pads are set as invisible, so the look is right as well. Any way that’s my solution. I did warn you all at the beginning that my solution owes much to my trusty mentor “Heath Robinson” or should that be “sods law” !!! Happy cargo stacking. Pete
simonjackson1964 Geschrieben 30. Mai 2021 Autor Geschrieben 30. Mai 2021 Hi Hotwheels Actually, my solution was much simpler. Each cargo pad/container floor on the ground has a list of three Object elements, and an index (called "Stack Height"). When the crane references the Container floor, it checks the stack height. If the height is 0, then the container floor becomes the target. If the height is greater than zero then the object in the list referenced by the stack height becomes the target. Obviously, the stack height is then incremented and the object ID of the new container placed in the next object in the list. If the stack height is three, the next container floor is used instead. Each of the three cranes had ten container floors to choose from and the floor is chosen using a random number. I'm still working on the reverse procedure...
220hotwheels Geschrieben 31. Mai 2021 Geschrieben 31. Mai 2021 Hi Simon I did say right at the beginning that much of what I do relies very much on 'Heath Robinson'. As I pick up hints and tips I then go back to my drawing board and make suitable changes. Your solution certainly merits a modification to my layout although I am only stacking containers up to 2 high. Clearly you have an understanding of the use of Lua from what I have been reading about your solution to getting carriage doors to open and close. My knowledge is still at the stone age stage but I quite fancy having a go at following your solution for carriage door operation so will see how I get on. Good luck with the reverse procedure. Pete
220hotwheels Geschrieben 31. Mai 2021 Geschrieben 31. Mai 2021 HI Simon Just thought I should let you know that having followed your solution to the carriage door opening/closing problem I now have all working perfectly on each of the trains where such facilities are available. The moral to this story is either you have the knowledge or you know who has or where to find it. Long live the forum and all who contribute. It makes life for we less knowledgeable folk much more enjoyable. As they say, "a problem shared is a problem halved", especially if you are able to understand the solution and better still put it into practice. Once again many thanks for sharing your knowledge. Pete
simonjackson1964 Geschrieben 2. Juni 2021 Autor Geschrieben 2. Juni 2021 Thanks, but technically it wasn't my knowledge originally... I think it was Goetz who suggested using a user-defined event. I'd never done that before. Now I use them all over the place!
220hotwheels Geschrieben 3. Juni 2021 Geschrieben 3. Juni 2021 Hi Simon Well in that case many thanks to both you and Goetz, he has also helped me too in the past. He is certainly a source of great knowledge with regard to this hobby of our's. When I know half of what he seems to know I will feel that I have achieved much. In the meantime I shall continue to muddle through following both Heath Robinson and Murphy's law as a general rule but picking up tips here and there in order to correct my mistakes. How are you doing with your container stacking in reverse? I don't suppose my feeble attempt with Lua would be of any interest but I certainly manage to get all containers back to their original positions without too much hassle but then I am only stacking 2 up max. Anyway if it's of interest let me know and I'll send you a copy of my Lua script. Pete
simonjackson1964 Geschrieben 4. Juni 2021 Autor Geschrieben 4. Juni 2021 I've got it working in both directions at one end, but not at the same time - or rather, I'm still figuring out how to make the change over from taking containers off the stacks and putting them on trucks, to a train arriving and the containers being taken off the wagons and put on the stacks, go smoothly. Getting the cranes to load the train at the other end is just a matter of changing the targets on the events that put them on the lorries - that and duplicating the events that handle the train arriving....
220hotwheels Geschrieben 4. Juni 2021 Geschrieben 4. Juni 2021 Oh I see. Your application of events is clearly somewhat different to mine. I unload from either ship, train or truck. Place onto a different mode of transport and off they go to another destination where they are unloaded, stacked in one form or another and then in a given period of time simply reappear back at the start point. My layout is quite large so the magic trick works quite well as long as you don't sit and dwell on that element until the magic takes place. In my last message I did refer to this as my feeble attempt with Lua. That was not a strictly accurate description of the actual Lua instruction which was kindly given to me by another extremely knowledgeable member who's technical abilities I can currently only dream about. The feeble part is my interpretation of the application into my layout. Now that I've set that record straight I can return to a more peaceful state of mind!!! Good luck with your endeavours.
Empfohlene Beiträge
Erstelle ein Benutzerkonto oder melde dich an, um zu kommentieren
Du musst ein Benutzerkonto besitzen, um einen Kommentar verfassen zu können
Benutzerkonto erstellen
Neues Benutzerkonto für unsere Community erstellen.
Neues Benutzerkonto erstellenAnmelden
Du hast bereits ein Benutzerkonto? Melde dich hier an.
Jetzt anmelden