#############################################################
#
#  PGML Area
#
##DESCRIPTION
## Modified Nodal Analysis of Electric Circuits 
##ENDDESCRIPTION

##KEYWORDS('Electric Circuits', 'Nodal Analysis')

## DBsubject('Electric Circuits')
## DBchapter('Solution Methods')
## DBsection('Modified Nodal Analysis')
## Date('27/9/2016')
## Author('L. R. Linares, luisl@ece.ubc.ca')
## Institution('University of British Columbia')

########################################################################

DOCUMENT();      

loadMacros(
   "PGstandard.pl",     # Standard macros for PG language
   "MathObjects.pl",
   "PGML.pl",
   "parserPopUp.pl",
   "weightedGrader.pl",
   #"source.pl",        # allows code to be displayed on certain sites.
   #"PGcourse.pl",      # Customization file for the course
);

# Print problem number and point value (weight) for the problem
TEXT(beginproblem());

# Show which answers are correct and which ones are incorrect
$showPartialCorrectAnswers = 1;

##############################################################
#
#  Setup
#
#

sub deg {
  my ($rad) = shift;
  return $rad*180/pi;
}

sub rad {
  my ($deg) = shift;
  return $deg*pi/180;
}

sub parallel { #Beware of an jXL+jXc==0.
  my $a = shift;
  my $b = shift;
  return($a*$b/($a+$b));
}

# Context("Complex"); # Or Context("Numeric");
Context("Complex");
Context()->flags->set(tolerance => .02);

#---- Random variables for this problem --------------------
$a = Real(random(10,40,2));

#---- Formulas to compute answers --------------------------
$In=(480**2/$a)*(20000/480)**2;

#---- Answers to the problem -------------------------------
$ans1 = Real($In);

#############################################################
#
#  PGML Area
#
#
BEGIN_PGML
An equipment with [$a] kVA is operating under nominal conditions. What is its current?

*Note:* In this problem, you may only submit numerical answers. (i.e. If 4 is the correct answer, 4 will be marked as correct, but 2+2 will be marked as incorrect.)

*Caption to the figure*

[@ image( "figure.png", width=>312, height=>94) @]*

*(a) Current .......... :* [_______] [``A``]

END_PGML

WEIGHTED_ANS($ans1->cmp(), 100);

Context()->functions->disable("All");
Context()->operators->undefine('+','-','**','^','/',' /','/ ','//','U','u+','fn','.','><','!',',','_',' ','*',' *','* ');
Context()->parens->remove('|','(','[','{');
Context()->constants->remove('i');

##############################################################
ENDDOCUMENT();     

