#garfield Logs
Jan 28 2012
#garfield Calendar
17:14 rue_mohr I'll take that as a yes
17:14 rue_mohr I see fragments of a few state machines here
17:14 mortenmj ok. what do you have in mind?
17:15 rue_mohr well, one of the things I'm thinking now is about when the inputs have to be sampled
17:16 rue_mohr it seems you have to always be watching them
17:16 mortenmj yes, it seems that way
17:16 mortenmj on a µC i would attach them to ISRs, but that's not possible here
17:17 rue_mohr polling would be ok
17:17 mortenmj yea
17:17 mortenmj it's the only solution as far as i can see
17:17 rue_mohr so you would have a main event loop to poll inputs and check the state machine against them
17:17 rue_mohr while(1) { inputPoll(); updateMachine(); }
17:17 mortenmj agreed
17:18 rue_mohr gathering the inputs is easy
17:18 mortenmj the lab setup comes with an IO library, so that's all sorted
17:18 rue_mohr updateMachine can start by looking at the obstruction sensor, if its set, force a motor stop and return
17:20 rue_mohr I think the next major difference in the execution is if your in an idle mode or not
17:21 rue_mohr so the Schlitten ist idle, going up, or going down (in general, ignoring stopping at floors for loading/unlaoding)
17:21 mortenmj yes
17:22 rue_mohr thats a small state machine there
17:22 mortenmj those are the states of the motor, yea
17:22 rue_mohr ok
17:23 rue_mohr no,
17:23 mortenmj at least the way i think of it
17:23 mortenmj no?
17:23 rue_mohr the motor may be stopped while the carrige is going down because its loading or unloading people
17:23 mortenmj that's true
17:23 mortenmj so it's the state of the car itself
17:23 rue_mohr yes
17:24 mortenmj the door can be open or closed. should that be a small machine?
17:24 rue_mohr when the car is going down it will go thru states of stopping, open, wait, close on floors it needs to
17:24 rue_mohr hmm
17:24 mortenmj it can, in the real world, also be opening and closing, but here the transition between open and closed is instantaneous
17:25 rue_mohr how about this
17:26 rue_mohr carIdle, carPauseUp, carPauseDown, carUp, carDown, carOpenWait
17:26 mortenmj makes sense
17:26 rue_mohr idle goes to up or down
17:27 rue_mohr up or down go to themself, also pauseUp, pauseDown,
17:27 rue_mohr pauseup/down go to openwait
17:28 rue_mohr openwait returns to carUp, CarDown, or idle depending on entry state
17:29 mortenmj when does carUp and carDown loop to themselves?
17:29 rue_mohr when still going up or down
17:29 rue_mohr Ich brauche eine neue Zahnb?rste ich einen habe ich gegessen habe
17:29 rue_mohr brb
17:30 rue_mohr much better
17:30 mortenmj uh, you need a new toothbrush? okay...
17:31 rue_mohr the reason that up and down go to themselfs is so that if you get to a floor you do not need to stop on, you dont have to
17:32 mortenmj i agree
17:32 rue_mohr in the main loop, the state machine should only be re-evaluated if the inputs have changed
17:32 rue_mohr mortenmj, does that draw as a diagram ok?
17:32 mortenmj yes
17:33 rue_mohr the elevator floor indicators are a seperate state machine
17:33 rue_mohr every time a floor switch is triggered, it causes the light for that floor to be on
17:34 rue_mohr that can just be coded tho
17:34 rue_mohr !time
17:34 tobbor My watch says its 15:30 Sat Jan 28 2012
17:35 mortenmj rue_mohr: http://i.imgur.com/7pZ7Z.jpg
17:36 rue_mohr the lobby request buttons can be seperate state machines, where the botton causes the light to latch on, and the floor switch, combined with the cars direction, clear the indicator
17:37 rue_mohr ok, you need to draw in what input events cause which state changes
17:38 mortenmj this is wrong though. what i've drawn
17:38 mortenmj you can't go from carUp to carOpen
17:38 mortenmj i need to swap carUp with carPauseUp and carDown with carPauseDown
17:39 mortenmj you go straight from idle to a moving state, then to a paused state, and then to the doors being open
17:39 rue_mohr you ahve to pause before you open
17:40 rue_mohr my thought was that you pause at the floor and open the doors, wait, (close) and continue
17:40 mortenmj yes
17:41 mortenmj opening the doors would be part of the transition from carPauseUp/Down to carOpen
17:41 mortenmj then you would stay in carOpen for at least 3 seconds before moving on if applicable
17:41 mortenmj well, you would stay in carOpen for 3 seconds, then go to carIdle (which involves closing the doors), and in carIdle you would see if there's anywhere you need to go
17:42 mortenmj the spec says to leave the doors open for 3 seconds when you stop at a floor that's been requested
17:43 mortenmj but wait. when we're stopped at a floor (carPause*) we know from our state which direction we're gonna continue in. that isn't stored in carOpen
17:43 rue_mohr I had opening the doors as part of pause
17:44 mortenmj part of the transition to pause?
17:45 rue_mohr Bitte warten
17:48 mortenmj k
17:49 rue_mohr !assist images
17:49 tobbor Possibly http://eds.dyndns.org/~ircjunk/images
17:49 rue_mohr http://eds.dyndns.org/~ircjunk/images/elevstate.jpg
17:50 mortenmj that works
17:50 rue_mohr oh there is an error, if the car is idle and a request is made for the floor its on, it goes direct to an open and wait
17:52 mortenmj if someone is inside and selects the current floor? i think going through the open cycle makes sense in that case
17:52 mortenmj i.e. we check if we should move up or down to get there, see that we're already there, skip past those and go straight to opening the doors
17:52 rue_mohr or if its on the floor and the lobby button is pressed
17:52 mortenmj looping back through idle could involve opening the doors
17:53 mortenmj back to*
17:53 rue_mohr mein Radiergummi ist auf Feuer
17:54 mortenmj your eraser is burning?
17:55 rue_mohr :)
17:56 mortenmj where are you from? you said you were UTC-8 which puts you on the US west coast, right? but you keep saying silly stuff in german
17:56 rue_mohr I'm in BC canada
17:57 mortenmj i hear the scenery is lovely
17:57 rue_mohr they say its the best
17:57 rue_mohr I'v always lived here, I dont know
17:58 rue_mohr http://eds.dyndns.org/~ircjunk/images/dscn4946_redsky.jpg
17:58 rue_mohr http://eds.dyndns.org/~ircjunk/images/dscn7634_snow.jpg
17:59 mortenmj i was thinking more http://latos.net/canada/images/PynaCaribooMountainsBritishColumbia.jpg
17:59 rue_mohr http://eds.dyndns.org/~ircjunk/images/p1010625_deer.jpg
18:00 rue_mohr yea we have places here that look like that too
18:01 mortenmj that's a beautiful deer
18:01 mortenmj do you hunt?
18:01 rue_mohr just with my camera
18:02 mortenmj i don't hunt big game. just birds
18:02 mortenmj so, we happy with the car's state machine?
18:02 rue_mohr http://www.justanimal.org/images/emu-12.jpg ?
18:03 rue_mohr I have to re-photograph my image
18:03 mortenmj http://upload.wikimedia.org/wikipedia/commons/1/1f/Rock_Ptarmigan_%28Lagopus_Muta%29.jpg
18:04 rue_mohr ah
18:05 mortenmj so where do we go from here?
18:05 rue_mohr I hve new diagram
18:06 rue_mohr http://eds.dyndns.org/~ircjunk/images/elevstate2.jpg
18:07 rue_mohr but that machine alone does not remmeber if its going up or down
18:08 rue_mohr do not stop happens on arrival of a new floor
18:08 mortenmj well, in that case we need to store that information in memory, which means that up and down can both be combined to a single state
18:08 mortenmj isn't it better to have upOpen and downOpen?
18:08 mortenmj so that direction is stored in the state machine?
18:08 rue_mohr the lines from open wait to up or down could also just depend on the state of a variable
18:09 rue_mohr you can, but then you need an open that can happen from idle
18:09 rue_mohr and a wait to go with it
18:09 mortenmj that's true. that's not good
18:09 rue_mohr it dosn't matter much, I'm running out of eraser
18:09 mortenmj i just think that if you're gonna store direction in memory, then you can make a state "moving" that replaces both "up" and "down"
18:10 mortenmj which is fine, really
18:10 mortenmj what do you think?
18:10 rue_mohr yes, thats fine
18:10 rue_mohr Ihave to leave in a half hour, do you want to meet after sleep?
18:10 mortenmj sure
18:11 mortenmj when does your machine go from pause to openWait?
18:12 rue_mohr almost immediate
18:12 mortenmj so why are they two states?
18:12 rue_mohr its there cause its triggered by a different event
18:12 mortenmj i'm not following
18:12 mortenmj what triggers the move from pause to openWait?
18:13 rue_mohr openwait dosn't finish untill the timer finishes
18:13 mortenmj i don't follow
18:13 mortenmj the only way to openWait is through pause. why is openWait needed?
18:13 rue_mohr the transistion from up/down pause is triggered by arrival at a floor
18:14 mortenmj ah, i get it
18:14 rue_mohr probably also becuase I cant shake the idea of I limit switch on the door
18:14 mortenmj you go from moving to pause and then you go to openWait and stay there for n seconds before moving on or going to idle
18:14 rue_mohr yes
18:15 mortenmj it's not strictly necessary i think
18:15 mortenmj but i don't mind it
18:15 rue_mohr becuase the door is instantanious in your elevator you may consider one of them a sudostate
18:15 mortenmj right
18:15 mortenmj in a real setup you'd probably want a state for the door closing as well
18:15 mortenmj er, a transition for the door closing
18:16 mortenmj you obviously don't want to start until the door is properly closed
18:16 rue_mohr yes, there would be switches for the door fully open and fully closed
18:16 rue_mohr :) there is also a homing function thats triggered by the fire alarm
18:17 rue_mohr usually to let hte people out on the nearest floor if the fire detector immediatly outside the door is not triggered
18:17 mortenmj fire alarm should make it go to the lobby (first floor presumably), open the doors and shut down, yeah?
18:17 mortenmj oh, it would just go to the nearest floor (below)?
18:18 rue_mohr there are two fire floors defined, one is the backup incase the other is on fire
18:18 mortenmj ah
18:18 mortenmj and if both are on fire?
18:18 rue_mohr it also depends on the rules for the elevator at the location its intsalled in
18:19 rue_mohr I'v not been told about that one, but that would require two floors to be on fire at the same time
18:19 mortenmj which can easily happen
18:19 rue_mohr no, there would be a delay
18:19 mortenmj only if the fire alarm is working optimally
18:19 rue_mohr they trigger quite quickly
18:19 mortenmj i wouldn't bet anyone's life on it
18:20 rue_mohr in that case what do you do if all the floors are on fire :)
18:20 mortenmj i would probably do "go to the first fire floor, if that doesn' work go to the second fire floor, if that doesn't work go to the first floor no matter what"
18:20 rue_mohr lock them in? :)
18:21 mortenmj they can't sue if they're dead :p
18:21 mortenmj oh, wait. their families can
18:21 rue_mohr only movie elevators have cieling hatches, its too dangerous for people to go climbing in shafts
18:23 mortenmj oh, absolutely. i've never seen a ceiling hatch that wasn't at least screwed in quite securely
18:23 rue_mohr and the critical logic of an elevator must be relay operated.. here anyhow
18:24 rue_mohr they had to replace all the relays in the new recreational facility here, and I missed out on getting them
18:24 rue_mohr :(
18:24 rue_mohr but they were 48V, which isn't that usefull to me anyhow
18:26 mortenmj so, we're putting this on hold until tomorrow?
18:28 rue_mohr I do need to leave soon for a few hours
18:28 rue_mohr your will need sleep
18:28 mortenmj yeah
18:28 mortenmj and if i get up too late tomorrow i'll have a hard time come monday
18:29 mortenmj thank you for your help. see you tomorrow!