GE Historian Simulation

361 views Asked by At

I have been trying to simulate values in Historian without great success. I'm very new to both the environment and VBscript itself.

I'm trying to simulate simple 1's and 0's. My goal is to make it run for 1-2 minutes, returning 1's. Then going down for 15-30 seconds; returns 0's. Both being random in amount of uptime and downtime.

If I understand the program correctly it will just fire the script every second. Meaning, I can't have sort of a global value which remembers, making it difficult to program... I've already tried playing with pronbabilities, like:

dim r
r = (int(rnd*100)+1)*10

IF r >= 35 THEN
 Result = 1
ELSE
 Result = 0
END IF

But this only takes into consideration for the uptime. When the downtime is registered, it is only registered for 1 second... :/

Does anyone have any experience or any ideas on how to implement a simple simulation code? Thanks!

Edit: I've been testing the inbuilt functions, trying to solve the problem with a counter that I could use to reset every time it hits a number. But I cannot get it to completely work:

    pre = PreviousValue("TAG1","Now - 1Second")


    IF PreviousQuality("TAG1","Now - 1Second") OR pre = -1 THEN
     result = 0
    END IF

    IF pre >= 10 THEN
     result = 0
    ELSEIF pre < 10 THEN
     result = AddData("TAG1",pre+1,"Now",100)
    ELSE
     result = -1
    END IF

I just cannot get it to work... been starring myself blind.. :/

Edit 2: Seems like a daily journal by now.. :P But I managed to make a counter out of the code above with a tweak to it. Thought I only had to make another tag that then would return values 1s and 0s for a period of time. Apparently, Historian cannot keep up and spit out values while reading another tag...

1

There are 1 answers

0
fuzzy_logic On BEST ANSWER

I have been trying to simulate values in Historian

I've used the file collector with success in the past to test/simulate downtime and loss scenarios for equipment we monitor, doco here: GE File Collector

Essentially you just create an XML or CSV file in one of these formats

Example XML:

<Import>
    <DataList Version="1.0.71">
        <Tag Name="TIGER.IMPORT_TAG1.F_CV">
            <Data>
                <TimeStamp>01-Mat-2018 11:00:15.000</TimeStamp>
                <Value>0</Value>
                <DataQuality>Good</DataQuality>
            </Data>
            <Data>
                <TimeStamp>20-Jul-2001 11:00:36.000</TimeStamp>
                <Value>0</Value>
                <DataQuality>Good</DataQuality>
            </Data>
            <Data>
                <TimeStamp>01-Mat-2018 11:00:30.000</TimeStamp>
                <Value>1</Value>
                <DataQuality>Bad</DataQuality>
            </Data>
            <Data>
                <TimeStamp>01-Mat-2018 11:00:45.000</TimeStamp>
                <Value>0</Value>
                <DataQuality>Good</DataQuality>
            </Data>
        </Tag>
    </DataList>
</Import>

Once you've got the collector up and running, you then place the XML or CSV file into the "Incoming" folder which is being monitored by the file collector.

Example location of Incoming folder: C:\Proficy Historian Data\ImportFiles\Incoming

Another upside to using files to configure your simulation data, coupled with a simple test plan, is that you now have a defined set of repeatable test cases.