Disaster Advances Vol. 8 (3) March (2015)
35
Modeling and simulation of ship lock based on secondary development Liang Gui-lan
1,2*, E Yu-kun
1,2 and Feng Liang
3
1. Key Laboratory of Coastal Disaster and Defence, Ministry of Education, Hohai University, Nanjing 210098, CHINA
2. College of Harbor, Coastal and Offshore Engineering, Hohai University, Nanjing 210098, CHINA
3. College of Civil and Transportation Engineering, Hohai University, Nanjing 210098, CHINA
Abstract With the purpose of solving the problem of
insufficiency of parametric design of the whole lock
and simulation effect, this paper has developed a
program based on Solidworks with Visual Basic to
realize parametric design of lock model and
simulation of the lock. On the basis of analysis of lock
structure, the program has realized parametric design
of upper lock head, lower lock head and lock chamber
by controlling the key sizes of the lock structure and it
has reduced repeated works and has improved the
efficiency. Take an engineering project as example to
examine the result of the program and it matches the
objectives well. This program has provided a
convenient means to analyze the calculation results
and to preview the model. Keywords: Lock, solidworks, secondary development, parametric design, visualization.
Introduction The ship lock is a kind of channel buildings and is made to
overcome the water head difference which can improve the
navigation conditions. Its basic structure includes lock
chamber, upper lock head, lower lock head and approach
channel and some other parts1. A lock is complicated,
especially in upper and lower lock heads because of the
variation of water transmission way and stilling facilities.
As a result, the designers should perform very well in the
profession and in space imagination. Formerly people
receive drawings as achievements which do better in
introducing the details but do less well in understanding
than 3D models, especially lock head. To some degree it
has added the repeated works when designers communicate
with others and modify the drawings2.
People use 3-dimensional CAD technologies such as
AutoCAD to build ship lock construction. The method
makes it easy to check the results and also shows the details
in a direct way. Nowadays a large number of softwares are
utilized in the aspects of force and stability analysis,
sometimes ignore and simplify the structure details. It is
well known that the lock head is much more complicated
than the lock chamber, so in the past people have only
studied the system of lock head and how to realize
parametric design. There is a lack of study in modeling of
the whole body of a ship lock. Meanwhile, many models
are not capable of simulating operating process. These
problems are in existence in lock modeling.
Based on solidworks, secondary development method is
used with Visual Basic to make the program come true.
The results are easy to check and contain the animation that
can simulate the change of water levels and location of the
gates. In consideration of large quantities of locks, the
program regard miter gate as study object and water
transmission way is centralized water transmission system,
only build the shape of lock without checking the stability.
The empty tank in the lock head has not been considered.
Lock modeling method Lock modeling analysis: The lock transports ships by
concentrated water head, which consists of lock head, lock
chamber, approach channel and corresponding
equipments3. They are complex and various. The lock head
separate lock chamber and approach channel so the lock
chamber could maintain the water level inside. Water
inflows and discharges via water transmission way. Lock
chamber is a place where ships wait, it has integral
structure and separate structure two kinds.
The program is aimed at building 3-D model of lock
realistically. In order to reduce inessential works, to
develop the program in the future readily, one kind of lock
structure has been chosen as an example to analyze the
matter. Upper lock head and lower lock head are both
equiped with miter gate, water transmission way is
centralized water transmission system and lock chamber
adopts integral structure. According to engineering
experience, some parts are default.
Solidworks secondary development and Visual Basic:
Solidworks is 3-D design software based on Windows,
values parametric design and feather most which can build
complex bodies conveniently. solidworks applies Feather
Manager which simplifies the details of a model, thus
makes it popular4. Besides, solidworks also provides plug-
in tools such as Motion Manager, Photoworks and so on.
But in certain industry, it is necessary to meet specific
needs, to make repeated works standard and automated, so
secondary development based on solidworks is of vital
importance. API functions within solidworks containing
most instructions in solidworks can be called by advanced
language like Visual Basic.
Disaster Advances Vol. 8 (3) March (2015)
36
The program chooses Visual Basic as secondary
development language to exploit solidworks. Visual Basic
can develop a visualized program with the advantages of
easy to use, widely used and efficiency. It can be combined
with other advanced language such as C++, Java5. Visual
Basic adopts event-driving programming and interactive
developing, it is easy to learn and use and can find practical
and concise human-computer interaction interface.
Program developing progress: To call methods and
attributes of solidworks API by Visual Basic, objects are
needed. Objects contain SolidWorks, Environment, Frame,
Attribute Def, Modeler and others. Each level has its own
objects and each object has its own attributes, methods and
events6. Before creating solidworks applied object, the
software and VB must be connected.
Dim swApp As Object
Set swApp = CreateObject("sldworks.application")
Code above can open solidworks interface and then API
can be called.
In this program lock modeling module is completed in
solidworks parts environment. Before operation it has to
compile parts environment and open a new solidworks
project. Below is the code.
Set Part = swApp.NewDocument("C:\Documents and
Settings\All Users\Application
Data\SolidWorks\SolidWorks 2010\templates\part.prtdot",
0, 0, 0)
swApp.ActivateDoc2 "part1", False, longstatus
Set Part = swApp.ActiveDoc
The simulation module is completed in assembly
environment. First insert models of lock chamber, lock
heads and gates saved already, then connect lock chamber
with lock heads steadily with the function of cooperation, but the gates can move in a limited space which makes it
possible to simulate working process according to the
location of gates and water level inside and outside the
lock. The code of inserting a part and open a solidworks
assembly project is as follows:
Set Part = swApp.OpenDoc6("E:\lock model and
simulation\model data\lock chamber.SLDPRT", 1, 0, "",
longstatus, longwarnings)
swApp.ActivateDoc2 "lock chamber", False, longstatus
Set Part = swApp.ActiveDoc
Set Part = swApp.NewDocument("C:\Documents and
Settings\All Users\Application
Data\SolidWorks\SolidWorks
2010\templates\assembly.asmdot", 0, 0, 0)
swApp.ActivateDoc2 "assembly1", False, longstatus
Set Part = swApp.ActiveDoc
Considering the lock structure with the requirements and
confine of the program, to make the interface clear and
brief, the program consists of lock chamber, upper lock
head and its gate, lower lock head and its gate and
simulation 4 modules7.
Take integral structure for instance to build lock chamber
3-D model, the designing sizes include length, width,
height (breast included), floor thickness, side wall width; in
consideration of the breast wall, the height and width of the
breast wall should be determined. The model is shown as
figure 1.
Figure 1: Lock chamber model
The module of upper lock head and its gate contains two
parts, namely upper lock and miter gate modeling. Miter
gate is simplified. The upper lock head can be divided into
floor, side pier and water transmission way 3 parts, the
users can type in the numbers of each size according to the
describing words in front of the input box. Some parameter
unspecified, such as baffle wall style, the program just has
default settings according to traditional examples. The
parametric design interface is shown as figure 2.
The module of lower lock head and its gate is similar with
the module of upper lock head and its gate, the code and
interface can be inferred. Simulation module consists of
lock preview and simulation two parts. Left part of the
interface realizes preview function. The water transmission
way inside lock head is hollow; this part provides a means
to browse it. Click export button to export lock head already saved. For example, as the model of lower lock
head built according to an engineering construction is
exported, click|left view option, top view option and front view option to observe orthographic views, meanwhile the model has become linear body, click hypostatic model option to resume. Input distance from profile to the bottom of the floor in the input box, click profile of water transmission way, then it forms a profile at the exact location.
Disaster Advances Vol. 8 (3) March (2015)
37
Figure 2: Parametric design interface of upper lock head
Figure 3: Lock preview interface
Figure 4: Profile of water transmission way of lower lock head
Disaster Advances Vol. 8 (3) March (2015)
38
The right part of the interface of simulation module
performs in assembly environment with the condition that
all documents saved in the certain folder. Click lock preview, the whole lock is created automatically. The lock chamber and lock heads are still but the gates can move and
the water levels inside and outside the lock chamber can
change.
Visualization and simulation of the lock With the help of plug-in tool Photoworks users can render
the model and make well qualified and simulated picture;
users can also make movies with Motion Manager Tool by
changing water levels and angles of gate and flow. This
paper has examined the results of the program by an
engineering example. First build the lock chamber model.
The controlling sizes are listed in table 1. Operate the
program and click model button to gain the model.
While modeling the lock heads, the gate is created as well
but is saved as a single part which has nothing to do with
the lock head, aiming at moving the gate to realize the
simulation of lock operation. The sizes of upper lock head
have been shown in figure 1. The upper and lower lock
heads rendered models are as in figure 5.
Simulation module must operate only after all the models
have been saved, otherwise the model cannot be created
when the part needed cannot be found. The model of water
is fictitious body which has a high transparency. The parts
of fictitious water model are built in assembly environment
and then will be saved in the same folder as other parts.
Based on existing information, when the gates are open and
when closed, how long it lasts to change the water level
inside the lock chamber, these can all be gained. In Motino
Manager Environment, the users can change the angle of
the gates and the water flow to simulate lock operation and
output short movies. As making the animation, the
background can be changed; the models material, color, transparency and the light vary, so it is not rational to
exploit this aspect.
Table 1
Designing sizes of lock chamber
(a) (b)
Fig. 5: 3D models of lock heads (a) upper lock head model (b) lower lock head model
Places in
lock
chamber
Main sizes of lock chamber Floor
thickness
Side wall
width
Breast wall
Effective
length
Sedation
segment
Height Width Height Width
Sizes(m) 230.00 20.00 15.00 2.00 2.00 23.00 1.20 0.30
Disaster Advances Vol. 8 (3) March (2015)
39
Fig. 6: Details of rendered lock model
Fig. 7: 3-D model of the whole lock
Conclusion Ship lock is a common building in water conservancy and
plays a key role in water transportation. Based on
solidworks, this paper has developed a program that can
provide assistance for designers with Visual Basic to realize
parametric design and simulation of the lock. The interface
is clear and easy to modify, it has given a possible solution
to such kind of study. The operation result of the program
has proved to be reliable, but it cannot solve all problems as
the types of locks change. Furthermore, it requires high
capability of utilizing the software solidworks and its plug-
in tools. In detail, then the gates are not miter gates or the
water transmission ways change its type, the program can
be no longer applied. While simulating the operation of the lock, ship element has not been considered yet which can
be improved in the future.
Acknowledgement This paper is supported by project of the nature-science
fund of Jiangsu Province (Project BK2011743), the
Peoples Republic of China.
References 1. Liu Xiao-ping and Tao Gui-lan, Canalization Project,
Beijing, Peoples Transportation Press (2009)
2. Lei Fei et al, 3D design of lock head based on AutoCAD
ARX, Port & Water Engineering, 2, 128-132 (2013)
3. Xiao-kang H.E. et al, Modeling of the Lower Lock Head of
Ship Lock Based on AutoCAD and VB, Journal of
Heilongjiang Hydraulic Engineering College, 34(4), 126-128
(2007)
Disaster Advances Vol. 8 (3) March (2015)
40
4. Zhang Xiang-yue, 3-Dimension modeling for offshore
platform by second development of Solid Works with VB
Language, Tianjin, Tianjin University (2006)
5. Niu You-qi and Sun Jian-guo, New Edition Visual Basic
Program Design Courses, Suzhou, Suzhou University Press
(2007)
6. Jiang Hong et al, Solidworks Secondary Development
Examples Analysis, Beijing, Mechanics Industry Press (2004)
7. Tang X. J. and Su C., Development of CAD Software for
Ship Lock Design, Port & Water Engineering, 4, 73-76
(2006)
8. Chen Wen-long, Study on Visual and Integrating CAD
Systems of the Miter Gate Dissertation for Master Degree of
Science, Nanjing, Hohai University (2003).
(Received 15th December 2014, accepted 30
th January
2015)