Visio Guy

Visio Guy Website & General Stuff => User-submitted Stuff => Topic started by: hidden layer on October 30, 2019, 04:41:14 AM

Title: Relay Simulation Tool
Post by: hidden layer on October 30, 2019, 04:41:14 AM
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!

cheers,
hl
Title: Re: Relay Simulation Tool
Post by: hidden layer on October 30, 2019, 04:53:24 AM
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.

cheers,

hl
Title: Re: Relay Simulation Tool
Post by: hidden layer on October 30, 2019, 05:20:33 AM
i forgot:

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

;)

hl
Title: Re: Relay Simulation Tool
Post by: Hey Ken on October 30, 2019, 07:30:13 AM
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:  http://visguy.com/vgforum/index.php?topic=6969.msg29130#msg29130 (http://visguy.com/vgforum/index.php?topic=6969.msg29130#msg29130).  Could use some improvements, but at least it works!

   - Ken

Title: Re: Relay Simulation Tool
Post by: wapperdude on October 30, 2019, 08:54:59 AM
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.

Cheers.
Title: Re: Relay Simulation Tool
Post by: Paul Herber on October 30, 2019, 11:48:00 AM
I tried this some time ago.

https://www.paulherber.co.uk/articles/visio-articles/connected-shapes/ (https://www.paulherber.co.uk/articles/visio-articles/connected-shapes/)
Title: Re: Relay Simulation Tool
Post by: hidden layer on October 30, 2019, 11:59:27 AM
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!

Greez
hl
Title: Re: Relay Simulation Tool
Post by: wapperdude on October 30, 2019, 12:06:39 PM
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. 
Title: Re: Relay Simulation Tool
Post by: hidden layer on October 31, 2019, 02:07:37 AM
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!

hl
Title: Re: Relay Simulation Tool
Post by: wapperdude on October 31, 2019, 09:22:49 AM
 :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.
Title: Re: Relay Simulation Tool
Post by: cliff50 on October 31, 2019, 02:58:23 PM
works fine , well done.  ;
Can it be made to operate relays on other pages as well as the current page ?
Title: Re: Relay Simulation Tool
Post by: hidden layer on November 01, 2019, 04:06:29 AM
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!
hl
Title: Re: Relay Simulation Tool
Post by: wapperdude on November 01, 2019, 09:43:43 AM
Quite right...
The shapesheet doesn't have enough "power" to allow a 100%, non-code solution.  You met your goals, it works. Job done.

Title: Re: Relay Simulation Tool
Post by: hidden layer on December 04, 2019, 07:42:40 AM
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
hl
Title: Re: Relay Simulation Tool
Post by: hidden layer on December 17, 2019, 07:37:58 AM
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).

cu
hl
Title: Re: Relay Simulation Tool
Post by: metuemre on December 17, 2019, 08:57:52 AM
Hi hidden layer,

Here is a sample as starting point http://visguy.com/vgforum/index.php?topic=7527.msg31895#msg31895 (http://visguy.com/vgforum/index.php?topic=7527.msg31895#msg31895)
Title: Re: Relay Simulation Tool
Post by: hidden layer on December 19, 2019, 01:33:43 AM
hello metuemre,
thanks!

but I cannot open this because I work with Visio 2010 (which cannot open XML-based files). If you could translate them it would be very Kind.

;)

cheers
hl
Title: Re: Relay Simulation Tool
Post by: metuemre on December 19, 2019, 03:08:14 AM
Hi hidden layer,

Attached are Visio 2010 files for your use.

Cheers
Emre
Title: Re: Relay Simulation Tool
Post by: hidden layer on December 20, 2019, 06:42:46 AM
Hello Emre,
nice!

the Output of the (-!)- 'devices' is possible to Switch with the right-click -> shape-data only - right?
(because I read something like database...)
for the schematic-vsd I did it with double-click. for me it's more 'haptic'

some questions:
it seems that the timer is not working - but there is a lot of vba which I cannot check right now...
also the procedures in the CALLTHIS- functions (in shapesheet) i cannot find in the procedures...

...so Christmas won't be boring  ;)

cheers
hl
Title: Re: Relay Simulation Tool
Post by: metuemre on December 20, 2019, 08:03:42 AM
This is just a small portion of a complete control system emulator. It has OPC DA client embedded in vba to talk to an OPC DA Server and read the inputs and write outputs every second. It also has a connection to our IO database in SQL server. These features are not available in your file. That's why you will not find most of the callthis functions in VBA.

Values of Inputs at the left side can be toggled via shape data as you guessed but you can modify it as per your requirements.

Timer function should run when the input to timer is TRUE but make sure that Microsoft Scripting Runtime is selected as reference in VBA.

Feel free to ask any questions you may have.
Cheers
Emre