Commit 4d932dcb authored by Umar Farooq's avatar Umar Farooq
Browse files

Add gtnet-skt RSCAD drafts to the clients directory

parent 3f3cbe20
POINT0 int
POINT1 int
POINT2 int
POINT3 int
POINT4 float
This example demonstrates UDP socket communication. Data is sent from the RTDS to a standalone java program, and the java program can send information back to the RTDS.
This is done using the SKT protocol on the GTNETx2 card.
Note: You need to install the JDK to be able to compile java files http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html MAKE sure the path to the bin folder of the JDK
is added to the windows path variable (google to figure this out)
Note: If you want some extra information printed in the DOS window set the boolean DEBUG=true
1. Open a windows command shell and go to the Tutorial|SAMPLES|GTSKT|ExampleGUI folder.
2. Compile the .java code. Use the command below in the windows command shell
javac GNET_SKT_UDP_GUI.java
3. Run the code using the command below
java GNET_SKT_UDP_GUI
4. Upon running the program, two panels will appear. The GTNET-SKT UDP Server and the GTNET-SKT UDP Client.
A file chooser box can be used to request the file name that defines the name and type of the received data or type of data to send.
Browse to the file named received.txt in the Tutorial|SAMPLES|GTSKT folder. The table will be filled with data from the file or the user can add/delete items from the table
5. Press the Start button in the GUI
A message will be displayed in the Messages Text area
Server socket created. Waiting for incoming data ...
6. A file chooser box can be used to request the file name that defines the name and type of type of data to send. To manually add points press
the Add button in the GTNET-SKT UDP Client panel and add 2 points, change the type of point 0 to "int"
7. Press the Send button in the GUI and the UDP packet will be sent to the GTNET-SKT UDP Server panel.
TO use the GTNET-SKT the user must change the Remote Server Settings IP Address and Port in the GTNET-SKT UDP Client panel so the program will send the UDP packet to the GTNET
8. Open the Draft case, edit the GTNET-SKT component, go to the Remote IP Configuration tab and change the Remote IP address to the IP address of your PC.
9. Compile the Draft case, ensure to change the allocation of the component to the proper RTDS processor and GTIO port based on your hardware configuration.
10. Run the simulation.
11. Press the Send button in the simulation, the value on the Point slider is sent to the java program and will appear in the GTNET-SKT UDP server panel.
12. Press the Send button in the GUI and the UDP packet will be sent to the simulation and is displayed in the meters POINTIn0 and POINTin1.
\ No newline at end of file
import java.awt.Color;
import java.awt.Component;
import java.awt.Graphics;
import java.awt.Insets;
import javax.swing.border.Border;
class SoftEdgeBorder implements Border
{
protected int m_w=3;
protected int m_h=3;
protected Color m_topColor = Color.gray;//white;
protected Color m_bottomColor = Color.gray;
public SoftEdgeBorder()
{
m_w=3;
m_h=3;
}
public SoftEdgeBorder(int w, int h) {
m_w=w;
m_h=h;
}
public SoftEdgeBorder(int w, int h, Color col)
{
m_w=w;
m_h=h;
m_topColor = col;
m_bottomColor = col;
}
public SoftEdgeBorder(int w, int h, Color topColor,
Color bottomColor)
{
m_w=w;
m_h=h;
m_topColor = topColor;
m_bottomColor = bottomColor;
}
public Insets getBorderInsets(Component c)
{
return new Insets(m_h, m_w, m_h, m_w);
}
public boolean isBorderOpaque() { return true; }
public void paintBorder(Component c, Graphics g,
int x, int y, int w, int h)
{
w--;
h--;
g.setColor(m_topColor);
g.drawLine(x, y+h-m_h, x, y+m_h);
g.drawArc(x, y, 2*m_w, 2*m_h, 180, -90);
g.drawLine(x+m_w, y, x+w-m_w, y);
g.drawArc(x+w-2*m_w, y, 2*m_w, 2*m_h, 90, -90);
g.setColor(m_bottomColor);
g.drawLine(x+w, y+m_h, x+w, y+h-m_h);
g.drawArc(x+w-2*m_w, y+h-2*m_h, 2*m_w, 2*m_h, 0, -90);
g.drawLine(x+m_w, y+h, x+w-m_w, y+h);
g.drawArc(x, y+h-2*m_h, 2*m_w, 2*m_h, -90, -90);
}
}
\ No newline at end of file
import java.awt.Color;
import java.awt.GradientPaint;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.Shape;
import java.awt.geom.RoundRectangle2D;
import javax.swing.Action;
import javax.swing.DefaultButtonModel;
import javax.swing.Icon;
import javax.swing.JButton;
class SoftEdgeButton extends JButton
{
private static final float arcwidth = 6.0f;
private static final float archeight = 6.0f;
protected static final int focusstroke = 2;
protected final Color currFocusBorderCol = new Color(100,113,200, 200);//(110,123,139, 200);//(100,150,255,200); //rgba
protected final Color pressedCol = new Color(197, 220, 250);//(230,230,230);
protected final Color hoverBorderCol = new Color(140,211,251);//(135,206,250);//Color.ORANGE;
protected final Color buttonCol = new Color(202, 225, 255);//(250, 250, 250);
protected final Color buttonBorderCol = Color.gray;
protected Shape shape;
protected Shape border;
protected Shape base;
public SoftEdgeButton() {
this(null, null);
}
public SoftEdgeButton(Icon icon) {
this(null, icon);
}
public SoftEdgeButton(String text) {
this(text, null);
}
public SoftEdgeButton(Action a) {
this();
setAction(a);
}
public SoftEdgeButton(String text, Icon icon) {
setModel(new DefaultButtonModel());
init(text, icon);
setContentAreaFilled(false);
setBackground(buttonCol);
initShape();
}
protected void initShape() {
if(!getBounds().equals(base)) {
base = getBounds();
shape = new RoundRectangle2D.Float(0, 0, getWidth()-1, getHeight()-1, arcwidth, archeight);
border = new RoundRectangle2D.Float(focusstroke, focusstroke,
getWidth()-1-focusstroke*2,
getHeight()-1-focusstroke*2,
arcwidth, archeight);
}
}
private void paintFocusAndRollover(Graphics2D g2, Color color) {
g2.setPaint(new GradientPaint(0, 0, color, getWidth()-1, getHeight()-1, color.brighter(), true));
g2.fill(shape);
g2.setPaint(new GradientPaint(0, 0, Color.WHITE, 0, (int)(getHeight()-1)/*-1*/, getBackground(), false));
//g2.setColor(getBackground());
g2.fill(border);
}
@Override protected void paintComponent(Graphics g) {
initShape();
Graphics2D g2 = (Graphics2D)g;
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
if(getModel().isArmed()) {
g2.setColor(pressedCol);
g2.fill(shape);
}else if(isRolloverEnabled() && getModel().isRollover()) {
paintFocusAndRollover(g2, hoverBorderCol);
}else if(hasFocus()) {
paintFocusAndRollover(g2, currFocusBorderCol);
}else{
g2.setPaint(new GradientPaint(0, 0, Color.WHITE, 0, (int)(getHeight()-1)/*-1*/, getBackground(), false));
//g2.setColor(getBackground());
g2.fill(shape);
}
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
g2.setColor(getBackground());
super.paintComponent(g2);
}
@Override protected void paintBorder(Graphics g) {
initShape();
Graphics2D g2 = (Graphics2D)g;
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2.setColor(buttonBorderCol);
g2.draw(shape);
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
}
@Override public boolean contains(int x, int y) {
initShape();
return shape.contains(x, y);
}
}
\ No newline at end of file
RSCAD 4.003.1aa
INFORMATION FILE: gtnet_skt_2point_tcp.inf
FILE TO DOWNLOAD: gtnet_skt_2point_tcp
FINISH TIME: 0.2 SECONDS
PRE-TRIGGER: 20%
PLOT DENSITY: EVERY POINT
METER UPDATE FREQUENCY: 1000
COMTRADE PLOT SAVE FREQUENCY: 50.0
COMPONENT: SLIDER
BOX AT (20,12), DIMENSIONS 170 x 150
NAME: Point
ICON: NONE
ICON AT: (176,99)
GROUP: (NONE)
GROUP: Subsystem #1|CTLs|Inputs
DESC: Point0
UNITS:
MIN: -2.147E7
MAX: 2.147E7
VALUE: 1718000.0
COMPONENT: BUTTON
BOX AT (120,180), DIMENSIONS 50 x 70
NAME:
ICON: NONE
ICON AT: (291,133)
GROUP: (NONE)
GROUP: Subsystem #1|CTLs|Inputs
DESC: Send
COMPONENT: METER
BOX AT (324,12), DIMENSIONS 115 x 150
NAME:
ICON: EXISTS
ICON AT: (484,68)
GROUP: (NONE)
GROUP: Subsystem #1|CTLs|Vars
DESC: rxCnt
UNITS:
MIN: 0.0
MAX: 10000.0
FONT_SIZE: 16
SHOW AS METER_2
COLOR FALSE
VISUAL_STYLE: 0
COMPONENT: METER
BOX AT (440,12), DIMENSIONS 115 x 150
NAME:
ICON: EXISTS
ICON AT: (484,68)
GROUP: (NONE)
GROUP: Subsystem #1|CTLs|Vars
DESC: txCnt
UNITS:
MIN: 0.0
MAX: 10000.0
FONT_SIZE: 16
SHOW AS METER_2
COLOR FALSE
VISUAL_STYLE: 0
COMPONENT: METER
BOX AT (556,12), DIMENSIONS 108 x 150
NAME:
ICON: EXISTS
ICON AT: (287,112)
GROUP: (NONE)
GROUP: Subsystem #1|GTNETSKT|GTNETSKT1
DESC: POINTIn0
UNITS: units
MIN: -100.0
MAX: 100.0
FONT_SIZE: 16
PRECISION: 4
SHOW AS METER_2
COLOR FALSE
VISUAL_STYLE: 0
COMPONENT: METER
BOX AT (192,16), DIMENSIONS 132 x 144
NAME:
ICON: EXISTS
ICON AT: (323,247)
GROUP: (NONE)
GROUP: Subsystem #1|CTLs|Vars
DESC: POINT0
UNITS:
MIN: 0.0
MAX: 1.0
FONT_SIZE: 16
PRECISION: 6
SHOW AS METER_2
COLOR FALSE
VISUAL_STYLE: 0
COMPONENT: METER
BOX AT (664,12), DIMENSIONS 116 x 148
NAME:
ICON: EXISTS
ICON AT: (287,112)
GROUP: (NONE)
GROUP: Subsystem #1|GTNETSKT|GTNETSKT1
DESC: POINTin1
UNITS: units
MIN: 0.0
MAX: 1.0
FONT_SIZE: 16
PRECISION: 9
SHOW AS METER_2
COLOR FALSE
VISUAL_STYLE: 0
"C:\RSCAD\BIN\rtdspc.exe" -PP -PSCAD_MASTER "C:\RSCAD" -PSCAD_USER "U:\ACS-Public\35_msv\15_msv-ufa\RSCAD_workspace" -PSCAD_PATH "C:\RSCAD\BIN" -CONFIG_FILE "C:\RSCAD\HDWR\config_file_02.txt" -case "U:\ACS-Public\35_msv\15_msv-ufa\RSCAD_workspace\fileman\GTNET_UDP_tests\GTSKT_tutorial\GTSKT\Standard_2pt_udp_loopback\gtnet_skt_2point_udp" -rack 7 -verbose -Options "C:\RSCAD\BIN\..\.\BIN\bat.options"
\ No newline at end of file
CASE: Test Circuit
Delt: 50.000000 us
Rack: 7 NoRealTime: 0
Output Desc="SendData" Group="Subsystem #1|CTLs|Vars" Units=" " Type=INT Min=0 Max=1 Rack=7 Adr=200410
Output Desc="txCnt" Group="Subsystem #1|CTLs|Vars" Units=" " Type=INT Min=0 Max=1 Rack=7 Adr=200414
Output Desc="POINT5" Group="Subsystem #1|CTLs|Vars" Units=" " Type=IEEE Min=0.0000 Max=1.0000 Rack=7 Adr=200418
Output Desc="POINT0" Group="Subsystem #1|CTLs|Vars" Units=" " Type=INT Min=0 Max=1 Rack=7 Adr=20041C
Output Desc="rxCnt" Group="Subsystem #1|CTLs|Vars" Units=" " Type=INT Min=0 Max=1 Rack=7 Adr=200420
Output Desc="readyToSen" Group="Subsystem #1|CTLs|Vars" Units=" " Type=INT Min=0 Max=1 Rack=7 Adr=200424
Output Desc="POINTIn0" Group="Subsystem #1|GTNETSKT|GTNETSKT1" Units="units" Type=INT Min=0 Max=1 Rack=7 Adr=200428
Output Desc="POINTin1" Group="Subsystem #1|GTNETSKT|GTNETSKT1" Units="units" Type=INT Min=0 Max=1 Rack=7 Adr=20042C
Output Desc="POINTin2" Group="Subsystem #1|GTNETSKT|GTNETSKT1" Units="units" Type=INT Min=0 Max=1 Rack=7 Adr=200430
Output Desc="POINTin3" Group="Subsystem #1|GTNETSKT|GTNETSKT1" Units="units" Type=INT Min=0 Max=1 Rack=7 Adr=200434
Output Desc="POINTin4" Group="Subsystem #1|GTNETSKT|GTNETSKT1" Units="units" Type=IEEE Min=0.0000 Max=1.0000 Rack=7 Adr=200438
Pushbutton Desc="Send" Group="Subsystem #1|CTLs|Inputs" Type=INT P0=0 P1=1 Rack=7 Adr=784010
String Desc="CircuitTitle Annotation" Group="Annotation" InitValue="Test Circuit"
String Desc="Draft file" Group="Annotation" InitValue="Draft file: U:\ACS-Public\35_msv\15_msv-ufa\RSCAD_workspace\fileman\GTNET_UDP_tests\GTSKT_tutorial\GTSKT\Standard_2pt_udp_loopback\gtnet_skt_2point_udp.dft"
String Desc="Draft file modification date" Group="Time tags" InitValue="2016/12/22 19:14:48"
String Desc="Compile date" Group="Time tags" InitValue="2016/12/22 19:14:52"
COMPONENT_TIMING_INFORMATION:
timing_record: subsystem=1 processor=0 processor_type=GPC
timing_record: subsystem=1 processor=1 processor_type=GPC
timing_record: subsystem=1 processor=2 processor_type=GPC
timing_record: subsystem=1 processor=3 processor_type=GPC
timing_record: subsystem=1 processor=4 processor_type=GPC
timing_record: subsystem=1 processor=5 processor_type=GPC
timing_record: subsystem=1 processor=6 processor_type=GPC
timing_record: subsystem=1 processor=7 processor_type=GPC
timing_record: subsystem=1 processor=8 processor_type=PB5
timing_record: subsystem=1 processor=9 processor_type=PB5
timing_record: subsystem=1 processor_type=3PC processor_count=0
timing_record: timing_name=Send component_type=RISC_PB subsystem=1 processor=2 processor_type=GPC clock_index=3 enabled=false use=CTLS lf=0.000000 logical_proc=1
timing_record: timing_name=edgedet_cb component_type=RISC_CMODEL subsystem=1 processor=2 processor_type=GPC clock_index=4 enabled=true use=CTLS lf=0.000000 logical_proc=1
timing_record: timing_name=UPDOWNC component_type=RISC_CMODEL subsystem=1 processor=2 processor_type=GPC clock_index=5 enabled=true use=CTLS lf=0.000000 logical_proc=1
timing_record: timing_name=TIMERC component_type=RISC_CMODEL subsystem=1 processor=2 processor_type=GPC clock_index=6 enabled=true use=CTLS lf=0.000000 logical_proc=1
timing_record: timing_name=UPDOWNC component_type=RISC_CMODEL subsystem=1 processor=2 processor_type=GPC clock_index=7 enabled=true use=CTLS lf=0.000000 logical_proc=1
timing_record: timing_name=gtnetskt component_type=RISC_CMODEL subsystem=1 processor=2 processor_type=GPC clock_index=8 enabled=true use=CTLS lf=0.000000 logical_proc=1
MESSAGES:
Compiling U:\ACS-Public\35_msv\15_msv-ufa\RSCAD_workspace\fileman\GTNET_UDP_tests\GTSKT_tutorial\GTSKT\Standard_2pt_udp_loopback\gtnet_skt_2point_udp.dft for RTDS rack 7...
Nodes and Wires...
Compiling subsystem ''
Electrical nodes found: 0
Running In Pre-Processor Mode (RTDSPCPP Inclusion)
REAL-TIME DIGITAL SIMULATOR POWER SYSTEM COMPILER
(c) Copyright 1994-2008 RTDS Technologies Inc.
Version C10.04
Compilation Time: 11:09:29 May 26 2015
Data file name: gtnet_skt_2point_udp.dtp
Inf file name: tmp.gtnet_skt_2point_udp.inf
Map file name: gtnet_skt_2point_udp.map
Output file name: gtnet_skt_2point_udp_r#
Configuration file directory: .
Configuration file name: C:\RSCAD\HDWR\config_file_02.txt
Title from data file: "Test Circuit"
Library file directory: C:\RSCAD/RTDS
Library file name: rt_sim.lib
Library file version: 62.57
Library file directory: C:\RSCAD/RTDS
Library file name: rpc.lib
Library file version: 24.53
Time-step used = 50.000000 us
Network Conductance Matrix Overlay Statistics:
Subsystem 1 contains 0 matrix overlays.
Control Component Statistics:
Subsystem 1 contains 32 control components.
End of process. Peak memory usage = 327438336 bytes
rtc terminated successfully.
CASE: Test Circuit
Delt: 50.000000 us
Backplane operation set to IEEE mode
+----------------------------------------------------------+
| |
| S U B S Y S T E M #01 |
| |
| mapped to |
| |
| R T D S R A C K #07 |
| |
+----------------------------------------------------------+
C O M P O N E N T P R O C E S S O R S
------------------------------------------------------------
RISC CONTROLS COMPONENTS(proc 1) --> RPC-GPC Card #2 Processor A
RISC edgedet_cb function
RISC UPDOWNC function
RISC TIMERC function
RISC UPDOWNC function
RISC gtnetskt function
Hidden T2 Transfer List
--------------------------------
BP_Address Signal_Type Signal_name
0x104 named_signal_prc SendData
0x105 named_signal_prc txCnt
0x106 named_signal_prc POINT5
0x107 named_signal_prc POINT0
0x108 named_signal_prc rxCnt
0x109 named_signal_prc readyToSen
0x10A named_signal_prc POINTIn0
0x10B named_signal_prc POINTin1
0x10C named_signal_prc POINTin2
0x10D named_signal_prc POINTin3
0x10E named_signal_prc POINTin4
T I M E - S T E P I N F O R M A T I O N
S U B S Y S T E M 1
==========================================================
Backplane Communication Speed = 60.000000 ns
T2 communication time 1.1400 us
Minimum time-step 3.1400 us
Common Current Injections: 0(local) + 0(xrack)
STARTING RACK NUMBER 7
# Proc ComponentType:Name Load
#----------------------------------------------------------------------------------------
SUBSYSTEM 1
#----------------------
2 ControlsProcessor1 100
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment