################################################################################
# FICHE DE MODELE SABER : ED:1 REV:0
# AUTEUR:OCSIMIZE DATE:13/02/01
#
# FICHIER l_oc.sin : ind. b du 22/01/06
# ETAT : valide
################################################################################
#==============================================================================#
element template l_oc p m = l,imax,n,ur,len,area,r,ic,rth_hs,temp_int,nc
#==============================================================================#
################################################################################
# Copyright 2001 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
#
# 13/02/01: creation
#
# 22/01/06: ind b
#
# coefficient for saturation (nc) added
# proper temperature (temp_int) added
################################################################################
#
# pins
#
################################################################################
# Name Type Signification
#
# p electrical voltage input
# m electrical voltage output
#
################################################################################
#
# Parameters definition
#
################################################################################
# Name Default value Signification
#
# l undef (H) inductance that superset following 4 parameters :
# n undef (-) number of winding turns
# len undef (m) magnetic path length
# area undef (m**2) magnetic path cross section
# ur 1 (-) relative permeability
#
# rth_hs 0 (degC/W) thermal resistance - heatsink
# imax 5 (A) current where inductance begins to saturate
# nc 0.33 (-) coefficent of saturating function
# temp_int undef (degC) environnement temperature of the device
#
################################################################################
#
# Postprocess information
#
################################################################################
# Name Unit Signification
#
# pwrd Watt power dissipated in the device
# power Watt power in the device
# tempj degC temperature of the device
#
################################################################################
#
# usage
#
################################################################################
#
# This template simulate an inductance with saturation
# when i > imax a coefficient modulate the inductance
#
#
# o (p)
# |
# --
# | |
# | |
# | |
# --
# |
# o (m)
#
################################################################################
# Notes :
################################################################################
#
#
#
################################################################################
#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
electrical p, m
export val p pwrd
export val p power
export val tc tempj
number l=undef,
n = undef,
len = undef,
area = undef,
ur = 1
number imax=5
number r = 0,
rth_hs = 0,
ic = undef
number temp_int = undef
number nc = 0.33
external number temp
{
val nu coef
val l lequiv
val f f
val v vr, vl, vt
val joule energy
var i i
struc {number bp,inc;} i_ns[*]
<consts.sin
number u0, temp_local, lcalc
number debug = 0
#
#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
parameters {
# simple checks not using saber_message for portability
if (1 <= nc) {
message("\n")
message("TMPL_S_PAR_LT in template % : \n \n", instance())
error("\t nc must be < 1. \n \n")
# saber_message("TMPL_S_PAR_LT",instance(),"nc", nc, 1)
}
if (l <0) saber_message("TMPL_W_GT_REL_VALUE",instance(),"l","0")
if (area<0) saber_message("TMPL_S_EQUIV_POSEQ",instance(),"area")
if (n <0) saber_message("TMPL_S_EQUIV_POSEQ",instance(),"n")
if (ur <0) saber_message("TMPL_S_EQUIV_POSEQ",instance(),"ur")
if (len<=0) saber_message("TMPL_S_EQUIV_POS", instance(),"len")
if ((r<0)|(r==undef)) {
saber_message("TMPL_S_POSEQ",instance(),"r")
}
if ((l~=undef)&((n~=undef)|(len~=undef)|(area~=undef)|(ur~=1))) {
if (n~=undef) saber_message("TMPL_W_ALT_SPEC",
instance(),"l", "n","n")
if (len~=undef) saber_message("TMPL_W_ALT_SPEC",
instance(),"l", "len","len")
if (area~=undef) saber_message("TMPL_W_ALT_SPEC",
instance(),"l", "area","area")
if (ur~=1) saber_message("TMPL_W_ALT_SPEC",
instance(),"l", "ur","ur")
}
else if ((l==undef)&(n==undef)&(len==undef)&(area==undef)&(ur==1)) {
saber_message("TMPL_S_ALT_SPEC", instance(),
"inductance","l","n, len, area, and ur")
}
else if (l==undef) {
if (n ==undef) saber_message("TMPL_S_UNDEF", instance(), "n")
if (len ==undef) saber_message("TMPL_S_UNDEF", instance(), "len")
if (area==undef) saber_message("TMPL_S_UNDEF", instance(), "area")
if (ur ==undef) saber_message("TMPL_S_UNDEF", instance(), "ur")
}
if(temp_int == undef) {
temp_local = temp
}
else {
temp_local = temp_int
}
i_ns = [(-imax,imax/10),(0,imax/10),(imax,0)]
u0 = 4 * 1e-7 * math_pi
if (l == undef) lcalc = n**2 * u0 * ur * area/len
else lcalc = l
if (debug) {
message("\n")
message("template % : \n \n", instance())
message("\t i_ns : % \n \n",i_ns)
}
}
#
#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
values {
if(abs(i) < imax) {
coef = 1
}
else {
coef = (imax/(abs(i)))**nc
}
lequiv = lcalc*coef
vt = v(p) - v(m)
f = lequiv*i
vr = i*r
vl = vt - vr
power = vt*i
pwrd = i*i*r
tempj = temp_local + pwrd*rth_hs
energy = 0.5*i*i*lequiv
}
#
#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
control_section {
newton_step(i,i_ns)
initial_condition(i,ic)
}
#
#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
equations {
i(p->m) += i
i: vt = d_by_dt(f) + vr
}
}