Sci cosim: Difference between revisions

Jump to navigation Jump to search
458 bytes added ,  29 September 2020
(Back to Category:Packages.)
 
(9 intermediate revisions by 7 users not shown)
Line 5: Line 5:


== Installation ==
== Installation ==
1. Install Octave version 4.0.0 or higher and Scilab v.5.5.2 or higher
1. Install Octave (version 4.0.0 or higher) and Scilab v.5.5.2 _specifically_ (note: the BackDoor module is currently not supported for the new SciLab v6.0.0 version)


2. Install sockets package in Octave by executing  
2. Install the `sockets` package in Octave by executing  


''pkg install -forge -auto sockets''
''pkg install -forge sockets''


3. Download sci_cosim package from  https://github.com/amromanov/sci_cosim  
3. Download the `sci_cosim` package from  https://github.com/amromanov/sci_cosim  


4. Install sci_cosim package in Octave by executing  
4. Install the `sci_cosim` package in Octave by executing  


''pkg install -auto sci_cosim_0.1.3.tar.gz''
''pkg install sci_cosim_0.1.3.tar.gz''


5. Start Scilab GUI and install Toolbox Backdoor by pressing in main menu Applications → Module manager - ATOMS → Technical → Backdoor → Install
5. Start the Scilab GUI and install the `Backdoor` toolbox from the main menu: Applications → Module manager - ATOMS → Technical → Backdoor → Install


6. Restart Scilab. If every thing was done correct, after restart there will message in command window "BackDoor: listening to connections on TCP port"
6. Restart Scilab. If every thing was done correctly, after restarting there will be a message in the command window "BackDoor: listening to connections on TCP port"
 
You _may_ encounter an error that the files "backdoor.start" / "backdoor.quit" cannot be found. This occurs if the files are named e.g. "BackDoor.start" on the disk (i.e. case-sensitive). Simply rename the files to lowercase and restart SciLab.


== Running demo ==
== Running demo ==


1. Download demo from https://github.com/amromanov/sci_cosim/demo.tar.gz
1. Download demo from https://github.com/amromanov/sci_cosim/raw/master/demo.tar.gz


2. Extract it to any folder, where your user has read/write rights
2. Extract it to any folder, where your user has read/write rights
Line 31: Line 33:
4. Run Octave and change folder to the one, where you have extracted demo
4. Run Octave and change folder to the one, where you have extracted demo


5. Run sci_sim_example.m
5. Load the two packages ''pkg load sockets'' and ''pkg load sci_cosim'' in octave.
 
6. Run sci_sim_example.m


== Function description ==
== Function description ==
Line 49: Line 53:


== Usage cases ==
== Usage cases ==
In all usage case, described below, user doesn't need to have any knowledge about using Scilab interface and in the most cases he doesn't have to know Scilab scripting language. You can use only Xcos and do the rest of things in Octave.  
In all usage case, described below, user doesn't need to have any knowledge about using Scilab interface and in the most cases they don't have to know Scilab scripting language. You can use only Xcos and do the rest of things in Octave.  


1. Simple dynamic systems rapid prototyping.  
1. Simple dynamic systems rapid prototyping.  
Line 88: Line 92:
== How to Run and Change an Xcos diagram ==
== How to Run and Change an Xcos diagram ==


1) After installing Scilab and and the sci_cosim package and getting the "backdoor" to work, then you can try this help section.
1) After installing Scilab and and the sci_cosim package and getting the Toolbox Backdoor for Scilab to work, then you can try this help section.
 
2) Download examples from the GitHub
https://github.com/amromanov/sci_cosim/raw/master/demo.tar.gz


2) Get these 2 files from Dropbox and put them in your PWD.
3) Click in the sci_pid_model.zcos file to start Scilab and Xcos You should see a diagram of the control system.
    https://www.dropbox.com/sh/ab3w067d5g04ald/AACIY8ymH9fuWk8Yc1K4-EKaa?dl=0
3)Click in the zcos file to start Scilab and Xcos You should see a diagram of the control system.


4) Open the .m file in your octave editor.
4) Open the sci_pid_example.m file in your octave editor.


5) Run the .m file  
5) Run the sci_pid_example.m file  
    You should see a plot that has the output of the plant
 
    with no feedback, and the output of the plant in the feedback loop
You should see a plot that has the output of the plant with no feedback, and the output of the plant in the feedback loop and the control action signal that has been clipped at 5 volts.
    and the control action signal that has been clipped at 5 volts.


6) You can then play with the PID parameters in the M file and see how they affect the output.
6) You can then play with the PID parameters in the M file and see how they affect the output.
Line 105: Line 109:
7) In the loop diagram in Xcos click in the  "SATURATION"(clipper) box and change the clipping to be 10 Volts  
7) In the loop diagram in Xcos click in the  "SATURATION"(clipper) box and change the clipping to be 10 Volts  


8) Rerun the m file and retune the PID.
8) Rerun the M file and retune the PID.


9) Now for a little harder problem.
9) Now for a little harder problem. Lets change the plant parameters to (s+1)*(s+5)
    Lets change the plant parameters to (s+1)*(s+5)
    If you just click on the plant and try and do this, Xcos might
    complain that it doesn't know what k is, if this happens
    you have to first go to the Scilab main window and put k=1 there. k will be changed
    from your m file later. Now you will be able to change the plant in both locations.


10) In the m file set k=5 and run the new system
If you just click on the plant and try and do this, Xcos might complain that it doesn't know what k is, if this happens you have to first go to the Scilab main window and put k=1 there. k will be changed  from your M file later. Now you will be able to change the plant in both locations.
 
10) In the sci_pid_example.m file set k=5 and run the new system


11) Now lets add a time delay in the feedback part of the loop.
11) Now lets add a time delay in the feedback part of the loop.
Line 129: Line 130:


11.6) The input and outputs are on the wrong side, so we will mirror it.
11.6) The input and outputs are on the wrong side, so we will mirror it.
    Right click on the box and the select" format" and "Mirror"
 
Right click on the box and the select" format" and "Mirror"


11.7) Move the box to a convenient place to rewire it in the feedback loop,
11.7) Move the box to a convenient place to rewire it in the feedback loop,


11.8) Now rewire it:
11.8) Now rewire it:
    On the left side of the delay box is an output black arrow point,
 
    click on this and drag the mouse to the left until you are to the left of the summing junction box.
On the left side of the delay box is an output black arrow point, click on this and drag the mouse to the left until you are to the left of the summing junction box.
    Now let go of the left button and move the mouse pointer up to the height of the input pin of the summing box.
 
    Click the left button  to place a corner in the wire.
Now let go of the left button and move the mouse pointer up to the height of the input pin of the summing box.
     Now move to the input pin until you get a green box around the input pin.
 
     Click the left mouse button again to make the connection.
Click the left button  to place a corner in the wire.
      
Now move to the input pin until you get a green box around the input pin.
      
Click the left mouse button again to make the connection.


11.9) We now have to join a wire to an existing wire.
11.9) We now have to join a wire to an existing wire.
    Place the mouse pointer on the wire from the output of the plant.
 
    The wire should be highlighted but not selected.
Place the mouse pointer on the wire from the output of the plant.
    Hold the left mouse button down and start drawing a wire.
 
    Join it to the input of the delay
The wire should be highlighted but not selected.
 
Hold the left mouse button down and start drawing a wire.
 
Join it to the input of the delay


12)    Double click on the delay box and change the delay to be .1 seconds.
12)    Double click on the delay box and change the delay to be .1 seconds.
Line 152: Line 162:


14)    In the M file change the line:
14)    In the M file change the line:
             sci_sim('sci_ap_model3.zcos');    %Running xcos simulation
             sci_sim('sci_pid_model.zcos');    %Running xcos simulation
       to
       to
             sci_sim('newname.zcos');          %Running xcos simulation
             sci_sim('newname.zcos');          %Running xcos simulation
Line 164: Line 174:


Distributed under the New BSD License
Distributed under the New BSD License
[[Category:Packages]]

Navigation menu