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

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

  • 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

  • Simple street simulation In web browser

    hello,I have 2 question
    1st:
    I intend to develop a (simple) online multiplayer game. I want make a realistic street as possible. I want to add a people walking around for each multiplayer player and I want to add buildings and cars etc. like a real world. which java platform should I download and use? and which topics should I study?
    2nd question:
    for such a game what should be my server's capability?
    thanks.

    hello
    thanks for the helpful answers.My question is at the second paragraph but firstly I want to tell about something Java which is I have never study on before.
    I have developed some programs other common platforms and I have worked some jobs also. Only thing I was know about java was that it is a web technology which I was get face to face on some web pages and it s icon on my taskbar. when I get the simulation idea I started search for java a couple days ago. Now I think I wish I was meet java years ago. I realizad that Java has a soul which I never felt before when I was developing a program... sorry I can tell more but I extended too much.
    I want to ask one question. For a couple days I meet a lot of java concept JDK, JRE and their versions. I agree with the making applet that no needs upgrade. However 3D graphics can be used in java 1.4.2. ?

  • Simple Project Simulation Example

    Lets Consider a simple full adder project:
    `timescale 1ns / 1ps
    module add(var1,var2,add,clk,cin,cout);
    input [3:0] var1;
    input [3:0] var2;
    output reg [3:0] add;
    input clk;
    input cin;
    output reg cout;
    always @ (posedge clk) begin
    {cout,add}=var1+var2+cin;
    end
    endmodule
    This this the adder module
    `timescale 1ns / 1ps
    module top();
    reg [3:0] var1;
    reg [3:0] var2;
    wire [3:0] add;
    reg cin;
    wire cout;
    reg clk=0;
    add A1(.cin(cin),.cout(cout),.add(add),.var1(var1),.var2(var2),.clk(clk));
    initial begin
    var1=3;
    var2=2;
    cin=1;
    end
    initial #2 $finish;
    initial begin
    forever
    #1 clk=~clk;
    end
    endmodule
    This code is only used for simulation purpose.
    Can anybody explain what mistake i am doing?
    I have attached the snapshots for Behavioural simulation,Post synthesis functional Simulation and Post synthesis Timing Simulation.

    HI,
    When you create a test bench, remember that the GSR pulse occurs automatically in the post-synthesis and post-implementation simulation. This holds all registers in reset for the first 100 ns of the simulation.
    As mentioned by muzaffer you are not waiting long enough to get out of the GSR condition.
    Change the initial statemnet as below and you will be able to see the expected results.
    initial #102 $finish;
    For more details on GSR please refer to below user guide Global set and Reset section.
    http://www.xilinx.com/support/documentation/sw_manuals/xilinx2015_2/ug900-vivado-logic-simulation.pdf
    The following bullets are recommendations for creating an effective test bench.
    • Always specify the `timescale in Verilog test bench files.
    • Initialize all inputs to the design within the test bench at simulation time zero to properly begin simulation with known values.
    • Apply stimulus data after 100ns to account for the default Global Set/Reset (GSR) pulse used in UNISIM and SIMPRIMS-based simulation.
    • Begin the clock source before the Global Set/Reset (GSR) is released
     

  • Elevator Simulation using LABVIEW AND SPEEDY 33?

    Hello there, I am looking for a sample elevator stimulation by LABVIEW using SPEEDY-33. If anybody has a sample on how I should begin or how my elevator should look like please help. Thanks in advance.

    Hi,
    I think that a good tutorial to start with the DSP module might be this one and probably continue with learn LabVIEW DSP in 3 hours.
    Hope this will get you going.
    General info on the DSP is here.
    However if you have any question, feel free to ask 
    Best regards,
    Jano

  • Cannot change slide duration in software simulation

    I'm using Captivate 7 for the first time. I had a much older version, but seldom used it.
    I have recorded a simple software simulation that should be a piece of cake to edit and produce, but have come across a problem I don't know how to solve. The simulation includes an item on screen being clicked, then dragged and dropped into a new location. I cannot edit the duration of the slide that shows the drag-and-drop motion. It has a duration of 6.5 seconds, which is painfully and unrealistically slow and there is no way I can find to shorten it.
    I can't drag the end of the slide on the timeline, right-clicking hasn't produced anything promising in pop-up menus, and the Properties panel has a Time field, but when I select the 6.5 seconds and change it, it just reverts to 6.5 seconds immediately afterward.
    I recall this sort of thing being very simple in previous versions of Captivate. Not anymore, I guess...
    Thanks,
    - Jennifer

    Thanks, guys! Those replies led me to try something that actually worked. It did record as a video demo (the red strike-through line) as Varun Kalra suggested. I discovered that I can click the end of the timeline for that slide (where the word END displays), then use the left arrow on my keyboard to decrease the duration of the slide.
    That probably wouldn't work if the entire animation was too slow, but in this case, just the very end was too slow.
    Thanks much!
    - Jennifer

  • Help about physic simulation in Director 11.5

    Given that:
    1) The Help of Director about the functions of physical simulation in 3D is  not very easy to use;
    2) I work with 3D max;
    3) Havok does not work anymore with Director 11.5;
    4) I tried to use the new plug in "AGEIA PhysX" in 3d max " and it works.
    5) Adobe says that "AGEIA PhysX" is the current engine for the simulation physic in 3d in Director,
    but when I export in W3D the physical simulation does not work. I make a mistake or it is just like that?
    Someone can tell me if there are some tutorial about:
    1) physic simulation in Direcrot 11.5. Better to download.
    2) how to export the "AGEIA PhysX" simulation form 3d max to W3D and preserve the physical simulation
    inside Director.
    I hope I am wrong but, if I am right, if professional programs that accelerate the physical simulation with 3D programming, like
    3d max (with Havok or Physix) do not work, the only way to make even a simple physics simulation in Director is the compilation with keyboard, boring and slow, as did was with DOS.
    Don't tell me that it is so.
    I am sorry for the bad English
    Thanks.

    If a SWF needs to access other files you need to link to the external file when importing it, instead of the standard import. Everything Flash needs to load should be in the same relative location.

  • 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

  • PM, QPSK, QAM, OFDM software simulations and examples

    Hi everyone,
                       I am trying to find examples on Phase Modulation and other modulation examples (but currently PM modulation is the 1st priority) but i look for the tutorial in NI website they only provide Amplitude and Frequency Modulations Examples on software simulation. Anybody knows where to find or even has this modulation example can you please tell me because i really need it for my project. Thanks!

    Hi,
        actually i just trying to use examples in NI for my project as a VI exercise  to let understand the concept of each modulation. Because in NI tutorial website, there are simple software simulation exercises to let people download and know the concept of each modulation. I am trying to use these examples in my project to let people understand more in the modulation. Please see the exercise i have uploaded you will understand more. I have downloaded AM, FM, ASK, FSK and PSK but i still need others. Now, i trying to finish the catergory for analog modulation, AM, FM and PM. So i finding PM modulation now, the url u have written i seen it before but i think i cant find what i want. that's y i am also asking if anyone happen to have it or create it by yourself, would you mind 'sharing' it with me by uploading the files if you happen to have it.
    Attachments:
    [Universal Communication Training Kit] HI.vi ‏115 KB
    Universal Toolkit.PNG ‏138 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.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • 3D graph issues in 8.6

      I'm trying to program a simple 3D simulation in LabVIEW and am running into numerous issues with the 3D graphs.
    1) An old program I had used the 3D ActiveX graph.  When I load that VI, LV says it could not load the ActiveX control.  I never intentionally uninstalled it.  From the help I've found, it sounds like 8.6 should support the 3D ActiveX graph and the new Native (XControl) graph.  Any ideas how it might have come unstuck on my computer, or how to retrieve it?  It is also gone within LV 8.5 now too.
    2) I can find very little help about the new Native 3D Graph.  I found one example, which was amazingly incomplete.  No instructions on the front panel.  3 graphs were generated on the diagram, but only one was connected to the indicator.  Very odd.
    3) I first placed the graph on a tab control and had very odd display issues.  Someone had mentioned this type of problem recently (though I think they were referring to the ActiveX 3D Graph), so I moved it off the tab.  However, it still has odd display issues.  For example, often when the VI is not running, the graph control displays odd snippets of the Windows desktop - things that had been displayed on those pixels of the screen at some previous time.  When the program is running, the graph flashes between what it should display and these bogus images.
    4) I am using the  create_plot_line VI to try to create two lines on my graph.  As a sort of animation, I calculate  increasing arrays of points and continuosly update the graph with more and more points, so the line (trajectory) grows.  It seems like this is more like a "graph" than a "chart", so I should always create the plot with all the points that should be plotted, not just plot the one new point like you would with an old LabVIEW chart.  And that sort of works.  But if I leave the program running and restart the trajectory after it has already plotted it once, then a line appears from the end of the trajectory back to the beginning, as if it still has all the old points in some sort of memory and is adding new points, hence drawing a line from the last point from the first program iteration to the first point on the second iteration.  So I'm a bit confused about how this type of graph is supposed to be used.  Why are there no examples or instructions?  (Or am I just missing them - e.g. not seeing them, or maybe they got erased from my system like the ActiveX graph did...)
        Under the assumption that this graph is more like a picture control, where you add an element with one VI and pass the ref to another VI that adds another element, etc., I have tried wrapping the graph's main wire around in a shift register and only plotting the one new point.  It doesn't really seem to work...  The trajectory is there, but only when you rotate the 3D view.
    5) I want the two trajectories to be different colors.   Luckily there is a "color vector" input to the sub-vi that will probably do this.  But I can find no documentation on it.  You can't read this color vector with a property node, that I can find, so I can't get an example of the current color vector.  I can see this color vector in the 3D Graph Properties page, but at that point, you can only change the colors of the over and under points, not the main color ramp.  I tried specifying an array of color boxes, but didn't get reasonable results.  I probably don't have the right number of elements.  Interestingly, the Color Vector input is an array of reals!  The context sensitive help for the sub-vi is useless.  Isn't this documented somewhere?
    Thanks for any help,
       DaveT
    David Thomson Original Code Consulting
    www.originalcode.com
    National Instruments Alliance Program Member
    Certified LabVIEW Architect
    There are 10 kinds of people: those who understand binary, and those who don't.

    Dave Thomson wrote:
    5) I want the two trajectories to be different colors.   Luckily there is a "color vector" input to the sub-vi that will probably do this.  But I can find no documentation on it.  You can't read this color vector with a property node, that I can find, so I can't get an example of the current color vector.  I can see this color vector in the 3D Graph Properties page, but at that point, you can only change the colors of the over and under points, not the main color ramp.  I tried specifying an array of color boxes, but didn't get reasonable results.  I probably don't have the right number of elements.  Interestingly, the Color Vector input is an array of reals!  The context sensitive help for the sub-vi is useless.  Isn't this documented somewhere?
    Thanks for any help,
       DaveT
     CW 3d graph Example here.
    To set the color ramp you need to set the colors and the values and you need the same number of elements in each array. You will also have to set the ramp style you want to custom.
    Also note colrs are "BGR" not "RGB".
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • PSK Demod.VI doesn't demodulate the enitre message

    I'm attempting to create my own PSK link similar to the PSK Transmitter and Receiver examples shipped with the NI Comm Toolkit.
    Before getting the hardware in the loop, I tried to create a simple transceiver simulation, similar to the MT PSK Transceiver(with FFT Spectrum) found in the simulation examples folder.
    Starting with BPSK, I began by defining my own simple 8-bit message...prepended by a few guard bits, and an 8-bit sync sequence.  No problems there.
    However, after using the PSK Demoduate VI...I notice that not all of my bits are getting demodulated.  In otherwords...it finds the sync location correctly, and starts it's demodulation, but not all of my message bits get demodulated.  It's as if they weren't even there to begin with.
    I looked at the MT PSK Transceiver (with FFT Spectrum) example a little deeper, and found that the same thing happens.  There's a mysterious VI called Align Array that comes after the PSK Demod VI thats chopping the orignal TX message to the length of what gets demodulated, so that the front panel advertises a "See...they're the same!", when in reality, not all of the tx sequence got demodulated.
    Why is this?  I suspect that it has something to do with the filtering...but I thought that this was the purpose of the guard bits...to give the filters something to chew on during the first few samples so that group delay through the filters didn't mess with you signal.  It almost seems as if I need some guard bits at the end of my message as well so that demod of my message bits can continue even after the filters begin to "empty"? 
    Brandon

    Hi Brandon,
    You are correct in thinking that the Align Array VI has something to do with filtering, it is compensating for digital filter delay in the PSK demodulator.  You'll also notice that the Align Array VI doesn't throw away any bits after the first time its ran (when it discards the guard bits).  After this any bits that can't be matched in the present iteration of the loop are matched in the next iteration by storing them up in a shift register.  In this transceiver example, this has to be done this way because there is a direct correlation between the number of symbols the modulator produces and the number of symbols that come out of the demodulator.  In continuous mode with the Modulation Tools, because of the filter, there will always be some symbols that will be delayed going through the filter and will come through the next iteration of the loop.
    Once you go to hardware, you would see a similar issue if you are doing continuous acquisition.  Continuous acquisition is challenging to do because demodulation takes a lot of processing and in general it is difficult to keep up with the VSA's buffer.  Normally, I have seen people do a finite acquisition, making sure that the amount of data acquired is long enough to account for the filter delay and then discarding symbols at the start.  You'll notice that the hardware examples do this by using a subVI called mod_Truncate Filter Transient.
    Regards,
    Craig
    Systems Engineering
    National Instruments

  • How can I transfer a big .pdf file e.g. 9 MB from my Macintosh Performa 5200 and its OS 8.1 to an USB-flash drive?

    How can I transfer a big .pdf file e.g. 9 MB from my Macintosh Performa 5200 and its OS 8.1 to an USB flash drive? E.g. is there any adapter available in order to connect the SCSI with USB? Or is it better to use a compression software and transfer it to 10 3,5" floppy discs?
    Thank you
    Emanuel

    Hello Emanuel,
    The Performa 5200CD did not have built-in Ethernet as standard, so unless an Ethernet card (or an external SCSI or LocalTalk-to-Ethernet adapter) has been added, that method would not be available in this case.
    Your suggestion involving compression software (such as an appropriate version of StuffIt) with segmenting capabilities could of course be one alternative.
    If you have an internal or external modem for the Performa, another way could be to use the telephone lines for transfers. A communications program would have to be used on both sides (for example, ZTerm or the communications section of ClarisWorks on the Performa).
    It is even possible to connect two serial modems directly. A simple line simulator (in principle, a 9 V battery in series with a 680 ohm resistor in one of the leads in an RJ-11 to RJ-11 cable), which can be built in a couple of minutes, is sometimes needed. Do NOT use a line simulator for units connected to the public telephone network.
    Yet another solution could be a null-modem transfer to a PC with a (DB-9M) serial port. This would require a null-modem cable (can be designed by combining a Macintosh modem cable (MiniDIN-8M to DB-25M) with a normal PC-style (DB-25F to DB-9F) null-modem cable . HyperTerminal or another communications program can be used on the PC.
    What do you have to work with (other computers/models/platforms)? Is this a one-time transfer, or do you plan to send additional files later? Is the intention to continue to use the Performa 5200?
    Jan

  • Modulation en fréquence FM, mon vi n'a pas d'erreur avec un spectre FM et un signal temporel FAUX; je dois ignorer quelque chose sur l'utilisation de vi génarateur de fonction par rapport à la phase

    BONJOUR,
    j'ai un problème simple
    - construire un vi simple pour simuler une modulation de fréquence
    - je n'ai pas de message d'erreur
    - je suis persuader de la formulation de ma FM
    -je n'obtiens pas ce que l'on devrait obtenir en spectral et en temporel
    - je dois ignorer quelque chose sur l'utilisation de vi génarateur de fonction par rapport à la phase.
    je cherche, je cherche en vain et là j'ai besoin d'aide.
    merci d'avance, voir vi joint
    Attachments:
    IMPH problème FM.vi ‏68 KB

    salut emperor,
    désolé, mais j'ai à nouveau besoin de tes compétences. j'ai introduit ton FM.vi dans une application (analyseur de spectre pédagogique à l'initiation du traitement du signal) et je rencontre une incompréhension: le vi que tu m'as fourni marche impécable mais quand je le fait fonctionner dans mon application, je n'ai pas d'erreur, mais il y  rien qui sort de ta boucle for ???
    ci joint mon appli zippée avec un doc qui te permettra de situer le problème.
    si tu arrives à le bebugger je te félicite d'avance et j'espère que mon appli te sera utile si tu souhaites la conserver.
    merci d'avance et bonne chance
    Attachments:
    IMPH pour EMPEROR.zip ‏434 KB

Maybe you are looking for

  • Adobe Creative Cloud 3 month offer says "serial already redeemed"

    I recently purchased a Wacom Tablet which included an offer for three months Adobe Creative Cloud full package, which of course I'd like to use. When I go to https://creative.adobe.com/redeem and fill in the serial number I received from Wacom I get

  • How do I set up Airport extreme as a remote with Gateway 2wire as a base

    I just switched over to sbcglobal from comcast. Before switching, I had been using an APE as a base station connected with ethernet to my G5 and another APE as a remote. With sbcgobal I got a Gateway 2wire modem. What I would like to know is how do I

  • OS X Yosemite RAM Issues - kernel_task

    Hello, Looks like I have a memory leak somewhere.  I'm unable to pin it down.  My kernel_task is taking too much memory and it force yosemite to kill window manager, not a good thing Can you help me out?  I'm really considering a roll back to maveric

  • Webi Published with dinamic filename in file system

    Hello, We have a problem in BO 4.0 SP5. We have a webi with the following prompt: Year: ie. 2014 Month: ie. 001 Company: ie ES01 The name webi is: Report_Sales When we shchedule the report we can't name the file like: "Report_Sales_<year>_<month>  (i

  • How can I do to display the imported pictures' effects on my PC ?

    I took some pictures with my iPhone with an effect (black and white for example). Then I imported them to my computer and the pictures in black and white were on my computer without effect (in colour) ! As if I didn't take them in black and white but