Example #1
0
int main(int argc, char* argv[])
{
    int i;
    int size = argc - 1;

    for (i = 1; i < argc; i++) {
        argv[i - 1] = argv[i];
    }

    char* rpn[size];
    shunt(argv, size, rpn);

    // for (i = 0; i < size; i++) {
    //     printf("%s\n", rpn[i]);
    // }

    printf("%f\n", compute_rpn(rpn, size));
}
Example #2
0
/**
 * Set values of YBus matrix. These can then be used in subsequent
 * calculations
 */
void gridpack::ymatrix::YMBus::setYBus(void)
{
  gridpack::ComplexType ret(0.0,0.0);
  std::vector<boost::shared_ptr<BaseComponent> > branches;
  getNeighborBranches(branches);
  int size = branches.size();
  int i;
  // HACK: Need to cast pointer, is there a better way?
  for (i=0; i<size; i++) {
    gridpack::ymatrix::YMBranch *branch
      = dynamic_cast<gridpack::ymatrix::YMBranch*>(branches[i].get());
    ret -= branch->getAdmittance();
    ret -= branch->getTransformer(this);
    ret += branch->getShunt(this);
  }
  if (p_shunt) {
    gridpack::ComplexType shunt(p_shunt_gs,p_shunt_bs);
    ret += shunt;
  }
  p_ybusr = real(ret);
  p_ybusi = imag(ret);
}