wip: modbus ui for webrelay

This commit is contained in:
Yeongdo Park 2020-07-24 19:30:40 -07:00
parent e2f3ad1ccd
commit bdfc973137
5 changed files with 992 additions and 649 deletions

2
.idea/misc.xml generated
View file

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.7 (modbus-test)" project-jdk-type="Python SDK" />
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.7 (webrelay-modbus)" project-jdk-type="Python SDK" />
</project>

2
.idea/modbus-test.iml generated
View file

@ -4,7 +4,7 @@
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/venv" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="jdk" jdkName="Python 3.7 (webrelay-modbus)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View file

@ -9,27 +9,25 @@ import wx.grid
import wx.propgrid
import gettext
gettext.install(None)
from pubsub import pub
import re
from registers import regdict
print('pubsub API version', pub.VERSION_API)
from pubsub.utils.notification import useNotifyByWriteFile
import sys
useNotifyByWriteFile(sys.stdout)
import pprint
from pubsub import pub
import pubsub.utils.notification
import easymodbus.modbusClient
from registers import regdict
from stabiliti import StabilitiController as SC
from faults import faultInfo
from FaultView import FaultFrame
print('pubsub API version', pub.VERSION_API)
pubsub.utils.notification.useNotifyByWriteFile(sys.stdout)
class Controller:
def __init__(self, view):
self.sc = None
@ -39,6 +37,8 @@ class Controller:
self.refresh_rate = 2000
self.mode = False
self.mbclient = None
pub.subscribe(self.getFaultInfo, 'fault_selected')
pub.subscribe(self.startTimer, 'monitoring_started')
pub.subscribe(self.stopTimer, 'monitoring_stopped')
@ -58,21 +58,26 @@ class Controller:
self.sc.setUserStop()
def startTimer(self):
self.mbclient.connect()
self.timer.Start(self.refresh_rate)
def stopTimer(self):
self.mbclient.close()
self.timer.Stop()
def applyNetworkConfigs(self, ncDict):
if self.sc:
self.sc.checkClose()
if self.mbclient:
if self.mbclient.is_connected():
self.mbclient.close()
self.mbclient = easymodbus.modbusClient.ModbusClient(ncDict["ipaddr"], ncDict["port"])
self.mbclient.unitidentifier = ncDict["uid"]
self.refresh_rate = ncDict.pop("refresh")
self.sc = SC(**ncDict)
def resetNetworkConfigs(self):
if self.sc:
self.sc.checkClose()
self.sc = None
if self.mbclient:
if self.mbclient.is_connected():
self.mbclient.close()
self.mbclient = None
def resetPcsRemote(self):
if self.sc:
@ -102,52 +107,35 @@ class Controller:
def OnTimer(self, event):
# Read registers
self.sc.readAllRegisters()
relay_status = self.mbclient.read_coils(0,10)
# Process registers
# Show Registers
factivity = self.sc.readFaultActivity()
foccurence = self.sc.readFaultOccurence()
self.view.SetFaultGrid(factivity, foccurence)
stats = list(range(4))
stats[0], _ = (self.sc.getSystemStatus())
stats[1], _ = (self.sc.getPortStatusAC1())
stats[2], _ = (self.sc.getPortStatusDC2())
stats[3], _ = (self.sc.getPortStatusDC3())
self.view.update_status(list(map("\n".join, stats)))
'''
for item in self.writeQueue:
name, value = item
self.sc.write(name, value)
'''
for i, rstatus in enumerate(relay_status):
if rstatus:
self.view.indicators[i].SetValue("ON")
self.view.indicators[i].SetBackgroundColour(wx.Colour(0, 255, 0))
else:
self.view.indicators[i].SetValue("OFF")
self.view.indicators[i].SetBackgroundColour(wx.Colour(255, 0, 0))
class MyFrame(FaultFrame):
def __init__(self, *args, **kwds):
FaultFrame.__init__(self, *args, **kwds)
self.property_page = self.property_grid_1.AddPage("Ports")
self.property_page_etc = self.property_grid_1.AddPage("Etc")
for k in regdict:
prop = wx.propgrid.StringProperty(label=k, value="")
prop.SetHelpString(str(regdict[k]))
if re.search(r'^p[1-3]_', k):
self.property_page.Append(prop)
else:
self.property_page_etc.Append(prop)
self.property_page.Sort()
self.property_page_etc.Sort()
# self.property_page.SetPropertyAttributeAll("Raw", 0)
# self.property_page_etc.SetPropertyAttributeAll("Raw", 0)
self.property_grid_1.SetPropertyAttributeAll("Units", 0)
self.property_grid_1.SetColumnCount(3, self.property_page.GetIndex())
self.property_grid_1.SetColumnCount(3, self.property_page_etc.GetIndex())
self.property_grid_1.ShowHeader()
pub.subscribe(self.update_display, 'read_all_registers')
self.indicators = [
self.text_ctrl_1,
self.text_ctrl_2,
self.text_ctrl_3,
self.text_ctrl_4,
self.text_ctrl_5,
self.text_ctrl_6,
self.text_ctrl_7,
self.text_ctrl_8,
self.text_ctrl_9,
self.text_ctrl_10,
]
def update_status(self, stats):
self.text_ctrl_system_status.SetValue(stats[0])
@ -167,8 +155,6 @@ class MyFrame(FaultFrame):
self.property_page_etc.SetPropertyValue(k, str(v.convertValue(reg[v.address])))
self.property_page_etc.SetPropertyAttribute(k, "Units", str((reg[v.address])))
def OnFaultSelect(self, event): # wxGlade: MyFrame.<event_handler>
pub.sendMessage("fault_selected", pos=(event.GetRow(), event.GetCol()))
event.Skip()
@ -239,24 +225,15 @@ class MyFrame(FaultFrame):
def OnCheckSysOpMode(self, event):
pub.sendMessage("check_system_op_mode")
def OnOpStart(self, event):
mode = (self.choice_ac1_control.GetStringSelection(),
self.choice_dc2_control.GetStringSelection(),
self.choice_dc3_control.GetStringSelection())
inputs = {
"p1_real_pwr_setpt": self.text_ctrl_ac1_realpwr.Value,
"p1_react_pwr_setpt": self.text_ctrl_ac1_reactpwr.Value,
"p2_current_setpt": self.text_ctrl_dc2_current.Value,
"p2_power_setpt": self.text_ctrl_dc2_power.Value,
"p2_voltage_setpt": self.text_ctrl_dc2_voltage.Value,
"p3_current_setpt": self.text_ctrl_dc3_current.Value,
"p3_power_setpt": self.text_ctrl_dc3_power.Value,
"p3_voltage_setpt": self.text_ctrl_dc3_voltage.Value,
}
pub.sendMessage("start_system_op_manual", mode=mode, val=inputs)
def OnRelayOn(self, event):
event.Skip()
def OnRelayOff(self, event):
event.Skip()
def OnRelayPulse(self, event):
event.Skip()
def OnOpStop(self, event):
pub.sendMessage("stop_system_op_manual")
# end of class MyFrame
@ -268,9 +245,12 @@ class MyApp(wx.App):
self.frame.Show()
return True
# end of class MyApp
if __name__ == "__main__":
gettext.install("app") # replace with the appropriate catalog name
app = MyApp(0)
app.MainLoop()

View file

@ -1,11 +1,9 @@
# -*- coding: UTF-8 -*-
#
# generated by wxGlade 0.9.5 on Tue Feb 18 18:22:15 2020
# generated by wxGlade 0.9.6 on Fri Jul 24 15:09:44 2020
#
import wx
import wx.grid
import wx.propgrid
# begin wxGlade: dependencies
import gettext
@ -20,8 +18,8 @@ class FaultFrame(wx.Frame):
# begin wxGlade: FaultFrame.__init__
kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_FRAME_STYLE
wx.Frame.__init__(self, *args, **kwds)
self.SetSize((1099, 729))
self.input_ip = wx.TextCtrl(self, wx.ID_ANY, _("192.168.1.21"))
self.SetSize((411, 480))
self.input_ip = wx.TextCtrl(self, wx.ID_ANY, _("192.168.1.2"))
self.input_port = wx.TextCtrl(self, wx.ID_ANY, _("502"))
self.input_uid = wx.TextCtrl(self, wx.ID_ANY, _("240"))
self.input_refresh = wx.TextCtrl(self, wx.ID_ANY, _("2000"))
@ -29,34 +27,46 @@ class FaultFrame(wx.Frame):
self.apply_button = wx.Button(self, wx.ID_ANY, _("Apply"))
self.rreset_button = wx.Button(self, wx.ID_ANY, _("Remote PCS Reset"))
self.button_1 = wx.ToggleButton(self, wx.ID_ANY, _("Start"))
self.op_mode_button = wx.Button(self, wx.ID_ANY, _("System OP Mode"))
self.text_op_mode = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_READONLY)
self.text_ctrl_system_status = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_MULTILINE | wx.TE_READONLY)
self.text_ctrl_ac1_status = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_MULTILINE | wx.TE_READONLY)
self.text_ctrl_dc2_status = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_MULTILINE | wx.TE_READONLY)
self.text_ctrl_dc3_status = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_MULTILINE | wx.TE_READONLY)
self.fault_grid = wx.grid.Grid(self, wx.ID_ANY, size=(1, 1))
self.text_fault_doc = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_MULTILINE | wx.TE_READONLY)
self.text_fault_status = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_MULTILINE | wx.TE_READONLY)
self.panel_1 = wx.Panel(self, wx.ID_ANY)
self.button_2 = wx.Button(self.panel_1, wx.ID_ANY, _("Start"))
self.button_3 = wx.Button(self.panel_1, wx.ID_ANY, _("Stop"))
self.choice_ac1_control = wx.Choice(self.panel_1, wx.ID_ANY, choices=[_("IDLE"), _("NET"), _("GPWR"), _("FPWR")])
self.text_ctrl_ac1_realpwr = wx.TextCtrl(self.panel_1, wx.ID_ANY, _("0"))
self.text_ctrl_ac1_reactpwr = wx.TextCtrl(self.panel_1, wx.ID_ANY, _("0"))
self.choice_dc2_control = wx.Choice(self.panel_1, wx.ID_ANY, choices=[_("IDLE"), _("NET"), _("PV/MPPT"), _("CURR"), _("PWR"), _("VOLT")])
self.text_ctrl_dc2_current = wx.TextCtrl(self.panel_1, wx.ID_ANY, _("0"))
self.text_ctrl_dc2_power = wx.TextCtrl(self.panel_1, wx.ID_ANY, _("0"))
self.text_ctrl_dc2_voltage = wx.TextCtrl(self.panel_1, wx.ID_ANY, _("0"))
self.text_ctrl_7 = wx.TextCtrl(self.panel_1, wx.ID_ANY, "")
self.text_ctrl_8 = wx.TextCtrl(self.panel_1, wx.ID_ANY, "")
self.button_4 = wx.Button(self.panel_1, wx.ID_ANY, _("Enable Precharge"))
self.button_5 = wx.Button(self.panel_1, wx.ID_ANY, _("Disable Precharge"))
self.choice_dc3_control = wx.Choice(self.panel_1, wx.ID_ANY, choices=[_("IDLE"), _("NET"), _("PV/MPPT"), _("CURR"), _("PWR"), _("VOLT")])
self.text_ctrl_dc3_current = wx.TextCtrl(self.panel_1, wx.ID_ANY, _("0"))
self.text_ctrl_dc3_power = wx.TextCtrl(self.panel_1, wx.ID_ANY, _("0"))
self.text_ctrl_dc3_voltage = wx.TextCtrl(self.panel_1, wx.ID_ANY, _("0"))
self.property_grid_1 = wx.propgrid.PropertyGridManager(self, wx.ID_ANY, style=wx.propgrid.PG_DESCRIPTION | wx.propgrid.PG_TOOLBAR)
self.text_ctrl_1 = wx.TextCtrl(self, wx.ID_ANY, _("OFF"), style=wx.BORDER_NONE | wx.TE_CENTRE | wx.TE_READONLY)
self.button_2 = wx.Button(self, wx.ID_ANY, _("ON"))
self.button_3 = wx.Button(self, wx.ID_ANY, _("OFF"))
self.button_4 = wx.Button(self, wx.ID_ANY, _("PULSE"))
self.text_ctrl_2 = wx.TextCtrl(self, wx.ID_ANY, _("OFF"), style=wx.BORDER_NONE | wx.TE_CENTRE | wx.TE_READONLY)
self.button_5 = wx.Button(self, wx.ID_ANY, _("ON"))
self.button_6 = wx.Button(self, wx.ID_ANY, _("OFF"))
self.button_7 = wx.Button(self, wx.ID_ANY, _("PULSE"))
self.text_ctrl_3 = wx.TextCtrl(self, wx.ID_ANY, _("OFF"), style=wx.BORDER_NONE | wx.TE_CENTRE | wx.TE_READONLY)
self.button_8 = wx.Button(self, wx.ID_ANY, _("ON"))
self.button_9 = wx.Button(self, wx.ID_ANY, _("OFF"))
self.button_10 = wx.Button(self, wx.ID_ANY, _("PULSE"))
self.text_ctrl_4 = wx.TextCtrl(self, wx.ID_ANY, _("OFF"), style=wx.BORDER_NONE | wx.TE_CENTRE | wx.TE_READONLY)
self.button_11 = wx.Button(self, wx.ID_ANY, _("ON"))
self.button_12 = wx.Button(self, wx.ID_ANY, _("OFF"))
self.button_13 = wx.Button(self, wx.ID_ANY, _("PULSE"))
self.text_ctrl_5 = wx.TextCtrl(self, wx.ID_ANY, _("OFF"), style=wx.BORDER_NONE | wx.TE_CENTRE | wx.TE_READONLY)
self.button_14 = wx.Button(self, wx.ID_ANY, _("ON"))
self.button_15 = wx.Button(self, wx.ID_ANY, _("OFF"))
self.button_16 = wx.Button(self, wx.ID_ANY, _("PULSE"))
self.text_ctrl_6 = wx.TextCtrl(self, wx.ID_ANY, _("OFF"), style=wx.BORDER_NONE | wx.TE_CENTRE | wx.TE_READONLY)
self.button_17 = wx.Button(self, wx.ID_ANY, _("ON"))
self.button_18 = wx.Button(self, wx.ID_ANY, _("OFF"))
self.button_19 = wx.Button(self, wx.ID_ANY, _("PULSE"))
self.text_ctrl_7 = wx.TextCtrl(self, wx.ID_ANY, _("OFF"), style=wx.BORDER_NONE | wx.TE_CENTRE | wx.TE_READONLY)
self.button_20 = wx.Button(self, wx.ID_ANY, _("ON"))
self.button_21 = wx.Button(self, wx.ID_ANY, _("OFF"))
self.button_22 = wx.Button(self, wx.ID_ANY, _("PULSE"))
self.text_ctrl_8 = wx.TextCtrl(self, wx.ID_ANY, _("OFF"), style=wx.BORDER_NONE | wx.TE_CENTRE | wx.TE_READONLY)
self.button_23 = wx.Button(self, wx.ID_ANY, _("ON"))
self.button_24 = wx.Button(self, wx.ID_ANY, _("OFF"))
self.button_25 = wx.Button(self, wx.ID_ANY, _("PULSE"))
self.text_ctrl_9 = wx.TextCtrl(self, wx.ID_ANY, _("OFF"), style=wx.BORDER_NONE | wx.TE_CENTRE | wx.TE_READONLY)
self.button_26 = wx.Button(self, wx.ID_ANY, _("ON"))
self.button_27 = wx.Button(self, wx.ID_ANY, _("OFF"))
self.button_28 = wx.Button(self, wx.ID_ANY, _("PULSE"))
self.text_ctrl_10 = wx.TextCtrl(self, wx.ID_ANY, _("OFF"), style=wx.BORDER_NONE | wx.TE_CENTRE | wx.TE_READONLY)
self.button_29 = wx.Button(self, wx.ID_ANY, _("ON"))
self.button_30 = wx.Button(self, wx.ID_ANY, _("OFF"))
self.button_31 = wx.Button(self, wx.ID_ANY, _("PULSE"))
self.__set_properties()
self.__do_layout()
@ -65,10 +75,36 @@ class FaultFrame(wx.Frame):
self.Bind(wx.EVT_BUTTON, self.OnApply, self.apply_button)
self.Bind(wx.EVT_BUTTON, self.OnButtonRemoteReset, self.rreset_button)
self.Bind(wx.EVT_TOGGLEBUTTON, self.ToggleMonitoring, self.button_1)
self.Bind(wx.EVT_BUTTON, self.OnCheckSysOpMode, self.op_mode_button)
self.Bind(wx.grid.EVT_GRID_CMD_CELL_LEFT_CLICK, self.OnFaultSelect, self.fault_grid)
self.Bind(wx.EVT_BUTTON, self.OnOpStart, self.button_2)
self.Bind(wx.EVT_BUTTON, self.OnOpStop, self.button_3)
self.Bind(wx.EVT_BUTTON, self.OnRelayOn, self.button_2)
self.Bind(wx.EVT_BUTTON, self.OnRelayOff, self.button_3)
self.Bind(wx.EVT_BUTTON, self.OnRelayPulse, self.button_4)
self.Bind(wx.EVT_BUTTON, self.OnRelayOn, self.button_5)
self.Bind(wx.EVT_BUTTON, self.OnRelayOff, self.button_6)
self.Bind(wx.EVT_BUTTON, self.OnRelayPulse, self.button_7)
self.Bind(wx.EVT_BUTTON, self.OnRelayOn, self.button_8)
self.Bind(wx.EVT_BUTTON, self.OnRelayOff, self.button_9)
self.Bind(wx.EVT_BUTTON, self.OnRelayPulse, self.button_10)
self.Bind(wx.EVT_BUTTON, self.OnRelayOn, self.button_11)
self.Bind(wx.EVT_BUTTON, self.OnRelayOff, self.button_12)
self.Bind(wx.EVT_BUTTON, self.OnRelayPulse, self.button_13)
self.Bind(wx.EVT_BUTTON, self.OnRelayOn, self.button_14)
self.Bind(wx.EVT_BUTTON, self.OnRelayOff, self.button_15)
self.Bind(wx.EVT_BUTTON, self.OnRelayPulse, self.button_16)
self.Bind(wx.EVT_BUTTON, self.OnRelayOn, self.button_17)
self.Bind(wx.EVT_BUTTON, self.OnRelayOff, self.button_18)
self.Bind(wx.EVT_BUTTON, self.OnRelayPulse, self.button_19)
self.Bind(wx.EVT_BUTTON, self.OnRelayOn, self.button_20)
self.Bind(wx.EVT_BUTTON, self.OnRelayOff, self.button_21)
self.Bind(wx.EVT_BUTTON, self.OnRelayPulse, self.button_22)
self.Bind(wx.EVT_BUTTON, self.OnRelayOn, self.button_23)
self.Bind(wx.EVT_BUTTON, self.OnRelayOff, self.button_24)
self.Bind(wx.EVT_BUTTON, self.OnRelayPulse, self.button_25)
self.Bind(wx.EVT_BUTTON, self.OnRelayOn, self.button_26)
self.Bind(wx.EVT_BUTTON, self.OnRelayOff, self.button_27)
self.Bind(wx.EVT_BUTTON, self.OnRelayPulse, self.button_28)
self.Bind(wx.EVT_BUTTON, self.OnRelayOn, self.button_29)
self.Bind(wx.EVT_BUTTON, self.OnRelayOff, self.button_30)
self.Bind(wx.EVT_BUTTON, self.OnRelayPulse, self.button_31)
# end wxGlade
def __set_properties(self):
@ -76,50 +112,34 @@ class FaultFrame(wx.Frame):
self.SetTitle(_("PCS Controller"))
self.rreset_button.Enable(False)
self.button_1.Enable(False)
self.fault_grid.CreateGrid(8, 8)
self.fault_grid.SetRowLabelSize(30)
self.fault_grid.SetColLabelSize(30)
self.fault_grid.EnableEditing(0)
self.fault_grid.EnableDragColSize(0)
self.fault_grid.EnableDragRowSize(0)
self.fault_grid.EnableDragGridSize(0)
self.fault_grid.SetColSize(0, 30)
self.fault_grid.SetColSize(1, 30)
self.fault_grid.SetColSize(2, 30)
self.fault_grid.SetColSize(3, 30)
self.fault_grid.SetColSize(4, 30)
self.fault_grid.SetColSize(5, 30)
self.fault_grid.SetColSize(6, 30)
self.fault_grid.SetColSize(7, 30)
self.fault_grid.SetRowSize(0, 30)
self.fault_grid.SetRowSize(1, 30)
self.fault_grid.SetRowSize(2, 30)
self.fault_grid.SetRowSize(3, 30)
self.fault_grid.SetRowSize(4, 30)
self.fault_grid.SetRowSize(5, 30)
self.fault_grid.SetRowSize(6, 30)
self.fault_grid.SetRowSize(7, 30)
self.fault_grid.SetMinSize((270, 270))
self.choice_ac1_control.SetSelection(0)
self.choice_dc2_control.SetSelection(0)
self.choice_dc3_control.SetSelection(0)
self.text_ctrl_1.SetBackgroundColour(wx.Colour(255, 0, 0))
self.text_ctrl_2.SetBackgroundColour(wx.Colour(255, 0, 0))
self.text_ctrl_3.SetBackgroundColour(wx.Colour(255, 0, 0))
self.text_ctrl_4.SetBackgroundColour(wx.Colour(255, 0, 0))
self.text_ctrl_5.SetBackgroundColour(wx.Colour(255, 0, 0))
self.text_ctrl_6.SetBackgroundColour(wx.Colour(255, 0, 0))
self.text_ctrl_7.SetBackgroundColour(wx.Colour(255, 0, 0))
self.text_ctrl_8.SetBackgroundColour(wx.Colour(255, 0, 0))
self.text_ctrl_9.SetBackgroundColour(wx.Colour(255, 0, 0))
self.text_ctrl_10.SetBackgroundColour(wx.Colour(255, 0, 0))
# end wxGlade
def __do_layout(self):
# begin wxGlade: FaultFrame.__do_layout
sizer_1 = wx.BoxSizer(wx.HORIZONTAL)
sizer_2 = wx.BoxSizer(wx.VERTICAL)
sizer_11 = wx.StaticBoxSizer(wx.StaticBox(self.panel_1, wx.ID_ANY, _("DC3 Port")), wx.HORIZONTAL)
grid_sizer_2 = wx.GridSizer(4, 2, 0, 0)
sizer_10 = wx.StaticBoxSizer(wx.StaticBox(self.panel_1, wx.ID_ANY, _("DC2 Port")), wx.HORIZONTAL)
grid_sizer_1 = wx.GridSizer(7, 2, 0, 0)
sizer_9 = wx.StaticBoxSizer(wx.StaticBox(self.panel_1, wx.ID_ANY, _("AC1 Port")), wx.HORIZONTAL)
grid_sizer_3 = wx.GridSizer(3, 2, 0, 0)
sizer_5 = wx.StaticBoxSizer(wx.StaticBox(self.panel_1, wx.ID_ANY, _("Manual Mode Control")), wx.HORIZONTAL)
sizer_3 = wx.BoxSizer(wx.VERTICAL)
sizer_7 = wx.BoxSizer(wx.VERTICAL)
sizer_8 = wx.BoxSizer(wx.VERTICAL)
sizer_4 = wx.GridSizer(7, 2, 0, 0)
sizer_14 = wx.BoxSizer(wx.HORIZONTAL)
sizer_13 = wx.BoxSizer(wx.HORIZONTAL)
sizer_12 = wx.BoxSizer(wx.HORIZONTAL)
sizer_11 = wx.BoxSizer(wx.HORIZONTAL)
sizer_10 = wx.BoxSizer(wx.HORIZONTAL)
sizer_9 = wx.BoxSizer(wx.HORIZONTAL)
sizer_6 = wx.BoxSizer(wx.HORIZONTAL)
sizer_5 = wx.BoxSizer(wx.HORIZONTAL)
sizer_3 = wx.BoxSizer(wx.HORIZONTAL)
sizer_2 = wx.BoxSizer(wx.HORIZONTAL)
sizer_4 = wx.GridSizer(6, 2, 0, 0)
label_1 = wx.StaticText(self, wx.ID_ANY, _("IP Address"))
sizer_4.Add(label_1, 0, 0, 0)
sizer_4.Add(self.input_ip, 0, 0, 0)
@ -136,84 +156,100 @@ class FaultFrame(wx.Frame):
sizer_4.Add(self.apply_button, 0, 0, 0)
sizer_4.Add(self.rreset_button, 0, 0, 0)
sizer_4.Add(self.button_1, 0, 0, 0)
sizer_4.Add(self.op_mode_button, 0, 0, 0)
sizer_4.Add(self.text_op_mode, 0, 0, 0)
sizer_7.Add(sizer_4, 0, wx.EXPAND, 0)
label_21 = wx.StaticText(self, wx.ID_ANY, _("System Status"))
sizer_8.Add(label_21, 0, 0, 0)
sizer_8.Add(self.text_ctrl_system_status, 1, wx.EXPAND, 0)
label_22 = wx.StaticText(self, wx.ID_ANY, _("AC1 Status"))
sizer_8.Add(label_22, 0, 0, 0)
sizer_8.Add(self.text_ctrl_ac1_status, 1, wx.EXPAND, 0)
label_23 = wx.StaticText(self, wx.ID_ANY, _("DC2 Statu"))
sizer_8.Add(label_23, 0, 0, 0)
sizer_8.Add(self.text_ctrl_dc2_status, 1, wx.EXPAND, 0)
label_24 = wx.StaticText(self, wx.ID_ANY, _("DC3 Status"))
sizer_8.Add(label_24, 0, 0, 0)
sizer_8.Add(self.text_ctrl_dc3_status, 1, wx.EXPAND, 0)
sizer_7.Add((20, 20), 0, wx.EXPAND, 0)
label_5 = wx.StaticText(self, wx.ID_ANY, _("Relay 1"))
sizer_2.Add(label_5, 0, 0, 0)
sizer_2.Add((20, 20), 0, 0, 0)
sizer_2.Add(self.text_ctrl_1, 0, 0, 0)
sizer_2.Add((20, 20), 0, 0, 0)
sizer_2.Add(self.button_2, 0, 0, 0)
sizer_2.Add(self.button_3, 0, 0, 0)
sizer_2.Add(self.button_4, 0, 0, 0)
sizer_8.Add(sizer_2, 1, wx.ALIGN_CENTER_HORIZONTAL, 0)
label_6 = wx.StaticText(self, wx.ID_ANY, _("Relay 2"))
sizer_3.Add(label_6, 0, 0, 0)
sizer_3.Add((20, 20), 0, 0, 0)
sizer_3.Add(self.text_ctrl_2, 0, 0, 0)
sizer_3.Add((20, 20), 0, 0, 0)
sizer_3.Add(self.button_5, 0, 0, 0)
sizer_3.Add(self.button_6, 0, 0, 0)
sizer_3.Add(self.button_7, 0, 0, 0)
sizer_8.Add(sizer_3, 1, wx.ALIGN_CENTER_HORIZONTAL, 0)
label_7 = wx.StaticText(self, wx.ID_ANY, _("Relay 3"))
sizer_5.Add(label_7, 0, 0, 0)
sizer_5.Add((20, 20), 0, 0, 0)
sizer_5.Add(self.text_ctrl_3, 0, 0, 0)
sizer_5.Add((20, 20), 0, 0, 0)
sizer_5.Add(self.button_8, 0, 0, 0)
sizer_5.Add(self.button_9, 0, 0, 0)
sizer_5.Add(self.button_10, 0, 0, 0)
sizer_8.Add(sizer_5, 1, wx.ALIGN_CENTER_HORIZONTAL, 0)
label_8 = wx.StaticText(self, wx.ID_ANY, _("Relay 4"))
sizer_6.Add(label_8, 0, 0, 0)
sizer_6.Add((20, 20), 0, 0, 0)
sizer_6.Add(self.text_ctrl_4, 0, 0, 0)
sizer_6.Add((20, 20), 0, 0, 0)
sizer_6.Add(self.button_11, 0, 0, 0)
sizer_6.Add(self.button_12, 0, 0, 0)
sizer_6.Add(self.button_13, 0, 0, 0)
sizer_8.Add(sizer_6, 1, wx.ALIGN_CENTER_HORIZONTAL, 0)
label_9 = wx.StaticText(self, wx.ID_ANY, _("Relay 5"))
sizer_9.Add(label_9, 0, 0, 0)
sizer_9.Add((20, 20), 0, 0, 0)
sizer_9.Add(self.text_ctrl_5, 0, 0, 0)
sizer_9.Add((20, 20), 0, 0, 0)
sizer_9.Add(self.button_14, 0, 0, 0)
sizer_9.Add(self.button_15, 0, 0, 0)
sizer_9.Add(self.button_16, 0, 0, 0)
sizer_8.Add(sizer_9, 1, wx.ALIGN_CENTER_HORIZONTAL, 0)
label_10 = wx.StaticText(self, wx.ID_ANY, _("Relay 6"))
sizer_10.Add(label_10, 0, 0, 0)
sizer_10.Add((20, 20), 0, 0, 0)
sizer_10.Add(self.text_ctrl_6, 0, 0, 0)
sizer_10.Add((20, 20), 0, 0, 0)
sizer_10.Add(self.button_17, 0, 0, 0)
sizer_10.Add(self.button_18, 0, 0, 0)
sizer_10.Add(self.button_19, 0, 0, 0)
sizer_8.Add(sizer_10, 1, wx.ALIGN_CENTER_HORIZONTAL, 0)
label_11 = wx.StaticText(self, wx.ID_ANY, _("Relay 7"))
sizer_11.Add(label_11, 0, 0, 0)
sizer_11.Add((20, 20), 0, 0, 0)
sizer_11.Add(self.text_ctrl_7, 0, 0, 0)
sizer_11.Add((20, 20), 0, 0, 0)
sizer_11.Add(self.button_20, 0, 0, 0)
sizer_11.Add(self.button_21, 0, 0, 0)
sizer_11.Add(self.button_22, 0, 0, 0)
sizer_8.Add(sizer_11, 1, wx.ALIGN_CENTER_HORIZONTAL, 0)
label_12 = wx.StaticText(self, wx.ID_ANY, _("Relay 8"))
sizer_12.Add(label_12, 0, 0, 0)
sizer_12.Add((20, 20), 0, 0, 0)
sizer_12.Add(self.text_ctrl_8, 0, 0, 0)
sizer_12.Add((20, 20), 0, 0, 0)
sizer_12.Add(self.button_23, 0, 0, 0)
sizer_12.Add(self.button_24, 0, 0, 0)
sizer_12.Add(self.button_25, 0, 0, 0)
sizer_8.Add(sizer_12, 1, wx.ALIGN_CENTER_HORIZONTAL, 0)
label_13 = wx.StaticText(self, wx.ID_ANY, _("Relay 9"))
sizer_13.Add(label_13, 0, 0, 0)
sizer_13.Add((20, 20), 0, 0, 0)
sizer_13.Add(self.text_ctrl_9, 0, 0, 0)
sizer_13.Add((20, 20), 0, 0, 0)
sizer_13.Add(self.button_26, 0, 0, 0)
sizer_13.Add(self.button_27, 0, 0, 0)
sizer_13.Add(self.button_28, 0, 0, 0)
sizer_8.Add(sizer_13, 1, wx.ALIGN_CENTER_HORIZONTAL, 0)
label_14 = wx.StaticText(self, wx.ID_ANY, _("Relay 10"))
sizer_14.Add(label_14, 0, 0, 0)
sizer_14.Add((20, 20), 0, 0, 0)
sizer_14.Add(self.text_ctrl_10, 0, 0, 0)
sizer_14.Add((20, 20), 0, 0, 0)
sizer_14.Add(self.button_29, 0, 0, 0)
sizer_14.Add(self.button_30, 0, 0, 0)
sizer_14.Add(self.button_31, 0, 0, 0)
sizer_8.Add(sizer_14, 1, wx.ALIGN_CENTER_HORIZONTAL, 0)
sizer_7.Add(sizer_8, 1, wx.EXPAND, 0)
sizer_1.Add(sizer_7, 1, wx.EXPAND, 0)
sizer_3.Add(self.fault_grid, 0, wx.ALIGN_CENTER, 0)
label_25 = wx.StaticText(self, wx.ID_ANY, _("Fault Info (Documented)"))
sizer_3.Add(label_25, 0, 0, 0)
sizer_3.Add(self.text_fault_doc, 1, wx.EXPAND, 0)
label_26 = wx.StaticText(self, wx.ID_ANY, _("Fault Status"))
sizer_3.Add(label_26, 0, 0, 0)
sizer_3.Add(self.text_fault_status, 1, wx.EXPAND, 0)
sizer_1.Add(sizer_3, 1, wx.EXPAND, 0)
sizer_5.Add(self.button_2, 0, 0, 0)
sizer_5.Add(self.button_3, 0, 0, 0)
sizer_2.Add(sizer_5, 0, 0, 0)
label_8 = wx.StaticText(self.panel_1, wx.ID_ANY, _("Control Method"))
grid_sizer_3.Add(label_8, 0, 0, 0)
grid_sizer_3.Add(self.choice_ac1_control, 0, 0, 0)
label_11 = wx.StaticText(self.panel_1, wx.ID_ANY, _("Real Power Setpoint"))
grid_sizer_3.Add(label_11, 0, 0, 0)
grid_sizer_3.Add(self.text_ctrl_ac1_realpwr, 0, 0, 0)
label_12 = wx.StaticText(self.panel_1, wx.ID_ANY, _("Reactive Power Setpoint"))
grid_sizer_3.Add(label_12, 0, 0, 0)
grid_sizer_3.Add(self.text_ctrl_ac1_reactpwr, 0, 0, 0)
sizer_9.Add(grid_sizer_3, 1, wx.EXPAND, 0)
sizer_2.Add(sizer_9, 1, wx.EXPAND, 0)
label_9 = wx.StaticText(self.panel_1, wx.ID_ANY, _("Contol Method"))
grid_sizer_1.Add(label_9, 0, 0, 0)
grid_sizer_1.Add(self.choice_dc2_control, 0, 0, 0)
label_19 = wx.StaticText(self.panel_1, wx.ID_ANY, _("Current Setpoint"))
grid_sizer_1.Add(label_19, 0, 0, 0)
grid_sizer_1.Add(self.text_ctrl_dc2_current, 0, 0, 0)
label_13 = wx.StaticText(self.panel_1, wx.ID_ANY, _("Power Setpoint"))
grid_sizer_1.Add(label_13, 0, 0, 0)
grid_sizer_1.Add(self.text_ctrl_dc2_power, 0, 0, 0)
label_14 = wx.StaticText(self.panel_1, wx.ID_ANY, _("Voltage Setpoint"))
grid_sizer_1.Add(label_14, 0, 0, 0)
grid_sizer_1.Add(self.text_ctrl_dc2_voltage, 0, 0, 0)
label_17 = wx.StaticText(self.panel_1, wx.ID_ANY, _("Precharge Limit Low"))
grid_sizer_1.Add(label_17, 0, 0, 0)
label_18 = wx.StaticText(self.panel_1, wx.ID_ANY, _("Precharge Limit High"))
grid_sizer_1.Add(label_18, 0, 0, 0)
grid_sizer_1.Add(self.text_ctrl_7, 0, 0, 0)
grid_sizer_1.Add(self.text_ctrl_8, 0, 0, 0)
grid_sizer_1.Add(self.button_4, 0, 0, 0)
grid_sizer_1.Add(self.button_5, 0, 0, 0)
sizer_10.Add(grid_sizer_1, 1, wx.EXPAND, 0)
sizer_2.Add(sizer_10, 1, wx.EXPAND, 0)
label_10 = wx.StaticText(self.panel_1, wx.ID_ANY, _("Control Method"))
grid_sizer_2.Add(label_10, 0, 0, 0)
grid_sizer_2.Add(self.choice_dc3_control, 0, 0, 0)
label_20 = wx.StaticText(self.panel_1, wx.ID_ANY, _("Current Setpoint"))
grid_sizer_2.Add(label_20, 0, 0, 0)
grid_sizer_2.Add(self.text_ctrl_dc3_current, 0, 0, 0)
label_15 = wx.StaticText(self.panel_1, wx.ID_ANY, _("Power Setpoint"))
grid_sizer_2.Add(label_15, 0, 0, 0)
grid_sizer_2.Add(self.text_ctrl_dc3_power, 0, 0, 0)
label_16 = wx.StaticText(self.panel_1, wx.ID_ANY, _("Voltage Setpoint"))
grid_sizer_2.Add(label_16, 0, 0, 0)
grid_sizer_2.Add(self.text_ctrl_dc3_voltage, 0, 0, 0)
sizer_11.Add(grid_sizer_2, 1, wx.ALL | wx.EXPAND, 1)
sizer_2.Add(sizer_11, 1, wx.EXPAND, 0)
self.panel_1.SetSizer(sizer_2)
sizer_1.Add(self.panel_1, 1, wx.EXPAND, 0)
sizer_1.Add(self.property_grid_1, 1, wx.EXPAND, 0)
self.SetSizer(sizer_1)
self.Layout()
# end wxGlade
@ -234,20 +270,16 @@ class FaultFrame(wx.Frame):
print("Event handler 'ToggleMonitoring' not implemented!")
event.Skip()
def OnCheckSysOpMode(self, event): # wxGlade: FaultFrame.<event_handler>
print("Event handler 'OnCheckSysOpMode' not implemented!")
def OnRelayOn(self, event): # wxGlade: FaultFrame.<event_handler>
print("Event handler 'OnRelayOn' not implemented!")
event.Skip()
def OnFaultSelect(self, event): # wxGlade: FaultFrame.<event_handler>
print("Event handler 'OnFaultSelect' not implemented!")
def OnRelayOff(self, event): # wxGlade: FaultFrame.<event_handler>
print("Event handler 'OnRelayOff' not implemented!")
event.Skip()
def OnOpStart(self, event): # wxGlade: FaultFrame.<event_handler>
print("Event handler 'OnOpStart' not implemented!")
event.Skip()
def OnOpStop(self, event): # wxGlade: FaultFrame.<event_handler>
print("Event handler 'OnOpStop' not implemented!")
def OnRelayPulse(self, event): # wxGlade: FaultFrame.<event_handler>
print("Event handler 'OnRelayPulse' not implemented!")
event.Skip()
# end of class FaultFrame

File diff suppressed because it is too large Load diff