Ok Sup Forums, literally every morning when going to work the elevator in my apartment behaves retarded. How hard is it to write a freaking elevator software? It's literally just a queue.
Your building has 20 floors and 2 elevator shafts with 1 operational elevator in each shaft. Write the software in your favorite language!
>favorite language Elevators are almost exclusively "written" in low level languages / assembly
Zachary Hughes
inb4 JS elevator software
Jaxon Perez
while True goto floor 50
Carter Thompson
then do it!
Justin Harris
>Software for elevators Whats even the point? You can build it using sequential circuits
Nathan Rodriguez
can you imagine, your elevator failing cause some arsetwat ruined a npm package which finds the first element in an array? a sign of times.
Juan Lopez
>literally just a queue Scheduling elevators is an NP-hard problem. [1]
[1] Group Elevator Scheduling with Advanced Traffic Information for Normal Operations and Coordinated Emergency Evacuation,” Proceedings of IEEE International Conference on Robotics and Automation, pp. 1419-1424, Apr. 2005.
Brandon Lewis
I would suggest an elevator in my house runs that if it wasn't from 70s or something.
Austin Ward
1: when there's no floors called, go to the main floor (usually the ground floor), as that's where new people are most likely to arrive 2: when you're going up, keep going up as long as there's a higher floor that you need to go to 3: when going down, keep going down as long as there's a lower floor that you need to go to
There, that's the best elevator algorithm, barring statistical analysis of traffic flow.
Bentley Rivera
>when there's no floors called, go to the main floor (usually the ground floor), as that's where new people are most likely to arrive 5:00 PM Everyone wants to go home Time wasted because elevator is at ground floor Algorithm fail
Michael Nelson
think it would be better if the 'main' floor would be somewhere in the middle, such that arriving people at groundfloor and people in their apartments have approx. the same waiting time.
Mason Price
>barring statistical analysis of traffic flow It would be trivial to change the "rest" floor (step 1) to a different one depending on the time of day For example there's no way having a midway rest floor is the best in the evening when everyone is coming home, but it could be good in the mornings. This is in the case of a place where people live, a workplace would be the opposite.
Gavin Ward
hmm...
public class elevator{
public static final maxFloor = 20;
public static void main(String[] args){ int[] queue = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; while(true){ Elevator e = new Elevator(); int currentHour = new SimpleDateFormat("HH").format(new Date()); e.setPosition(waitingfloor(currentHour)); for(int f in queue){ if(f==1){ e.setPosition(f); queue[f] = 0; } } } }
public static int waitingfloor(int hour){ int waitingFloor = null; if(hour>0 && hour15 && hour
David Carter
>int[] queue = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; Koder detected
Lucas Gonzalez
Modern elevator controllers are CPU / microprocessor based (newer Otis, all Kone), but the older ones are relay logic
Involves more C/C++ than ASM, and you'd be surprised about the non critical bits. Otis use python for management software
>Everyone wants to go home >on a single elevator >because they won't be waiting on the previous fucks who took it
Liam James
exit() elevator's broken today, my job here is done.
Joseph Murphy
>elevator >software Jokes on you, it's hard-wired logic.
Jason Gray
Silly boy, it's not the 1980s anymore.
Now you'll find a CPU, a RTOS and often Linux when it comes to elevator control
Kayden Torres
kek
Samuel Evans
>you'd be surprised about the non critical bits. Otis use python for management software Well, now I can.
David Hill
No, it's gonna be hard-wired logic
Zachary White
use the override code for your elevator or get a knockoff emergency services key from e-bay
Angel Morgan
Pajeet, there's literally a Queue in the JDK
Eli Stewart
>implying autistic NEETs are useless Given enough autism, we are the swiss army knife kind of people. There, here's your elevator pseudo-code, it controls one elevator with 5 floors and uses two magnetic strips to indicate if it's in range for a landing. It also has no memory and no smooth frequency modulation, desu. Just don't blame me when everyone's angry at your shit, it's your fault for asking Sup Forums out of all places for code for an elevator. Struct { Int Pos Bool Parked
Volatile Bool DoorInterlock Volatile Bool RangeUp Volatile Bool RangeDown Volatile Bool Direction Volatile Bool StopBtn } Car
Function Stop: Make the motor stop unconditionally Immediate return
Function SwitchToSlow Make the motor operate at a lower frequency to reduce the car speed Immediate return after setting
Function SwitchToNormal Make the motor operate at the normal frequency for normal car speed Immediate return after setting
Function SendUp: SwitchToNormal Make the motor start to pull the car up Car Direction := 1 Immediate return after starting
Function SendDown: SwitchToNormal Make the motor start to move the car down Car Direction := 0 Immediate return after starting
Function SendUpSlow (ReturnAtShaftTop) SwitchToSlow SendUp If ReturnAtShaftTop: /* Hardware interface to know when the car hits the shaft top */ Return Else: Immediate return
Function SendDownSlow (ReturnAtShaftBottom) SwitchToSlow SendDown If ReturnAtShaftBottom: /* Hardware interface to know when the car hits the shaft spring */ Return Else: Immediate return
Function CloseDoors Make the door motors start to close them Return after the expected amount of time to close the doors
Function OpenDoors Make the door motors start to open them Return after the expected amount of time to open the doors
Function GetCall MyCall := -1 for i := 4 to 0 If HARDWARE_INTERFACE_CALL_BUTTONS_OR_CAR_BUTTONS[i]: MyCall := i Return MyCall Too long...
Bentley White
Main: Int Call Bool PrevRange Int Tries
/* Initialization process * We make sure the elevator is at the first floor but we don't know its * position, so we send it to the bottom of the shaft and when it hits the * spring, it should stop. After that, we send it to the first floor. */
SendDownSlow (Yes) Car Pos := -1 Call := 0 SendUpSlow (No) Car Parked := No PrevRange := No
/* The Main Loop */ /* If someone pushes the stop button or tries to open the door, we stop. */ /* When the car is parked, it must be at a floor. So we do the following: * If there isn't a call, check the call buttons to see if there is a call; * We try 5 times to close the doors, and if we can close it, it goes. * Otherwise, the call is cancelled and the doors open. */ /* If not parked, and it starts passing a magnetic strip, we change the * current floor accordingly. If it's our call's floor, we prepare to land. * If we don't have contact with the strips, we make sure to note that. * If this is our call's floor and we see both strips, we land. */
While true: If Car StopBtn or (DoorInterlock nor Car Parked): Stop Car Parked := Yes PrevRange := No Call := -1 OpenDoors
If Car Parked: If Call = -1: Call := GetCall Tries := 0 If Tries < 5: If Call != -1 and Call != Car Pos: CloseDoors If Car DoorInterlock: If Car Pos < Call: SendUp Else: SendDown Else: OpenDoors Tries + 1 Else: Call = -1 Else: Call = -1 Else:
If not PrevRange and Car RangeUp or Car RangeDown: PrevRange := Yes If Car Direction: Car Pos + 1 Else Car Pos - 1 If Car Pos = Call: SwitchToSlow
If Car RangeUp nand Car RangeDown: PrevRange := No
If Car Pos = Call and Car RangeUp and Car RangeDown: Stop Car Parked := Yes PrevRange := No Call := -1 OpenDoors
I watched that shit awhile back, homie. Are we autistic for watching a video about elevators? Wtf. When did I get like this.
Wyatt Richardson
if(hour>0 && hour15 && hour
Jose Turner
Yeah but elevators man.
Jeremiah Nguyen
i have used one where you had to press the button multiple times sometimes but it does register the press on first attempt too because a sound comes from it but nothing happens before its pressed again.
Jason Roberts
divide by zero after 19
Brandon Wood
Usually not assembly, but C of some sort.
And software is not quite necessary, you can make elevator (or lift) to work on simple relay circuits, with the same safety.
Nathan Taylor
but its cool to make things as complex as possible now. it needs to run a full os and a managing program written in a meme language.
Juan Williams
No, micro controller and two IGBT drivers are way cheaper, than bunch of relays and big copper transformer for it. And more reliable, because relays have tendency to stuck and so on. Also they have regen of some sort. And much softer start of cabin...
Julian James
sooooo... your professor gave you an assignment and you came here to get us to do your homework? you're gonna fail, man. 2 reasons: 1. you aren't learning anything when you use us as your unpaid interns 2. chances are excellent that your prof comes here. at the very least, he/she uses cheating software like YAP or SafeAssign. you will be caught but hey, good attempt.
Leo Phillips
How exactly do they debug elevator software? What's the setup like?
Benjamin Morales
try out all the possible combinations if its wrong reflash it and try it again
Jayden Edwards
Best one I've seen there was a control panel on each floor. You selected the floor you were going to and it optimized Minimal time between the lifts, was a government building with 4 lifts
Jose Cooper
This is a tower designed for testing lifts
Matthew Morgan
You can abuse these by selecting the same floor over and over, the elevator thinks there's a lot of people waiting and moves you up the queue
William Miller
movlw elevator movwf targetfloor loop:goto loop end
Jack Thomas
Literally anyone didn't thought the following: A person in the 5th. floor call elevator and there are 3 cabins. So, the first one is going top. The second one is going bottom but you call the elevator while going 3rd. floor. The 3rd. one just never come.
The algorhithm won't work with that situation when it's repeated at least 3 times.
Charles Robinson
>Elevator goes up, after five floors is full >Elevator keeps going up, stopping at another 10 floors, opening the door, waiting for no-one to get in because they can't fit, closing door >Finally goes back down, does this all again >Gets to bottom, lets 10 people out >Starts again, another 20 minutes pass >Never lets anyone on the top floors out
Owen James
imagine how big the tower designed to test lift testing towers is.
Owen Peterson
...
Justin Allen
They just model it in software.
Cameron Green
elevators should have a close door button. lots of time is wasted waiting for the door closing timer.
Landon Rogers
I guess you could say it runs on bare metal :^)
Charles Reyes
I work for a elevator company. AMA
Hunter Lopez
This is a real problem in some busy malls that have bad escalators or just very many floors
Caleb Flores
I don't think the elevator should be moving unless there is someone waiting for it. Otherwise it might have to change direction all of a sudden that makes the whole build more complex.
Juan Wright
I would think critical safety stuff would still be plc controlled, no? Ladder logic...
Jayden Brooks
Elevators don't have software dumbasses, they don't even have memory. I work fixing elevators.
Anthony Reyes
you made me laugh
Connor Wood
>>It's literally just a queue. but it's not just a queue user, it's real physical hardware weighing a ton or more that could cause injury or death if it doesn't operate properly. Pic related, if you don't control higher order derivatives of acceleration you'll make people uncomfortable and decrease the life of expensive elevator hardware.
Jose Richardson
Why the fuck did I just watch this whole thing
Christian Scott
I should have posted this one, really. It's the same talk, except they had two hours to deliver it instead of one. It’s basically the same but with more detail. youtube.com/watch?v=ZUvGfuLlZus
Lincoln Long
Same here. Was interesting. And quite fun.
Julian Miller
I watched that a while ago. Pretty interesting and gives some good insight into how elevators work and why they take paths they do.
OP just thinks his elevator is acting retarded because he doesn't understand it. The problem is that his ego has placed things he doesn't understand as inferior to him.
Christopher Rodriguez
That's assuming that elevator is installed in an office building. If it is installed in an apartment building then the elevator being on the ground floor at 5pm is a bonus.
Caleb Carter
>Otherwise it might have to change direction all of a sudden that makes the whole build more complex. A moving elevator won't change direction.
Assuming there is more than one elevator, one of the other elevators will start moving when the call is issued. If there is only one elevator, then it will get to the home floor, open, wait a little, close and go back up to the call floor.
But that is assuming that algorithm is in use. It wouldn't be the best algorithm in all cases but it may be in some cases.
Brandon Parker
If you are working in automation the language of industrial controllers is often ladder diagrams, logical operations in the form of electrical contacts wired to coils, or some form of boolean assembly. Sometimes it's sequencial flow charts which are really close to state machines. The resulting program run in an infinite loop or at fixed time. It's intervals. often interpreted languages now but it have been specialized hardware at one time. Even with that, users notice of omron brand controllers have a disclaimer saying that it should not used in nuclear power plants or othe safety critical systems. You'd have to seriously debug your Arduino's state machine to carry people
Xavier Walker
That makes three hours of their elevator talk I have watched now.