Skin depth

This script will create a dialog box to calculate the eddy current skin depth in different units. There is also an icon to use it as a toolbutton.

Dialog for Skin depth calculation

Icon for user toolbutton:

Images in script:

/ SkinDepth.comi
/ ====================
/ Features: A non-editable history in a dialog box
/           Presetting the variables only first time, then keep settings on subsequent runs
/ Preset some variables (only if they are not set yet)
/ Author:	 Klaus Höffer
/ Date:          29.10.2010 
/ Opera-Version:  13.042
/ Comiskript for: Opera2d, Modeller, Postprocessor
$if %EXISTVAR(#sigma) Eq 0
$if %EXISTVAR(#freq) Eq 0
  $CONSTANT NAME=#freq   VALUE=1000
$if %EXISTVAR(#MU_R) Eq 0
  $CONSTANT NAME=#mu_r     VALUE=1
$CONSTANT NAME=#unit_microns VALUE=1E6
$CONSTANT NAME=#unit_mm      VALUE=1E3
$CONSTANT NAME=#unit_cm      VALUE=1E2
$CONSTANT NAME=#unit_m       VALUE=1
$string Name=userunit VALUE='mm'
$constant #state 0
$while #state<2 
  $if #state==0 
    / Dialog to ask user information (with defaults set above) 
    / ===========================================================  
    $DIALOG ACTION=START TITLE='Calculate skin depth' 
      $groupbox action=start Title='' Orientation=horizontal strips=1
         $displayline 'skindepthformula.png'  
      $groupbox action=stop
      $groupbox action=start Title='' Orientation=horizontal strips=2
        $ASK NAME=#sigma PROMPT='Material Conductivity:' 
        $displayline '[S/m]'  
        $ASK NAME=#freq  PROMPT='Frequency:' 
        $displayline '[Hz]'  
        $Layout spanx 2
        $ASK NAME=#MU_R PROMPT='Relative permeability:' 
        $Layout spanx 2
        $PROMPT NAME=userunit PROMPT='Units for the skin depth:' HISTORY='mm cm m microns' EDIT=NO
      $groupbox action=stop
    $cons #state #state+VF_ButtonPressed
  $end if
  / Factor for units
  / =====================
  $STRING NAME=factor VALUE='#unit_&userunit&'
  / The actual Equation
  / =========================
  $PARAMETER NAME=#skin VALUE=1/SQRT(pi*#freq*Mu0*#MU_R*#sigma) 
 $if #state==1 
    / Print out the results 
    / ================================
    $DIALOG ACTION=start TITLE='Skin depth of infinite plane' 
        $DISPLAYLINE TEXT='<b>Skin depth:</b> %real(#skin*&factor&) &userunit&' 
    $cons #state #state+VF_ButtonPressed
  $end if
$end while
/ end of SkinDepth.comi
scripts/dialogs/skindepth.txt · Last modified: 2013/06/27 11:50 by henschel Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0