################################################################################ # FICHE DE MODELE SABER : ED:1 REV:0 # AUTEUR:OCSIMIZE DATE:02/11/04 # # FICHIER onoffpower.sin : ind. a du 02/11/04 # ETAT : valid ################################################################################ #==============================================================================# element template onoffpower p m = pxoff, pxon, vstartup, vmin, vmax,\ vshutdown, failmode, abnormal_power #==============================================================================# ################################################################################ # Copyright 2004 to infinity and beyond..., Ocsimize. # This template may not be reproduced or modified # without permission from Ocsimize. Ocsimize does not assume # liability for the use of this template or the results # obtained from using it as long as it is not validated by the final user. # Usage of this template is allowed for customers of Ocsimize's customers ################################################################################ ################################################################################ # # MODIFICATION # # 02/11/04: creation ################################################################################ # # pins # ################################################################################ # Name Type Signification # # p electrical current input # m electrical current output # ################################################################################ # # Parameters definition # ################################################################################ # Name Default value Signification # # pxoff 50m(W) power of the device when off # pxon 4 (W) power of the device when off # vstartup 15.5(V) device starts to work # vmin 16 (V) device starts to be on nominal # vmax 40 (V) device stops to be on nominal # vshutdown 50 (V) device stops to work but abnormally # abnormal_power 5000 (W) failure power # failmode shortcircuit not used yet ################################################################################ # # Postprocess information # ################################################################################ # Name Unit Signification # # deltav V (Pa) voltage difference # rx o (Ohm) equivalent resistance # power W continuous power # ################################################################################ # # usage # ################################################################################ # # This template links the current and the power # such that power = [v(p) - v(m)]*current # power may take two value according to the voltage level # # # o (p) # | # -- # | | # | | # | | # -- # | # o (m) # ################################################################################ # Notes : ################################################################################ # # * abnormal_power is such that abnormal_power = i_failure*vshutdown # # so if the failure is a shortcircuit puts abnormal_power = 5000 # this will give a 100 A current (if vshutdown = 50 Volts). # And if the failure is an opencircuit puts abnormal_power = 0.1 # this will give a 2 mA current (if vshutdown = 50 Volts). # # ################################################################################ electrical p,m number pxoff = 50m, pxon = 4 , vstartup = 15.5 , vmin = 16 number vmax = 40, vshutdown = 50, abnormal_power = 5000 enum {opencircuit,shortcircuit} failmode = shortcircuit { val v deltav, voltage val p power val r rx var i i state nu failed, before, after val nu spy struc { number bp, incr ; } deltav_ns[*] number debug = 0 number order_of_vstartup_vmin_vmax_vshutdown = 0 number all_the_values_vstartup_pxoff_abnormal_power number xpoint1, xpoint2, xpoint3, diffxpoint1, diffxpoint2, diffxpoint3 foreign mdnewt # #---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 parameters { # simple checks not using saber_message for portability all_the_values_vstartup_pxoff_abnormal_power = ((vstartup <= 0) | (pxoff <= 0) | (abnormal_power <= 0)) if (all_the_values_vstartup_pxoff_abnormal_power == 1) { message("\n") message("TMPL_S_GT_0 in template % : \n \n", instance()) error("\t all_the_values_vstartup_pxoff_abnormal_power must be > 0. \n \n") } order_of_vstartup_vmin_vmax_vshutdown = ((vstartup < vmin) & (vmin < vmax) & \ (vmax < vshutdown)) if (order_of_vstartup_vmin_vmax_vshutdown == 0) { message("\n") message("TMPL_S_ILL_VALUE in template % : \n \n", instance()) error("\t order_of_vstartup_vmin_vmax_vshutdown is specified \ incorrectly. \n \n") # saber_message("TMPL_S_ILL_VALUE",instance(),"order_of_vstartup_vmin_vmax") } if (pxon <= pxoff) { message("\n") message("TMPL_S_GT_PARM in template % : \n \n", instance()) error("\t pxon must be > pxoff. \n \n") saber_message("TMPL_S_GT_PARM",instance(),"pxon","pxoff") } xpoint1 = vstartup + (vmin - vstartup)/2 xpoint2 = vmin + (vmax - vmin)/2 xpoint3 = vmax + (vshutdown - vmax)/2 diffxpoint1 = (xpoint2 - xpoint1)/10 diffxpoint2 = (xpoint3 - xpoint2)/10 diffxpoint3 = (1.1*vshutdown - xpoint3)/10 deltav_ns = [(-100,10), (0,0.1*vstartup),\ (vstartup/2, (vstartup - vstartup/2)/10) , \ (xpoint1 , (xpoint2 - xpoint1)/10), \ (xpoint2 , (xpoint3 - xpoint2)/10), \ (xpoint3, (1.1*vshutdown - xpoint3)/10),\ (1.1*vshutdown,vshutdown),(10.1*vshutdown,0)] deltav_ns = mdnewt(1meg,deltav_ns) if (debug) { message("\n") message("template % : \n \n", instance()) message("\t deltav_ns : % \n \n",deltav_ns) message("\t xpoint1 : %, diffxpoint1 : % \n",xpoint1, diffxpoint1) message("\t xpoint2 : %, diffxpoint2 : % \n",xpoint2, diffxpoint2) message("\t xpoint3 : %, diffxpoint3 : % \n",xpoint3, diffxpoint3) } } #---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 when(dc_init) { failed = 0 } when(threshold(deltav, vshutdown, before, after)) { if (before < 0 & after > 0) { failed = 2 } } #---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 values { deltav = v(p) - v(m) if (deltav < vstartup & failed < 1) { power=pxoff voltage = 0 # rx = vmin*vmin/pxoff rx = vstartup*vstartup/pxoff spy = 1 } else if (deltav>=vstartup & deltav < vmin & failed < 1) { power= ((pxon - pxoff)/(vmin - vstartup))*(deltav - vstartup) + pxoff voltage = ((vmin - 0)/(vmin - vstartup))*(deltav - vstartup) + 0 rx = voltage*voltage/power spy = 2 } else if (deltav>=vmin & deltav < vmax & failed < 1) { power=pxon voltage = deltav rx = deltav*deltav/pxon spy = 3 } else if (deltav >= vmax & deltav < vshutdown) { power= ((abnormal_power - pxon)/(vshutdown - vmax))*(deltav - vmax) + pxon voltage = deltav rx = deltav*deltav/power spy = 4 } else if (deltav >= vshutdown | failed > 1) { power = abnormal_power voltage = deltav rx = vshutdown*vshutdown/abnormal_power spy = 5 } } #---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 control_section { # sample_points(deltav,deltav_sp) newton_step(deltav,deltav_ns) } #---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 equations { i(p) += i i(m) -= i # i: power = voltage*i i: i = voltage/rx } }