/** * The input file to gORUN_XML contains all the output variable to report back * named as "ReportVariable." For arrays you have to request every value in the array. **/ private void writeReportVariable(XmlTextWriter xw, sinter_Variable var) { string basePath = snipProcessNameFromPath(getSettingWithDefault("ProcessName", ""), var.addressStrings[0]); switch (var.type) { case sinter_Variable.sinter_IOType.si_DOUBLE: case sinter_Variable.sinter_IOType.si_INTEGER: case sinter_Variable.sinter_IOType.si_STRING: xw.WriteStartElement("ReportVariable"); xw.WriteAttributeString("pathName", basePath); xw.WriteEndElement(); break; case sinter_Variable.sinter_IOType.si_DOUBLE_VEC: case sinter_Variable.sinter_IOType.si_INTEGER_VEC: case sinter_Variable.sinter_IOType.si_STRING_VEC: sinter_Vector vec = (sinter_Vector)var; int[] indicies = vec.get_vectorIndicies(this); foreach (int idx in indicies) { xw.WriteStartElement("ReportVariable"); xw.WriteAttributeString("pathName", addVecIndex(basePath, idx)); xw.WriteEndElement(); } break; default: throw new NotImplementedException(string.Format("Only static types are currently allowed with gPROMS, unknown type: {0}", var.type)); } }
private void writeVarValues(XmlTextWriter xw, sinter_Variable var) { switch (var.type) { case sinter_Variable.sinter_IOType.si_DOUBLE: xw.WriteElementString("RealValue", var.Value.ToString()); break; case sinter_Variable.sinter_IOType.si_INTEGER: xw.WriteElementString("IntegerValue", var.Value.ToString()); break; case sinter_Variable.sinter_IOType.si_STRING: xw.WriteElementString("StringValue", var.Value.ToString()); break; case sinter_Variable.sinter_IOType.si_DOUBLE_VEC: sinter_Vector dvect = (sinter_Vector)var; for (int i = 0; i < dvect.size; ++i) { xw.WriteElementString("RealValue", dvect.getElement(i).ToString()); } break; case sinter_Variable.sinter_IOType.si_INTEGER_VEC: sinter_Vector ivect = (sinter_Vector)var; for (int i = 0; i < ivect.size; ++i) { xw.WriteElementString("IntegerValue", ivect.getElement(i).ToString()); } break; case sinter_Variable.sinter_IOType.si_STRING_VEC: sinter_Vector svect = (sinter_Vector)var; for (int i = 0; i < svect.size; ++i) { xw.WriteElementString("StringValue", svect.getElement(i).ToString()); } break; default: throw new sinter_SimulationException(String.Format("gPROMS input variable, {0}, does not have a type that is supported by gPROMS sinter.", var.name)); } }