3 floor elevator

Hi to everyone!I want to build a 3 floor elevator simulation construction for a paper of mine.The plan is to be build like this.
pc->labview->modbus->rs232 converter->plc->elevator construction
I want to control the elevator from labview.Is there something wrong to the order?Do i miss something?Any information and links about same projects will be pracious,because it's the first time that i mess with all this stuff :-).Thank you all

Hi,
what you describe is a quite typical usecase. Here are some links that should help you to getting started with your Modbus communication:
Modbus LabVIEW Library
Creating Modbus I/O Servers (DSC Module)
Please note, that for the second option the LabVIEW DSC module is required.
I hope this helps,
Jochen Klier
National Instruments

Similar Messages

  • Help with creation of elevator simulator...

    I'm trying to create an elevator simulator but i'm having a problem making the elevator pause (for like 5secs) at the necessary floors to show the pick up & let off passengers ...
    Any suggestions on how to make it pause?
    I'm using: a timer to paint a graphic into a panel
    I'm not sure if any other information is needed... but if so just say & i'll post it.
    Thanks alot.

    TJacobs, that's an excellent idea, but I wonder when the number of threads goes up (and factor in the GUI event thread) whether those counts will still be accurate.
    I think another way to go would be to have one thread for all the elevators. Have it sleep at one second intervals. Then, have that thread wake up and iterate over each elevator. Each elevator class would sequentially evaluate its position. You would need to introduce an element of time into your elevator classes, having them calculate delta position or wait time in terms of one second units.
    Just a thought.
    - Saish

  • Ap elevator solution

    Can you explain me some technics of ap installing in elevator for skyscrapers
    do you install ap on every floor, or you installing it in elevator mine
    also if cisco has ap for internal installation with two antennas
    please give me some explanation

    Well in the states, many cities don't allow these equipment in the elevator shaft. I think the best solution is if the elevator company can run an Ethernet cable in the shaft (depending on length) and place an AP inside the car. I have seen APs mounted outside the elevator doors and depending on the door, your signal can be lost when the door closes. You also have to look at the roaming from switching access points, which can cause an unreliable solution.
    Other options is running a DAS in the elevator shaft. Speak with the elevator company to see what suggestions they have.
    Sent from Cisco Technical Support iPhone App

  • LR5.2 and Canon 6D gps elevation data

    Have you also noticed problem with the GPS elevation data?
    We sailed a ferry in North-West (US to Canada) and the GPS should better show the same elevation than: Its the waterline + elevation of the passenger deck.
    Instead, LR displays a different elevation with every image, ranging from +9 feet to... -300 feet, and trust me, we did not turned into a submarine
    LR issue or Canon issue? Does someone has more information about that?
    Thomas

    Use an online service to list the GPS data inside an actual photo and see if it matches what LR is showing you:  http://regex.info/exif.cgi
    And even if a camera’s photos don’t have altitude measurements encoded in them, and LR was hypothetically using a reverse-geocoding service to map GPS coordinates to an estimated altitude that the camera wasn’t supplying, this service would most likely be returning estimated sea-floor depths not water-surface measurements, right?
    I mean what would be more useful for a ship captain to know, that he is floating on the surface of the water with an altitude of 0 (ignoring any fluctuations from tides), or that the sea-floor is 10 meters below and he’s about to run aground?

  • WLAN deployment across 3 floors without cable

    I have a customer looking to install a wireless network across 3 floors with full coverage on each floor. 2 ssid's are needed one for guest use and one for their business use. The top floor is where the server and demarc is located. The top floor is very small in relative size to the lower 2 floors.
    It is a very old historic building and they refuse to run cable (drilling of holes...)
    They will need bandwidth to support 12 pos systems (varied throughout the building) running off of the server (terminal services). They will also need enough bandwidth for the guest ssid (internet use).
    Installing a lot of ap's as repeaters will reduce the available bandwidth. What options are available?

    Keep in mind, you'll need a solid site survey to back up any recommendations made.
    That being said, probably your best would be a dual radio AP, where the 802.11g/b radio is for client use, and the 802.11a radio would act as a wireless backbone.
    If you use a 1200 series, you'd want one AP (per floor) located in / near the stairway and/or elevator such that you can use it as a "raceway" for the 802.11a signal.
    Depending on the size and layout of the floor (wide open, partitioned, trees/flowers/hanging decorations), you can perhaps cover the area with ~2-3 APs (each set for a different 802.11g channel: 1, 6, or 11 preferred).
    You should stagger the AP channel assignments per floor such that the AP directly above or below is using a different channel.
    This is greatly simplified. More details would be helpful (like the square footage of the each floor, and the general layout, are there going to be any mobile clients, or all fixed location POS stations?).
    and, again, you must do a good site survey to find out how many APS would be needed. If you need more than three per floor, then it would probably be better to use the 802.11a radio for clients and the 802.11g radios for the "backbone" .... 802.11a has more channels, and none of them overlap.
    Good Luck
    Scott

  • Elevator Simulation using GUI... HELP!

    I need immediate help on how to make the elevator move from floor to floor... this is not using java applet... I'll paste the program that I have done so far... I don't know how to use timers and listeners in order to make the Elevator move.... Wat should I do...
    Here is my program:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    //The main class
    public class Elevator_Simulation extends JFrame
         public JLabel state; // display the state of the elevator
    private JLabel id; //your name and group
    public ButtonPanel control; //the button control panel
    private Elevator elevator; // the elevator area
    //constructor
         public Elevator_Simulation()
         // Create GUI
              setTitle("Elevator Simulation");
              getContentPane().add(new ButtonPanel(), BorderLayout.WEST);
              id = new JLabel(" Name: Abinaya Vasudevan Group:SE3");
              getContentPane().add(id, BorderLayout.NORTH);
    // Main method
    public static void main(String[] args)
         // Create a frame and display it
    Elevator_Simulation frame = new Elevator_Simulation();
    frame.setSize(800,800);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              frame.getContentPane().add(new Elevator(frame));          
              //Get the dimension of the screen
              Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
              int screenWidth = screenSize.width;
              int screenHeight = screenSize.height;
              int x = (screenWidth - frame.getWidth())/2;
              int y = (screenHeight - frame.getHeight())/2;
              frame.setLocation(x,y);
              frame.setVisible(true);
    } //the end of Elevator_Simulation class
    //The ButtonPanel class receives and handles button pressing events
    class ButtonPanel extends JPanel implements ActionListener
         public JButton b[] = new JButton[8]; // 8 Buttons
    public boolean bp[] = new boolean[8]; // the state of each button, pressed or not
    //constructor
    public ButtonPanel()
         //create GUI
              setLayout(new GridLayout(8,1));
              for (int i=1; i<=8; i++)
                   b[8-i] = new JButton("F"+(8-(i-1)));
                   b[8-i].addActionListener(this);
                   add(b[8-i]);
    public void actionPerformed(ActionEvent e)
         //handle the button pressing events
              bp[8-((int)(e.getActionCommand().charAt(1)))] = true;
    } //the end of ButtonPanel class
    // The elevator class draws the elevator area and simulates elevator movement
    class Elevator extends JPanel implements ActionListener
         //Declaration of variables
    private Elevator_Simulation app; //the Elevator Simulation frame
    private boolean up; // the elevator is moving up or down
    private int width; // Elevator width
         private int height; // Elevator height
    private int xco;     // The x coordinate of the elevator's upper left corner
    private int yco; // The y coordinate of the elevator's upper left corner
    private int dy0; // Moving interval
    private int topy; //the y coordinate of the top level
    private int bottomy; // the y coordinate of the bottom level
    private Timer tm; //the timer to drive the elevator movement
    //other variables to be used ...
    //constructor
    public Elevator(Elevator_Simulation app)
         //necessary initialization
              tm = new Timer(1000, this);
              tm.setInitialDelay(300);
              tm.start();
    // Paint elevator area
    public void paintComponent(Graphics g)
              //obtain geometric values of components for drawing the elevator area
              xco = getWidth()/2-10;
              yco = getHeight()/2-20;
              width = 10;
              height = 20;
              //clear the painting canvas
              super.paintComponent(g);
    //start the Timer if not started elsewhere
              if(!tm.isRunning())
                   tm.start();
    //draw horizontal lines and the elevator
              g.setColor(Color.magenta);
              g.drawLine(0,0,getWidth(), 0);
              g.drawLine(0,93,getWidth(), 93);
              g.drawLine(0,186,getWidth(), 186);
              g.drawLine(0,279,getWidth(), 279);
              g.drawLine(0,372,getWidth(), 372);
              g.drawLine(0,465,getWidth(), 465);
              g.drawLine(0,558,getWidth(), 558);
              g.drawLine(0,651,getWidth(), 651);
              g.drawLine(0,744,getWidth(), 744);
              g.drawLine(0,837,getWidth(), 837);
              g.setColor(Color.black);
              g.fill3DRect(getWidth()/2 - 50, 93, 100, 93, true);
              g.setColor(Color.magenta);
              g.drawLine(getWidth()/2, 93, getWidth()/2, 186);     
    //Handle the timer events
    public void actionPerformed(ActionEvent e)
         //loop if the elevator needs to be stopped for a while
    //adjust Y coordinate to simulate elevetor movement
    //change moving direction when hits the top and bottom
    //repaint the panel
    //update the state of the elevator
    } //the end of Elevator class
    The skeleton was provided but I am still not sure how to do it... So pls help... asap....

    I've figured out the movement part... But why doesnt my variable state get set into the new String values? And how do I make it stop at the respective floors when the buttons are pressed?
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    //The main class
    public class Elevator_Simulation extends JFrame
         public JLabel state; // display the state of the elevator
       private JLabel id;  //your name and group
       public ButtonPanel control = new ButtonPanel(); //the button control panel
       private Elevator elevator; // the elevator area
       //constructor
         public Elevator_Simulation()
            // Create GUI
              setTitle("Elevator Simulation");
              getContentPane().add(control, BorderLayout.WEST);
              id = new JLabel("                                                                                      Name: Abinaya Vasudevan  Group:SE3");
              state = new JLabel("");
              getContentPane().add(state, BorderLayout.SOUTH);
              getContentPane().add(id, BorderLayout.NORTH);
       // Main method
       public static void main(String[] args)
            // Create a frame and display it
          Elevator_Simulation frame = new Elevator_Simulation();
          frame.setSize(800,800);
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              frame.getContentPane().add(new Elevator(frame));          
                //Get the dimension of the screen
              Dimension  screenSize = Toolkit.getDefaultToolkit().getScreenSize();
              int screenWidth = screenSize.width;
              int screenHeight = screenSize.height;
              int x = (screenWidth - frame.getWidth())/2;
              int y = (screenHeight - frame.getHeight())/2;
              frame.setLocation(x,y);
              frame.setVisible(true);       
    } //the end of Elevator_Simulation class
    //The ButtonPanel class receives and handles button pressing events
    class ButtonPanel extends JPanel implements ActionListener
         public JButton b[] = new JButton[8];  // 8 Buttons
       public boolean bp[] = new boolean[8]; // the state of each button, pressed or not
       //constructor
       public ButtonPanel()
            //create GUI
              setLayout(new GridLayout(8,1));
              for (int i=1; i<=8; i++)
                   b[8-i] = new JButton("F"+(8-(i-1)));
                   b[8-i].addActionListener(this);
                   add(b[8-i]);
              for(int j=0; j<=7; j++)
                   bp[j] = false;
       public void actionPerformed(ActionEvent e)
            int buttonNumber = Integer.parseInt(String.valueOf(e.getActionCommand().charAt(1)));
              bp[8 - buttonNumber] = true;
    } //the end of ButtonPanel class
    // The elevator class draws the elevator area and simulates elevator movement
    class Elevator extends JPanel implements ActionListener
         //Declaration of variables
       private Elevator_Simulation app; //the Elevator Simulation frame
       private boolean up; // the elevator is moving up or down
       private int width;  // Elevator width
         private int height; // Elevator height
       private int xco;     // The x coordinate of the elevator's upper left corner
       private int yco; // The y coordinate of the elevator's upper left corner
       private int dy0; // Moving interval
       private int topy; //the y coordinate of the top level
       private int bottomy; // the y coordinate of the bottom level
       private Timer tm; //the timer to drive the elevator movement
         private int offset;
         private ButtonPanel button;
       //other variables to be used ...
       //constructor
       public Elevator(Elevator_Simulation app)
            //necessary initialization
              tm = new Timer(0, this);
              tm.start();
              up = true;
              offset = 0;
       // Paint elevator area
       public void paintComponent(Graphics g)
              //obtain geometric values of components for drawing the elevator area
              width = getWidth()/8;
              height = getHeight()/8;
              xco = getWidth()/2 -50;
              yco = (height * 7) + offset;
              topy = 0;
              bottomy = height * 7;
              //clear the painting canvas
              super.paintComponent(g);
          //start the Timer if not started elsewhere
              if(!tm.isRunning())
                   tm.start();
          //draw horizontal lines and the elevator
              g.setColor(Color.magenta);
              g.drawLine(0,0,getWidth(), 0);
              g.drawLine(0,height,getWidth(), height);
              g.drawLine(0,(height*2),getWidth(), (height*2));
              g.drawLine(0,(height*3),getWidth(), (height*3));
              g.drawLine(0,(height*4),getWidth(), (height*4));
              g.drawLine(0,(height*5),getWidth(), (height*5));
              g.drawLine(0,(height*6),getWidth(), (height*6));
              g.drawLine(0,(height*7),getWidth(), (height*7));
              g.drawLine(0,(height*8),getWidth(), (height*8));
              g.setColor(Color.black);
              g.fill3DRect(xco, yco, width, height, true);
              g.setColor(Color.magenta);
              g.drawLine(xco+(width/2), yco, xco+(width/2), (yco+height));
       //Handle the timer events
       public void actionPerformed(ActionEvent e)
            //loop if the elevator needs to be stopped for a while
              //adjust Y coordinate to simulate elevetor movement
          //change moving direction when hits the top and bottom
          //repaint the panel
          //update the state of the elevator
              if(up && yco > topy)
                   offset--;
              if(!up && yco < bottomy)
                   offset++;
              if(yco == topy)
                   up = false;
                   app.state.setText("The elevator is going down");
              if(yco == bottomy)
                   up = true;
                   app.state.setText("The elevator is going up");
              repaint();          
    } //the end of Elevator class

  • Kinect loses track of bodies when rotated in pitch/elevation

    I have an application where I am using a Kinect v2 to track people. The Kinect is mounted to a gimbal that is then moved to point at the body joint the Kinect is tracking. This seems to work just fine when the Kinect is moved in yaw/azimuth (rotated about
    its y-axis), however the Kinect seems to have issues when it is moved in pitch/elevation (rotated about its x-axis). The body tracking loses track of all bodies, causing the gimbal to stop, and after a second or two it will reacquire the people in view. With
    smaller motions or very slow motions, the Kinect is less likely to lose track, but it is still very sensitive. The track loss seems to be correlated with a change in what the Kinect views as the floor plane (it can happen regardless of whether or not the Kinect
    can see the floor).
    Is this a fundamental limitation of the Kinect body tracking? Is there anything that can be done to make the body tracking less sensitive to pitch changes or floor plane changes? I understand that having the Kinect itself move is not exactly a normal
    use-case for it.

    Body tracking is only supported when the sensor is orientated horizontally with the ground/floor plane. We do not support any other sensor orientation by design. Optimal sensor configuration is 6 feet from the floor with the sensor tilted down with
    unobstructed view of the floor(no IR shadow casting because of object edges). The sensor must see the users head and both shoulders to acquire a hard lock-on.
    If you need other tracking abilities you may need to revert to blob detections of your own tracking system.
    Carmine Sirignano - MSFT

  • How to make a vertical lift or elevator in a platform game

    I am creating a side scrolling platform game using the book "Flash Game University" by Gary Rosenzweig.
    My protagonist has an instance of "hero".
    My current issue is trying to create a lift or elevator to carry the player up or down. The lift is not covered in the book. My thoughts were that the lift constantly moved up and down at a pace determined by a timer. I cannot get my lift to move. I have created a movie clip called "lift" and made it exported for action script. I can make it act similar to a floor movie clip so that I can stand on it, but I cannot get the lift to move on the y axis.
    I tried creating a new function called lift() and using a for loop to count between 0 and 100 using a variable "i" and then make my lift move up 1 unit for each loopcycle. It didn't work.
    lift.y -= lift.y - 1;
    Does anyone have a better solution?
    Thanks,
    Alex

    Rob,
    This worked. Here is my current code ...
    var topIndex:Number = 20;
                        var bottomIndex:Number = 160;
                        var stepDistance:Number = 10;
                        var movingUp:Boolean = true;
    public function createLift()
                                            box = new Object();
                                            box.mc = gamelevel.box;
    public function moveMyLift():void
                                            // lift 01
                                            if (movingUp && box.mc.y > topIndex)
                                                      box.mc.y -= stepDistance;
                                            else
                                                      movingUp = false;
                                              if (!movingUp && box.mc.y < bottomIndex)
                                                      box.mc.y += stepDistance;
                                            else
                                                      movingUp = true;
                                            if (hero.mc.hitTestObject(box.mc))
                                                      hero.mc.y = box.mc.y;
    My lift works correctly. It moves up and down correctly and when I jump on it I stay moving on it. There are only 3 things that don't make sense.
    1. When I am on the elevator I cannot jump. If I am not on the elevator I can jump normally.
    2. When I touch any portion of the elevator, my character automatically repositions itself to stand on the elevator. It seems normal, but not something that should happen in my scenario. I only want to "climb" on the elevator if I touch the "top" of the elevator.
    3. If I add a second elevator, even with its own function, the timing of the elevator math appears to synch instead of work independently. Why? The two elevators synch their movement and timing. Also the first elevator stutters as the synching of the two elevators match thier movement and then moves in unison with the second elevator. Why are they not operating separately?
    Here is the code for the first and second elevator:
    private var box:Object;
    private var box02:Object;
    var topIndex:Number = 20;
    var bottomIndex:Number = 160;
    var stepDistance:Number = 10;
    var movingUp:Boolean = true;
    var topIndexLift02:Number = 1;
                        var bottomIndexLift02:Number = 100;
                        var stepDistanceLift02:Number = 4;
    public function createLift()
                                            box = new Object();
                                            box.mc = gamelevel.box;
                                            box02 = new Object();
                                            box02.mc = gamelevel.box02;
    public function moveMyLift():void
                                            // lift 01
                                            if (movingUp && box.mc.y > topIndex)
                                                      box.mc.y -= stepDistance;
                                            else
                                                      movingUp = false;
                                              if (!movingUp && box.mc.y < bottomIndex)
                                                      box.mc.y += stepDistance;
                                            else
                                                      movingUp = true;
                                            if (hero.mc.hitTestObject(box.mc))
                                                      hero.mc.y = box.mc.y;
                                  public function moveMyLift02():void
                                            // lift02
                                            if (movingUp && box02.mc.y > topIndexLift02)
                                                      box02.mc.y -= stepDistanceLift02;
                                            else
                                                      movingUp = false;
                                              if (!movingUp && box02.mc.y < bottomIndexLift02)
                                                      box02.mc.y += stepDistanceLift02;
                                            else
                                                      movingUp = true;
                                            if (hero.mc.hitTestObject(box02.mc))
                                                      hero.mc.y = box02.mc.y;
    public function gameLoop(event:Event)
                                            // get time difference
                                            if (lastTime == 0) lastTime = getTimer();
                                            var timeDiff:int = getTimer() - lastTime;
                                            lastTime += timeDiff;
                                            // only perform tasks if in play mode
                                            if (gameMode == "play")
                                                      moveCharacter(hero,timeDiff);
                                                      moveEnemies(timeDiff);
                                                      checkCollisions();
                                                      scrollWithHero();
                                                      createLift();
                                                      moveMyLift();
      moveMyLift02();
    Thank you,
    Alex
    Message was edited by: ajdove

  • Elevator SCADA System

    I'm half way with my Elevator SCADA System on the LabView 8.0, and I need some technical support to make it to the perfection. This system is to control and indicate the situation of Elevator in the building. If the Down Button on the 2nd floor and 3rd floor was pressed in the same time during the Elevator was on the 1st floor, the Elevator will go to the 2nd floor first and then 3rd floor. How to let the Elevator go to the 3rd floor first and then only 2nd floor since they are on the same down direction? 
    Anyone have an idea on perfection of controling and indicating an Elevator. 
    I appreciate your kindness. 
    Good Luck!!!

    First, if you have the DSC module, you should already have an example for how to control elevators in the example finder (Help>>Find Examples).
    Second, if you want help, you should post your code and explain exactly what you want. I don't have 8.0, so I can't help you, but I'm sure someone else will be able to.
    Try to take over the world!

  • AP1131 - how to determine "elevation" for location server?

    I have some AP1131's. These have internal omni-directional antennas, so they are just square boxes with a plastic cover on the top and a mounting bracket on the bottom. I think they are supposed to be mounted upside-down on the ceiling (horizontally), but I'm not sure.
    Mine are mounted in the ceiling, but vertically, so the top cover is pointing towards a certain area of the building instead of the floor.
    So I'm trying to figure out how to set the "elevation" in the location server maps. I read that 0 degrees means the top cover of the AP points to the right (east), and 180 means it points to the left (west), and 90 degrees means it points down toward the floor. So I think I need to set mine up as 0 degrees or 180 degrees, but how do I tell it that it's pointing north or south?

    Check the two following documents:
    http://www.cisco.com/en/US/docs/wireless/wcs/5.0/configuration/guide/wcsmaps.html#wpmkr1129876
    - The antenna angle is relative to the map's X axis. Because the origin of the X (horizontal) and Y (vertical) axes is in the upper left corner of the map, 0 degrees points side A of the access point to the right, 90 degrees points side A down, 180 degrees points side A to the left, and so on.
    - The antenna elevation is used to move the antenna vertically, up or down, to a maximum of 90 degrees.
    AP configuration antennas
    HTH

  • Simple Elevator Simulator

    Hello all. I am trying to create a simple elevator simulator that uses up and down buttons to call the elevator and floor buttons to choose the desired floor. The goal is to display the current floor the elevator is on using LEDs and using a delay with the LEDs to simulate movement. Currently, I am trying to use a queue based state machine to do this. I have tried looking for the "Multiple Notifiers - elevator example" in the example finder and my version of LabVIEW doesn't have that apperently, but I doubt that will help anyways since I'm using queues. Are there any good examples or concepts out there that can help me out? I appreciate the help.

    Apparently that llb did not make the cut for inclusion in the 2013 shipping examples
    the attachment is a zipped version of the llb from 2012
    Jeff
    Attachments:
    notifier.zip ‏101 KB

  • Elevator Gui

    Hi guys. Can anyone help me with this. I cant seems to get my elevator working. I jus want it to get it moving only thats all. For now at least.
    Here is my code.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    //The main class
    public class Elevator_Simulation extends JFrame{
      public JLabel state; // display the state of the elevator
      private JLabel id;  //your name and group
      public ButtonPanel control= new ButtonPanel(); //the button control panel
      private Elevator elevator; // the elevator area
      private static final String myProperty = "Name: XXX Group: XXX";
      //constructor
      public Elevator_Simulation()
      // Create GUI
           setTitle("Elevator_Simulation");
           Container container = getContentPane();
      // Centralise my name & group
           id = new JLabel(myProperty);
           JPanel idPanel = new JPanel();
           idPanel.add(id);
           getContentPane().add(idPanel, BorderLayout.NORTH);
      // Add ButtonPanel
           JPanel buttonPanel=new JPanel();
           buttonPanel.add(control);
           getContentPane().add(control, BorderLayout.WEST);
      // Add state
           state=new JLabel("Up/Down");
           JPanel statePanel = new JPanel();
           statePanel.add(state);
           getContentPane().add(statePanel, BorderLayout.SOUTH);
      /* Add elevator
           JPanel elevatorPanel= new JPanel();
           elevatorPanel.add(elevator);
           getContentPane().add(elevatorPanel, BorderLayout.CENTER);
      // Main method
      public static void main(String[] args) {
      // Create a frame and display it
           Elevator_Simulation frame = new Elevator_Simulation();
           frame.setSize(500,500);
           frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
           frame.getContentPane().add(new Elevator(frame));
      // GUI @ Middle Screen      
           Dimension  screenSize = Toolkit.getDefaultToolkit().getScreenSize();
              int screenWidth = screenSize.width;
              int screenHeight = screenSize.height;
              int x = (screenWidth - frame.getWidth())/2;
              int y = (screenHeight - frame.getHeight())/2;
              frame.setLocation(x,y);
              frame.setVisible(true);
    } //the end of Elevator_Simulation class
    //The ButtonPanel class receives and handles button pressing events
    class ButtonPanel extends JPanel implements ActionListener {
      public JButton b[] = new JButton[8];  // 8 Buttons
      public boolean bp[] = new boolean[8]; // the state of each button, pressed or not
      //constructor
      public ButtonPanel() {
      //create GUI
          setLayout(new GridLayout(8,1));
      // Create 8 Floor Buttons and register listeners
              for (int i=1; i<=8; i++)
                   b[8-i] = new JButton("F"+(8-(i-1)));
                   b[8-i].setBackground(Color.blue);
                   b[8-i].addActionListener(this);
                   add(b[8-i]);
      public void actionPerformed(ActionEvent e) {
      //handle the button pressing events
           Toolkit.getDefaultToolkit().beep();
    } //the end of ButtonPanel class
    // The elevator class draws the elevator area and simulates elevator movement
    class Elevator extends JPanel implements ActionListener{
      //Declaration of variables
      private Elevator_Simulation app; //the Elevator Simulation frame
      private boolean up; // the elevator is moving up or down
      private int width;  // Elevator width
      private int height; // Elevator height
      private int xco;     // The x coordinate of the elevator's upper left corner
      private int yco; // The y coordinate of the elevator's upper left corner
      private int dy0; // Moving interval
      private int topy; //the y coordinate of the top level
      private int bottomy; // the y coordinate of the bottom level
      private Timer tm; //the timer to drive the elevator movement
      //other variables to be used ...
      //constructor
      public Elevator(Elevator_Simulation app) {
      //necessary initialization
           Timer timer=new Timer(100,this);
           timer.start();
      // Paint elevator area
      public void paintComponent(Graphics g) {
      //obtain geometric values of components for drawing the elevator area
      //clear the painting canvas
      //start the Timer if not started elsewhere
      //draw horizontal lines and the elevator 
           width = getWidth()/8;
           height= getHeight()/8;
           bottomy = (height * 7)+ height;
           topy= 0;
           xco= (getWidth()/2)-(width/2);
           yco= (getHeight()/2)-(height/2);
           super.paintComponent(g); 
           // Create 8 Lines
           for (int i=0; i<=8; i++)
                g.setColor(Color.black);
                g.drawLine(0,(height*i),getWidth(), (height*i));
           if ( yco > getHeight())
                yco=bottomy;
          yco +=2;
          g.setColor(Color.gray);
          g.fillRect(xco, yco, width, height);
          g.setColor(Color.magenta);
          g.drawLine(xco+(width/2), yco, xco+(width/2), (yco+height));
      //Handle the timer events
      public void actionPerformed(ActionEvent e) {
      //loop if the elevator needs to be stopped for a while
      //adjust Y coordinate to simulate elevetor movement
      //change moving direction when hits the top and bottom
      //repaint the panel
           repaint();
      //update the state of the elevator
    } //the end of Elevator classi think theres something wrong with the way i set my timer. I jus want it to move to the top(topy) then restart at the bottomy then move back up again. Greatly appreciate if someone could assist me.

    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    //The main class
    public class Elevator_Simulation extends JFrame{
      public JLabel state; // display the state of the elevator
      private JLabel id;  //your name and group
      public ButtonPanel control= new ButtonPanel(); //the button control panel
      private Elevator elevator; // the elevator area
      private static final String myProperty = "Name: Loh Khai Ping Group: SE2";
      //constructor
      public Elevator_Simulation()
      // Create GUI
           setTitle("Elevator_Simulation");
           Container container = getContentPane();
      // Centralise my name & group
           id = new JLabel(myProperty);
           JPanel idPanel = new JPanel();
           idPanel.add(id);
           getContentPane().add(idPanel, BorderLayout.NORTH);
      // Add ButtonPanel
           JPanel buttonPanel=new JPanel();
           buttonPanel.add(control);
           getContentPane().add(control, BorderLayout.WEST);
      // Add state
           state=new JLabel("Up/Down");
           JPanel statePanel = new JPanel();
           statePanel.add(state);
           getContentPane().add(statePanel, BorderLayout.SOUTH);
      /* Add elevator
           JPanel elevatorPanel= new JPanel();
           elevatorPanel.add(elevator);
           getContentPane().add(elevatorPanel, BorderLayout.CENTER);
      // Main method
      public static void main(String[] args) {
      // Create a frame and display it
           Elevator_Simulation frame = new Elevator_Simulation();
           frame.setSize(500,500);
           frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
           frame.getContentPane().add(new Elevator(frame));
      // GUI @ Middle Screen      
           Dimension  screenSize = Toolkit.getDefaultToolkit().getScreenSize();
              int screenWidth = screenSize.width;
              int screenHeight = screenSize.height;
              int x = (screenWidth - frame.getWidth())/2;
              int y = (screenHeight - frame.getHeight())/2;
              frame.setLocation(x,y);
              frame.setVisible(true);
    } //the end of Elevator_Simulation class
    //The ButtonPanel class receives and handles button pressing events
    class ButtonPanel extends JPanel implements ActionListener {
      public JButton b[] = new JButton[8];  // 8 Buttons
      public boolean bp[] = new boolean[8]; // the state of each button, pressed or not
      //constructor
      public ButtonPanel() {
      //create GUI
          setLayout(new GridLayout(8,1));
      // Create 8 Floor Buttons and register listeners
              for (int i=1; i<=8; i++)
                   b[8-i] = new JButton("F"+(8-(i-1)));
                   b[8-i].setBackground(Color.blue);
                   b[8-i].addActionListener(this);
                   add(b[8-i]);
      public void actionPerformed(ActionEvent e) {
      //handle the button pressing events
           Toolkit.getDefaultToolkit().beep();
    } //the end of ButtonPanel class
    // The elevator class draws the elevator area and simulates elevator movement
    class Elevator extends JPanel implements ActionListener{
      //Declaration of variables
      private Elevator_Simulation app; //the Elevator Simulation frame
      private boolean up; // the elevator is moving up or down
      private int width;  // Elevator width
      private int height; // Elevator height
      private int xco;     // The x coordinate of the elevator's upper left corner
      private int yco; // The y coordinate of the elevator's upper left corner
      private int dy0; // Moving interval
      private int topy; //the y coordinate of the top level
      private int bottomy; // the y coordinate of the bottom level
      private Timer tm; //the timer to drive the elevator movement
      //other variables to be used ...
      //constructor
      public Elevator(Elevator_Simulation app) {
      //necessary initialization
           tm =new Timer(100,this);
           tm.start();
      // Paint elevator area
      public void paintComponent(Graphics g) {
      //obtain geometric values of components for drawing the elevator area
      //clear the painting canvas
      //start the Timer if not started elsewhere
      //draw horizontal lines and the elevator 
           width = getWidth()/8;
           height= getHeight()/8;
           bottomy = (height * 7);
           topy= 0;
           xco= (getWidth()/2)-(width/2);
           yco=  bottomy;
           super.paintComponent(g);
           // Create 8 Lines
           for (int i=0; i<=8; i++)
                g.setColor(Color.black);
                g.drawLine(0,(height*i),getWidth(), (height*i));
          g.setColor(Color.gray);
          g.fillRect(xco, yco, width, height);
          g.setColor(Color.magenta);
          g.drawLine(xco+(width/2), yco, xco+(width/2), (yco+height));
      //Handle the timer events
      public void actionPerformed(ActionEvent e) {
      //loop if the elevator needs to be stopped for a while
      //adjust Y coordinate to simulate elevetor movement
      //change moving direction when hits the top and bottom
      //repaint the panel
           yco +=2;
           xco +=2;
           /* if ( yco >= 0 )
                yco=bottomy;
          repaint();
      //update the state of the elevator
    } //the end of Elevator class*Updated code.. It still cant move. Please assist.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • How to launch an application with elevated administrator account privilege from windows service even if the account has not yet logon

    Here is the case:
    OS environment: Windows 7
    There are two user accounts in my system, standard user "S" and administrator account "A", and there is a windows service running with "Local System" privilege.
    Now i logged-in with account "S", and i want to launch an application with elevated administrator account "A" from that service program, so here is the code snippet:
    int LaunchAppWithElevatedPrivilege (
    LPTSTR lpszUsername, // client to log on
    LPTSTR lpszDomain, // domain of client's account
    LPTSTR lpszPassword, // client's password
    LPTSTR lpCommandLine // command line to execute e.g. L"C:\\windows\\regedit.exe"
    DWORD dwExitCode = 0;
    HANDLE hToken = NULL;
    HANDLE hFullToken = NULL;
    HANDLE hPrimaryFullToken = NULL;
    HANDLE lsa = NULL;
    BOOL bResult = FALSE;
    LUID luid;
    MSV1_0_INTERACTIVE_PROFILE* profile = NULL;
    DWORD err;
    PTOKEN_GROUPS LocalGroups = NULL;
    DWORD dwLength = 0;
    DWORD dwSessionId = 0;
    LPVOID pEnv = NULL;
    DWORD dwCreationFlags = 0;
    PROCESS_INFORMATION pi = {0};
    STARTUPINFO si = {0};
    __try
    if (!LogonUser( lpszUsername,
    lpszDomain,
    lpszPassword,
    LOGON32_LOGON_INTERACTIVE,
    LOGON32_PROVIDER_DEFAULT,
    &hToken))
    LOG_FAILED(L"GetTokenInformation failed!");
    __leave;
    if( !GetTokenInformation(hToken, (TOKEN_INFORMATION_CLASS)19, (VOID*)&hFullToken,
    sizeof(HANDLE), &dwLength))
    LOG_FAILED(L"GetTokenInformation failed!");
    __leave;
    if(!DuplicateTokenEx(hFullToken, MAXIMUM_ALLOWED, NULL,
    SecurityIdentification, TokenPrimary, &hPrimaryFullToken))
    LOG_FAILED(L"DuplicateTokenEx failed!");
    __leave;
    DWORD dwSessionId = 0;
    WTS_SESSION_INFO* sessionInfo = NULL;
    DWORD ndSessionInfoCount;
    bResult = WTSEnumerateSessions(WTS_CURRENT_SERVER_HANDLE, 0, 1, &sessionInfo, &ndSessionInfoCount);
    if (!bResult)
    dwSessionId = WTSGetActiveConsoleSessionId();
    else
    for(unsigned int i=0; i<ndSessionInfoCount; i++)
    if( sessionInfo[i].State == WTSActive )
    dwSessionId = sessionInfo[i].SessionId;
    if(0 == dwSessionId)
    LOG_FAILED(L"Get active session id failed!");
    __leave;
    if(!SetTokenInformation(hPrimaryFullToken, TokenSessionId, &dwSessionId, sizeof(DWORD)))
    LOG_FAILED(L"SetTokenInformation failed!");
    __leave;
    if(CreateEnvironmentBlock(&pEnv, hPrimaryFullToken, FALSE))
    dwCreationFlags |= CREATE_UNICODE_ENVIRONMENT;
    else
    pEnv=NULL;
    if (! ImpersonateLoggedOnUser(hPrimaryFullToken) )
    LOG_FAILED(L"ImpersonateLoggedOnUser failed!");
    __leave;
    si.cb= sizeof(STARTUPINFO);
    si.lpDesktop = L"winsta0\\default";
    bResult = CreateProcessAsUser(
    hPrimaryFullToken, // client's access token
    NULL, // file to execute
    lpCommandLine, // command line
    NULL, // pointer to process SECURITY_ATTRIBUTES
    NULL, // pointer to thread SECURITY_ATTRIBUTES
    FALSE, // handles are not inheritable
    dwCreationFlags, // creation flags
    pEnv, // pointer to new environment block
    NULL, // name of current directory
    &si, // pointer to STARTUPINFO structure
    &pi // receives information about new process
    RevertToSelf();
    if (bResult && pi.hProcess != INVALID_HANDLE_VALUE)
    WaitForSingleObject(pi.hProcess, INFINITE);
    GetExitCodeProcess(pi.hProcess, &dwExitCode);
    else
    LOG_FAILED(L"CreateProcessAsUser failed!");
    __finally
    if (pi.hProcess != INVALID_HANDLE_VALUE)
    CloseHandle(pi.hProcess);
    if (pi.hThread != INVALID_HANDLE_VALUE)
    CloseHandle(pi.hThread);
    if(LocalGroups)
    LocalFree(LocalGroups);
    if(pEnv)
    DestroyEnvironmentBlock(pEnv);
    if(hToken)
    CloseHandle(hToken);
    if(hFullToken)
    CloseHandle(hFullToken);
    if(hPrimaryFullToken)
    CloseHandle(hPrimaryFullToken);
    return dwExitCode;
    I passed in username and password of account "A" to method "LaunchAppWithElevatedPrivilege", and also the application i want to launch, e.g. "C:\windows\regedit.exe", but when i run the service program, i found it do launch
    "regedit.exe" with elevated account "A", but the content of regedit.exe is pure back. screenshot as below:
    Can anyone help me on this?

    You code is not dealing with the DACL access to Winsta0\Default.  Only the LocalSystem account will have full access and the interactively logged on user which is why regedit is not displaying properly.  You'll need to grant access to your user. 
    You also need to deal with UAC since that code is going to give you a non-elevated token via LogonUser().  You need to get the full token via a call to GetTokenInformation() + TokenLinkedToken.
    thanks
    Frank K [MSFT]
    Follow us on Twitter, www.twitter.com/WindowsSDK.

  • Jabber for Windows 10.5.1 not working without elevated permissions

    Customer starts Jabber for Windows 10.5.1 and gets a pop-up about CiscoJabber.exe, wbxcOIEx.exe, and wbxcOIEx64 and to contact WebEx support.  It appears these components are talking to Outlook.  Show connection status under Outlook we see a mapi connection error with a code 0x80080005 that goes back to permissions error.
    Users are not local administrators running Windows 7.  Jabber was packaged using LanDesk and deployed to PC and installed with admin rights.
    Workaround was to grant elevated permissions to Jabber folder that had CiscoJabber.exe, wbxcOIEx.exe, and wbxcOIEx64.
    see attached screenshot.
    TAC Case 632162203 sent issue to BU for escalation, meanwhile customer elevated that folder permissions

    @ richard Beck   good answer your answer is right 

  • Macbook pro over 5 years old phoned up because it fell onto the floor and mad a big bang looked at screen it was cracked and battery looked liked it had exploded i explaind what had happend and was told that it was normal how dangerouse is that no warning

    mac book pro 17 over £2000 when new in the middle of the night i heard a loud noise found out that my laptop was on the floor looked and seen screen was craked and that what looked to me the battery had exploded coursing it to fall on to the floor the was nor warning and have had no recal letters from apple warning me that this may happen . so i phoned up apple and was speacking to some one i have thare name but wont say explaind what had happend an he said that it was normal to my shock as if it landed on any one or poss a pet as it was random .he said it was normal more than once and also i was on speaker phone and had some one else listening .i asked for him to send me what he had said via email but he said he could not so he put me through to some one called katalin who said to ignore what he had said . but at this stage i had two isues one that my expensive laptop is damaged .and the second it thta thay admited liyability by saying it was normal
    after many emails and phone calls i think there best offer was if i spend about 184 pound thay would give me a £54 discount which as i have just spent over £2200 on new macbook pro was a bit on an insult
    i do under stand that batterys do charge but as i had no warning especial if this was going to happen
    if as thay said this is normal as it was bourght from apple direct should thay have sent a letter or email as thay would have had my details warning me that this can randomly happen as in my case .
    the battery in my opinion has exploded ref defonition and .
    my consern is that this could have been alot worse and no warning even thay admited that it is normal
    .that sent me a letter basicly say all about my waranty .but how can this be so defently a safty isue regarding my case
    i cant just buy new battery because screen craked and dont no any other things wron ref fall fery disapointed with apple but i do not have the money or time to take any further .i and my familey have many apple products and were due for upgrading but hard to think are thay save.as iphones /apads/macbook /macbookpro/and other products very disapointed .dont think i would have been treated this way by dell

    u can give try to using external enclosre and backup ur files. I hope u will get files back. or using external enclosre with ur hdd boot into Linux and try to mount ur harddisk.
    there are multiple no of tutorial to mount apple partion in Linux.

Maybe you are looking for

  • Can I pass username & password in JDBC URL in Crystal Reports 2008?

    Hi, I tried to put this URL in the CRConfig.xml file : jdbc:postgresql://hostname:5432/db_name?user=user_name&password=pw Without the user and password parameters, it works fine but I always have to enter the database information when I create a new

  • 2012 mac mini and 10.7?

    Hi, Does anyone know if a 2012 Mac Mini will allow me to install 10.7 Lion on it? We use Lion Server but don't want to upgrade to 10.8 because of missing features. Thanks

  • I downloaded an album on my iphone 5..help!

    I downloaded an album on my iphone 5, and synced it to my laptop. it has put the songs on the playlist in itunes, but has taken it off my iphone, and wont put them on there even though they are in the playlist on the comp..?

  • Instrument Driver Template VI's

    Hello, I am doing a study about labview and need to control instruments via labview in an effort to create an "database" of the instruments at the lab. In a later stage i shall use these VI's so that i can control a complete test for emc. Am i correc

  • Taskbar / Window Colour Not Matching

    When personalising Windows 10 the colour of the Windows and the Taskbar are not matching up as intended. I have the colour set to a light blue however the task bar is a dark blue. I'm unsure if this is my doing of a bug in windows but i cannot seem t