News:

  • October 14, 2025, 09:35:44 AM

Login with username, password and session length

Author Topic: Program generator for advanced features  (Read 1574 times)

Kristjan

  • Sr. Member
  • ****
  • Posts: 67
    • Idnadartaekni ehf
Program generator for advanced features
« on: May 27, 2022, 05:20:04 AM »
When programming multiple instances of the same scenario (e.g. 50 fire dampers) I like to program one instance in ladder and then copy the mnemonics into an external editor (text editor or spreadsheet), do some copy-paste and replace operations and then copy back into ladder (Tools - Instert Instructions from File). This can save a lot of hours.

Is there any way to programmatically generate more advanced features, e.g. Modbus I/O scanner devices? It certainly is easier by creating new devices from profiles but there is still a handful of manual operations (mouse clicks and keyboard entries) that I would love to automate. Will I just need to resort to an external logic (Python et.al.) to simulate the manual operations in Do-More Designer?

franji1

  • Bit Weenie
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 3761
    • Host Engineering
Re: Program generator for advanced features
« Reply #1 on: May 27, 2022, 08:39:13 AM »
There are automated tools for doing such things at a GUI level, but nothing built-in to Designer (no macros, no macro recording).

The following text file Designer document types can be shared across projects:
  • Modbus Scanner Profiles
  • Electronic Data Sheets (EDS)
  • AXSCRIPT scripts
  • Value Data Blocks
  • UDTs
  • Element Documentation
  • Code-Blocks





Controls Guy

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 3601
  • Darth Ladder
Re: Program generator for advanced features
« Reply #2 on: May 27, 2022, 01:01:37 PM »
Could you use a subroutine instead?   I've done what you're talking about before, and even semi-automated it with VBA, but in a platform that allows code reuse, that seems like the optimum solution
I retract my earlier statement that half of all politicians are crooks.  Half of all politicians are NOT crooks.  There.

Kristjan

  • Sr. Member
  • ****
  • Posts: 67
    • Idnadartaekni ehf
Re: Program generator for advanced features
« Reply #3 on: May 30, 2022, 05:38:00 AM »
Thank you for the replies.
I'll need to try out subroutines but since my fire dampers are a monitoring function with timers I'd at least need to change the implementation. Generally speaking, subroutines are a great way to reuse code but I guess they are not applicable in all situations.

Controls Guy

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 3601
  • Darth Ladder
Re: Program generator for advanced features
« Reply #4 on: May 30, 2022, 11:25:48 AM »
True!   You can also do timers by doing wall clock math.   Look at tickus or tickms on enable, and calculate the expiration time.   Or count transitions of a flasher bit, either one of the internal ones or one you build yourself.
I retract my earlier statement that half of all politicians are crooks.  Half of all politicians are NOT crooks.  There.

Controls Guy

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 3601
  • Darth Ladder
Re: Program generator for advanced features
« Reply #5 on: May 30, 2022, 12:18:20 PM »
Yet another approach would be to write the routine once using indirect addressing, then loop through it using JMPs or FOR-NEXT.  Bear in mind that if you use timers, the TMR would have to be executed every scan (so don't allow a yield), but at least you wouldn't have to repeat the code.

If feasible for the rest of the program, putting everything to do with the fire dampers in instances of a UDT (FireDamper1.Tripped through FireDamper40.ElapsedTime or whatever) would simplify the indirect addressing. UDTs can now contain other structures like timers.
I retract my earlier statement that half of all politicians are crooks.  Half of all politicians are NOT crooks.  There.