I am working on integrating a fortran model for future data in AF. What options do I have other than having the model export a txt file and using the PI UFL interface. Thanks.
It's an application in Fortran that you are building?
Why not use Pi WEBAPI?
The fortran application has already been built by someone else but I don't have much information how it should be integrated.
I was informed to look into the CLR, but after some searching it seems that PI AF SDK doesn't support it.
Curious to know if PI has any other SDKs that could integrate the model, but I can use the PI WEBAPI as you suggested. Thanks!
If the application has been built, the issue is going to be how to integrate with the application, not how to integrate with PI.
I'd suggest you look at an integration or ETL tool, draw up your interfaces and design from there.
Is the fortran 'model' an application - executable or DLL?
The fortran application is an executable.
ok, you must have some documentation on how to either input some data or otherwise get a response from the application. Does it read/write from a file / database? Does it listen on a port?
If you can give us some more info, we can suggest some way to integrate it.
Unfortunately I don't have much information on this and I'll have to get in contact with its creator. I'll reopen the question when I get more information. Thanks.
It would be highly dependent on the actual application. I haven't seen FORTRAN in quite some time, but I would definitely looked into the PI Web API as suggested by Rob.
I was the guy from Houston sitting in your section last week.
As @Rob_Curtis mentions, we need to know a lot more about your Fortran executable. To me, it is a black box that accepts inputs and returns outputs. And that raises lots of questions.
What inputs will it be expecting? Does it expect a text file or command line parameters? If a text file, will it be CSV in a specific order, or JSON text? Are the UOM's for the inputs specific? For example, if the Fortran model expects temperatures in Celsius, and your attributes are in Fahrenheit, then you will need some pre-processing to transform the data as the model expects.
How are the output(s) produced? Does the EXE just return a value, or will it be a text file, or will results be shown to the console or given StdOut device? What would be the format of the text file? If written to console, you will have to parse the console text. I assume output values are going to be fairly "naked" - that is it will be a raw value with no UOM or timestamp associated with it. However, I would presume there an implicit UOM as defined by the model.
You could write an AF SDK and .NET app that performs:
For instance, the pre-processing could grab a desired element from an AFDatabase. This element would contain AFAttributes for all the inputs and outputs. Those attributes would use the PIPoint DR mapped to some PI points on a data archive. You would gather the inputs, fetch the PI data for them, perform any UOM conversions, and transform to be compatible with the Fortran model.
For post-processing, you must fetch the output values from your Fortran model, assign to AFValue with the UOM as defined by the model. You will need to assign a timestamp (below). You may need to then convert to the UOM as defined by the output attribute. You would then write those AFValues in order to persist the data back to PI.
The timestamp depends upon the input timestamps. If you grab the inputs for the same event, then that event is your timestamp. If you issue a GetValue on the attributes, it returns the current value, which could have different timestamps for each input. Granted you could use AFTime.Now as the trigger time, but I find that insufficient (and somewhat lazy). Instead, I would loop over all the input values, and grab the most recent timestamp. The most recent timestamp would then be the timestamp for your outputs.
That's just one approach. But you have investigating to do in order to understand more about what the Fortran model will accept. And that really should be first step.
Retrieving data ...