bms

Members
  • Content Count

    12
  • Joined

  • Last visited

Community Reputation

0 Neutral

About bms

  • Rank
    Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. I'm trying to track down what I think is a memory leak. DF runs fine for about a day, then starts to error out that it can't run any sequences. Task Manager shows DF is using over 1GB of memory; up from about 150mb on startup. It looks to be an issue with my logging function, which is called every 10 seconds to write all tags to MySQL. Simplified version: try private MySQLHandle = DB.Open("dfsqlsource", "user", "pass") //for loops to create query, removed here for brevity private string SQLQuery = "INSERT INTO etc etc" DB.Execute(MySQLHandle, SQLQuery) DB.Close(MySQLHandle) catch() System.ErrorMessage("SQL Log All Error: " + strLastError) DB.Close(MySQLHandle) endcatch Am I using DB.Open() and DB.Close() correctly? Or is it something to do with the private variables staying in scope between function calls or something weird like that?
  2. This works OK: private string SQLQuery = "SELECT Data_Manager.Time_Stamp, Inverter.RemoteReady FROM Data_Manager JOIN Inverter ON Inverter.Time_Stamp LIMIT 1000" private FieldHandle = DB.Query(MySQLHandle, SQLQuery) ? DB.Field(FieldHandle, 1) But I get an error "O1004 Unable to run query" for this: private string SQLQuery = "SELECT Data_Manager.Time_Stamp, Inverter.RemoteReady FROM Data_Manager JOIN Inverter ON Inverter.Time_Stamp LIMIT 1000" private RO = DB.QueryToClass(MySQLHandle, SQLQuery) ? RO.FieldNames
  3. bms

    Hmi

    +1 for SVG, that would be great. I'm not having any luck getting WMF directly into the symbol component, either from the clipboard, or using the load image button. Is it supported?
  4. bms

    Hmi

    Is there a way to import vector graphics directly, or do you have to go via the symbol factory?
  5. bms

    Generate Alarms From Script

    Is there a way to dynamically create alarms from sequences, or do they have to be manually added in the alarm summary view?
  6. bms

    Alarm on comm timeout/cable unplug

    That's great, thank you. Do these objects also support ModbusTCP Slave? Also, I'm confused with variable scope in a specific situation: class ModbusClass local string IPAddress = "192.168.1.1" local ModbusAddress = 1 local EthernetPort local ModbusDevice function Init() EthernetPort = new (CCommEthernet) EthernetPort.Address = IPAddress EthernetPort.Port = 502 EthernetPort.InitComm() EthernetPort.Purge() ModbusDevice = new (CCommDevice) ModbusDevice.PortObject = EthernetPort ModbusDevice.ProtocolName = "ModbusTCP" endfunction function Read(start, length, string type) ? format("IP Address: %s", ModbusDevice.IPAddress) return evaluate("ModbusDevice." + type + "(" + ModbusAddress + "," + start + "," + length + ")") endfunction endclass class DataManagerClass local Modbus function Init() Modbus = new (ModbusClass) endfunction endclass global DM = new (DataManagerClass) DM.Init() DM.Modbus.IPAddress = "10.0.0.19" DM.Modbus.Init() DM.Modbus.Read(0,125,"ReadInputU16") The output is: 192.168.1.1. The local variable IPAddress holds "10.0.0.19" as I would expect, but why does ModbusDevice.IPAddress print 192.168.1.1? Curiously, I do correctly poll the slave at 10.0.0.19
  7. bms

    Alarm on comm timeout/cable unplug

    Is it possible to call a Comm Device by referencing its underlying object? For example, switching between two different Modbus devices using a single wrapper: device.DataManager.Address = "10.0.0.19" device.SafetyEquipment.Address = "10.0.0.20" class ModbusStatsClass local Interface local Address function ReadModbus(start, size) return Interface.ReadHoldingU16(Address, start, size) endfunction endclass class DataManagerClass local WindSpeed local ModbusStats function Init() ModbusStats = new (ModbusStatsClass) ModbusStats.Address = 1 ModbusStats.Interface = device.DataManager endfunction endclass class SafetyEquipmentClass local LocalRemote local ModbusStats function Init() ModbusStats = new (ModbusStatsClass) ModbusStats.Address = 2 ModbusStats.Interface = device.SafetyEquipment endfunction endclass Global DM = new (DataManagerClass) Global SEIO = new (SafetyEquipmentClass) DM.Init() SEIO.Init() Private HoldingRegisters = DM.ModbusStats.ReadModbus(0, 125) // Do some stuff HoldingRegisters = SEIO.ModbusStats.ReadModbus(0, 60) //Do some other stuff
  8. bms

    Nested Classes

    Got it. Thanks for the detailed explanations; much appreciated.
  9. Is there an unsigned set register function? When reading I use ReadHoldingU16() but there doesn't appear to be a corresponding SetRegisterU16()?
  10. bms

    Nested Classes

    Sorry the omitted local is a typo. I am still a little confused by what is happening behind the scenes. Am I right in saying when this runs: class WSCLASS local status local temperature = new (MINMAXCLASS) local windspeed = new (MINMAXCLASS) endclass Then temperature and windspeed hold pointers to MINMAXCLASS, not the objects themselves? Then when I do: global ws = new(wsclass) ws will correctly hold the object wsclass with a copy of the member variable "status"? But the nested members "min" and "max" don't actually exist as copies in ws? So when altering them: ws.temperature.max = 10 This is actually updating the memory that was allocated when the class was first defined, not memory belonging to the object ws? And therefore considered a runtime error with undefined behavior?
  11. bms

    Nested Classes

    OK thanks. For clarity I'm assuming the leading C in CMinMaxClass is a typo? I've come across some curious behavior. This was actually working for me last week: class MINMAXCLASS local min local max endclass global min_max_t = new (MINMAXCLASS) class WSCLASS local status min_max_t temperature min_max_t windspeed endclass global ws = new(wsclass) ws.temperature.max = 10 But now gives an error. But if I do this: class MINMAXCLASS local min local max endclass class WSCLASS local status temperature = new (MINMAXCLASS) windspeed = new (MINMAXCLASS) endclass global ws = new(wsclass) ws.temperature.max = 10 Then change to the first code, it works with no error message. Am I just grabbing some garbage value that hasn't been collected yet?
  12. Is it possible to nest classes in DF? class MINMAXCLASS local min local max endclass class WSCLASS local status MINMAXCLASS temperature MINMAXCLASS windspeed endclass global ws = new(WSCLASS) ws.temperature.max = 10