100 likes | 252 Views
Auto-Generation of EASY5 Models Using XML Data. Brian Ummel EASY5 Product Support March 16, 2000. What does Auto-Generation of Models Mean?. Standard method of building an EASY5 model is: 1. Look up data where it exists (CAD system, schematics, documents, or some other analysis tool)
E N D
Auto-Generation of EASY5 Models Using XML Data Brian Ummel EASY5 Product Support March 16, 2000
What does Auto-Generation of Models Mean? • Standard method of building an EASY5 model is: 1. Look up data where it exists (CAD system, schematics, documents, or some other analysis tool) 2. Convert the representation and data to the form EASY5 needs 3. Hand build the corresponding EASY5 model by hand • The EASY5 GUI tries to make this process as simple as possible but building a large model is still a lot of work • Question: Why can’t we automate the creation of EASY5 models? • Answer: Lots of reasons • Most obvious: The current EASY5 model file format makes it difficult
Current Model File Format • The current model file format (i.e. the format of files with names of the form model_name.mf.nn) is essentially a “memory dump” of the C structures used by EASY5x at run time. • Typical piece of an EASY5 model file: • 0 -1 0 2 1 1 1 1 • 1 • 0 1 1 0 1 3320.0 3950.0 3480.0 • TZAC • Nozzle\Dynamics • 17 20 997 4096 0 -1 • 9901181617 • 1 0 8 • 0 • 1 0 9 • 0 • 23 • 23 • te 0 • pa 10 0.000000 1.000000 • fo -1 • As most of us have learned the hard way, even the smallest mistake in this file will result in EASY5x being unable to read the file.
Historical Reasons: The first implementation of EASY5w used Apollo Metafile Graphics which had its own file format Efficiency Reasons: The current format can be read directly into memory without any interpretation or conversion Even so, it is not all that fast for very large models Because of the efficiency issue, the current format will be probably be supported for some time. So (at least for now) we’re talking about an alternate format for importing models into EASY5. Why We Use the Current Format
The import file format must be: Easy to write Completely specify the data being imported Not require that the model be completely specified Easy and unambiguous to read Amenable to changes required by future EASY5 enhancements Our primary tasks were: 1. Inventing a rich but forgiving syntax 2. Writing a parser for that syntax Then along came XML Choosing an Import File Format
XML is a “tagged” markup language Tagged means that the data in the file is labeled with names indicating the meaning of the data Labels are tags very similar to tags in HTML Significant Difference: XML allows you to define your own tags Syntax is consistent and very clean - we don’t have to invent one XML is an ASCII file format Means easy transfer of data between machines Free field format is very forgiving XML is a W3C standard for information transfer over the World Wide Web Parsers are widely available XML files are readable by other applications (e.g. Web Browsers) What is XML?
XML is an “Object Oriented” Language Each “element” (a tagged entry delimited by angle brackets < and /> or by < name…> and </name>) represents an object “Attributes” and “members” specify the properties of the object EASY5 objects are primarily components and connections In XML an EASY5 library component looks like: <component name = “LA1” xloc = “3200” yloc = “2800” > <libref library = “gp” libmember = “LA” /> <input id = “GAI” name = “tempSensor_gain” value = “10” /> <input id = “TC” name = “tempSensor_timeConstant” value = “0.03” /> </component> A port connection looks like: <connection from_component = “IN1” to_component = “LA1” > <port_connection from_port = “2” to_port = “1” /> </connection>
XML can be “Validated” Very easy for a XML parser to determine if a XML document is “Well Formed” (ie the “punctuation” is correct). More importantly, the XML specification includes a provision for specifying a “Document Type Definition (DTD)” which: Is a formal definition of the syntax of a particular type of data file expressed using XML Can be used by publicly available XML parsers to determine if a file is valid Usage of “attributes” versus “members” for expressing properties of elements is driven by the constraints on what is valid. The format of an EASY5 XML model file is specified by a file called easy5_model.dtd The current program which reads EASY5 XML files and produces EASY5 metafiles is called ezxml.exe
Status of The EASY5 XML Project The current prototype version of ezxml can import: • Flat models (no submodels) • Library components (not Fortran or C components) • Component locations • Port connections (not custom connections) • Parameter values of inputs • User defined names The submodel structure will be supported next (this summer)
Plans for The EASY5 XML Project Current Project: • Enhance the EASY5 model DTD to be able to specify everything in the current model file • Have the import program support the full DTD • We’re looking for opportunities to test this work Under consideration: • Write an export program to support conversion of EASY5 models into other types of models (such as code generators like GSDS)