Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - blabla

Pages: [1] 2
1
General Board / Re: use data from excel table
« on: April 29, 2015, 11:35:51 pm »


I would like to type in the value of the attribute in excel and bring it to Enterprise Architect. You can see this in the picture.
Example:
It is like variable in c of type char with the value 5 and the name variable.
I don'know what I have to write in vba to insert the inital value from excel to EA.

Next challange is to use the attribut in a state diagramm as a transition.

I have to change something here

Code: [Select]
Public Function addOrUpdateAttribute(parentClass As EA.element, name As String, stereotype As String, description As String, attrType As String) As EA.Attribute
    Dim myAttribute As EA.Attribute
    'try to find existing attribute with the given name
    Set myAttribute = getAttributeByName(parentClass, name)
    If myAttribute Is Nothing Then
        'no existing attribute, create new
        Set myAttribute = parentClass.Attributes.AddNew(name, "Attribute")
    End If
    'set properties
    myAttribute.stereotype = stereotype
    myAttribute.Notes = description
    myAttribute.Type = attrType
    'myAttribute.Initial Value = attrType
    'save attribute
    myAttribute.Update
    'refresh attributes collection
    parentClass.Attributes.Refresh
    'return attribute
    Set addOrUpdateAttribute = myAttribute
End Function

2
General Board / Re: use data from excel table
« on: April 24, 2015, 06:23:44 pm »
I'm trying to use the vba programm to read the inital value, but I don't know  how I can  insert the value.

To read the value of the excel shit is not  a problem.

only the syntax at the creation and update of the attributs

Code: [Select]
'-------------------------------------------------------------
' Author:   Geert Bellekens
' Date:     01/09/2009
' Description: Gets the data from the active excel sheet and
'   creates the classes and attributes defined on there
'-------------------------------------------------------------
Public Sub importFromExcel()
Dim excelConn As New ExcelConnector
Dim eaConn As New EAConnector
Dim excelData As Collection
Dim parentPackage As EA.package
'get the selected package
Set parentPackage = eaConn.getSelectedPackage()
'read the data in the active excel sheet starting from the second row (first row is for the headings
Set excelData = excelConn.getValues(2, 1)
'loop the data
Dim row As Collection
'loop rows
Dim currentClass As EA.element
For Each row In excelData
    Dim elementType As String 'Class or Attribute
    Dim name As String
    Dim stereotype As String
    Dim description As String
    Dim attrType As String
    Dim inital_value As String
    Dim attributeLength As String
    'get the type of element
    elementType = row.Item(1)
    'get the name
    name = row.Item(2)
    'get the stereotype
    If row.Count > 2 Then
        stereotype = row.Item(3)
        If stereotype = "null" Then
            stereotype = ""
        End If
    Else
        stereotype = ""
    End If
    
    
    'get the description
    If row.Count > 3 Then
        description = row.Item(4)
    Else
        description = ""
    End If
    'get the Initial Value
    If row.Count > 6 Then
        inital_value = row.Item(7)
    Else
        inital_value = ""
    End If
    
    
    If eaConn.isValidElementType(elementType) Then
            'create the element
            Set currentClass = eaConn.addOrUpdateElement(parentPackage, elementType, name, stereotype, description)
    ElseIf elementType = "Attribute" Then
        If row.Count > 4 Then
            'get the attribute type
            attrType = row.Item(5)
            If attrType = "null" Then
                attrType = ""
            End If
        Else
            attrType = ""
        End If
        
        Dim currentAttribute As EA.Attribute
        Set currentAttribute = eaConn.addOrUpdateAttribute(currentClass, name, stereotype, inital_value, attrType)
        
        'get the attribute lenght
        If row.Count > 5 Then
            attributeLength = row.Item(6)
            'create or update the length tag
           eaConn.addOrUpdateAttributeTag currentAttribute, "length", attributeLength
        End If
    End If
Next
'refresh the contents of the package so that the changes are seen in EA
eaConn.refreshModelView parentPackage
End Sub

3
General Board / Re: use data from excel table
« on: April 24, 2015, 05:22:06 pm »
time and data should be variable.
array would be the best.
I want to import data from a other simulation programm and use the imported data in a state diagramm


4
General Board / Re: use data from excel table
« on: April 23, 2015, 10:30:49 pm »
Quote
hello

I'm using EA11. I want to use data from a excel file in a state diagramm.
for example:

time  data
  0      0
  1      2
  2      4
  ..      ..

Can I use this data. For example for a Transistion. [data>=3].

Maybe you can sen a short example. It would be very helpful.
thanks for every help ;)


maybe I can use the excelimporterv3??

5
General Board / use data from excel table
« on: April 23, 2015, 10:01:18 pm »
hello

I'm using EA11. I want to use data from a excel file in a state diagramm.
for example:

time  data
  0      0
  1      2
  2      4
  ..      ..

Can I use this data. For example for a Transistion. [data>=3].

Maybe you can sen a short example. It would be very helpful.
thanks for every help ;)

6
General Board / Re: SysML script read a textfile?
« on: June 03, 2015, 06:13:20 pm »
I used this programm line

readTextFile("C:\Users\ma\Desktop\Hello.txt");


7
General Board / SysML script read a textfile?
« on: May 29, 2015, 10:15:47 pm »
Hello
Is it possible to read a textfile with the script in JAVASCRIPT of a constraint block?

8
General Board / SysML parametric model trigger signal
« on: June 03, 2015, 04:36:29 pm »
hello together,

Is it possible to trigger a signal in a parametric sysml model.
Example:
time range 0 - 10 sec

trigger if time >=5 sec and use the trigger in a state chart as a transition-

9
General Board / Re: change value variable in state diagram during
« on: May 26, 2015, 08:04:12 pm »
Do I nee Visual Studio for that?

10
General Board / Re: change value variable in state diagram during
« on: May 26, 2015, 04:14:11 pm »
Do you know may be the name or the path of the example.
I didn't found it

11
General Board / change value variable in state diagram during simu
« on: May 23, 2015, 12:36:07 am »
Hi
I want to change the variable in a state diagramm during the simulation.
For example I have a external input, which delivers the values of a variable. May be a sensor signal for velocity.
So my Problem is to get in the data and change the state if the value is mor than 2 m/s.

The input is maybe given in a excel sheet. To make a statemodel is not the problem. The Problem is to get use the data of the excel sheet as a variable.

Does someone know what the simulationtime in EA is? Like in Matlab simulink you have solvers fix-step or variable-step.

12
General Board / Re: Constraint Block script in SysML
« on: May 15, 2015, 06:43:31 pm »
Does anyone know why this code doesn't work? Script language = java

Code: [Select]
int a=400;
output=a

if I write this code it works
Code: [Select]
output=400

13
General Board / Re: Constraint Block script in SysML
« on: May 15, 2015, 04:06:56 pm »
My idea is to add a vba script to a constraint block. With the vba script I can read the excel sheet

14
General Board / Constraint Block script in SysML
« on: May 07, 2015, 11:36:02 pm »
I would like to read data from a excel file
in a constraint block script

how could I do this? or is this not possible

15
General Board / tagged value as transition
« on: April 30, 2015, 10:02:52 pm »
Can I use a taggedvalue as a transtion in a state diagramm.

Example:
Attributname   :  KL30
Tagvaluename :  initialvalue
Taggedvalue    :  6


State1   --[KL30.initialvalue>=6]-->    State 2


Pages: [1] 2