Multisim and Ultiboard

cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to make an interactive symbol?

I'm trying to make a relay for use in multisim, and I don't quite understand how the symbol editor works, but is it possible to make an interactive symbol, like a switch that opens/closes ?

 

I think I should be able to use spice data from a relay(modified) to get mine to work?

[CODE]

* !!!BEGIN-INTERACT
*  : Ion           0.0048   ;
*  : Ioff           0.0016 ;
*  0        constant  S_OFF
*  1        constant  S_ON
*  0.0      VARIABLE   r1Cur
*  .( Loading the relay 1B form ... ) cr
*  : PWR_OFF
*      S_OFF  ==>_*animation_state
* ;
*  : PWR_ON
*      S_ON   ==>_*animation_state
* ;
*  PWR_OFF
*  :BEGIN_PLOT
*     PWR_OFF
* ;
*  :OUT_DATA
*     GET_INSTANCE Vsource ::V V  i  ==>_*r1Cur
*      Ion    *r1Cur    f.<=   if
*         PWR_ON
*     else   Ioff *r1Cur  f.>=   if
*         PWR_OFF
*     endif endif
* ;
* : BEGIN_ANALYSIS UPDATE_SETTINGS;
* !!!END-INTERACT
*
.SUBCKT DPDT_RELAY C1 C2 NO1 COM1 NC1 NO2 COM2 NC2 PARAMS: RCOIL=500 LCOIL=0.048 RON=1m

RC C1 C3 RCOIL
LC C3 C4 LCOIL

XK4 C4 C5 COM2 NC2 RELAY (RON={RON} ROFF=1E12)
XK2 C5 C6 COM1 NC1 RELAY (RON={RON} ROFF=1E12)
XK3 C6 C7 NO2 COM2 RELAY (RON=1E12 ROFF={RON})
XK1 C7 C2 NO1 COM1 RELAY (RON=1E12 ROFF={RON})
.ENDS

.SUBCKT RELAY 1 2 3 4 PARAMS: RON=1m ROFF=1E12
V 1 2 0
W0 3 4 V NC_contact
.MODEL NC_contact ISWITCH (Ion=0.0048 Ioff=0.0016 Ron={RON} Roff={ROFF})
.ENDS[/CODE]

0 Kudos
Message 1 of 7
(3,466 Views)

Just realized I might be using the wrong animation state stuff for the symbol I made since I made the symbol more like a switch (a couple) so the animation for a relay is different from what I used.

 

My symbol doesn't entirely work anyway, when I put puwer to COM1, the output ends up at NC2 instead of NC1, and NO1/NC1 don't work at all.

0 Kudos
Message 2 of 7
(3,460 Views)

Hi GRNDPNDR,

 

It is not possible for users to be able to create interactive components. It is not possible to store interactive components in the User or Corporate Database. Sorry for any inconvenience.

 

Hope this helps.

Regards,

Tayyab R,
National Instruments.
0 Kudos
Message 3 of 7
(3,458 Views)

well, that sucks and should definitely be a feature.

 

That aside, how do I go about making the symbol useable in simulation? is there anyway to have it still function like a relay even if the symbol doesn't animate?

 

as I mentioned, half of it works half as well as it should 🙂

0 Kudos
Message 4 of 7
(3,452 Views)

Hi,

 

If you have the spice model for the relay, you can create the component by going to Tools -> Component Wizard and following the steps. If you use the component, it will function as it should but you just wont see its interactive changes.

 

A component creation tutorial is given in the link below:

 

https://decibel.ni.com/content/groups/circuit/blog/2011/04/06/component-creation-101

 

Hope this helps.

Regards,

Tayyab R,
National Instruments.
0 Kudos
Message 5 of 7
(3,450 Views)

Thats precisely what I did, and made a symbol for it but it isn't working quite right so maybe the spice data is wrong.

 

I originally made a circuit using 2xSPDT NO and 2xSPDT NC relays to make a DPDT. I used that spice data and had someone help me cut it down into a single model.

 

This is what I ended up with.

 

*## Multisim Component U1 ##*
* !!!BEGIN-INTERACT
*  2.0 constant high
*  0.0 constant low
*  2   constant max_states
*  low VARIABLE volt
*
*  :MAP_KEYBOARD_INPUT ++++K1 1 ++++k1 -1 ;
*
*  : UPDATE_SETTINGS
*     *animation_state max_states  low  high  STATE  volt
*     GRADUAL_CHANGE_AT_RUN  
*  ;
*
*  :KEYBOARD_INPUT locals| shift_state |
*     shift_state *animation_state max_states NEXT_STATE_WRAP
*                                             ==>_*animation_state
*     UPDATE_SETTINGS
*  ;
*
*  :GRADUAL_CHANGE_AT_RUN locals| ref value |
*     value  SET_INSTANCE Vsource ::V  V2 dc
*  ;
*
*  :BEGIN_PLOT
*     UPDATE_SETTINGS
*  ;
*
*  : INIT_IMOUSE_OPTION
*    1 0 4 IMOUSE_SET
*  ;
*
*  : GET_IMOUSE_SUBCOMPS ( -- [iIdxN ... iIdx1] )
*    1
*  ;
*
*  : ON_SUBCOMP_IMOUSE_EVENT locals| eEventType nOptions iSubCompIdx |
*    eEventType 2 = if
*      -1
*      -1 KEYBOARD_INPUT
*    else
*      0
*    endif
*  ;
*
*  ( Initialize the settings )
*   UPDATE_SETTINGS
*   INIT_IMOUSE_OPTION
*
*  :BEGIN_ANALYSIS
*    UPDATE_SETTINGS
*  ;
*
* !!!END-INTERACT
.SUBCKT DPDT_Relay  COIL+ COIL- NO1 COM1 NC1 NO2 COM2 NC2 PARAMS: RCOIL=500 LCOIL=0.048 RON=1m

RC C1 C3 RCOIL
LC C3 C4 LCOIL

XK4 C4 C5 COM2 NC2 RELAY (RON={RON} ROFF=1E12)
XK2 C5 C6 COM1 NC1 RELAY (RON={RON} ROFF=1E12)
XK3 C6 C7 NO2 COM2 RELAY (RON=1E12 ROFF={RON})
XK1 C7 C2 NO1 COM1 RELAY (RON=1E12 ROFF={RON})
.ENDS

.SUBCKT RELAY 1 2 3 4 PARAMS: RON=1m ROFF=1E12
V 1 2 0
W0 3 4 V NC_contact
.MODEL NC_contact ISWITCH (Ion=0.0048 Ioff=0.0016 Ron={RON} Roff={ROFF})
.ENDS

0 Kudos
Message 6 of 7
(3,446 Views)

This is what happens when it's wired up in simulation, it should be clear that this shouldn't work the way it's hooked up so something is wrong with the model somewhere.

0 Kudos
Message 7 of 7
(3,445 Views)