BB code in posts seems to be working again!
I haven't turned on every single tag, so please let me know if there are any that are used/needed but not activated.

Main Menu

Relay Simulation Tool

Started by hidden layer, October 30, 2019, 09:41:14 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

hidden layer

Hello together,
here's a .vss which contains some symbols that will work for simulating complex relay schematics. a Manual will be supplied with the next message.

The Simulation will work without vba, but there's a bit vba needed to make allocations between coil and contacts of the relays. and another script to make allocations for the Connections.

I created this (with a little big help from the guys here) because the available Simulation Tools I found (e.g. K-Relay) are very limited in Terms of amount of contacts for a single relay, amount of relays and so on.

I used Visio2010 for this.

any improvements, warnings, adaptions... are welcome!


hidden layer

and here's the file which contains the macros.

I use this as a template and it works (at least for me) for all applications I tried out within the last 3 weeks. So it is a bit new/ immature/ bumpy but it works.

the schematic is a part of one I used for a current project but a bit anonymized. The relays shall be renamed either with 'speaking names' or with their original IDs from the schematics. lamps and switches as well.

I'll spread this around to some friends/ collegues of mine (which still may have not an account here) - we'll see if and how this will mature.



hidden layer

i forgot:

Switches and power supplies can be toggled with double-click.



Hey Ken

Hey, hl!

   Several years ago I wrote some Visio VBA to draw active schematic circuits.  It has batteries, bulbs, wires, switches and relays, and you can design and actually operate circuits.  Might give you some ideas.  (Yeah – ideas of what to avoid! ;- )  Check it out:  Could use some improvements, but at least it works!

   - Ken

Ken V. Krawchuk
No Dogs on Mars - A Starship Story


Haven't had a chance to try this yet, nor anything like K-Relay.  But I was wondering if their limitation is just a software limitation or is it based upon availability of actual hardware?   Simulating a relay with, say, 100 contacts, would merely be an intellectual endeavor with no applicable value if no such device exists.  Just an uninformed observation.  Looking forward to trying this.

Visio 2019 Pro

Paul Herber

Electronic and Electrical engineering, business and software stencils for Visio -

hidden layer

Hi wapperdude,
in Trains there are lots of relays due to safety regulations. the Switch to activate a loco sometimes activates 10 relays with up to 6 contacts. so 50 is not seldom... ;)
I give to all of These relays the same Name - to simplify the endeavor.
What I have seen with K-Relay is that there's a limited Screen and predefined paths what is not much. for schematics in this 'size' I don't Need a Simulation ;)

Hi Ken - asap I'll check this. Thanks! currently I'm a bit below water.

Hi Paul - thanks for the link - later more!

and now for something complete different: I write with a PC with German Keyboard (and probably German spelling correction) - sorry for upper cases here and there... wtf!



Played around a little bit.  Nice.  Kinda convoluted following signals around.  I assume that Master.3 is the coil?  Seems to work well and does what it's supposed to.  Who'da thought trains were so involved!

A couple of suggestions:
1) use the double click entry to bring up the shape data menu:  DOCMD(1312) and use the right click menu (Actions sections) to control the switch on/off.
2) on the NO contact, and I presume, the NC contact, the inputs and outputs are reversed.  Normally, the common terminal always has the incoming signal, and the outgoing is the switched pin.  Perhaps different in railroading world.   ;)
3) you might want to add a terminal type that has 3 contacts: common, NO, NC.  When the relay is energized, the contact switches from NC position to the NO position.  Basically a SPDT. Alternatively, just a single shape with 3 contacts.  Depending upon wiring, could be a NC, NO, or SPDT. 
Visio 2019 Pro

hidden layer

Hi wapperdude,
thanks for the flowers!

it's not only Trains. If you have to realize something with a SafetyIntegrityLevel (0-4; 4 is Maximum - in case of malfunction many souls lost...) you can choose between PLC or relays. A PLC is much more expensive as any relay - of course these relays are more expensive than Standard ones.

actually I started with right-click to Switch ON/OFF (so there were some iterations to get this result as it is...) but then it turns out (to me) that it is more simple to realize the switching with a dblClick. Because the schematic will Change a Little bit only but I have to Show this more often to guys who insist that it works but not for me - y'know?
The shape data you have to enter only once after you dropped it. That's why it is at the menue. anyway - it's more about that I am lazy and a dblClick is much less "work" than a click, a move and another f***ing click  ;).

inverted in-and Output... maybe there's a Standard but in our schematics it's drawn like this. And the tool they work with (E3-series/ EPLAN) is not railway-specific. Maybe it's the american way - they interchanged symbold for resistors and coils (compared to German symbols) too  ;)
The real source for choosing a determinated in- and Output is something different:
There are schematics where some contact is placed in the middle of the schematic (so Pin1 have to be active if Pin2 is active AND the contact is Closed as well as the other way round). And this I haven't solved yet because there was always a circular reference. I know there's a way with Getf(GetRef(... but for the schematics I work with it was not necessary to dive that deep.

about the last Point - yes I started some minutes but then I discovered to save this time and take a NC and a NO in parallel - that's it. The amount of contacts is not limited at all.

have fun!



 :D :D :D

(I have German ancestry, so this is politically OK...)  Yes, German's do things backwards....grammatically...throwing mommy from the train, a kiss, etc.  Actually, there's probably no rule for that.

You and Hey Ken should start a club...oh, wait, that would take too much effort!  LOL. 

Anyway, nicely done.
Visio 2019 Pro


works fine , well done.  ;
Can it be made to operate relays on other pages as well as the current page ?

hidden layer

Hi Cliff,
actually I don't know about that because I didn't take this into account. It could be possible to adapt this with master-switches and master "lamps" which are located in a 'common' area to act there and see the 'result' also there.
The cases I made this tool for is only at one page. Sometimes they are large... but it's o.k (for me).

Also the macro takes always the ActivePage to allocate wires and devices - maybe this have to be adapted as well.

so sorry for any inconvenience ;)

Hey wapperdude,
as I regard this as a technical dominated place the relation between language (and it's pitfalls) and some technical aspects we should discuss in the Humor- corner, right?
e.g. English drive on (at?) the wrong side of the road...disambiguated to the right side where the others drive... ;)

Hello Ken,
your .vsd didn't work at my PC - aside of the switches (upper left corner). then I took a look at the macros and stopped investigation there. This is a bit beyond my experience with macros in Visio.
My way to use macros at all (in Excel) was some accidentally found solution and has its reason in my laziness to do things again and again and again. And then one thing chases the other.
The thing is that I don't wanted to do this with macros if it's possible without.
Only the allocation cannot be done by formulas afaik.

have fun!


Quite right...
The shapesheet doesn't have enough "power" to allow a 100%, non-code solution.  You met your goals, it works. Job done.

Visio 2019 Pro

hidden layer

Hi there,
just another stencil with an additional NC-Switch.
Remember that the contact turns to red Color if the Switch is active, and always use the template in the 2nd post (at least the macros).

have fun

hidden layer

Hi Folks,
last week I thought that the same way of working could be a good solution for locic diagrams (AND, OR, NOR ans so on). If there is a solution already existend I would appreciate any links (before I start to work on it during the holiday).

So if or if not - anyway - I wish all of you a nice Christmas and a healthy new year (yes... wealthy too).


Browser ID: smf (possibly_robot)
Templates: 4: index (default), Display (default), GenericControls (default), GenericControls (default).
Sub templates: 6: init, html_above, body_above, main, body_below, html_below.
Language files: 4: index+Modifications.english (default), Post.english (default), Editor.english (default), Drafts.english (default).
Style sheets: 4: index.css, attachments.css, jquery.sceditor.css, responsive.css.
Hooks called: 430 (show)
Files included: 38 - 1676KB. (show)
Memory used: 1349KB.
Tokens: post-login.
Cache hits: 13: 0.00148s for 26,720 bytes (show)
Cache misses: 2: (show)
Queries used: 15.

[Show Queries]