Browse Source

Scada crossbar

master
Evgeny Gagua 2 months ago
parent
commit
1ba9faf14d
  1. 1
      files.list
  2. 56
      lib/controller/doPlatformOperations.php
  3. 191
      lib/controller/getScadaEditor.php
  4. 38
      lib/controller/getScadaStatus.php
  5. 165
      lib/javascript/jsapi_dynamic/argus_settings.js
  6. BIN
      style/assets/sm_ico_gw.png
  7. 13
      style/style.css

1
files.list

@ -3424,6 +3424,7 @@
./style/assets/vspc-icon-256.png
./style/assets/igr.png
./style/assets/sm_ico_w.png
./style/assets/sm_ico_gw.png
./style/assets/1141811-512.png
./style/assets/ms_ul.png
./style/assets/sm_ico_rl.png

56
lib/controller/doPlatformOperations.php

@ -398,6 +398,62 @@
$LOG->reg_op( $_POST );
break;
};
case 21:{ // change Crossbar Output 'A'
$SCA = intval( $_POST['SCA'] );
$NMD = intval( $_POST['OPCODE'] );
if( $OID == 0 ) {
$Data['msg']='Wrong Parameters!';
echo json_encode( $Data );
exit();
};
$QS="UPDATE `modbus_modules` SET `crossbar_a` = {$NMD} WHERE `platform_id`={$OID} AND `id`={$SCA}";
$DATABASE->Query( $QS );
$Data['success'] = true;
$LOG->reg_op( $_POST );
break;
};
case 22:{ // change Crossbar Output 'A'
$SCA = intval( $_POST['SCA'] );
$NMD = intval( $_POST['OPCODE'] );
if( $OID == 0 ) {
$Data['msg']='Wrong Parameters!';
echo json_encode( $Data );
exit();
};
$QS="UPDATE `modbus_modules` SET `crossbar_b` = {$NMD} WHERE `platform_id`={$OID} AND `id`={$SCA}";
$DATABASE->Query( $QS );
$Data['success'] = true;
$LOG->reg_op( $_POST );
break;
};
case 23:{ // change Crossbar Output 'A'
$SCA = intval( $_POST['SCA'] );
$NMD = intval( $_POST['OPCODE'] );
if( $OID == 0 ) {
$Data['msg']='Wrong Parameters!';
echo json_encode( $Data );
exit();
};
$QS="UPDATE `modbus_modules` SET `crossbar_c` = {$NMD} WHERE `platform_id`={$OID} AND `id`={$SCA}";
$DATABASE->Query( $QS );
$Data['success'] = true;
$LOG->reg_op( $_POST );
break;
};
case 24:{ // change Crossbar Output 'A'
$SCA = intval( $_POST['SCA'] );
$NMD = intval( $_POST['OPCODE'] );
if( $OID == 0 ) {
$Data['msg']='Wrong Parameters!';
echo json_encode( $Data );
exit();
};
$QS="UPDATE `modbus_modules` SET `crossbar_d` = {$NMD} WHERE `platform_id`={$OID} AND `id`={$SCA}";
$DATABASE->Query( $QS );
$Data['success'] = true;
$LOG->reg_op( $_POST );
break;
};
case 200:{ //Remove Platform
if( $OID ){
$QS = "SELECT `id` FROM `metro_tracks` WHERE `platform_id`={$OID}";

191
lib/controller/getScadaEditor.php

@ -31,12 +31,13 @@
xtype: 'panel',
border: false,
frame: false,
html: '<table width="100%" border=0><tr><td class="small_prop_logo" id="adam">&nbsp;</td></tr></table>'
width: 160,
html: '<table width="128px" border=0><tr><td class="medium_prop_logo" id="adam">&nbsp;</td></tr></table>'
},{
xtype: 'form',
border: false,
frame: false,
labelWidth: 150,
labelWidth: 100,
labelAlign: 'right',
width: '100%',
items:[{
@ -44,6 +45,9 @@
border: false,
frame: false,
html: '<table width="100%" border=0><tr><td class="small_prop_title" align="center" style="font-size: 14px; font-weight: bold;">{$Labels->GetLabel('_MODBUS_RTU_')}:{$SC['label']}</td><td><img id="scae_onl_sts" src="/style/assets/bul_gray.png"></td></tr></table>'
},{
xtype: 'spacer',
height: 5
},{
xtype: 'textfield',
id: 'sca_label',
@ -100,7 +104,7 @@
value: '{$SC['port']}',
listeners:{
change: function( a, c, b ){
doPlatformOperation( {$SC['platform_id']}, 16, c, true );
doScadaOperation( {$SC['platform_id']}, {$SC['id']}, 16, c, true );
}
}
}]
@ -131,6 +135,7 @@
html: 'AUX Signal'
},{
xtype: 'combo',
id: 'sce_cb_o_1',
lazyRender: true,
mode: 'local',
forceSelection: true,
@ -140,21 +145,22 @@
store: new Ext.data.ArrayStore({
fields: ['mode','mode_txt'],
data: [
[-1,'{$Labels->GetLabel('__DISABLED__')}'],
[0,'Coil D1'],[1,'Coil D2'],[2,'Coil D3'],[3,'Coil D4']
[0,'{$Labels->GetLabel('__DISABLED__')}'],
[1,'Coil D1'],[2,'Coil D2'],[3,'Coil D3'],[4,'Coil D4']
]
}),
valueField: 'mode',
displayField: 'mode_txt',
value: '{$SC['crossbar_a']}',
value: '0',
width: 120,
listeners:{
select: function( a, c, b ){
//doPlatformOperation( {$SC['platform_id']}, 12, b, true );
doScadaOperation( {$SC['platform_id']}, {$SC['id']}, 21, b, false );
}
}
},{
xtype: 'combo',
id: 'sce_cb_o_2',
lazyRender: true,
mode: 'local',
forceSelection: true,
@ -164,21 +170,22 @@
store: new Ext.data.ArrayStore({
fields: ['mode','mode_txt'],
data: [
[-1,'{$Labels->GetLabel('__DISABLED__')}'],
[0,'Coil D1'],[1,'Coil D2'],[2,'Coil D3'],[3,'Coil D4']
[0,'{$Labels->GetLabel('__DISABLED__')}'],
[1,'Coil D1'],[2,'Coil D2'],[3,'Coil D3'],[4,'Coil D4']
]
}),
valueField: 'mode',
displayField: 'mode_txt',
value: '{$SC['crossbar_b']}',
value: '0',
width: 120,
listeners:{
select: function( a, c, b ){
//doPlatformOperation( {$SC['platform_id']}, 12, b, true );
doScadaOperation( {$SC['platform_id']}, {$SC['id']}, 22, b, false );
}
}
},{
xtype: 'combo',
id: 'sce_cb_o_3',
lazyRender: true,
mode: 'local',
forceSelection: true,
@ -188,21 +195,22 @@
store: new Ext.data.ArrayStore({
fields: ['mode','mode_txt'],
data: [
[-1,'{$Labels->GetLabel('__DISABLED__')}'],
[0,'Coil D1'],[1,'Coil D2'],[2,'Coil D3'],[3,'Coil D4']
[0,'{$Labels->GetLabel('__DISABLED__')}'],
[1,'Coil D1'],[2,'Coil D2'],[3,'Coil D3'],[4,'Coil D4']
]
}),
valueField: 'mode',
displayField: 'mode_txt',
value: '{$SC['crossbar_c']}',
value: '0',
width: 120,
listeners:{
select: function( a, c, b ){
//doPlatformOperation( {$SC['platform_id']}, 12, b, true );
doScadaOperation( {$SC['platform_id']}, {$SC['id']}, 23, b, false );
}
}
},{
xtype: 'combo',
id: 'sce_cb_o_4',
lazyRender: true,
mode: 'local',
forceSelection: true,
@ -212,32 +220,23 @@
store: new Ext.data.ArrayStore({
fields: ['mode','mode_txt'],
data: [
[-1,'{$Labels->GetLabel('__DISABLED__')}'],
[0,'Coil D1'],[1,'Coil D2'],[2,'Coil D3'],[3,'Coil D4']
[0,'{$Labels->GetLabel('__DISABLED__')}'],
[1,'Coil D1'],[2,'Coil D2'],[3,'Coil D3'],[4,'Coil D4']
]
}),
valueField: 'mode',
displayField: 'mode_txt',
value: '{$SC['crossbar_d']}',
value: '0',
width: 120,
listeners:{
select: function( a, c, b ){
//doPlatformOperation( {$SC['platform_id']}, 12, b, true );
doScadaOperation( {$SC['platform_id']}, {$SC['id']}, 24, b, false );
}
}
},{
xtype: 'spacer',
height: 10,
colspan: 4
},{
xtype: 'panel',
colspan: 4,
bodyCssClass:'_infoPanel', bodyStyle: 'font-size: 10px; background-color: #000; text-align: center;',
html: 'TEST MODBUS MODULE COILS'
},{
xtype: 'spacer',
height: 5,
colspan: 4
},{
xtype: 'button',
id: 'sc_tbtn_1',
@ -246,6 +245,7 @@
width: '80%',
text: 'Test D1',
pressed: {$P1},
disabled: true,
handler: function( b, e ){
b.disable();
if( b.pressed ){
@ -262,6 +262,7 @@
allowDepress: true,
text: 'Test D2',
pressed: {$P2},
disabled: true,
handler: function( b, e ){
b.disable();
if( b.pressed ){
@ -278,6 +279,7 @@
width: '80%',
text: 'Test D3',
pressed: {$P3},
disabled: true,
handler: function( b, e ){
b.disable();
if( b.pressed ){
@ -294,6 +296,7 @@
width: '80%',
text: 'Test D4',
pressed: {$P4},
disabled: true,
handler: function( b, e ){
b.disable();
if( b.pressed ){
@ -302,6 +305,130 @@
doPlatformOperation( {$SC['platform_id']}, 18, ({$CCCV} & ( ~8 ) ), false );
};
}
},{
xtype: 'spacer',
height: 5,
colspan: 4
},{
xtype: 'panel',
bodyCssClass:'_infoPanel', bodyStyle: 'font-size: 10px; background-color: #000; text-align: center;',
html: 'DI 0 <img id="sce_in_1_img" width="8px" src="/style/assets/sm_ico_gw.png">'
},{
xtype: 'panel',
bodyCssClass:'_infoPanel', bodyStyle: 'font-size: 10px; background-color: #000; text-align: center;',
html: 'DI 1 <img id="sce_in_2_img" width="8px" src="/style/assets/sm_ico_gw.png">'
},{
xtype: 'panel',
bodyCssClass:'_infoPanel', bodyStyle: 'font-size: 10px; background-color: #000; text-align: center;',
html: 'DI 2 <img id="sce_in_3_img" width="8px" src="/style/assets/sm_ico_gw.png">'
},{
xtype: 'panel',
bodyCssClass:'_infoPanel', bodyStyle: 'font-size: 10px; background-color: #000; text-align: center;',
html: 'DI 3 <img id="sce_in_4_img" width="8px" src="/style/assets/sm_ico_gw.png">'
},{
xtype: 'spacer',
height: 5,
colspan: 4
},{
xtype: 'combo',
id: 'sce_cb_i_1',
lazyRender: true,
mode: 'local',
forceSelection: true,
triggerAction: 'all',
editable: false,
disableKeyFilter: true,
store: new Ext.data.ArrayStore({
fields: ['mode','mode_txt'],
data: [
[0,'{$Labels->GetLabel('__DISABLED__')}'],
[1,'Upper Track'],[2,'Bottom Track'],[3,'Both']
]
}),
valueField: 'mode',
displayField: 'mode_txt',
value: '-1',
width: 120,
listeners:{
select: function( a, c, b ){
//doPlatformOperation( {$SC['platform_id']}, 12, b, true );
}
}
},{
xtype: 'combo',
id: 'sce_cb_i_2',
lazyRender: true,
mode: 'local',
forceSelection: true,
triggerAction: 'all',
editable: false,
disableKeyFilter: true,
store: new Ext.data.ArrayStore({
fields: ['mode','mode_txt'],
data: [
[0,'{$Labels->GetLabel('__DISABLED__')}'],
[1,'Upper Track'],[2,'Bottom Track'],[3,'Both']
]
}),
valueField: 'mode',
displayField: 'mode_txt',
value: '-1',
width: 120,
listeners:{
select: function( a, c, b ){
//doPlatformOperation( {$SC['platform_id']}, 12, b, true );
}
}
},{
xtype: 'combo',
id: 'sce_cb_i_3',
lazyRender: true,
mode: 'local',
forceSelection: true,
triggerAction: 'all',
editable: false,
disableKeyFilter: true,
store: new Ext.data.ArrayStore({
fields: ['mode','mode_txt'],
data: [
[0,'{$Labels->GetLabel('__DISABLED__')}'],
[1,'Upper Track'],[2,'Bottom Track'],[3,'Both']
]
}),
valueField: 'mode',
displayField: 'mode_txt',
value: '-1',
width: 120,
listeners:{
select: function( a, c, b ){
//doPlatformOperation( {$SC['platform_id']}, 12, b, true );
}
}
},{
xtype: 'combo',
id: 'sce_cb_i_4',
lazyRender: true,
mode: 'local',
forceSelection: true,
triggerAction: 'all',
editable: false,
disableKeyFilter: true,
store: new Ext.data.ArrayStore({
fields: ['mode','mode_txt'],
data: [
[0,'{$Labels->GetLabel('__DISABLED__')}'],
[1,'Upper Track'],[2,'Bottom Track'],[3,'Both']
]
}),
valueField: 'mode',
displayField: 'mode_txt',
value: '-1',
width: 120,
listeners:{
select: function( a, c, b ){
//doPlatformOperation( {$SC['platform_id']}, 12, b, true );
}
}
}]
},{
xtype: 'spacer',
@ -317,14 +444,10 @@
}],
listeners: {
afterrender: function( panel ){
console.log('Panel is Rendered');
fetchScadaEditorStatus();
},
beforedestroy: function(panel) {
// Return false to halt destruction
console.log('Panel is about to be destroyed');
},
destroy: function(panel) {
console.log('Panel has been destroyed');
stopScadaEditorStatusUpdate();
}
}
}

38
lib/controller/getScadaStatus.php

@ -14,12 +14,40 @@
if( $MID ){
unset( $Data['msg'] );
$Data['status'] = 'ok';
$QS = "SELECT `status`, `values`, `crossbar_a`,`crossbar_b`,`crossbar_c`,`crossbar_d` WHERE `id`={$MID}";
$QS = "SELECT `wm`, `status`, `values`, `crossbar_a`,`crossbar_b`,`crossbar_c`,`crossbar_d` FROM `modbus_modules` WHERE `id`={$MID}";
$RR = $DATABASE->Query( $QS, false );
$VV = intval( $RR[0]['values'];
$VO = $VV & 0xFF;
$VI = ($VV >> 8 ) & 0xFF;
if( $RR[0]['wm'] == 'E' ){
$Data['online'] = (intval($RR[0]['status']))?true:false;
if( $Data['online'] ){
$VV = intval( $RR[0]['values'] );
$VO = $VV & 0xFF;
$Data['outputs']=array();
$Data['outputs'][] = ($VO & 1)?true:false;
$Data['outputs'][] = ($VO & 2)?true:false;
$Data['outputs'][] = ($VO & 4)?true:false;
$Data['outputs'][] = ($VO & 8)?true:false;
$VI = ($VV >> 8 ) & 0xFF;
$Data['inputs']=array();
$Data['inputs'][] = ($VI & 1)?true:false;
$Data['inputs'][] = ($VI & 2)?true:false;
$Data['inputs'][] = ($VI & 4)?true:false;
$Data['inputs'][] = ($VI & 8)?true:false;
};
} else {
$Data['online'] = false;
};
$VV = intval( $RR[0]['crossbar_a'] );
$Data['cb_out_a'] = $VV & 0x0F;
$Data['cb_in_a'] = ( $VV >> 4 ) & 0x0F;
$VV = intval( $RR[0]['crossbar_b'] );
$Data['cb_out_b'] = $VV & 0x0F;
$Data['cb_in_b'] = ( $VV >> 4 ) & 0x0F;
$VV = intval( $RR[0]['crossbar_c'] );
$Data['cb_out_c'] = $VV & 0x0F;
$Data['cb_in_c'] = ( $VV >> 4 ) & 0x0F;
$VV = intval( $RR[0]['crossbar_d'] );
$Data['cb_out_d'] = $VV & 0x0F;
$Data['cb_in_d'] = ( $VV >> 4 ) & 0x0F;
};
};
break;

165
lib/javascript/jsapi_dynamic/argus_settings.js

@ -1188,32 +1188,165 @@ function stopScadaEditorStatusUpdate(){
};
function fetchScadaEditorStatus(){
clearTimeout( scadaEditorStatusTimeout );
if( scadaEditorStatusTimeout != null ) clearTimeout( scadaEditorStatusTimeout );
scadaEditorStatusTimeout = null;
Ext.Ajax.request({
url: '/lib/controller/getScadaStatus.php',
params: {
UID: <?=$UserID;?>,
SID: '<?=$Session;?>',
DID: devUploadID
MODE: 0,
MID: SelectedScadaModule
},
success: function( response, opts ){
var data = Ext.decode(response.responseText);
var tT = Ext.getCmp('upp_ttext');
if( tT != undefined ){
if( data.count > 0 ){
scadaEditorStatusTimeout = setTimeout( fetchScadaEditorStatus, 1000 );
};
if( data.current != undefined ){
tT.update('<p class="UPTTEXT">Uploading '+data.count+' file(s)</p>');
document.getElementById('upp_ctext').innerHTML ='<p class="UPCTEXT">Current File: '+data.current+'</p>';
Ext.getCmp('upp_pbar').updateProgress( data.progress, Math.round( data.progress*100 )+'%', true );
scadaEditorStatusTimeout = setTimeout( fetchScadaEditorStatus, 1000 );
var data = Ext.decode(response.responseText);
if( data.status == 'ok' ){
if( data.online ){
var lt = document.getElementById('scae_onl_sts');
if( lt != undefined ) lt.src = "/style/assets/bul_green.png";
lt = document.getElementById('sce_in_1_img');
if( data.inputs[0] ){
if( lt != undefined ) lt.src = "/style/assets/sm_ico_o.png";
} else {
if( lt != undefined ) lt.src = "/style/assets/sm_ico_gw.png";
};
lt = document.getElementById('sce_in_2_img');
if( data.inputs[1] ){
if( lt != undefined ) lt.src = "/style/assets/sm_ico_o.png";
} else {
if( lt != undefined ) lt.src = "/style/assets/sm_ico_gw.png";
};
lt = document.getElementById('sce_in_3_img');
if( data.inputs[2] ){
if( lt != undefined ) lt.src = "/style/assets/sm_ico_o.png";
} else {
if( lt != undefined ) lt.src = "/style/assets/sm_ico_gw.png";
};
lt = document.getElementById('sce_in_4_img');
if( data.inputs[3] ){
if( lt != undefined ) lt.src = "/style/assets/sm_ico_o.png";
} else {
if( lt != undefined ) lt.src = "/style/assets/sm_ico_gw.png";
};
var tT = Ext.getCmp('sc_tbtn_1');
if( tT != undefined ){
tT.enable();
tT.suspendEvents();
tT.toggle( data.outputs[0] );
tT.resumeEvents();
};
tT = Ext.getCmp('sc_tbtn_2');
if( tT != undefined ){
tT.enable();
tT.suspendEvents();
tT.toggle( data.outputs[1] );
tT.resumeEvents();
};
tT = Ext.getCmp('sc_tbtn_3');
if( tT != undefined ){
tT.enable();
tT.suspendEvents();
tT.toggle( data.outputs[2] );
tT.resumeEvents();
};
tT = Ext.getCmp('sc_tbtn_4');
if( tT != undefined ){
tT.enable();
tT.suspendEvents();
tT.toggle( data.outputs[3] );
tT.resumeEvents();
};
} else {
Ext.getCmp('upload_progres_panel').hide();
Ext.getCmp('uploaded_grid').show();
loadModuleFiles( devUploadID );
var lt = document.getElementById('scae_onl_sts');
if( lt != undefined ) lt.src = "/style/assets/bul_gray.png";
lt = document.getElementById('sce_in_1_img');
if( lt != undefined ) lt.src = "/style/assets/sm_ico_gw.png";
lt = document.getElementById('sce_in_2_img');
if( lt != undefined ) lt.src = "/style/assets/sm_ico_gw.png";
lt = document.getElementById('sce_in_3_img');
if( lt != undefined ) lt.src = "/style/assets/sm_ico_gw.png";
lt = document.getElementById('sce_in_4_img');
if( lt != undefined ) lt.src = "/style/assets/sm_ico_gw.png";
var tT = Ext.getCmp('sc_tbtn_1');
if( tT != undefined ){
tT.disable();
tT.suspendEvents();
tT.toggle( false );
tT.resumeEvents();
};
tT = Ext.getCmp('sc_tbtn_2');
if( tT != undefined ){
tT.disable();
tT.suspendEvents();
tT.toggle( false );
tT.resumeEvents();
};
tT = Ext.getCmp('sc_tbtn_3');
if( tT != undefined ){
tT.disable();
tT.suspendEvents();
tT.toggle( false );
tT.resumeEvents();
};
tT = Ext.getCmp('sc_tbtn_4');
if( tT != undefined ){
tT.disable();
tT.suspendEvents();
tT.toggle( false );
tT.resumeEvents();
};
};
var tT = Ext.getCmp('sce_cb_o_1');
if( tT != undefined ){
tT.suspendEvents();
tT.setValue( data.cb_out_a );
tT.resumeEvents();
};
tT = Ext.getCmp('sce_cb_o_2');
if( tT != undefined ){
tT.suspendEvents();
tT.setValue( data.cb_out_b );
tT.resumeEvents();
};
tT = Ext.getCmp('sce_cb_o_3');
if( tT != undefined ){
tT.suspendEvents();
tT.setValue( data.cb_out_c );
tT.resumeEvents();
};
tT = Ext.getCmp('sce_cb_o_4');
if( tT != undefined ){
tT.suspendEvents();
tT.setValue( data.cb_out_d );
tT.resumeEvents();
};
tT = Ext.getCmp('sce_cb_i_1');
if( tT != undefined ){
tT.suspendEvents();
tT.setValue( data.cb_in_a );
tT.resumeEvents();
};
tT = Ext.getCmp('sce_cb_i_2');
if( tT != undefined ){
tT.suspendEvents();
tT.setValue( data.cb_in_b );
tT.resumeEvents();
};
tT = Ext.getCmp('sce_cb_i_3');
if( tT != undefined ){
tT.suspendEvents();
tT.setValue( data.cb_in_c );
tT.resumeEvents();
};
tT = Ext.getCmp('sce_cb_i_4');
if( tT != undefined ){
tT.suspendEvents();
tT.setValue( data.cb_in_d );
tT.resumeEvents();
};
scadaEditorStatusTimeout = setTimeout( fetchScadaEditorStatus, 1000 );
} else {
//show error msg
};
},
failure: failureAJAXFunction

BIN
style/assets/sm_ico_gw.png

Binary file not shown.

After

Width: 16  |  Height: 16  |  Size: 642 B

13
style/style.css

@ -2316,6 +2316,19 @@ input[type="range"]:focus::-moz-range-thumb {
background-image: url("assets/adam-1.png")!important;
}
.medium_prop_logo{
width: 128px;
height: 128px;
border-radius: 64px;
}
.medium_prop_logo#adam{
background-color: orange;
background-repeat: no-repeat;
background-position: 12px 12px;
background-size: 100px 100px;
background-image: url("assets/adam-1.png")!important;
}
.small_vd_btn{
cursor: pointer;
background-color: yellow;

Loading…
Cancel
Save